1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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>
This commit is contained in:
Philip Langdale 2012-08-12 14:16:35 -07:00
parent 6057de19b5
commit 569027ea80

View File

@ -65,8 +65,18 @@ static int mov_text_decode_frame(AVCodecContext *avctx,
const char *ptr = avpkt->data; const char *ptr = avpkt->data;
const char *end; const char *end;
if (!ptr || avpkt->size <= 2) if (!ptr || avpkt->size < 2)
return avpkt->size ? AVERROR_INVALIDDATA : 0; 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 * The first two bytes of the packet are the length of the text string