mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2025-02-21 12:40:40 +00:00
avcodec/subviewerdec: add some memory checks
This commit is contained in:
parent
592716227c
commit
947a5111dd
@ -51,6 +51,7 @@ static int subviewer_decode_frame(AVCodecContext *avctx,
|
|||||||
void *data, int *got_sub_ptr, AVPacket *avpkt)
|
void *data, int *got_sub_ptr, AVPacket *avpkt)
|
||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
|
int ret = 0;
|
||||||
AVSubtitle *sub = data;
|
AVSubtitle *sub = data;
|
||||||
const char *ptr = avpkt->data;
|
const char *ptr = avpkt->data;
|
||||||
AVBPrint buf;
|
AVBPrint buf;
|
||||||
@ -67,9 +68,11 @@ static int subviewer_decode_frame(AVCodecContext *avctx,
|
|||||||
// note: no need to rescale pts & duration since they are in the same
|
// note: no need to rescale pts & duration since they are in the same
|
||||||
// timebase as ASS (1/100)
|
// timebase as ASS (1/100)
|
||||||
if (ptr && avpkt->size > 0 && !subviewer_event_to_ass(&buf, ptr))
|
if (ptr && avpkt->size > 0 && !subviewer_event_to_ass(&buf, ptr))
|
||||||
ff_ass_add_rect(sub, buf.str, avpkt->pts, avpkt->duration, 0);
|
ret = ff_ass_add_rect_bprint(sub, &buf, avpkt->pts, avpkt->duration, 0);
|
||||||
*got_sub_ptr = sub->num_rects > 0;
|
|
||||||
av_bprint_finalize(&buf, NULL);
|
av_bprint_finalize(&buf, NULL);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
*got_sub_ptr = sub->num_rects > 0;
|
||||||
return avpkt->size;
|
return avpkt->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user