diff mbox series

[FFmpeg-devel] avformat/argo_brp: remove block_align check for audio

Message ID 20201103134956.21780-1-zane@zanevaniperen.com
State Accepted
Commit 769ab6b86421aab3936bcef3fe1813875c7a5eb0
Headers show
Series [FFmpeg-devel] avformat/argo_brp: remove block_align check for audio | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Zane van Iperen Nov. 3, 2020, 1:50 p.m. UTC
Causes a divide-by-zero in the rare case where:
- the file has an audio stream,
- the first audio frame isn't within the first BRP_BASF_LOOKAHEAD frames,
- an audio frame is encountered later, and
- its chunk header (except num_blocks) contains all zeros
   (matching the uninitialised structure in the context)

The decoder will discard any garbage data, so the check isn't really needed.

Fixes: division by 0
Fixes: 26667/clusterfuzz-testcase-minimized-ffmpeg_dem_ARGO_BRP_fuzzer-5645146928185344.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
---
 libavformat/argo_brp.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Zane van Iperen Nov. 4, 2020, 1:46 p.m. UTC | #1
> Causes a divide-by-zero in the rare case where:
> - the file has an audio stream,
> - the first audio frame isn't within the first BRP_BASF_LOOKAHEAD frames,
> - an audio frame is encountered later, and
> - its chunk header (except num_blocks) contains all zeros
>    (matching the uninitialised structure in the context)
> 
> The decoder will discard any garbage data, so the check isn't really needed.
> 
> Fixes: division by 0
> Fixes: 26667/clusterfuzz-testcase-minimized-ffmpeg_dem_ARGO_BRP_fuzzer-5645146928185344.fuzz
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
> ---
>  libavformat/argo_brp.c | 3 ---
>  1 file changed, 3 deletions(-)

Ping. Will apply tomorrow if no comments.
diff mbox series

Patch

diff --git a/libavformat/argo_brp.c b/libavformat/argo_brp.c
index 766d4fd261..6d6da851e9 100644
--- a/libavformat/argo_brp.c
+++ b/libavformat/argo_brp.c
@@ -392,9 +392,6 @@  static int argo_brp_read_packet(AVFormatContext *s, AVPacket *pkt)
             return AVERROR_INVALIDDATA;
 
         blk.size -= ASF_CHUNK_HEADER_SIZE;
-
-        if (blk.size % st->codecpar->block_align != 0)
-            return AVERROR_INVALIDDATA;
     }
 
     if ((ret = av_get_packet(s->pb, pkt, blk.size)) < 0)