diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-05-09 13:25:34 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-05-20 03:41:34 +0200 |
commit | ec70017f9fc2d5a69b16508a6b00563d0b750b75 (patch) | |
tree | dd26e5ee774022ae6c94a3dc284495b9c2d23fe2 | |
parent | eca9c51090b28f9cc2c08b4c6c0678c32b4fbb03 (diff) | |
download | ffmpeg-ec70017f9fc2d5a69b16508a6b00563d0b750b75.tar.gz |
avcodec/flacdec: Return error code instead of 0 for failures
Fixes: infinite loop
Fixes: 1418/clusterfuzz-testcase-minimized-5934472438480896
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 3f5a68533decdfb4757207e8d7b5af06e1dcd197)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/flacdec.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c index 65edac262e..4ab2b420aa 100644 --- a/libavcodec/flacdec.c +++ b/libavcodec/flacdec.c @@ -201,12 +201,12 @@ static int get_metadata_size(const uint8_t *buf, int buf_size) buf += 4; do { if (buf_end - buf < 4) - return 0; + return AVERROR_INVALIDDATA; flac_parse_block_header(buf, &metadata_last, NULL, &metadata_size); buf += 4; if (buf_end - buf < metadata_size) { /* need more data in order to read the complete header */ - return 0; + return AVERROR_INVALIDDATA; } buf += metadata_size; } while (!metadata_last); |