summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2010-12-07 16:27:41 +0000
committerNils Wallménius <nils@rockbox.org>2010-12-07 16:27:41 +0000
commit02f836b1b2ab2fd827be950b1f41cdbed1572c5a (patch)
tree1e7c5106e7ae91bb3ecb2dff5046b33477754da9 /apps
parent0bfa899544d31ee2f34d149eb8bc17f89d7e9715 (diff)
downloadrockbox-02f836b1b2ab2fd827be950b1f41cdbed1572c5a.tar.gz
rockbox-02f836b1b2ab2fd827be950b1f41cdbed1572c5a.tar.bz2
rockbox-02f836b1b2ab2fd827be950b1f41cdbed1572c5a.zip
libtremor: merge upstream revision 17524 more sanity checking.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28761 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/codecs/libtremor/res012.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/apps/codecs/libtremor/res012.c b/apps/codecs/libtremor/res012.c
index bcddf97640..1263fa65ba 100644
--- a/apps/codecs/libtremor/res012.c
+++ b/apps/codecs/libtremor/res012.c
@@ -97,16 +97,27 @@ static vorbis_info_residue *res0_unpack(vorbis_info *vi,oggpack_buffer *opb){
info->partitions=oggpack_read(opb,6)+1;
info->groupbook=oggpack_read(opb,8);
+ /* check for premature EOP */
+ if(info->groupbook<0)goto errout;
+
for(j=0;j<info->partitions;j++){
int cascade=oggpack_read(opb,3);
- if(oggpack_read(opb,1))
- cascade|=(oggpack_read(opb,5)<<3);
+ int cflag=oggpack_read(opb,1);
+ if(cflag<0) goto errout;
+ if(cflag){
+ int c=oggpack_read(opb,5);
+ if(c<0) goto errout;
+ cascade|=(c<<3);
+ }
info->secondstages[j]=cascade;
acc+=icount(cascade);
}
- for(j=0;j<acc;j++)
- info->booklist[j]=oggpack_read(opb,8);
+ for(j=0;j<acc;j++){
+ int book=oggpack_read(opb,8);
+ if(book<0) goto errout;
+ info->booklist[j]=book;
+ }
if(info->groupbook>=ci->books)goto errout;
for(j=0;j<acc;j++){