diff mbox

[FFmpeg-devel] avcodec/libfdk-aacdec: Correct buffer_size parameter

Message ID 20170525012150.15508-1-michael@niedermayer.cc
State Accepted
Commit f61265571d68c410f5307c240a7f9c95c247fb54
Headers show

Commit Message

Michael Niedermayer May 25, 2017, 1:21 a.m. UTC
the timeDataSize argument to aacDecoder_DecodeFrame() seems undocumented and until
2016 04 (203e3f28fbebec7011342017fafc2a0bda0ce530) unused.
after that commit libfdk-aacdec interprets it as size in sample units and memsets that on error.
FFmpeg as well as others (like GStreamer) did interpret it as size in bytes

Fixes: 1442/clusterfuzz-testcase-minimized-4540199973421056 (This requires recent libfdk to reproduce)

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

Comments

Michael Niedermayer May 28, 2017, 1:08 a.m. UTC | #1
On Thu, May 25, 2017 at 03:21:50AM +0200, Michael Niedermayer wrote:
> the timeDataSize argument to aacDecoder_DecodeFrame() seems undocumented and until
> 2016 04 (203e3f28fbebec7011342017fafc2a0bda0ce530) unused.
> after that commit libfdk-aacdec interprets it as size in sample units and memsets that on error.
> FFmpeg as well as others (like GStreamer) did interpret it as size in bytes
> 
> Fixes: 1442/clusterfuzz-testcase-minimized-4540199973421056 (This requires recent libfdk to reproduce)
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/libfdk-aacdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

applied

[...]
diff mbox

Patch

diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c
index e5f7c4ebdc..2857b9453f 100644
--- a/libavcodec/libfdk-aacdec.c
+++ b/libavcodec/libfdk-aacdec.c
@@ -325,7 +325,7 @@  static int fdk_aac_decode_frame(AVCodecContext *avctx, void *data,
         return AVERROR_INVALIDDATA;
     }
 
-    err = aacDecoder_DecodeFrame(s->handle, (INT_PCM *) s->decoder_buffer, s->decoder_buffer_size, 0);
+    err = aacDecoder_DecodeFrame(s->handle, (INT_PCM *) s->decoder_buffer, s->decoder_buffer_size / sizeof(INT_PCM), 0);
     if (err == AAC_DEC_NOT_ENOUGH_BITS) {
         ret = avpkt->size - valid;
         goto end;