Commit 20708223 authored by Reimar Döffinger's avatar Reimar Döffinger Committed by 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: 's avatarJanne Grunau <janne-ffmpeg@jannau.net>
(cherry picked from commit 4a72765a)
parent a30ac54a
...@@ -1423,7 +1423,7 @@ static int dvbsub_decode(AVCodecContext *avctx, ...@@ -1423,7 +1423,7 @@ static int dvbsub_decode(AVCodecContext *avctx,
#endif #endif
if (buf_size <= 2) if (buf_size <= 2 || *buf != 0x0f)
return -1; return -1;
p = buf; p = buf;
...@@ -1467,12 +1467,7 @@ static int dvbsub_decode(AVCodecContext *avctx, ...@@ -1467,12 +1467,7 @@ static int dvbsub_decode(AVCodecContext *avctx,
p += segment_length; p += segment_length;
} }
if (p != p_end) { return p - buf;
av_dlog(avctx, "Junk at end of packet\n");
return -1;
}
return buf_size;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment