summaryrefslogtreecommitdiff
path: root/libavformat/rl2.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2013-09-19 16:57:47 +0300
committerMartin Storsjö <martin@martin.st>2013-09-19 22:47:00 +0300
commit3ca14aa5964ea5d11f7a15f9fff17924d6096d44 (patch)
tree2022396393f66aa432586ee6a7dae6cc6633f7fc /libavformat/rl2.c
parent83c285f88016b087c2f0f4b9ef356ad8ef12d947 (diff)
downloadffmpeg-3ca14aa5964ea5d11f7a15f9fff17924d6096d44.tar.gz
rl2: Avoid a division by zero
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/rl2.c')
-rw-r--r--libavformat/rl2.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/rl2.c b/libavformat/rl2.c
index ac0532f1c9..ab33aabccc 100644
--- a/libavformat/rl2.c
+++ b/libavformat/rl2.c
@@ -107,6 +107,10 @@ static av_cold int rl2_read_header(AVFormatContext *s)
rate = avio_rl16(pb);
channels = avio_rl16(pb);
def_sound_size = avio_rl16(pb);
+ if (!channels || channels > 42) {
+ av_log(s, AV_LOG_ERROR, "Invalid number of channels: %d\n", channels);
+ return AVERROR_INVALIDDATA;
+ }
/** setup video stream */
st = avformat_new_stream(s, NULL);