diff --git a/libavformat/rl2.c b/libavformat/rl2.c index 800e12edbe..fb7409eaa6 100644 --- a/libavformat/rl2.c +++ b/libavformat/rl2.c @@ -136,8 +136,10 @@ static av_cold int rl2_read_header(AVFormatContext *s) /** setup audio stream if present */ if(sound_rate){ - if(channels <= 0) + if (!channels || channels > 42) { + av_log(s, AV_LOG_ERROR, "Invalid number of channels: %d\n", channels); return AVERROR_INVALIDDATA; + } pts_num = def_sound_size; pts_den = rate;