forked from len0rd/rockbox
libtremor: merge upstream revision 17522 and 17523 adding more sanity checking.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28760 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
13eac3bd2f
commit
0bfa899544
2 changed files with 18 additions and 5 deletions
|
|
@ -67,6 +67,10 @@ static inline int ilog(register 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;
|
||||
|
|
@ -110,6 +114,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:
|
||||
|
|
@ -117,10 +132,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){
|
||||
|
||||
|
|
|
|||
|
|
@ -109,8 +109,10 @@ static vorbis_info_residue *res0_unpack(vorbis_info *vi,oggpack_buffer *opb){
|
|||
info->booklist[j]=oggpack_read(opb,8);
|
||||
|
||||
if(info->groupbook>=ci->books)goto errout;
|
||||
for(j=0;j<acc;j++)
|
||||
for(j=0;j<acc;j++){
|
||||
if(info->booklist[j]>=ci->books)goto errout;
|
||||
if(ci->book_param[info->booklist[j]]->maptype==0)goto errout;
|
||||
}
|
||||
|
||||
/* verify the phrasebook is not specifying an impossible or
|
||||
inconsistent partitioning scheme. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue