OSDN Git Service

avcodec/flacdec: Return error code instead of 0 for failures
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 9 May 2017 11:25:34 +0000 (13:25 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 9 May 2017 14:50:18 +0000 (16:50 +0200)
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>
libavcodec/flacdec.c

index f73a32b..581c73e 100644 (file)
@@ -205,12 +205,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);