aac: check the maximum number of channels
authorLuca Barbato <lu_zero@gentoo.org>
Sat, 27 Apr 2013 16:20:47 +0000 (18:20 +0200)
committerLuca Barbato <lu_zero@gentoo.org>
Sat, 27 Apr 2013 22:40:33 +0000 (00:40 +0200)
Broken bitstreams could report a larger than specified number of
channels and cause outbound writes.

CC:libav-stable@libav.org

libavcodec/aacdec.c

index 102c3d5..3219ec6 100644 (file)
@@ -141,6 +141,8 @@ static av_cold int che_configure(AACContext *ac,
                                  enum ChannelPosition che_pos,
                                  int type, int id, int *channels)
 {
+    if (*channels >= MAX_CHANNELS)
+        return AVERROR_INVALIDDATA;
     if (che_pos) {
         if (!ac->che[type][id]) {
             if (!(ac->che[type][id] = av_mallocz(sizeof(ChannelElement))))