History

avcodec/wmaprodec: get frame during frame decode

Fixes: memleak Fixes: 17615/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA2_fuzzer-5681306024804352

Michael Niedermayer committed 7 years ago

Commit 0f89a221 parent 10eabb81 file · +6 −4Browse files

Unified · Split

libavcodec/wmaprodec.c+6−4
@@ -1793,6 +1793,12 @@ static int xma_decode_packet(AVCodecContext *avctx, void *data, · 1792 unmodified lines
17931793 AVFrame *frame = data;
17941794 int i, ret, offset = INT_MAX;
17951795
1796+ if (!s->frames[s->current_stream]->data[0]) {
1797+ s->frames[s->current_stream]->nb_samples = 512;
1798+ if ((ret = ff_get_buffer(avctx, s->frames[s->current_stream], 0)) < 0) {
1799+ return ret;
1800+ }
1801+ }
17961802 /* decode current stream packet */
17971803 ret = decode_packet(avctx, &s->xma[s->current_stream], s->frames[s->current_stream],
17981804 &got_stream_frame_ptr, avpkt);
@@ -1920,10 +1926,6 @@ static av_cold int xma_decode_init(AVCodecContext *avctx) · 121 unmodified lines
19201926 s->frames[i] = av_frame_alloc();
19211927 if (!s->frames[i])
19221928 return AVERROR(ENOMEM);
1923− s->frames[i]->nb_samples = 512;
1924− if ((ret = ff_get_buffer(avctx, s->frames[i], 0)) < 0) {
1925− return AVERROR(ENOMEM);
1926− }
19271929
19281930 s->start_channel[i] = start_channels;
19291931 start_channels += s->xma[i].nb_channels;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t