[FFmpeg-cvslog] Do not fail DVB sub decoding because of a few padding bytes
Reimar Döffinger
git
Fri Feb 11 03:52:13 CET 2011
ffmpeg | branch: master | Reimar D?ffinger <Reimar.Doeffinger at gmx.de> | Wed Feb 9 19:32:07 2011 +0100| [20708223dbd35b69a1b7cb542ee340c7c22af504] | committer: Michael Niedermayer
Do not fail DVB sub decoding because of a few padding bytes
Instead of returning an error when bytes are left over, just return
the number of actually used bytes as other decoders do.
Instead add a special case so an error will be returned when none
of the data looks valid to avoid making debugging a pain.
Signed-off-by: Janne Grunau <janne-ffmpeg at jannau.net>
(cherry picked from commit 4a72765a1c94b05bd3053b1f34f8457a3b71d714)
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=20708223dbd35b69a1b7cb542ee340c7c22af504
---
libavcodec/dvbsubdec.c | 9 ++-------
1 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index 8cc8d4f..401144f 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -1423,7 +1423,7 @@ static int dvbsub_decode(AVCodecContext *avctx,
#endif
- if (buf_size <= 2)
+ if (buf_size <= 2 || *buf != 0x0f)
return -1;
p = buf;
@@ -1467,12 +1467,7 @@ static int dvbsub_decode(AVCodecContext *avctx,
p += segment_length;
}
- if (p != p_end) {
- av_dlog(avctx, "Junk at end of packet\n");
- return -1;
- }
-
- return buf_size;
+ return p - buf;
}
More information about the ffmpeg-cvslog
mailing list