Bug 1117571 - Check mode index in vorbis_packet_blocksize(), r=kinetik
authorTimothy B. Terriberry <tterribe@vt.edu>
Sun, 04 Jan 2015 17:34:00 +0100
changeset 234991 5c86509a11bc8868f0967c451c216b8d0ce2e1c2
parent 234990 f33f5ff9d956b4b7d52fd5e808e90b734d5afd1b
child 234992 6b9c81a8c08149be5c3499b47b3e4230ee36fc24
push id346
push usermartin.thomson@gmail.com
push dateTue, 06 Jan 2015 00:23:07 +0000
reviewerskinetik
bugs1117571
milestone37.0a1
Bug 1117571 - Check mode index in vorbis_packet_blocksize(), r=kinetik
media/libtremor/bug1117571-r19420.patch
media/libtremor/lib/tremor_synthesis.c
media/libtremor/update.sh
media/libvorbis/bug1117571-r19419.patch
media/libvorbis/lib/vorbis_synthesis.c
media/libvorbis/update.sh
new file mode 100644
--- /dev/null
+++ b/media/libtremor/bug1117571-r19420.patch
@@ -0,0 +1,18 @@
+diff -r 55f3224d7513 media/libtremor/lib/tremor_synthesis.c
+--- a/media/libtremor/lib/tremor_synthesis.c	Sat Jan 03 20:02:33 2015 -0800
++++ b/media/libtremor/lib/tremor_synthesis.c	Sun Jan 04 11:17:29 2015 -0800
+@@ -119,13 +119,13 @@ long vorbis_packet_blocksize(vorbis_info
+     while(v>1){
+       modebits++;
+       v>>=1;
+     }
+ 
+     /* read our mode and pre/post windowsize */
+     mode=oggpack_read(&opb,modebits);
+   }
+-  if(mode==-1)return(OV_EBADPACKET);
++  if(mode==-1 || !ci->mode_param[mode])return(OV_EBADPACKET);
+   return(ci->blocksizes[ci->mode_param[mode]->blockflag]);
+ }
+ 
+ 
--- a/media/libtremor/lib/tremor_synthesis.c
+++ b/media/libtremor/lib/tremor_synthesis.c
@@ -119,13 +119,13 @@ long vorbis_packet_blocksize(vorbis_info
     while(v>1){
       modebits++;
       v>>=1;
     }
 
     /* read our mode and pre/post windowsize */
     mode=oggpack_read(&opb,modebits);
   }
-  if(mode==-1)return(OV_EBADPACKET);
+  if(mode==-1 || !ci->mode_param[mode])return(OV_EBADPACKET);
   return(ci->blocksizes[ci->mode_param[mode]->blockflag]);
 }
 
 
--- a/media/libtremor/update.sh
+++ b/media/libtremor/update.sh
@@ -26,8 +26,9 @@ cp $1/synthesis.c ./lib/tremor_synthesis
 cp $1/window_lookup.h ./lib/window_lookup.h
 cp $1/window.c ./lib/tremor_window.c
 cp $1/window.h ./lib/window.h
 cp $1/ivorbiscodec.h ./include/tremor/ivorbiscodec.h
 cp $1/os.h ./lib/os.h
 cp $1/COPYING ./COPYING
 cp $1/README ./README
 patch -p3 < ./bug719612.patch
+patch -p3 < ./bug1117571-r19420.patch
new file mode 100644
--- /dev/null
+++ b/media/libvorbis/bug1117571-r19419.patch
@@ -0,0 +1,22 @@
+diff -r 55f3224d7513 media/libvorbis/lib/vorbis_synthesis.c
+--- a/media/libvorbis/lib/vorbis_synthesis.c	Sat Jan 03 20:02:33 2015 -0800
++++ b/media/libvorbis/lib/vorbis_synthesis.c	Sun Jan 04 11:17:02 2015 -0800
+@@ -159,17 +159,17 @@ long vorbis_packet_blocksize(vorbis_info
+     while(v>1){
+       modebits++;
+       v>>=1;
+     }
+ 
+     /* read our mode and pre/post windowsize */
+     mode=oggpack_read(&opb,modebits);
+   }
+-  if(mode==-1)return(OV_EBADPACKET);
++  if(mode==-1 || !ci->mode_param[mode])return(OV_EBADPACKET);
+   return(ci->blocksizes[ci->mode_param[mode]->blockflag]);
+ }
+ 
+ int vorbis_synthesis_halfrate(vorbis_info *vi,int flag){
+   /* set / clear half-sample-rate mode */
+   codec_setup_info     *ci=vi->codec_setup;
+ 
+   /* right now, our MDCT can't handle < 64 sample windows. */
--- a/media/libvorbis/lib/vorbis_synthesis.c
+++ b/media/libvorbis/lib/vorbis_synthesis.c
@@ -159,17 +159,17 @@ long vorbis_packet_blocksize(vorbis_info
     while(v>1){
       modebits++;
       v>>=1;
     }
 
     /* read our mode and pre/post windowsize */
     mode=oggpack_read(&opb,modebits);
   }
-  if(mode==-1)return(OV_EBADPACKET);
+  if(mode==-1 || !ci->mode_param[mode])return(OV_EBADPACKET);
   return(ci->blocksizes[ci->mode_param[mode]->blockflag]);
 }
 
 int vorbis_synthesis_halfrate(vorbis_info *vi,int flag){
   /* set / clear half-sample-rate mode */
   codec_setup_info     *ci=vi->codec_setup;
 
   /* right now, our MDCT can't handle < 64 sample windows. */
--- a/media/libvorbis/update.sh
+++ b/media/libvorbis/update.sh
@@ -76,8 +76,9 @@ mkdir -p ./lib/books/coupled
 mkdir -p ./lib/books/floor
 mkdir -p ./lib/books/uncoupled
 cp $1/lib/books/coupled/res_books_stereo.h ./lib/books/coupled/
 cp $1/lib/books/coupled/res_books_51.h ./lib/books/coupled/
 cp $1/lib/books/floor/floor_books.h ./lib/books/floor/
 cp $1/lib/books/uncoupled/res_books_uncoupled.h ./lib/books/uncoupled/
 
 # Add any patches against upstream here.
+patch -p3 < ./bug1117571-r19419.patch