avcodec/dca_lbr: Fix off by 1 error in freq check
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 2 Feb 2017 14:23:31 +0000 (15:23 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 6 Feb 2017 09:17:13 +0000 (10:17 +0100)
Fixes out of array read
Fixes: 510/clusterfuzz-testcase-5737865715646464

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 61f70416f8542cc86c84ae6e0342ba10a35d7cba)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/dca_lbr.c

index 342603c..56c5f40 100644 (file)
@@ -310,7 +310,7 @@ static int parse_tonal(DCALbrDecoder *s, int group)
                 break;  // End of subframe
 
             freq += diff - 2;
-            if (freq >> (5 - group) > s->nsubbands * 4 - 5) {
+            if (freq >> (5 - group) > s->nsubbands * 4 - 6) {
                 av_log(s->avctx, AV_LOG_ERROR, "Invalid spectral line offset\n");
                 return -1;
             }