Hello community,
here is the log from the commit of package ffmpegthumbs for openSUSE:Factory checked in at 2018-11-06 14:34:53
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ffmpegthumbs (Old)
and /work/SRC/openSUSE:Factory/.ffmpegthumbs.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ffmpegthumbs"
Tue Nov 6 14:34:53 2018 rev:42 rq:646189 version:18.08.2
Changes:
--------
--- /work/SRC/openSUSE:Factory/ffmpegthumbs/ffmpegthumbs.changes 2018-10-17 08:28:11.146533271 +0200
+++ /work/SRC/openSUSE:Factory/.ffmpegthumbs.new/ffmpegthumbs.changes 2018-11-06 14:37:26.596772455 +0100
@@ -1,0 +2,6 @@
+Sat Nov 3 10:43:00 UTC 2018 - Fabian Vogt
From 477fe05f410852b78d44243a796c73dda2165398 Mon Sep 17 00:00:00 2001 From: Fabian Vogt
Date: Sat, 3 Nov 2018 11:41:56 +0100 Subject: [PATCH] Don't crash if initializeVideo fails
Summary: If avcodec_find_decoder returns NULL, a warning is printed and then NULL is dereferenced later... Test Plan: A user crashed thumbnail.so reproducably with a specific file. Doesn't anymore with this patch applied. Reviewers: broulik Differential Revision: https://phabricator.kde.org/D16631 --- ffmpegthumbnailer/moviedecoder.cpp | 14 ++++++++++---- ffmpegthumbnailer/moviedecoder.h | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ffmpegthumbnailer/moviedecoder.cpp b/ffmpegthumbnailer/moviedecoder.cpp index 6d1a79c..207e36b 100644 --- a/ffmpegthumbnailer/moviedecoder.cpp +++ b/ffmpegthumbnailer/moviedecoder.cpp @@ -73,7 +73,10 @@ void MovieDecoder::initialize(const QString& filename) return; } - initializeVideo(); + if (!initializeVideo()) { + // It already printed a message + return; + } m_pFrame = av_frame_alloc(); if (m_pFrame) { @@ -126,7 +129,7 @@ QString MovieDecoder::getCodec() return codecName; } -void MovieDecoder::initializeVideo() +bool MovieDecoder::initializeVideo() { for (unsigned int i = 0; i < m_pFormatContext->nb_streams; i++) { if (m_pFormatContext->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) { @@ -138,7 +141,7 @@ void MovieDecoder::initializeVideo() if (m_VideoStream == -1) { qDebug() << "Could not find video stream"; - return; + return false; } m_pVideoCodecContext = m_pFormatContext->streams[m_VideoStream]->codec; @@ -148,14 +151,17 @@ void MovieDecoder::initializeVideo() // set to NULL, otherwise avcodec_close(m_pVideoCodecContext) crashes m_pVideoCodecContext = NULL; qDebug() << "Video Codec not found"; - return; + return false; } m_pVideoCodecContext->workaround_bugs = 1; if (avcodec_open2(m_pVideoCodecContext, m_pVideoCodec, 0) < 0) { qDebug() << "Could not open video codec"; + return false; } + + return true; } int MovieDecoder::getWidth() diff --git a/ffmpegthumbnailer/moviedecoder.h b/ffmpegthumbnailer/moviedecoder.h index 060c02e..eadc8e2 100644 --- a/ffmpegthumbnailer/moviedecoder.h +++ b/ffmpegthumbnailer/moviedecoder.h @@ -51,7 +51,7 @@ public: bool getInitialized(); private: - void initializeVideo(); + bool initializeVideo(); bool decodeVideoPacket(); bool getVideoPacket(); -- 2.19.0