]> git.sesse.net Git - ffmpeg/commitdiff
vorbis: make sure ch is non zero before calling vorbis_residue_decode
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 4 Jan 2012 20:55:52 +0000 (21:55 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 4 Jan 2012 20:58:08 +0000 (21:58 +0100)
This possibly makes part of the CVE-2011-3895 fix unneeded.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/vorbisdec.c

index cc737e94b347240a2a2bbb1338394421f2fd914a..1bd7a0ba12ff0140e00b5269860b6db4dc925cc4 100644 (file)
@@ -1575,9 +1575,11 @@ static int vorbis_parse_audio_packet(vorbis_context *vc)
             av_log(vc->avccontext, AV_LOG_ERROR, "Too many channels in vorbis_floor_decode.\n");
             return -1;
         }
-        ret = vorbis_residue_decode(vc, residue, ch, do_not_decode, ch_res_ptr, vlen, ch_left);
-        if (ret < 0)
-            return ret;
+        if (ch) {
+            ret = vorbis_residue_decode(vc, residue, ch, do_not_decode, ch_res_ptr, vlen, ch_left);
+            if (ret < 0)
+                return ret;
+        }
 
         ch_res_ptr += ch * vlen;
         ch_left -= ch;