]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/cook.c
h264: (trivial) remove unneeded macro argument in x86/cabac.h
[ffmpeg] / libavcodec / cook.c
index cde2752ea7f3477c112231e6cc10dbbb3a173a01..292148a04327fbb1f4efb4dd7fee7cc81587f695 100644 (file)
@@ -280,8 +280,8 @@ static av_cold void init_cplscales_table(COOKContext *q)
 static inline int decode_bytes(const uint8_t *inbuffer, uint8_t *out, int bytes)
 {
     static const uint32_t tab[4] = {
-        AV_BE2NE32C(0x37c511f2U), AV_BE2NE32C(0xf237c511U),
-        AV_BE2NE32C(0x11f237c5U), AV_BE2NE32C(0xc511f237U),
+        AV_BE2NE32C(0x37c511f2u), AV_BE2NE32C(0xf237c511u),
+        AV_BE2NE32C(0x11f237c5u), AV_BE2NE32C(0xc511f237u),
     };
     int i, off;
     uint32_t c;
@@ -1238,6 +1238,11 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
         q->subpacket[s].gains2.now      = q->subpacket[s].gain_3;
         q->subpacket[s].gains2.previous = q->subpacket[s].gain_4;
 
+        if (q->num_subpackets + q->subpacket[s].num_channels > q->nb_channels) {
+            av_log(avctx, AV_LOG_ERROR, "Too many subpackets %d for channels %d\n", q->num_subpackets, q->nb_channels);
+            return AVERROR_INVALIDDATA;
+        }
+
         q->num_subpackets++;
         s++;
         if (s > MAX_SUBPACKETS) {