summaryrefslogtreecommitdiff
path: root/libavcodec/dvbsubdec.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2011-02-09 19:32:07 +0100
committerJanne Grunau <janne-ffmpeg@jannau.net>2011-02-10 21:37:31 +0100
commit4a72765a1c94b05bd3053b1f34f8457a3b71d714 (patch)
treef4b4195d815c54a0ee243c40038307f6c9f69352 /libavcodec/dvbsubdec.c
parentdda3f0ef48aa5c3b03566b60b6bf63211e1fe579 (diff)
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@jannau.net>
Diffstat (limited to 'libavcodec/dvbsubdec.c')
-rw-r--r--libavcodec/dvbsubdec.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index 8cc8d4fc83..401144f902 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;
}