libfdk-aacdec: Fix a boundary check

Message ID 20141210205203.BFE565DE4C@aruru.libav.org
State New
Headers show

Commit Message

Janne Grunau Dec. 10, 2014, 8:52 p.m.
Module: libav
Branch: master
Commit: c7921a480467876ece06566e0efd8f6bce9d1903

Author:    Martin Storsjö <martin@martin.st>
Committer: Martin Storsjö <martin@martin.st>
Date:      Wed Dec 10 08:02:43 2014 +0200

libfdk-aacdec: Fix a boundary check

This avoids potential out of bounds writes, with potential future
versions of the library.

Bug-Id: CID 1254945
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>

---

 libavcodec/libfdk-aacdec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c
index 2c2abae..deef56a 100644
--- a/libavcodec/libfdk-aacdec.c
+++ b/libavcodec/libfdk-aacdec.c
@@ -100,7 +100,7 @@  static int get_stream_info(AVCodecContext *avctx)
 
     for (i = 0; i < info->numChannels; i++) {
         AUDIO_CHANNEL_TYPE ctype = info->pChannelType[i];
-        if (ctype <= ACT_NONE || ctype > FF_ARRAY_ELEMS(channel_counts)) {
+        if (ctype <= ACT_NONE || ctype >= FF_ARRAY_ELEMS(channel_counts)) {
             av_log(avctx, AV_LOG_WARNING, "unknown channel type\n");
             break;
         }