diff options
author | Philip Langdale <philipl@overt.org> | 2012-08-12 14:16:35 -0700 |
---|---|---|
committer | Philip Langdale <philipl@overt.org> | 2012-08-15 22:03:16 -0700 |
commit | 569027ea80daf928e6c127a27b2d7d23950e4534 (patch) | |
tree | 3772e9694247455cbc2d2c782f0b5485dfb6edb4 /libavcodec | |
parent | 6057de19b5e0075fea55a3a0cb9d225ba3a6f9a4 (diff) | |
download | ffmpeg-569027ea80daf928e6c127a27b2d7d23950e4534.tar.gz |
movtextdec: Don't emit errors for normal duration-end packets.
The logic here was off. If the packet size is exactly two, then
it's a well-formed empty subtitle, used to mark the end of the
duration of the previous subtitle.
Signed-off-by: Philip Langdale <philipl@overt.org>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/movtextdec.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c index 52668e2ff7..a65bbb83e3 100644 --- a/libavcodec/movtextdec.c +++ b/libavcodec/movtextdec.c @@ -65,8 +65,18 @@ static int mov_text_decode_frame(AVCodecContext *avctx, const char *ptr = avpkt->data; const char *end; - if (!ptr || avpkt->size <= 2) - return avpkt->size ? AVERROR_INVALIDDATA : 0; + if (!ptr || avpkt->size < 2) + return AVERROR_INVALIDDATA; + + /* + * A packet of size two with value zero is an empty subtitle + * used to mark the end of the previous non-empty subtitle. + * We can just drop them here as we have duration information + * already. If the value is non-zero, then it's technically a + * bad packet. + */ + if (avpkt->size == 2) + return AV_RB16(ptr) == 0 ? 0 : AVERROR_INVALIDDATA; /* * The first two bytes of the packet are the length of the text string |