]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/cook.c
cook: check js_subband_start for validity
[ffmpeg] / libavcodec / cook.c
index 54b576f89f6f65e98ab45314cbc0041918480a22..7dcf6558ec5bd03f6cc68c19a20cf2af3b2626a3 100644 (file)
@@ -1091,6 +1091,11 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
         if (extradata_size >= 8) {
             bytestream_get_be32(&edata_ptr);    // Unknown unused
             q->subpacket[s].js_subband_start = bytestream_get_be16(&edata_ptr);
+            if (q->subpacket[s].js_subband_start >= 51) {
+                av_log(avctx, AV_LOG_ERROR, "js_subband_start %d is too large\n", q->subpacket[s].js_subband_start);
+                return AVERROR_INVALIDDATA;
+            }
+
             q->subpacket[s].js_vlc_bits = bytestream_get_be16(&edata_ptr);
             extradata_size -= 8;
         }