Version in base suite: 1.1.0-1 Version in overlay suite: 1.1.0-2 Base version: libvorbis_1.1.0-1 Target version: libvorbis_1.1.0-2 Base file: /org/ftp.debian.org/ftp/pool/main/libv/libvorbis/libvorbis_1.1.0-1.dsc Target file: /org/ftp.debian.org/ftp/pool/main/libv/libvorbis/libvorbis_1.1.0-2.dsc diff -u libvorbis-1.1.0/debian/changelog libvorbis-1.1.0/debian/changelog --- libvorbis-1.1.0/debian/changelog +++ libvorbis-1.1.0/debian/changelog @@ -1,3 +1,9 @@ +libvorbis (1.1.0-2) oldstable-security; urgency=low + + * Fix CVE-2007-3106 CVE-2007-4029 CVE-2007-4065 CVE-2007-4066 + + -- Moritz Muehlenhoff Sun, 20 Jan 2008 13:08:36 +0000 + libvorbis (1.1.0-1) unstable; urgency=low * New upstream. only in patch2: unchanged: --- libvorbis-1.1.0.orig/lib/sharedbook.c +++ libvorbis-1.1.0/lib/sharedbook.c @@ -329,30 +329,31 @@ c->used_entries=n; c->dim=s->dim; - /* two different remappings go on here. - - First, we collapse the likely sparse codebook down only to - actually represented values/words. This collapsing needs to be - indexed as map-valueless books are used to encode original entry - positions as integers. - - Second, we reorder all vectors, including the entry index above, - by sorted bitreversed codeword to allow treeless decode. */ + if(n>0){ + + /* two different remappings go on here. + + First, we collapse the likely sparse codebook down only to + actually represented values/words. This collapsing needs to be + indexed as map-valueless books are used to encode original entry + positions as integers. + + Second, we reorder all vectors, including the entry index above, + by sorted bitreversed codeword to allow treeless decode. */ - { /* perform sort */ ogg_uint32_t *codes=_make_words(s->lengthlist,s->entries,c->used_entries); ogg_uint32_t **codep=alloca(sizeof(*codep)*n); if(codes==NULL)goto err_out; - + for(i=0;icodelist=_ogg_malloc(n*sizeof(*c->codelist)); /* the index is a reverse index */ @@ -364,66 +365,66 @@ for(i=0;icodelist[sortindex[i]]=codes[i]; _ogg_free(codes); - } - - c->valuelist=_book_unquantize(s,n,sortindex); - c->dec_index=_ogg_malloc(n*sizeof(*c->dec_index)); - - for(n=0,i=0;ientries;i++) - if(s->lengthlist[i]>0) - c->dec_index[sortindex[n++]]=i; - c->dec_codelengths=_ogg_malloc(n*sizeof(*c->dec_codelengths)); - for(n=0,i=0;ientries;i++) - if(s->lengthlist[i]>0) - c->dec_codelengths[sortindex[n++]]=s->lengthlist[i]; - - c->dec_firsttablen=_ilog(c->used_entries)-4; /* this is magic */ - if(c->dec_firsttablen<5)c->dec_firsttablen=5; - if(c->dec_firsttablen>8)c->dec_firsttablen=8; - - tabn=1<dec_firsttablen; - c->dec_firsttable=_ogg_calloc(tabn,sizeof(*c->dec_firsttable)); - c->dec_maxlength=0; - - for(i=0;idec_maxlengthdec_codelengths[i]) - c->dec_maxlength=c->dec_codelengths[i]; - if(c->dec_codelengths[i]<=c->dec_firsttablen){ - ogg_uint32_t orig=bitreverse(c->codelist[i]); - for(j=0;j<(1<<(c->dec_firsttablen-c->dec_codelengths[i]));j++) - c->dec_firsttable[orig|(j<dec_codelengths[i])]=i+1; - } - } - - /* now fill in 'unused' entries in the firsttable with hi/lo search - hints for the non-direct-hits */ - { - ogg_uint32_t mask=0xfffffffeUL<<(31-c->dec_firsttablen); - long lo=0,hi=0; - for(i=0;idec_firsttablen); - if(c->dec_firsttable[bitreverse(word)]==0){ - while((lo+1)codelist[lo+1]<=word)lo++; - while( hi=(c->codelist[hi]&mask))hi++; - - /* we only actually have 15 bits per hint to play with here. - In order to overflow gracefully (nothing breaks, efficiency - just drops), encode as the difference from the extremes. */ - { - unsigned long loval=lo; - unsigned long hival=n-hi; - - if(loval>0x7fff)loval=0x7fff; - if(hival>0x7fff)hival=0x7fff; - c->dec_firsttable[bitreverse(word)]= - 0x80000000UL | (loval<<15) | hival; + c->valuelist=_book_unquantize(s,n,sortindex); + c->dec_index=_ogg_malloc(n*sizeof(*c->dec_index)); + + for(n=0,i=0;ientries;i++) + if(s->lengthlist[i]>0) + c->dec_index[sortindex[n++]]=i; + + c->dec_codelengths=_ogg_malloc(n*sizeof(*c->dec_codelengths)); + for(n=0,i=0;ientries;i++) + if(s->lengthlist[i]>0) + c->dec_codelengths[sortindex[n++]]=s->lengthlist[i]; + + c->dec_firsttablen=_ilog(c->used_entries)-4; /* this is magic */ + if(c->dec_firsttablen<5)c->dec_firsttablen=5; + if(c->dec_firsttablen>8)c->dec_firsttablen=8; + + tabn=1<dec_firsttablen; + c->dec_firsttable=_ogg_calloc(tabn,sizeof(*c->dec_firsttable)); + c->dec_maxlength=0; + + for(i=0;idec_maxlengthdec_codelengths[i]) + c->dec_maxlength=c->dec_codelengths[i]; + if(c->dec_codelengths[i]<=c->dec_firsttablen){ + ogg_uint32_t orig=bitreverse(c->codelist[i]); + for(j=0;j<(1<<(c->dec_firsttablen-c->dec_codelengths[i]));j++) + c->dec_firsttable[orig|(j<dec_codelengths[i])]=i+1; + } + } + + /* now fill in 'unused' entries in the firsttable with hi/lo search + hints for the non-direct-hits */ + { + ogg_uint32_t mask=0xfffffffeUL<<(31-c->dec_firsttablen); + long lo=0,hi=0; + + for(i=0;idec_firsttablen); + if(c->dec_firsttable[bitreverse(word)]==0){ + while((lo+1)codelist[lo+1]<=word)lo++; + while( hi=(c->codelist[hi]&mask))hi++; + + /* we only actually have 15 bits per hint to play with here. + In order to overflow gracefully (nothing breaks, efficiency + just drops), encode as the difference from the extremes. */ + { + unsigned long loval=lo; + unsigned long hival=n-hi; + + if(loval>0x7fff)loval=0x7fff; + if(hival>0x7fff)hival=0x7fff; + c->dec_firsttable[bitreverse(word)]= + 0x80000000UL | (loval<<15) | hival; + } } } } } - return(0); err_out: only in patch2: unchanged: --- libvorbis-1.1.0.orig/lib/books/coupled/res_books_stereo.h +++ libvorbis-1.1.0/lib/books/coupled/res_books_stereo.h @@ -462,83 +462,6 @@ 0 }; -static long _vq_quantlist__16c0_s_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static long _vq_lengthlist__16c0_s_p2_0[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, -}; - -static float _vq_quantthresh__16c0_s_p2_0[] = { - -1.5, -0.5, 0.5, 1.5, -}; - -static long _vq_quantmap__16c0_s_p2_0[] = { - 3, 1, 0, 2, 4, -}; - -static encode_aux_threshmatch _vq_auxt__16c0_s_p2_0 = { - _vq_quantthresh__16c0_s_p2_0, - _vq_quantmap__16c0_s_p2_0, - 5, - 5 -}; - -static static_codebook _16c0_s_p2_0 = { - 4, 625, - _vq_lengthlist__16c0_s_p2_0, - 1, -533725184, 1611661312, 3, 0, - _vq_quantlist__16c0_s_p2_0, - NULL, - &_vq_auxt__16c0_s_p2_0, - NULL, - 0 -}; - static long _vq_quantlist__16c0_s_p3_0[] = { 2, 1, @@ -1652,83 +1575,6 @@ 0 }; -static long _vq_quantlist__16c1_s_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static long _vq_lengthlist__16c1_s_p2_0[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0,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0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, -}; - -static float _vq_quantthresh__16c1_s_p2_0[] = { - -1.5, -0.5, 0.5, 1.5, -}; - -static long _vq_quantmap__16c1_s_p2_0[] = { - 3, 1, 0, 2, 4, -}; - -static encode_aux_threshmatch _vq_auxt__16c1_s_p2_0 = { - _vq_quantthresh__16c1_s_p2_0, - _vq_quantmap__16c1_s_p2_0, - 5, - 5 -}; - -static static_codebook _16c1_s_p2_0 = { - 4, 625, - _vq_lengthlist__16c1_s_p2_0, - 1, -533725184, 1611661312, 3, 0, - _vq_quantlist__16c1_s_p2_0, - NULL, - &_vq_auxt__16c1_s_p2_0, - NULL, - 0 -}; - static long _vq_quantlist__16c1_s_p3_0[] = { 2, 1, @@ -3764,83 +3610,6 @@ 0 }; -static long _vq_quantlist__8c0_s_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static long _vq_lengthlist__8c0_s_p2_0[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 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 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, -}; - -static float _vq_quantthresh__8c0_s_p2_0[] = { - -1.5, -0.5, 0.5, 1.5, -}; - -static long _vq_quantmap__8c0_s_p2_0[] = { - 3, 1, 0, 2, 4, -}; - -static encode_aux_threshmatch _vq_auxt__8c0_s_p2_0 = { - _vq_quantthresh__8c0_s_p2_0, - _vq_quantmap__8c0_s_p2_0, - 5, - 5 -}; - -static static_codebook _8c0_s_p2_0 = { - 4, 625, - _vq_lengthlist__8c0_s_p2_0, - 1, -533725184, 1611661312, 3, 0, - _vq_quantlist__8c0_s_p2_0, - NULL, - &_vq_auxt__8c0_s_p2_0, - NULL, - 0 -}; - static long _vq_quantlist__8c0_s_p3_0[] = { 2, 1, @@ -4933,83 +4702,6 @@ 0 }; -static long _vq_quantlist__8c1_s_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static long _vq_lengthlist__8c1_s_p2_0[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, -}; - -static float _vq_quantthresh__8c1_s_p2_0[] = { - -1.5, -0.5, 0.5, 1.5, -}; - -static long _vq_quantmap__8c1_s_p2_0[] = { - 3, 1, 0, 2, 4, -}; - -static encode_aux_threshmatch _vq_auxt__8c1_s_p2_0 = { - _vq_quantthresh__8c1_s_p2_0, - _vq_quantmap__8c1_s_p2_0, - 5, - 5 -}; - -static static_codebook _8c1_s_p2_0 = { - 4, 625, - _vq_lengthlist__8c1_s_p2_0, - 1, -533725184, 1611661312, 3, 0, - _vq_quantlist__8c1_s_p2_0, - NULL, - &_vq_auxt__8c1_s_p2_0, - NULL, - 0 -}; - static long _vq_quantlist__8c1_s_p3_0[] = { 2, 1, only in patch2: unchanged: --- libvorbis-1.1.0.orig/lib/modes/residue_8.h +++ libvorbis-1.1.0/lib/modes/residue_8.h @@ -22,17 +22,29 @@ static static_bookblock _resbook_8s_0={ { - {0},{0,0,&_8c0_s_p1_0},{0,0,&_8c0_s_p2_0},{0,0,&_8c0_s_p3_0}, - {0,0,&_8c0_s_p4_0},{0,0,&_8c0_s_p5_0},{0,0,&_8c0_s_p6_0}, - {&_8c0_s_p7_0,&_8c0_s_p7_1},{&_8c0_s_p8_0,&_8c0_s_p8_1}, + {0}, + {0,0,&_8c0_s_p1_0}, + {0}, + {0,0,&_8c0_s_p3_0}, + {0,0,&_8c0_s_p4_0}, + {0,0,&_8c0_s_p5_0}, + {0,0,&_8c0_s_p6_0}, + {&_8c0_s_p7_0,&_8c0_s_p7_1}, + {&_8c0_s_p8_0,&_8c0_s_p8_1}, {&_8c0_s_p9_0,&_8c0_s_p9_1,&_8c0_s_p9_2} } }; static static_bookblock _resbook_8s_1={ { - {0},{0,0,&_8c1_s_p1_0},{0,0,&_8c1_s_p2_0},{0,0,&_8c1_s_p3_0}, - {0,0,&_8c1_s_p4_0},{0,0,&_8c1_s_p5_0},{0,0,&_8c1_s_p6_0}, - {&_8c1_s_p7_0,&_8c1_s_p7_1},{&_8c1_s_p8_0,&_8c1_s_p8_1}, + {0}, + {0,0,&_8c1_s_p1_0}, + {0}, + {0,0,&_8c1_s_p3_0}, + {0,0,&_8c1_s_p4_0}, + {0,0,&_8c1_s_p5_0}, + {0,0,&_8c1_s_p6_0}, + {&_8c1_s_p7_0,&_8c1_s_p7_1}, + {&_8c1_s_p8_0,&_8c1_s_p8_1}, {&_8c1_s_p9_0,&_8c1_s_p9_1,&_8c1_s_p9_2} } }; only in patch2: unchanged: --- libvorbis-1.1.0.orig/lib/modes/psych_16.h +++ libvorbis-1.1.0/lib/modes/psych_16.h @@ -112,6 +112,13 @@ {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}}, }; +static noiseguard _psy_noiseguards_16[4]={ + {10,10,-1}, + {10,10,-1}, + {20,20,-1}, + {20,20,-1}, +}; + static double _noise_thresh_16[4]={ .3,.5,.5,.5 }; static int _noise_start_16[3]={ 256,256,9999 }; only in patch2: unchanged: --- libvorbis-1.1.0.orig/lib/modes/setup_16.h +++ libvorbis-1.1.0/lib/modes/setup_16.h @@ -65,7 +65,7 @@ _vp_tonemask_adj_16, _vp_tonemask_adj_16, - _psy_noiseguards_8, + _psy_noiseguards_16, _psy_noisebias_16_impulse, _psy_noisebias_16_short, _psy_noisebias_16_short, only in patch2: unchanged: --- libvorbis-1.1.0.orig/lib/modes/setup_22.h +++ libvorbis-1.1.0/lib/modes/setup_22.h @@ -44,7 +44,7 @@ _vp_tonemask_adj_16, _vp_tonemask_adj_16, - _psy_noiseguards_8, + _psy_noiseguards_16, _psy_noisebias_16_impulse, _psy_noisebias_16_short, _psy_noisebias_16_short, only in patch2: unchanged: --- libvorbis-1.1.0.orig/lib/modes/residue_16.h +++ libvorbis-1.1.0/lib/modes/residue_16.h @@ -21,7 +21,7 @@ { {0}, {0,0,&_16c0_s_p1_0}, - {0,0,&_16c0_s_p2_0}, + {0}, {0,0,&_16c0_s_p3_0}, {0,0,&_16c0_s_p4_0}, {0,0,&_16c0_s_p5_0}, @@ -35,7 +35,7 @@ { {0}, {0,0,&_16c1_s_p1_0}, - {0,0,&_16c1_s_p2_0}, + {0}, {0,0,&_16c1_s_p3_0}, {0,0,&_16c1_s_p4_0}, {0,0,&_16c1_s_p5_0}, only in patch2: unchanged: --- libvorbis-1.1.0.orig/lib/psy.c +++ libvorbis-1.1.0/lib/psy.c @@ -553,7 +553,10 @@ int i; int lo, hi; - float R, A, B, D; + float R=0.f; + float A=0.f; + float B=0.f; + float D=1.f; float w, x, y; tN = tX = tXX = tY = tXY = 0.f; only in patch2: unchanged: --- libvorbis-1.1.0.orig/lib/codebook.c +++ libvorbis-1.1.0/lib/codebook.c @@ -255,6 +255,7 @@ /* returns the number of bits ************************************************/ int vorbis_book_encode(codebook *book, int a, oggpack_buffer *b){ + if(a<0 || a>=book->c->entries)return(0); oggpack_write(b,book->codelist[a],book->c->lengthlist[a]); return(book->c->lengthlist[a]); } @@ -310,7 +311,7 @@ int read=book->dec_maxlength; long lo,hi; long lok = oggpack_look(b,book->dec_firsttablen); - + if (lok >= 0) { long entry = book->dec_firsttable[lok]; if(entry&0x80000000UL){ @@ -324,24 +325,24 @@ lo=0; hi=book->used_entries; } - + lok = oggpack_look(b, read); - + while(lok<0 && read>1) lok = oggpack_look(b, --read); if(lok<0)return -1; - + /* bisect search for the codeword in the ordered list */ { ogg_uint32_t testword=bitreverse((ogg_uint32_t)lok); - + while(hi-lo>1){ long p=(hi-lo)>>1; long test=book->codelist[lo+p]>testword; lo+=p&(test-1); hi-=p&(-test); - } - + } + if(book->dec_codelengths[lo]<=read){ oggpack_adv(b, book->dec_codelengths[lo]); return(lo); @@ -349,6 +350,7 @@ } oggpack_adv(b, read); + return(-1); } @@ -368,104 +370,121 @@ /* returns the [original, not compacted] entry number or -1 on eof *********/ long vorbis_book_decode(codebook *book, oggpack_buffer *b){ - long packed_entry=decode_packed_entry_number(book,b); - if(packed_entry>=0) - return(book->dec_index[packed_entry]); - + if(book->used_entries>0){ + long packed_entry=decode_packed_entry_number(book,b); + if(packed_entry>=0) + return(book->dec_index[packed_entry]); + } + /* if there's no dec_index, the codebook unpacking isn't collapsed */ - return(packed_entry); + return(-1); } /* returns 0 on OK or -1 on eof *************************************/ long vorbis_book_decodevs_add(codebook *book,float *a,oggpack_buffer *b,int n){ - int step=n/book->dim; - long *entry = alloca(sizeof(*entry)*step); - float **t = alloca(sizeof(*t)*step); - int i,j,o; - - for (i = 0; i < step; i++) { - entry[i]=decode_packed_entry_number(book,b); - if(entry[i]==-1)return(-1); - t[i] = book->valuelist+entry[i]*book->dim; + if(book->used_entries>0){ + int step=n/book->dim; + long *entry = alloca(sizeof(*entry)*step); + float **t = alloca(sizeof(*t)*step); + int i,j,o; + + for (i = 0; i < step; i++) { + entry[i]=decode_packed_entry_number(book,b); + if(entry[i]==-1)return(-1); + t[i] = book->valuelist+entry[i]*book->dim; + } + for(i=0,o=0;idim;i++,o+=step) + for (j=0;jdim;i++,o+=step) - for (j=0;jused_entries>0){ + int i,j,entry; + float *t; + + if(book->dim>8){ + for(i=0;ivaluelist+entry*book->dim; + for (j=0;jdim;) + a[i++]+=t[j++]; + } + }else{ + for(i=0;ivaluelist+entry*book->dim; + j=0; + switch((int)book->dim){ + case 8: + a[i++]+=t[j++]; + case 7: + a[i++]+=t[j++]; + case 6: + a[i++]+=t[j++]; + case 5: + a[i++]+=t[j++]; + case 4: + a[i++]+=t[j++]; + case 3: + a[i++]+=t[j++]; + case 2: + a[i++]+=t[j++]; + case 1: + a[i++]+=t[j++]; + case 0: + break; + } + } + } + } + return(0); +} - if(book->dim>8){ +long vorbis_book_decodev_set(codebook *book,float *a,oggpack_buffer *b,int n){ + if(book->used_entries>0){ + int i,j,entry; + float *t; + for(i=0;ivaluelist+entry*book->dim; for (j=0;jdim;) - a[i++]+=t[j++]; + a[i++]=t[j++]; } }else{ + int i,j; + for(i=0;ivaluelist+entry*book->dim; - j=0; - switch((int)book->dim){ - case 8: - a[i++]+=t[j++]; - case 7: - a[i++]+=t[j++]; - case 6: - a[i++]+=t[j++]; - case 5: - a[i++]+=t[j++]; - case 4: - a[i++]+=t[j++]; - case 3: - a[i++]+=t[j++]; - case 2: - a[i++]+=t[j++]; - case 1: - a[i++]+=t[j++]; - case 0: - break; - } + for (j=0;jdim;) + a[i++]=0.f; } - } - return(0); -} - -long vorbis_book_decodev_set(codebook *book,float *a,oggpack_buffer *b,int n){ - int i,j,entry; - float *t; - - for(i=0;ivaluelist+entry*book->dim; - for (j=0;jdim;) - a[i++]=t[j++]; } return(0); } long vorbis_book_decodevv_add(codebook *book,float **a,long offset,int ch, oggpack_buffer *b,int n){ + long i,j,entry; int chptr=0; - - for(i=offset/ch;i<(offset+n)/ch;){ - entry = decode_packed_entry_number(book,b); - if(entry==-1)return(-1); - { - const float *t = book->valuelist+entry*book->dim; - for (j=0;jdim;j++){ - a[chptr++][i]+=t[j]; - if(chptr==ch){ - chptr=0; - i++; + if(book->used_entries>0){ + for(i=offset/ch;i<(offset+n)/ch;){ + entry = decode_packed_entry_number(book,b); + if(entry==-1)return(-1); + { + const float *t = book->valuelist+entry*book->dim; + for (j=0;jdim;j++){ + a[chptr++][i]+=t[j]; + if(chptr==ch){ + chptr=0; + i++; + } } } } only in patch2: unchanged: --- libvorbis-1.1.0.orig/lib/vorbisfile.c +++ libvorbis-1.1.0/lib/vorbisfile.c @@ -73,15 +73,17 @@ } /* save a tiny smidge of verbosity to make the code more readable */ -static void _seek_helper(OggVorbis_File *vf,ogg_int64_t offset){ +static int _seek_helper(OggVorbis_File *vf,ogg_int64_t offset){ if(vf->datasource){ - (vf->callbacks.seek_func)(vf->datasource, offset, SEEK_SET); + if((vf->callbacks.seek_func)(vf->datasource, offset, SEEK_SET) == -1) + return OV_EREAD; vf->offset=offset; ogg_sync_reset(&vf->oy); }else{ /* shouldn't happen unless someone writes a broken callback */ - return; + return OV_EFAULT; } + return 0; } /* The read/seek functions track absolute position within the stream */ @@ -145,7 +147,10 @@ begin-=CHUNKSIZE; if(begin<0) begin=0; - _seek_helper(vf,begin); + + ret=_seek_helper(vf,begin); + if(ret)return(ret); + while(vf->offsetoffset); if(ret==OV_EREAD)return(OV_EREAD); @@ -158,7 +163,9 @@ } /* we have the offset. Actually snork and hold the page now */ - _seek_helper(vf,offset); + ret=_seek_helper(vf,offset); + if(ret)return(ret); + ret=_get_next_page(vf,og,CHUNKSIZE); if(ret<0) /* this shouldn't be possible */ @@ -193,7 +200,9 @@ bisect=(searched+endsearched)/2; } - _seek_helper(vf,bisect); + ret=_seek_helper(vf,bisect); + if(ret)return(ret); + ret=_get_next_page(vf,&og,-1); if(ret==OV_EREAD)return(OV_EREAD); if(ret<0 || ogg_page_serialno(&og)!=currentno){ @@ -204,7 +213,9 @@ } } - _seek_helper(vf,next); + ret=_seek_helper(vf,next); + if(ret)return(ret); + ret=_get_next_page(vf,&og,-1); if(ret==OV_EREAD)return(OV_EREAD); @@ -303,17 +314,23 @@ if(i==0){ /* we already grabbed the initial header earlier. Just set the offset */ vf->dataoffsets[i]=dataoffset; - _seek_helper(vf,dataoffset); + ret=_seek_helper(vf,dataoffset); + if(ret) + vf->dataoffsets[i]=-1; }else{ /* seek to the location of the initial header */ - _seek_helper(vf,vf->offsets[i]); - if(_fetch_headers(vf,vf->vi+i,vf->vc+i,NULL,NULL)<0){ - vf->dataoffsets[i]=-1; + ret=_seek_helper(vf,vf->offsets[i]); + if(ret){ + vf->dataoffsets[i]=-1; }else{ - vf->dataoffsets[i]=vf->offset; + if(_fetch_headers(vf,vf->vi+i,vf->vc+i,NULL,NULL)<0){ + vf->dataoffsets[i]=-1; + }else{ + vf->dataoffsets[i]=vf->offset; + } } } @@ -367,21 +384,27 @@ get the last page of the stream */ { ogg_int64_t end=vf->offsets[i+1]; - _seek_helper(vf,end); - - while(1){ - ret=_get_prev_page(vf,&og); - if(ret<0){ - /* this should not be possible */ - vorbis_info_clear(vf->vi+i); - vorbis_comment_clear(vf->vc+i); - break; - } - if(ogg_page_granulepos(&og)!=-1){ - vf->pcmlengths[i*2+1]=ogg_page_granulepos(&og)-vf->pcmlengths[i*2]; - break; + ret=_seek_helper(vf,end); + if(ret){ + /* this should not be possible */ + vorbis_info_clear(vf->vi+i); + vorbis_comment_clear(vf->vc+i); + }else{ + + while(1){ + ret=_get_prev_page(vf,&og); + if(ret<0){ + /* this should not be possible */ + vorbis_info_clear(vf->vi+i); + vorbis_comment_clear(vf->vc+i); + break; + } + if(ogg_page_granulepos(&og)!=-1){ + vf->pcmlengths[i*2+1]=ogg_page_granulepos(&og)-vf->pcmlengths[i*2]; + break; + } + vf->offset=ret; } - vf->offset=ret; } } } @@ -948,6 +971,7 @@ int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos){ ogg_stream_state work_os; + int ret; if(vf->ready_stateseekable) @@ -964,7 +988,8 @@ vf->current_serialno); /* must set serialno */ vorbis_synthesis_restart(&vf->vd); - _seek_helper(vf,pos); + ret=_seek_helper(vf,pos); + if(ret)return(ret); /* we need to make sure the pcm_offset is set, but we don't want to advance the raw cursor past good packets just to get to the first @@ -986,8 +1011,8 @@ ogg_packet op; int lastblock=0; int accblock=0; - int thisblock; - int eosflag; + int thisblock=0; + int eosflag=0; ogg_stream_init(&work_os,vf->current_serialno); /* get the memory ready */ ogg_stream_reset(&work_os); /* eliminate the spurious OV_HOLE @@ -1009,7 +1034,7 @@ }else{ if(eosflag) - ogg_stream_packetout(&vf->os,NULL); + ogg_stream_packetout(&vf->os,NULL); else if(lastblock)accblock+=(lastblock+thisblock)>>2; } @@ -1095,7 +1120,7 @@ int link=-1; ogg_int64_t result=0; ogg_int64_t total=ov_pcm_total(vf,-1); - + if(vf->ready_stateseekable)return(OV_ENOSEEK); @@ -1136,8 +1161,9 @@ bisect=begin+1; } - _seek_helper(vf,bisect); - + result=_seek_helper(vf,bisect); + if(result) goto seek_error; + while(beginoffset); if(result==OV_EREAD) goto seek_error; @@ -1148,11 +1174,18 @@ if(bisect==0) goto seek_error; bisect-=CHUNKSIZE; if(bisect<=begin)bisect=begin+1; - _seek_helper(vf,bisect); + result=_seek_helper(vf,bisect); + if(result) goto seek_error; } }else{ - ogg_int64_t granulepos=ogg_page_granulepos(&og); + ogg_int64_t granulepos; + + if(ogg_page_serialno(&og)!=vf->serialnos[link]) + continue; + + granulepos=ogg_page_granulepos(&og); if(granulepos==-1)continue; + if(granuleposoffset; /* raw offset of next page */ @@ -1168,9 +1201,10 @@ end=result; bisect-=CHUNKSIZE; /* an endless loop otherwise. */ if(bisect<=begin)bisect=begin+1; - _seek_helper(vf,bisect); + result=_seek_helper(vf,bisect); + if(result) goto seek_error; }else{ - end=result; + end=bisect; endtime=granulepos; break; } @@ -1187,17 +1221,18 @@ ogg_packet op; /* seek */ - _seek_helper(vf,best); + result=_seek_helper(vf,best); vf->pcm_offset=-1; - - if(_get_next_page(vf,&og,-1)<0)return(OV_EOF); /* shouldn't happen */ + if(result) goto seek_error; + result=_get_next_page(vf,&og,-1); + if(result<0) goto seek_error; if(link!=vf->current_link){ /* Different link; dump entire decode machine */ _decode_clear(vf); vf->current_link=link; - vf->current_serialno=ogg_page_serialno(&og); + vf->current_serialno=vf->serialnos[link]; vf->ready_state=STREAMSET; }else{ @@ -1216,13 +1251,15 @@ get one with a granulepos or without the 'continued' flag set. Then just use raw_seek for simplicity. */ - _seek_helper(vf,best); + result=_seek_helper(vf,best); + if(result<0) goto seek_error; while(1){ result=_get_prev_page(vf,&og); if(result<0) goto seek_error; - if(ogg_page_granulepos(&og)>-1 || - !ogg_page_continued(&og)){ + if(ogg_page_serialno(&og)==vf->current_serialno && + (ogg_page_granulepos(&og)>-1 || + !ogg_page_continued(&og))){ return ov_raw_seek(vf,result); } vf->offset=result; @@ -1313,19 +1350,20 @@ /* suck in a new page */ if(_get_next_page(vf,&og,-1)<0)break; - if(vf->current_serialno!=ogg_page_serialno(&og))_decode_clear(vf); + if(ogg_page_bos(&og))_decode_clear(vf); if(vf->ready_statecurrent_serialno=ogg_page_serialno(&og); for(link=0;linklinks;link++) - if(vf->serialnos[link]==vf->current_serialno)break; - if(link==vf->links)return(OV_EBADLINK); + if(vf->serialnos[link]==serialno)break; + if(link==vf->links) continue; vf->current_link=link; - ogg_stream_reset_serialno(&vf->os,vf->current_serialno); vf->ready_state=STREAMSET; + vf->current_serialno=ogg_page_serialno(&og); + ogg_stream_reset_serialno(&vf->os,serialno); ret=_make_decode_ready(vf); if(ret)return ret; lastblock=0; only in patch2: unchanged: --- libvorbis-1.1.0.orig/lib/info.c +++ libvorbis-1.1.0/lib/info.c @@ -135,11 +135,11 @@ if(vc->user_comments)_ogg_free(vc->user_comments); if(vc->comment_lengths)_ogg_free(vc->comment_lengths); if(vc->vendor)_ogg_free(vc->vendor); + memset(vc,0,sizeof(*vc)); } - memset(vc,0,sizeof(*vc)); } -/* blocksize 0 is guaranteed to be short, 1 is guarantted to be long. +/* blocksize 0 is guaranteed to be short, 1 is guaranteed to be long. They may be equal, but short will never ge greater than long */ int vorbis_info_blocksize(vorbis_info *vi,int zo){ codec_setup_info *ci = vi->codec_setup; @@ -162,14 +162,23 @@ if(ci->mode_param[i])_ogg_free(ci->mode_param[i]); for(i=0;imaps;i++) /* unpack does the range checking */ - _mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]); + if(ci->map_param[i]) /* this may be cleaning up an aborted + unpack, in which case the below type + cannot be trusted */ + _mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]); for(i=0;ifloors;i++) /* unpack does the range checking */ - _floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]); + if(ci->floor_param[i]) /* this may be cleaning up an aborted + unpack, in which case the below type + cannot be trusted */ + _floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]); for(i=0;iresidues;i++) /* unpack does the range checking */ - _residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]); - + if(ci->residue_param[i]) /* this may be cleaning up an aborted + unpack, in which case the below type + cannot be trusted */ + _residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]); + for(i=0;ibooks;i++){ if(ci->book_param[i]){ /* knows if the book was not alloced */ @@ -211,9 +220,10 @@ if(vi->rate<1)goto err_out; if(vi->channels<1)goto err_out; - if(ci->blocksizes[0]<8)goto err_out; + if(ci->blocksizes[0]<64)goto err_out; if(ci->blocksizes[1]blocksizes[0])goto err_out; - + if(ci->blocksizes[1]>8192)goto err_out; + if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */ return(0); @@ -587,12 +597,14 @@ memset(op_comm,0,sizeof(*op_comm)); memset(op_code,0,sizeof(*op_code)); - if(b->header)_ogg_free(b->header); - if(b->header1)_ogg_free(b->header1); - if(b->header2)_ogg_free(b->header2); - b->header=NULL; - b->header1=NULL; - b->header2=NULL; + if(b){ + if(b->header)_ogg_free(b->header); + if(b->header1)_ogg_free(b->header1); + if(b->header2)_ogg_free(b->header2); + b->header=NULL; + b->header1=NULL; + b->header2=NULL; + } return(ret); } only in patch2: unchanged: --- libvorbis-1.1.0.orig/lib/res0.c +++ libvorbis-1.1.0/lib/res0.c @@ -336,7 +336,7 @@ } } - { + if(best>-1){ float *ptr=book->valuelist+best*dim; for(i=0;i0) + acc[entry]++; #endif - + bits+=vorbis_book_encode(book,entry,opb); + } return(bits); @@ -380,11 +382,11 @@ int partvals=n/samples_per_partition; long **partword=_vorbis_block_alloc(vb,ch*sizeof(*partword)); float scale=100./samples_per_partition; - + /* we find the partition type for each partition of each channel. We'll go back and do the interleaved encoding in a bit. For now, clarity */ - + for(i=0;itrain_seq); of=fopen(buffer,"a"); @@ -426,7 +428,7 @@ } #endif look->frames++; - + return(partword); } @@ -446,7 +448,7 @@ int partvals=n/samples_per_partition; long **partword=_vorbis_block_alloc(vb,sizeof(*partword)); - + #if defined(TRAIN_RES) || defined (TRAIN_RESAUX) FILE *of; char buffer[80]; @@ -454,7 +456,7 @@ partword[0]=_vorbis_block_alloc(vb,n*ch/samples_per_partition*sizeof(*partword[0])); memset(partword[0],0,n*ch/samples_per_partition*sizeof(*partword[0])); - + for(i=0,l=info->begin/ch;imagmax)magmax=fabs(in[0][l]); for(k=1;kangmax)angmax=fabs(in[k][l]); - l++; + l++; } - + for(j=0;jclassmetric1[j] && angmax<=info->classmetric2[j]) break; - + partword[0][i]=j; - + } #ifdef TRAIN_RESAUX @@ -482,9 +484,9 @@ fprintf(of,"\n"); fclose(of); #endif - + look->frames++; - + return(partword); } @@ -509,15 +511,15 @@ int partvals=n/samples_per_partition; long resbits[128]; long resvals[128]; - + #ifdef TRAIN_RES for(i=0;ibegin;jend;j++){ + for(j=info->begin;jlook->tmax)look->tmax=in[i][j]; if(in[i][j]tmin)look->tmin=in[i][j]; } #endif - + memset(resbits,0,sizeof(resbits)); memset(resvals,0,sizeof(resvals)); @@ -525,11 +527,11 @@ words for a partition per channel until we've written all the residual words for that partition word. Then write the next partition channel words... */ - + for(s=0;sstages;s++){ - + for(i=0;iphrasebook->entries) look->phrasebits+=vorbis_book_encode(look->phrasebook,val,opb); @@ -547,14 +549,14 @@ else fprintf(stderr,"!"); #endif - + } } /* now we encode interleaved residual values for the partitions */ for(k=0;kbegin; - + for(j=0;jsecondstages[partword[j][i]]&(1<training_data[s][partword[j][i]]; { @@ -579,7 +581,7 @@ ret=encode(opb,in[j]+offset,samples_per_partition, statebook,accumulator); - + look->postbits+=ret; resbits[partword[j][i]]+=ret; } @@ -588,19 +590,20 @@ } } } - + /*{ long total=0; long totalbits=0; fprintf(stderr,"%d :: ",vb->mode); for(k=0;kgrouping; int partitions_per_word=look->phrasebook->dim; - int n=info->end-info->begin; + int max=vb->pcmend>>1; + int end=(info->endend:max); + int n=end-info->begin; - int partvals=n/samples_per_partition; - int partwords=(partvals+partitions_per_word-1)/partitions_per_word; - int ***partword=alloca(ch*sizeof(*partword)); - - for(j=0;jstages;s++){ - - /* each loop decodes on partition codeword containing - partitions_pre_word partitions */ - for(i=0,l=0;iphrasebook,&vb->opb); - if(temp==-1)goto eopbreak; - partword[j][l]=look->decodemap[temp]; - if(partword[j][l]==NULL)goto errout; - } - } + if(n>0){ + int partvals=n/samples_per_partition; + int partwords=(partvals+partitions_per_word-1)/partitions_per_word; + int ***partword=alloca(ch*sizeof(*partword)); + + for(j=0;jstages;s++){ - /* now we decode residual values for the partitions */ - for(k=0;kbegin+i*samples_per_partition; - if(info->secondstages[partword[j][l][k]]&(1<partbooks[partword[j][l][k]][s]; - if(stagebook){ - if(decodepart(stagebook,in[j]+offset,&vb->opb, - samples_per_partition)==-1)goto eopbreak; - } + /* each loop decodes on partition codeword containing + partitions_per_word partitions */ + for(i=0,l=0;iphrasebook,&vb->opb); + + if(temp==-1)goto eopbreak; + partword[j][l]=look->decodemap[temp]; + if(partword[j][l]==NULL)goto errout; } } - } + + /* now we decode residual values for the partitions */ + for(k=0;kbegin+i*samples_per_partition; + if(info->secondstages[partword[j][l][k]]&(1<partbooks[partword[j][l][k]][s]; + if(stagebook){ + if(decodepart(stagebook,in[j]+offset,&vb->opb, + samples_per_partition)==-1)goto eopbreak; + } + } + } + } + } } - errout: eopbreak: return(0); @@ -833,41 +840,44 @@ /* move all this setup out later */ int samples_per_partition=info->grouping; int partitions_per_word=look->phrasebook->dim; - int n=info->end-info->begin; - - int partvals=n/samples_per_partition; - int partwords=(partvals+partitions_per_word-1)/partitions_per_word; - int **partword=_vorbis_block_alloc(vb,partwords*sizeof(*partword)); - - for(i=0;istages;s++){ - for(i=0,l=0;iphrasebook,&vb->opb); - if(temp==-1)goto eopbreak; - partword[l]=look->decodemap[temp]; - if(partword[l]==NULL)goto errout; - } - - /* now we decode residual values for the partitions */ - for(k=0;ksecondstages[partword[l][k]]&(1<partbooks[partword[l][k]][s]; - - if(stagebook){ - if(vorbis_book_decodevv_add(stagebook,in, - i*samples_per_partition+info->begin,ch, - &vb->opb,samples_per_partition)==-1) - goto eopbreak; - } + int max=(vb->pcmend*ch)>>1; + int end=(info->endend:max); + int n=end-info->begin; + + if(n>0){ + int partvals=n/samples_per_partition; + int partwords=(partvals+partitions_per_word-1)/partitions_per_word; + int **partword=_vorbis_block_alloc(vb,partwords*sizeof(*partword)); + + for(i=0;istages;s++){ + for(i=0,l=0;iphrasebook,&vb->opb); + if(temp==-1)goto eopbreak; + partword[l]=look->decodemap[temp]; + if(partword[l]==NULL)goto errout; } - } + + /* now we decode residual values for the partitions */ + for(k=0;ksecondstages[partword[l][k]]&(1<partbooks[partword[l][k]][s]; + + if(stagebook){ + if(vorbis_book_decodevv_add(stagebook,in, + i*samples_per_partition+info->begin,ch, + &vb->opb,samples_per_partition)==-1) + goto eopbreak; + } + } + } + } } - errout: eopbreak: return(0); only in patch2: unchanged: --- libvorbis-1.1.0.orig/lib/floor1.c +++ libvorbis-1.1.0/lib/floor1.c @@ -358,7 +358,7 @@ 0.82788260F, 0.88168307F, 0.9389798F, 1.F, }; -static void render_line(int x0,int x1,int y0,int y1,float *d){ +static void render_line(int n, int x0,int x1,int y0,int y1,float *d){ int dy=y1-y0; int adx=x1-x0; int ady=abs(dy); @@ -370,8 +370,12 @@ ady-=abs(base*adx); - d[x]*=FLOOR1_fromdB_LOOKUP[y]; - while(++xx1)n=x1; + + if(x=adx){ err-=adx; @@ -1068,7 +1072,7 @@ hy*=info->mult; hx=info->postlist[current]; - render_line(lx,hx,ly,hy,out); + render_line(n,lx,hx,ly,hy,out); lx=hx; ly=hy; only in patch2: unchanged: --- libvorbis-1.1.0.orig/lib/block.c +++ libvorbis-1.1.0/lib/block.c @@ -322,20 +322,23 @@ } if(b->flr){ - for(i=0;ifloors;i++) - _floor_P[ci->floor_type[i]]-> - free_look(b->flr[i]); + if(ci) + for(i=0;ifloors;i++) + _floor_P[ci->floor_type[i]]-> + free_look(b->flr[i]); _ogg_free(b->flr); } if(b->residue){ - for(i=0;iresidues;i++) - _residue_P[ci->residue_type[i]]-> - free_look(b->residue[i]); + if(ci) + for(i=0;iresidues;i++) + _residue_P[ci->residue_type[i]]-> + free_look(b->residue[i]); _ogg_free(b->residue); } if(b->psy){ - for(i=0;ipsys;i++) - _vp_psy_clear(b->psy+i); + if(ci) + for(i=0;ipsys;i++) + _vp_psy_clear(b->psy+i); _ogg_free(b->psy); } @@ -348,8 +351,9 @@ } if(v->pcm){ - for(i=0;ichannels;i++) - if(v->pcm[i])_ogg_free(v->pcm[i]); + if(vi) + for(i=0;ichannels;i++) + if(v->pcm[i])_ogg_free(v->pcm[i]); _ogg_free(v->pcm); if(v->pcmret)_ogg_free(v->pcmret); }