aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-10-21 13:25:59 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-23 23:31:08 +0200
commit73e60e44391d0e7b8bc6a24a177fa0d4efe6f5f7 (patch)
tree3a8c3fb35e26f5646b047d6709855bf3157be3de /libavcodec
parent404c9331dde21f0e7b1b10649b2e348e854f45bb (diff)
downloadffmpeg-73e60e44391d0e7b8bc6a24a177fa0d4efe6f5f7.tar.gz
avcodec/flac_parser: Consider AV_INPUT_BUFFER_PADDING_SIZE
Fixes: out if array read Fixes: 40109/clusterfuzz-testcase-minimized-ffmpeg_dem_FLAC_fuzzer-4805686811295744 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Mattias Wadman <mattias.wadman@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/flac_parser.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index 3424583c49..b13b3b646a 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -55,6 +55,7 @@
/** largest possible size of flac header */
#define MAX_FRAME_HEADER_SIZE 16
+#define MAX_FRAME_VERIFY_SIZE (MAX_FRAME_HEADER_SIZE)
typedef struct FLACHeaderMarker {
int offset; /**< byte offset from start of FLACParseContext->buffer */
@@ -170,7 +171,7 @@ static int find_headers_search_validate(FLACParseContext *fpc, int offset)
uint8_t *header_buf;
int size = 0;
header_buf = flac_fifo_read_wrap(fpc, offset,
- MAX_FRAME_HEADER_SIZE,
+ MAX_FRAME_VERIFY_SIZE + AV_INPUT_BUFFER_PADDING_SIZE,
&fpc->wrap_buf,
&fpc->wrap_buf_allocated_size);
if (frame_header_is_valid(fpc->avctx, header_buf, &fi)) {