smacker demuxer: handle possible av_realloc() failure.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
parent
615baa13e4
commit
47a8589f7b
@ -286,11 +286,16 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
for(i = 0; i < 7; i++) {
|
for(i = 0; i < 7; i++) {
|
||||||
if(flags & 1) {
|
if(flags & 1) {
|
||||||
int size;
|
int size;
|
||||||
|
uint8_t *tmpbuf;
|
||||||
|
|
||||||
size = avio_rl32(s->pb) - 4;
|
size = avio_rl32(s->pb) - 4;
|
||||||
frame_size -= size;
|
frame_size -= size;
|
||||||
frame_size -= 4;
|
frame_size -= 4;
|
||||||
smk->curstream++;
|
smk->curstream++;
|
||||||
smk->bufs[smk->curstream] = av_realloc(smk->bufs[smk->curstream], size);
|
tmpbuf = av_realloc(smk->bufs[smk->curstream], size);
|
||||||
|
if (!tmpbuf)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
smk->bufs[smk->curstream] = tmpbuf;
|
||||||
smk->buf_sizes[smk->curstream] = size;
|
smk->buf_sizes[smk->curstream] = size;
|
||||||
ret = avio_read(s->pb, smk->bufs[smk->curstream], size);
|
ret = avio_read(s->pb, smk->bufs[smk->curstream], size);
|
||||||
if(ret != size)
|
if(ret != size)
|
||||||
|
Loading…
Reference in New Issue
Block a user