[xiph-commits] r17523 - trunk/Tremor
tterribe at svn.xiph.org
tterribe at svn.xiph.org
Wed Oct 13 17:17:09 PDT 2010
Author: tterribe
Date: 2010-10-13 17:17:09 -0700 (Wed, 13 Oct 2010)
New Revision: 17523
Modified:
trunk/Tremor/floor1.c
Log:
Port of r16182 from libvorbis.
Second half of fix to https://bugzilla.mozilla.org/show_bug.cgi?id=500254
Sanity check the floor 1 post list to reject files with repeated values that
would result in floor line segments with zero length.
Modified: trunk/Tremor/floor1.c
===================================================================
--- trunk/Tremor/floor1.c 2010-10-14 00:07:49 UTC (rev 17522)
+++ trunk/Tremor/floor1.c 2010-10-14 00:17:09 UTC (rev 17523)
@@ -68,6 +68,10 @@
return(ret);
}
+static int icomp(const void *a,const void *b){
+ return(**(int **)a-**(int **)b);
+}
+
static vorbis_info_floor *floor1_unpack (vorbis_info *vi,oggpack_buffer *opb){
codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
int j,k,count=0,maxclass=-1,rangebits;
@@ -111,6 +115,17 @@
info->postlist[0]=0;
info->postlist[1]=1<<rangebits;
+ /* don't allow repeated values in post list as they'd result in
+ zero-length segments */
+ {
+ int *sortpointer[VIF_POSIT+2];
+ for(j=0;j<count+2;j++)sortpointer[j]=info->postlist+j;
+ qsort(sortpointer,count+2,sizeof(*sortpointer),icomp);
+
+ for(j=1;j<count+2;j++)
+ if(*sortpointer[j-1]==*sortpointer[j])goto err_out;
+ }
+
return(info);
err_out:
@@ -118,10 +133,6 @@
return(NULL);
}
-static int icomp(const void *a,const void *b){
- return(**(int **)a-**(int **)b);
-}
-
static vorbis_look_floor *floor1_look(vorbis_dsp_state *vd,vorbis_info_mode *mi,
vorbis_info_floor *in){
More information about the commits
mailing list