---
 libavcodec/internal.h |    2 ++
 libavcodec/pcm.c      |    4 ++--
 libavcodec/utils.c    |    3 +--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index e5b1958..231d4b6 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -30,6 +30,8 @@
 #include "libavutil/pixfmt.h"
 #include "avcodec.h"
 
+#define FF_SANE_NB_CHANNELS 128U
+
 typedef struct InternalBuffer {
     uint8_t *base[AV_NUM_DATA_POINTERS];
     uint8_t *data[AV_NUM_DATA_POINTERS];
diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c
index 1f8f22d..3064aef 100644
--- a/libavcodec/pcm.c
+++ b/libavcodec/pcm.c
@@ -210,7 +210,7 @@ static av_cold int pcm_decode_init(AVCodecContext *avctx)
     PCMDecode *s = avctx->priv_data;
     int i;
 
-    if (avctx->channels <= 0 || avctx->channels > MAX_CHANNELS) {
+    if (avctx->channels <= 0) {
         av_log(avctx, AV_LOG_ERROR, "PCM channels out of bounds\n");
         return AVERROR(EINVAL);
     }
@@ -340,7 +340,7 @@ static int pcm_decode_frame(AVCodecContext *avctx, void 
*data,
         break;
     case AV_CODEC_ID_PCM_S16LE_PLANAR:
     {
-        const uint8_t *src2[MAX_CHANNELS];
+        const uint8_t *src2[FF_SANE_NB_CHANNELS];
         n /= avctx->channels;
         for (c = 0; c < avctx->channels; c++)
             src2[c] = &src[c * n * 2];
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 10230ca..be6d7ae 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -758,8 +758,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
*avctx, const AVCodec *code
     if (av_codec_is_decoder(codec))
         av_freep(&avctx->subtitle_header);
 
-#define SANE_NB_CHANNELS 128U
-    if (avctx->channels > SANE_NB_CHANNELS) {
+    if (avctx->channels > FF_SANE_NB_CHANNELS) {
         ret = AVERROR(EINVAL);
         goto free_and_end;
     }
-- 
1.7.1

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to