ffmpeg | branch: master | Anton Khirnov <an...@khirnov.net> | Thu Jul  9 
20:08:13 2015 +0200| [aa9d15d89bb4ee8a31607d3db1b8c5334eb88d2d] | committer: 
Anton Khirnov

qsvdec: avoid an infinite loop with no consumed data and no output

This is triggerable with the HEVC decoder. It is unclear yet whether the
bug is in the calling code or the MSDK, but it seems better to check for
this in any case.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=aa9d15d89bb4ee8a31607d3db1b8c5334eb88d2d
---

 libavcodec/qsvdec.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index da9b082..489375c 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -245,6 +245,13 @@ int ff_qsv_decode(AVCodecContext *avctx, QSVContext *q,
         return ff_qsv_error(ret);
     }
 
+    /* make sure we do not enter an infinite loop if the SDK
+     * did not consume any data and did not return anything */
+    if (!sync && !bs.DataOffset) {
+        av_log(avctx, AV_LOG_WARNING, "A decode call did not consume any 
data\n");
+        bs.DataOffset = avpkt->size;
+    }
+
     if (sync) {
         QSVFrame *out_frame = find_frame(q, outsurf);
 

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

Reply via email to