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
1793 AVFrame *frame = data;1793 AVFrame *frame = data;
1794 int i, ret, offset = INT_MAX;1794 int i, ret, offset = INT_MAX;
1795 1795
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 }
1796 /* decode current stream packet */1802 /* decode current stream packet */
1797 ret = decode_packet(avctx, &s->xma[s->current_stream], s->frames[s->current_stream],1803 ret = decode_packet(avctx, &s->xma[s->current_stream], s->frames[s->current_stream],
1798 &got_stream_frame_ptr, avpkt);1804 &got_stream_frame_ptr, avpkt);
@@ -1920,10 +1926,6 @@ static av_cold int xma_decode_init(AVCodecContext *avctx) · 121 unmodified lines
1920 s->frames[i] = av_frame_alloc();1926 s->frames[i] = av_frame_alloc();
1921 if (!s->frames[i])1927 if (!s->frames[i])
1922 return AVERROR(ENOMEM);1928 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 }
1927 1929
1928 s->start_channel[i] = start_channels;1930 s->start_channel[i] = start_channels;
1929 start_channels += s->xma[i].nb_channels;1931 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