[FFmpeg-devel] [PATCH] Avoid reading beyond end of stream in resync function.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Mon Aug 12 19:40:32 CEST 2013


This ends up printing a nonsense warning about
"marker does not match f_code".
This happens particularly frequently with VDPAU hwaccel
since there we fast-forward the stream directly to the end.
(Note: possibly it is incorrect for us to skip all the way to
the end for VDPAU, possibly someone should investigate that,
I am a bit lost in that regard).

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
---
 libavcodec/ituh263dec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
index 6d06a09..a88ff34 100644
--- a/libavcodec/ituh263dec.c
+++ b/libavcodec/ituh263dec.c
@@ -234,6 +234,8 @@ int ff_h263_resync(MpegEncContext *s){
         skip_bits1(&s->gb);
         align_get_bits(&s->gb);
     }
+    if (get_bits_left(&s->gb) < 16)
+        return -1;
 
     if(show_bits(&s->gb, 16)==0){
         pos= get_bits_count(&s->gb);
-- 
1.8.4.rc2



More information about the ffmpeg-devel mailing list