[FFmpeg-devel] [PATCH] avcodec/flac_parser: Do not loose header count in find_headers_search()
Paul B Mahol
onemda at gmail.com
Tue Feb 4 10:10:49 EET 2020
probably fine
On 2/3/20, Michael Niedermayer <michael at niedermayer.cc> wrote:
> Fixes: Timeout
> Fixes: out of array access
> Fixes:
> 20274/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLAC_fuzzer-5649631988154368
> Fixes:
> 19275/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLAC_fuzzer-5757535722405888
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> ---
> libavcodec/flac_parser.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
> index 9ffa288548..3424583c49 100644
> --- a/libavcodec/flac_parser.c
> +++ b/libavcodec/flac_parser.c
> @@ -208,16 +208,20 @@ static int find_headers_search(FLACParseContext *fpc,
> uint8_t *buf,
> uint32_t x;
>
> for (i = 0; i < mod_offset; i++) {
> - if ((AV_RB16(buf + i) & 0xFFFE) == 0xFFF8)
> - size = find_headers_search_validate(fpc, search_start + i);
> + if ((AV_RB16(buf + i) & 0xFFFE) == 0xFFF8) {
> + int ret = find_headers_search_validate(fpc, search_start + i);
> + size = FFMAX(size, ret);
> + }
> }
>
> for (; i < buf_size - 1; i += 4) {
> x = AV_RN32(buf + i);
> if (((x & ~(x + 0x01010101)) & 0x80808080)) {
> for (j = 0; j < 4; j++) {
> - if ((AV_RB16(buf + i + j) & 0xFFFE) == 0xFFF8)
> - size = find_headers_search_validate(fpc, search_start +
> i + j);
> + if ((AV_RB16(buf + i + j) & 0xFFFE) == 0xFFF8) {
> + int ret = find_headers_search_validate(fpc,
> search_start + i + j);
> + size = FFMAX(size, ret);
> + }
> }
> }
> }
> --
> 2.17.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-devel
mailing list