summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Terriberry <tterribe@xiph.org>2010-10-13 23:17:20 +0000
committerTim Terriberry <tterribe@xiph.org>2010-10-13 23:17:20 +0000
commit055a48d42a5779c15345713c09d3631d39698515 (patch)
tree2119e06ede0c01edf1db30cb96ae19032862e52f
parent88015f25dc5c29bf2819bfd8f7d2b46ec20dc204 (diff)
downloadtremor-055a48d42a5779c15345713c09d3631d39698515.tar.gz
Back out r17515.
This accidentally contained far more than I meant to commit. git-svn-id: https://svn.xiph.org/trunk/Tremor@17516 0101bb08-14d6-0310-b084-bc0e0c8e3800
-rw-r--r--backends.h3
-rw-r--r--info.c7
-rw-r--r--iseeking_example.c4
-rw-r--r--ivorbisfile_example.c4
-rw-r--r--res012.c13
-rw-r--r--sharedbook.c1
6 files changed, 13 insertions, 19 deletions
diff --git a/backends.h b/backends.h
index 5202421..50c1c45 100644
--- a/backends.h
+++ b/backends.h
@@ -92,10 +92,9 @@ typedef struct vorbis_info_residue0{
/* first stage (lossless partitioning) */
int grouping; /* group n vectors per partition */
int partitions; /* possible codebooks for a partition */
- int partvals; /* partitions ^ groupbook dim */
int groupbook; /* huffbook for partitioning */
int secondstages[64]; /* expanded out to pointers in lookup */
- int booklist[512]; /* list of second stage books */
+ int booklist[256]; /* list of second stage books */
} vorbis_info_residue0;
/* Mapping backend generic *****************************************/
diff --git a/info.c b/info.c
index 75e7205..f351a48 100644
--- a/info.c
+++ b/info.c
@@ -21,7 +21,6 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
-#include <limits.h>
#include <ogg/ogg.h>
#include "ivorbiscodec.h"
#include "codec_internal.h"
@@ -195,9 +194,9 @@ static int _vorbis_unpack_comment(vorbis_comment *vc,oggpack_buffer *opb){
if(vc->vendor==NULL)goto err_out;
_v_readstring(opb,vc->vendor,vendorlen);
i=oggpack_read(opb,32);
- if(i<0||i>=INT_MAX||i>(opb->storage-oggpack_bytes(opb))>>2)goto err_out;
- vc->user_comments=(char **)_ogg_calloc(i+1,sizeof(*vc->user_comments));
- vc->comment_lengths=(int *)_ogg_calloc(i+1, sizeof(*vc->comment_lengths));
+ if(i<0||i>(opb->storage-oggpack_bytes(opb))>>2)goto err_out;
+ vc->user_comments=(char **)_ogg_calloc(vc->comments+1,sizeof(*vc->user_comments));
+ vc->comment_lengths=(int *)_ogg_calloc(vc->comments+1, sizeof(*vc->comment_lengths));
if(vc->user_comments==NULL||vc->comment_lengths==NULL)goto err_out;
vc->comments=i;
diff --git a/iseeking_example.c b/iseeking_example.c
index 533d7bd..aaf0d39 100644
--- a/iseeking_example.c
+++ b/iseeking_example.c
@@ -18,8 +18,8 @@
#include <stdlib.h>
#include <stdio.h>
-#include "ivorbiscodec.h"
-#include "ivorbisfile.h"
+#include <vorbis/ivorbiscodec.h>
+#include <vorbis/ivorbisfile.h>
#ifdef _WIN32 /* We need the following two to set stdin/stdout to binary */
# include <io.h>
diff --git a/ivorbisfile_example.c b/ivorbisfile_example.c
index c99cfd2..1854fc4 100644
--- a/ivorbisfile_example.c
+++ b/ivorbisfile_example.c
@@ -21,8 +21,8 @@
#include <stdio.h>
#include <stdlib.h>
-#include "ivorbiscodec.h"
-#include "ivorbisfile.h"
+#include <vorbis/ivorbiscodec.h>
+#include <vorbis/ivorbisfile.h>
#ifdef _WIN32 /* We need the following two to set stdin/stdout to binary */
#include <io.h>
diff --git a/res012.c b/res012.c
index 38c3707..6c1d4e1 100644
--- a/res012.c
+++ b/res012.c
@@ -115,10 +115,6 @@ vorbis_info_residue *res0_unpack(vorbis_info *vi,oggpack_buffer *opb){
/* verify the phrasebook is not specifying an impossible or
inconsistent partitioning scheme. */
- /* modify the phrasebook ranging check from r16327; an early beta
- encoder had a bug where it used an oversized phrasebook by
- accident. These files should continue to be playable, but don't
- allow an exploit */
{
int entries = ci->book_param[info->groupbook]->entries;
int dim = ci->book_param[info->groupbook]->dim;
@@ -128,7 +124,7 @@ vorbis_info_residue *res0_unpack(vorbis_info *vi,oggpack_buffer *opb){
if(partvals > entries) goto errout;
dim--;
}
- info->partvals = partvals;
+ if(partvals != entries) goto errout;
}
return(info);
@@ -172,7 +168,8 @@ vorbis_look_residue *res0_look(vorbis_dsp_state *vd,vorbis_info_mode *vm,
}
}
- look->partvals=look->phrasebook->entries;
+ look->partvals=look->parts;
+ for(j=1;j<dim;j++)look->partvals*=look->parts;
look->stages=maxstage;
look->decodemap=(int **)_ogg_malloc(look->partvals*sizeof(*look->decodemap));
for(j=0;j<look->partvals;j++){
@@ -225,7 +222,7 @@ static int _01inverse(vorbis_block *vb,vorbis_look_residue *vl,
/* fetch the partition word for each channel */
for(j=0;j<ch;j++){
int temp=vorbis_book_decode(look->phrasebook,&vb->opb);
- if(temp==-1 || temp>=info->partvals)goto eopbreak;
+ if(temp==-1)goto eopbreak;
partword[j][l]=look->decodemap[temp];
if(partword[j][l]==NULL)goto errout;
}
@@ -307,7 +304,7 @@ int res2_inverse(vorbis_block *vb,vorbis_look_residue *vl,
if(s==0){
/* fetch the partition word */
int temp=vorbis_book_decode(look->phrasebook,&vb->opb);
- if(temp==-1 || temp>info->partvals)goto eopbreak;
+ if(temp==-1)goto eopbreak;
partword[l]=look->decodemap[temp];
if(partword[l]==NULL)goto errout;
}
diff --git a/sharedbook.c b/sharedbook.c
index fe49b10..03c2147 100644
--- a/sharedbook.c
+++ b/sharedbook.c
@@ -129,7 +129,6 @@ ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
but the above tree-gen code doesn't mark that. */
if(sparsecount != 1){
for(i=1;i<33;i++)
- printf("%2li: 0x%08lX\n", i, marker[i] & (0xffffffffUL>>(32-i)));
if(marker[i] & (0xffffffffUL>>(32-i))){
_ogg_free(r);
return(NULL);