libavformat/avidec: check memory allocation
Memory allocation for AVIOContext should be checked. In this code, all error conditions are sent to the "goto error". Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
6bdfea8d4b
commit
0c90377a40
@ -1072,11 +1072,15 @@ static int read_gab2_sub(AVFormatContext *s, AVStream *st, AVPacket *pkt)
|
|||||||
ff_const59 AVInputFormat *sub_demuxer;
|
ff_const59 AVInputFormat *sub_demuxer;
|
||||||
AVRational time_base;
|
AVRational time_base;
|
||||||
int size;
|
int size;
|
||||||
|
AVProbeData pd;
|
||||||
|
unsigned int desc_len;
|
||||||
AVIOContext *pb = avio_alloc_context(pkt->data + 7,
|
AVIOContext *pb = avio_alloc_context(pkt->data + 7,
|
||||||
pkt->size - 7,
|
pkt->size - 7,
|
||||||
0, NULL, NULL, NULL, NULL);
|
0, NULL, NULL, NULL, NULL);
|
||||||
AVProbeData pd;
|
if (!pb)
|
||||||
unsigned int desc_len = avio_rl32(pb);
|
goto error;
|
||||||
|
|
||||||
|
desc_len = avio_rl32(pb);
|
||||||
|
|
||||||
if (desc_len > pb->buf_end - pb->buf_ptr)
|
if (desc_len > pb->buf_end - pb->buf_ptr)
|
||||||
goto error;
|
goto error;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user