summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2010-12-07 16:22:51 +0000
committerNils Wallménius <nils@rockbox.org>2010-12-07 16:22:51 +0000
commit0bfa899544d31ee2f34d149eb8bc17f89d7e9715 (patch)
treee53f73fe010bd59611e04753f52b933ecb6c6d9a /apps
parent13eac3bd2f721b0b8c37af0f92351e3454c2bd9f (diff)
downloadrockbox-0bfa899544d31ee2f34d149eb8bc17f89d7e9715.tar.gz
rockbox-0bfa899544d31ee2f34d149eb8bc17f89d7e9715.tar.bz2
rockbox-0bfa899544d31ee2f34d149eb8bc17f89d7e9715.zip
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
Diffstat (limited to 'apps')
-rw-r--r--apps/codecs/libtremor/floor1.c19
-rw-r--r--apps/codecs/libtremor/res012.c4
2 files changed, 18 insertions, 5 deletions
diff --git a/apps/codecs/libtremor/floor1.c b/apps/codecs/libtremor/floor1.c
index 0d3828c816..98118d7ac9 100644
--- a/apps/codecs/libtremor/floor1.c
+++ b/apps/codecs/libtremor/floor1.c
@@ -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){
diff --git a/apps/codecs/libtremor/res012.c b/apps/codecs/libtremor/res012.c
index a60cf7fa1e..bcddf97640 100644
--- a/apps/codecs/libtremor/res012.c
+++ b/apps/codecs/libtremor/res012.c
@@ -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. */