Commit 8e20832c authored by Monty's avatar Monty
Browse files

Second half of fix to Mozilla BZ # 5000254: sanity check the floor 1

post list to reject files with repeated values that would result in
floor line segments with zero length.


svn path=/trunk/vorbis/; revision=16182
parent 2acdd3f5
......@@ -120,6 +120,9 @@ static void floor1_pack (vorbis_info_floor *i,oggpack_buffer *opb){
}
}
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=vi->codec_setup;
......@@ -164,6 +167,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:
......@@ -171,10 +185,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_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