diff mbox series

[FFmpeg-devel,2/2] avcodec/wmaprodec: Check that the EOF frame was allocated before decoding into it

Message ID 20210916223558.1226-2-michael@niedermayer.cc
State Accepted
Commit 48bbeac259a9eb323018c3715a84008867e1294f
Headers show
Series [FFmpeg-devel,1/2] avformat/mpegts: use actually read packet size in mpegts_resync special case | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Michael Niedermayer Sept. 16, 2021, 10:35 p.m. UTC
Fixes: NULL pointer dereference
Fixes: 38125/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA1_fuzzer-5151909422432256

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/wmaprodec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paul B Mahol Sept. 17, 2021, 6:46 a.m. UTC | #1
lgtm
Michael Niedermayer Sept. 17, 2021, 5:22 p.m. UTC | #2
On Fri, Sep 17, 2021 at 08:46:07AM +0200, Paul B Mahol wrote:
> lgtm

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index a4b48b13a8c..7b489943f43 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -1855,7 +1855,7 @@  static int xma_decode_packet(AVCodecContext *avctx, void *data,
         eof = 1;
 
         for (i = 0; i < s->num_streams; i++) {
-            if (!s->xma[i].eof_done) {
+            if (!s->xma[i].eof_done && s->frames[i]->data[0]) {
                 ret = decode_packet(avctx, &s->xma[i], s->frames[i],
                                     &got_stream_frame_ptr, avpkt);
             }