Commit 6e25b5c1 authored by Timothy B. Terriberry's avatar Timothy B. Terriberry

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.


git-svn-id: https://svn.xiph.org/trunk/Tremor@17523 0101bb08-14d6-0310-b084-bc0e0c8e3800
parent 699d1778
......@@ -68,6 +68,10 @@ static int ilog(unsigned int v){
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 @@ static vorbis_info_floor *floor1_unpack (vorbis_info *vi,oggpack_buffer *opb){
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 @@ static vorbis_info_floor *floor1_unpack (vorbis_info *vi,oggpack_buffer *opb){
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){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment