vorbisdec: Error on bark_map_size equal to 0.
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 10 Jan 2013 23:54:12 +0000 (00:54 +0100)
committerLuca Barbato <lu_zero@gentoo.org>
Mon, 25 Feb 2013 06:33:59 +0000 (07:33 +0100)
The value is used to calculate output LSP curve and a division by zero
and out of array accesses would occur.

CVE-2013-0894

CC: libav-stable@libav.org
Reported-by: Dale Curtis <dalecurtis@chromium.org>
Found-by: inferno@chromium.org
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
libavcodec/vorbisdec.c

index 158bd6f57c99c3857b7c05cb424157fc975ca2e6..600083bd59766c9ed66c10a3fc2d09fda5c44a42 100644 (file)
@@ -586,6 +586,11 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc)
             floor_setup->data.t0.order          = get_bits(gb,  8);
             floor_setup->data.t0.rate           = get_bits(gb, 16);
             floor_setup->data.t0.bark_map_size  = get_bits(gb, 16);
+            if (floor_setup->data.t0.bark_map_size == 0) {
+                av_log(vc->avccontext, AV_LOG_ERROR,
+                       "Floor 0 bark map size is 0.\n");
+                return AVERROR_INVALIDDATA;
+            }
             floor_setup->data.t0.amplitude_bits = get_bits(gb,  6);
             /* zero would result in a div by zero later *
              * 2^0 - 1 == 0                             */