From b78c6e61bf8643cc178873b01a5913f256d56ebb Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Fri, 16 Mar 2018 12:30:08 -0500 Subject: [PATCH] Update libvorbis from 1.3.5 to 1.3.6 * Fix CVE-2018-5146 - out-of-bounds write on codebook decoding. * Fix CVE-2017-14632 - free() on unitialized data * Fix CVE-2017-14633 - out-of-bounds read --- code/libvorbis-1.3.5/include/vorbis/codec.h | 1 - .../include/vorbis/vorbisenc.h | 1 - .../include/vorbis/vorbisfile.h | 1 - code/libvorbis-1.3.5/lib/analysis.c | 1 - code/libvorbis-1.3.5/lib/backends.h | 1 - code/libvorbis-1.3.5/lib/bitrate.c | 1 - code/libvorbis-1.3.5/lib/bitrate.h | 1 - code/libvorbis-1.3.5/lib/block.c | 1 - .../lib/books/coupled/res_books_51.h | 1 - .../lib/books/coupled/res_books_stereo.h | 1 - .../lib/books/floor/floor_books.h | 1 - .../lib/books/uncoupled/res_books_uncoupled.h | 1 - code/libvorbis-1.3.5/lib/codebook.c | 49 ++++--------------- code/libvorbis-1.3.5/lib/codebook.h | 1 - code/libvorbis-1.3.5/lib/codec_internal.h | 1 - code/libvorbis-1.3.5/lib/envelope.c | 1 - code/libvorbis-1.3.5/lib/envelope.h | 1 - code/libvorbis-1.3.5/lib/floor0.c | 1 - code/libvorbis-1.3.5/lib/floor1.c | 1 - code/libvorbis-1.3.5/lib/highlevel.h | 1 - code/libvorbis-1.3.5/lib/info.c | 34 +++++++------ code/libvorbis-1.3.5/lib/lookup.c | 1 - code/libvorbis-1.3.5/lib/lookup.h | 1 - code/libvorbis-1.3.5/lib/lookup_data.h | 1 - code/libvorbis-1.3.5/lib/lpc.c | 1 - code/libvorbis-1.3.5/lib/lpc.h | 1 - code/libvorbis-1.3.5/lib/lsp.c | 1 - code/libvorbis-1.3.5/lib/lsp.h | 1 - code/libvorbis-1.3.5/lib/mapping0.c | 2 - code/libvorbis-1.3.5/lib/masking.h | 1 - code/libvorbis-1.3.5/lib/mdct.c | 1 - code/libvorbis-1.3.5/lib/mdct.h | 1 - code/libvorbis-1.3.5/lib/misc.h | 1 - code/libvorbis-1.3.5/lib/modes/floor_all.h | 1 - code/libvorbis-1.3.5/lib/modes/psych_11.h | 1 - code/libvorbis-1.3.5/lib/modes/psych_16.h | 1 - code/libvorbis-1.3.5/lib/modes/psych_44.h | 1 - code/libvorbis-1.3.5/lib/modes/psych_8.h | 1 - code/libvorbis-1.3.5/lib/modes/residue_16.h | 1 - code/libvorbis-1.3.5/lib/modes/residue_44.h | 1 - .../libvorbis-1.3.5/lib/modes/residue_44p51.h | 1 - code/libvorbis-1.3.5/lib/modes/residue_44u.h | 1 - code/libvorbis-1.3.5/lib/modes/residue_8.h | 1 - code/libvorbis-1.3.5/lib/modes/setup_11.h | 1 - code/libvorbis-1.3.5/lib/modes/setup_16.h | 1 - code/libvorbis-1.3.5/lib/modes/setup_22.h | 1 - code/libvorbis-1.3.5/lib/modes/setup_32.h | 1 - code/libvorbis-1.3.5/lib/modes/setup_44.h | 1 - code/libvorbis-1.3.5/lib/modes/setup_44p51.h | 1 - code/libvorbis-1.3.5/lib/modes/setup_44u.h | 1 - code/libvorbis-1.3.5/lib/modes/setup_8.h | 1 - code/libvorbis-1.3.5/lib/modes/setup_X.h | 1 - code/libvorbis-1.3.5/lib/os.h | 3 +- code/libvorbis-1.3.5/lib/psy.c | 1 - code/libvorbis-1.3.5/lib/psy.h | 1 - code/libvorbis-1.3.5/lib/registry.c | 1 - code/libvorbis-1.3.5/lib/registry.h | 1 - code/libvorbis-1.3.5/lib/res0.c | 1 - code/libvorbis-1.3.5/lib/scales.h | 1 - code/libvorbis-1.3.5/lib/sharedbook.c | 19 +++++-- code/libvorbis-1.3.5/lib/smallft.c | 1 - code/libvorbis-1.3.5/lib/smallft.h | 1 - code/libvorbis-1.3.5/lib/synthesis.c | 3 +- code/libvorbis-1.3.5/lib/vorbisenc.c | 1 - code/libvorbis-1.3.5/lib/vorbisfile.c | 1 - code/libvorbis-1.3.5/lib/window.c | 1 - code/libvorbis-1.3.5/lib/window.h | 1 - 67 files changed, 46 insertions(+), 125 deletions(-) diff --git a/code/libvorbis-1.3.5/include/vorbis/codec.h b/code/libvorbis-1.3.5/include/vorbis/codec.h index 999aa335..42aa2913 100644 --- a/code/libvorbis-1.3.5/include/vorbis/codec.h +++ b/code/libvorbis-1.3.5/include/vorbis/codec.h @@ -11,7 +11,6 @@ ******************************************************************** function: libvorbis codec headers - last mod: $Id: codec.h 17021 2010-03-24 09:29:41Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/include/vorbis/vorbisenc.h b/code/libvorbis-1.3.5/include/vorbis/vorbisenc.h index 02332b50..55f3b4a6 100644 --- a/code/libvorbis-1.3.5/include/vorbis/vorbisenc.h +++ b/code/libvorbis-1.3.5/include/vorbis/vorbisenc.h @@ -11,7 +11,6 @@ ******************************************************************** function: vorbis encode-engine setup - last mod: $Id: vorbisenc.h 17021 2010-03-24 09:29:41Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/include/vorbis/vorbisfile.h b/code/libvorbis-1.3.5/include/vorbis/vorbisfile.h index 9271331e..56626119 100644 --- a/code/libvorbis-1.3.5/include/vorbis/vorbisfile.h +++ b/code/libvorbis-1.3.5/include/vorbis/vorbisfile.h @@ -11,7 +11,6 @@ ******************************************************************** function: stdio-based convenience library for opening/seeking/decoding - last mod: $Id: vorbisfile.h 17182 2010-04-29 03:48:32Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/analysis.c b/code/libvorbis-1.3.5/lib/analysis.c index 01aa6f30..0e11a167 100644 --- a/code/libvorbis-1.3.5/lib/analysis.c +++ b/code/libvorbis-1.3.5/lib/analysis.c @@ -11,7 +11,6 @@ ******************************************************************** function: single-block PCM analysis mode dispatch - last mod: $Id: analysis.c 16226 2009-07-08 06:43:49Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/backends.h b/code/libvorbis-1.3.5/lib/backends.h index ff5bcc95..22809d46 100644 --- a/code/libvorbis-1.3.5/lib/backends.h +++ b/code/libvorbis-1.3.5/lib/backends.h @@ -12,7 +12,6 @@ function: libvorbis backend and mapping structures; needed for static mode headers - last mod: $Id: backends.h 16962 2010-03-11 07:30:34Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/bitrate.c b/code/libvorbis-1.3.5/lib/bitrate.c index 3a71b1dc..96055140 100644 --- a/code/libvorbis-1.3.5/lib/bitrate.c +++ b/code/libvorbis-1.3.5/lib/bitrate.c @@ -11,7 +11,6 @@ ******************************************************************** function: bitrate tracking and management - last mod: $Id: bitrate.c 16227 2009-07-08 06:58:46Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/bitrate.h b/code/libvorbis-1.3.5/lib/bitrate.h index db48fcb6..655a68cc 100644 --- a/code/libvorbis-1.3.5/lib/bitrate.h +++ b/code/libvorbis-1.3.5/lib/bitrate.h @@ -11,7 +11,6 @@ ******************************************************************** function: bitrate tracking and management - last mod: $Id: bitrate.h 13293 2007-07-24 00:09:47Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/block.c b/code/libvorbis-1.3.5/lib/block.c index 345c0427..db245b3e 100644 --- a/code/libvorbis-1.3.5/lib/block.c +++ b/code/libvorbis-1.3.5/lib/block.c @@ -11,7 +11,6 @@ ******************************************************************** function: PCM data vector blocking, windowing and dis/reassembly - last mod: $Id: block.c 19457 2015-03-03 00:15:29Z giles $ Handle windowing, overlap-add, etc of the PCM vectors. This is made more amusing by Vorbis' current two allowed block sizes. diff --git a/code/libvorbis-1.3.5/lib/books/coupled/res_books_51.h b/code/libvorbis-1.3.5/lib/books/coupled/res_books_51.h index 93910ff4..47df4b22 100644 --- a/code/libvorbis-1.3.5/lib/books/coupled/res_books_51.h +++ b/code/libvorbis-1.3.5/lib/books/coupled/res_books_51.h @@ -11,7 +11,6 @@ ******************************************************************** * * function: static codebooks for 5.1 surround - * last modified: $Id: res_books_51.h 19057 2014-01-22 12:32:31Z xiphmont $ * ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/books/coupled/res_books_stereo.h b/code/libvorbis-1.3.5/lib/books/coupled/res_books_stereo.h index 9a9049f6..61d93404 100644 --- a/code/libvorbis-1.3.5/lib/books/coupled/res_books_stereo.h +++ b/code/libvorbis-1.3.5/lib/books/coupled/res_books_stereo.h @@ -11,7 +11,6 @@ ******************************************************************** function: static codebooks autogenerated by huff/huffbuld - last modified: $Id: res_books_stereo.h 19057 2014-01-22 12:32:31Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/books/floor/floor_books.h b/code/libvorbis-1.3.5/lib/books/floor/floor_books.h index e925313f..67d5f31a 100644 --- a/code/libvorbis-1.3.5/lib/books/floor/floor_books.h +++ b/code/libvorbis-1.3.5/lib/books/floor/floor_books.h @@ -11,7 +11,6 @@ ******************************************************************** function: static codebooks autogenerated by huff/huffbuld - last modified: $Id: floor_books.h 19057 2014-01-22 12:32:31Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/books/uncoupled/res_books_uncoupled.h b/code/libvorbis-1.3.5/lib/books/uncoupled/res_books_uncoupled.h index 736353b6..3d658ec4 100644 --- a/code/libvorbis-1.3.5/lib/books/uncoupled/res_books_uncoupled.h +++ b/code/libvorbis-1.3.5/lib/books/uncoupled/res_books_uncoupled.h @@ -11,7 +11,6 @@ ******************************************************************** function: static codebooks autogenerated by huff/huffbuld - last modified: $Id: res_books_uncoupled.h 19057 2014-01-22 12:32:31Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/codebook.c b/code/libvorbis-1.3.5/lib/codebook.c index 72f8a17a..78672e22 100644 --- a/code/libvorbis-1.3.5/lib/codebook.c +++ b/code/libvorbis-1.3.5/lib/codebook.c @@ -11,7 +11,6 @@ ******************************************************************** function: basic codebook pack/unpack/code/decode operations - last mod: $Id: codebook.c 19457 2015-03-03 00:15:29Z giles $ ********************************************************************/ @@ -387,7 +386,7 @@ long vorbis_book_decodevs_add(codebook *book,float *a,oggpack_buffer *b,int n){ t[i] = book->valuelist+entry[i]*book->dim; } for(i=0,o=0;idim;i++,o+=step) - for (j=0;jdim>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; - } - } + for(i=0;ivaluelist+entry*book->dim; + for(j=0;idim;) + a[i++]+=t[j++]; } } return(0); @@ -471,12 +441,13 @@ long vorbis_book_decodevv_add(codebook *book,float **a,long offset,int ch, long i,j,entry; int chptr=0; if(book->used_entries>0){ - for(i=offset/ch;i<(offset+n)/ch;){ + int m=(offset+n)/ch; + for(i=offset/ch;ivaluelist+entry*book->dim; - for (j=0;jdim;j++){ + for (j=0;idim;j++){ a[chptr++][i]+=t[j]; if(chptr==ch){ chptr=0; diff --git a/code/libvorbis-1.3.5/lib/codebook.h b/code/libvorbis-1.3.5/lib/codebook.h index 537d6c12..08440c69 100644 --- a/code/libvorbis-1.3.5/lib/codebook.h +++ b/code/libvorbis-1.3.5/lib/codebook.h @@ -11,7 +11,6 @@ ******************************************************************** function: basic shared codebook operations - last mod: $Id: codebook.h 19457 2015-03-03 00:15:29Z giles $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/codec_internal.h b/code/libvorbis-1.3.5/lib/codec_internal.h index de1bccae..e522be18 100644 --- a/code/libvorbis-1.3.5/lib/codec_internal.h +++ b/code/libvorbis-1.3.5/lib/codec_internal.h @@ -11,7 +11,6 @@ ******************************************************************** function: libvorbis codec headers - last mod: $Id: codec_internal.h 16227 2009-07-08 06:58:46Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/envelope.c b/code/libvorbis-1.3.5/lib/envelope.c index 010c66e2..da752375 100644 --- a/code/libvorbis-1.3.5/lib/envelope.c +++ b/code/libvorbis-1.3.5/lib/envelope.c @@ -11,7 +11,6 @@ ******************************************************************** function: PCM data envelope analysis - last mod: $Id: envelope.c 16227 2009-07-08 06:58:46Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/envelope.h b/code/libvorbis-1.3.5/lib/envelope.h index fd15fb32..f466efde 100644 --- a/code/libvorbis-1.3.5/lib/envelope.h +++ b/code/libvorbis-1.3.5/lib/envelope.h @@ -11,7 +11,6 @@ ******************************************************************** function: PCM data envelope analysis and manipulation - last mod: $Id: envelope.h 16227 2009-07-08 06:58:46Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/floor0.c b/code/libvorbis-1.3.5/lib/floor0.c index 213cce4e..443c0e5a 100644 --- a/code/libvorbis-1.3.5/lib/floor0.c +++ b/code/libvorbis-1.3.5/lib/floor0.c @@ -11,7 +11,6 @@ ******************************************************************** function: floor backend 0 implementation - last mod: $Id: floor0.c 19457 2015-03-03 00:15:29Z giles $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/floor1.c b/code/libvorbis-1.3.5/lib/floor1.c index d8bd4645..673e954c 100644 --- a/code/libvorbis-1.3.5/lib/floor1.c +++ b/code/libvorbis-1.3.5/lib/floor1.c @@ -11,7 +11,6 @@ ******************************************************************** function: floor backend 1 implementation - last mod: $Id: floor1.c 19457 2015-03-03 00:15:29Z giles $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/highlevel.h b/code/libvorbis-1.3.5/lib/highlevel.h index e38f370f..337b75bf 100644 --- a/code/libvorbis-1.3.5/lib/highlevel.h +++ b/code/libvorbis-1.3.5/lib/highlevel.h @@ -11,7 +11,6 @@ ******************************************************************** function: highlevel encoder setup struct separated out for vorbisenc clarity - last mod: $Id: highlevel.h 17195 2010-05-05 21:49:51Z giles $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/info.c b/code/libvorbis-1.3.5/lib/info.c index 8a2a001f..3fbb7c75 100644 --- a/code/libvorbis-1.3.5/lib/info.c +++ b/code/libvorbis-1.3.5/lib/info.c @@ -11,7 +11,6 @@ ******************************************************************** function: maintain the info structure, info <-> header packets - last mod: $Id: info.c 19441 2015-01-21 01:17:41Z xiphmont $ ********************************************************************/ @@ -31,8 +30,8 @@ #include "misc.h" #include "os.h" -#define GENERAL_VENDOR_STRING "Xiph.Org libVorbis 1.3.5" -#define ENCODE_VENDOR_STRING "Xiph.Org libVorbis I 20150105 (⛄⛄⛄⛄)" +#define GENERAL_VENDOR_STRING "Xiph.Org libVorbis 1.3.6" +#define ENCODE_VENDOR_STRING "Xiph.Org libVorbis I 20180316 (Now 100% fewer shells)" /* helpers */ static void _v_writestring(oggpack_buffer *o,const char *s, int bytes){ @@ -65,11 +64,13 @@ void vorbis_comment_add(vorbis_comment *vc,const char *comment){ } void vorbis_comment_add_tag(vorbis_comment *vc, const char *tag, const char *contents){ - char *comment=alloca(strlen(tag)+strlen(contents)+2); /* +2 for = and \0 */ + /* Length for key and value +2 for = and \0 */ + char *comment=_ogg_malloc(strlen(tag)+strlen(contents)+2); strcpy(comment, tag); strcat(comment, "="); strcat(comment, contents); vorbis_comment_add(vc, comment); + _ogg_free(comment); } /* This is more or less the same as strncasecmp - but that doesn't exist @@ -88,27 +89,30 @@ char *vorbis_comment_query(vorbis_comment *vc, const char *tag, int count){ long i; int found = 0; int taglen = strlen(tag)+1; /* +1 for the = we append */ - char *fulltag = alloca(taglen+ 1); + char *fulltag = _ogg_malloc(taglen+1); strcpy(fulltag, tag); strcat(fulltag, "="); for(i=0;icomments;i++){ if(!tagcompare(vc->user_comments[i], fulltag, taglen)){ - if(count == found) + if(count == found) { /* We return a pointer to the data, not a copy */ - return vc->user_comments[i] + taglen; - else + _ogg_free(fulltag); + return vc->user_comments[i] + taglen; + } else { found++; + } } } + _ogg_free(fulltag); return NULL; /* didn't find anything */ } int vorbis_comment_query_count(vorbis_comment *vc, const char *tag){ int i,count=0; int taglen = strlen(tag)+1; /* +1 for the = we append */ - char *fulltag = alloca(taglen+1); + char *fulltag = _ogg_malloc(taglen+1); strcpy(fulltag,tag); strcat(fulltag, "="); @@ -117,6 +121,7 @@ int vorbis_comment_query_count(vorbis_comment *vc, const char *tag){ count++; } + _ogg_free(fulltag); return count; } @@ -206,9 +211,9 @@ static int _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){ vi->channels=oggpack_read(opb,8); vi->rate=oggpack_read(opb,32); - vi->bitrate_upper=oggpack_read(opb,32); - vi->bitrate_nominal=oggpack_read(opb,32); - vi->bitrate_lower=oggpack_read(opb,32); + vi->bitrate_upper=(ogg_int32_t)oggpack_read(opb,32); + vi->bitrate_nominal=(ogg_int32_t)oggpack_read(opb,32); + vi->bitrate_lower=(ogg_int32_t)oggpack_read(opb,32); ci->blocksizes[0]=1<blocksizes[1]=1<backend_state; - if(!b||vi->channels<=0){ + if(!b||vi->channels<=0||vi->channels>256){ + b = NULL; ret=OV_EFAULT; goto err_out; } @@ -642,7 +648,7 @@ int vorbis_analysis_headerout(vorbis_dsp_state *v, memset(op_code,0,sizeof(*op_code)); if(b){ - oggpack_writeclear(&opb); + if(vi->channels>0)oggpack_writeclear(&opb); if(b->header)_ogg_free(b->header); if(b->header1)_ogg_free(b->header1); if(b->header2)_ogg_free(b->header2); diff --git a/code/libvorbis-1.3.5/lib/lookup.c b/code/libvorbis-1.3.5/lib/lookup.c index 3321ed3d..1cc1f88e 100644 --- a/code/libvorbis-1.3.5/lib/lookup.c +++ b/code/libvorbis-1.3.5/lib/lookup.c @@ -11,7 +11,6 @@ ******************************************************************** function: lookup based functions - last mod: $Id: lookup.c 16227 2009-07-08 06:58:46Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/lookup.h b/code/libvorbis-1.3.5/lib/lookup.h index f8b5b827..4bc0f3a2 100644 --- a/code/libvorbis-1.3.5/lib/lookup.h +++ b/code/libvorbis-1.3.5/lib/lookup.h @@ -11,7 +11,6 @@ ******************************************************************** function: lookup based functions - last mod: $Id: lookup.h 16227 2009-07-08 06:58:46Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/lookup_data.h b/code/libvorbis-1.3.5/lib/lookup_data.h index 2424a1b3..5de3cfdc 100644 --- a/code/libvorbis-1.3.5/lib/lookup_data.h +++ b/code/libvorbis-1.3.5/lib/lookup_data.h @@ -11,7 +11,6 @@ ******************************************************************** function: lookup data; generated by lookups.pl; edit there - last mod: $Id: lookup_data.h 16037 2009-05-26 21:10:58Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/lpc.c b/code/libvorbis-1.3.5/lib/lpc.c index f5199ec2..798f4cf0 100644 --- a/code/libvorbis-1.3.5/lib/lpc.c +++ b/code/libvorbis-1.3.5/lib/lpc.c @@ -11,7 +11,6 @@ ******************************************************************** function: LPC low level routines - last mod: $Id: lpc.c 16227 2009-07-08 06:58:46Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/lpc.h b/code/libvorbis-1.3.5/lib/lpc.h index 39d23760..9cc79451 100644 --- a/code/libvorbis-1.3.5/lib/lpc.h +++ b/code/libvorbis-1.3.5/lib/lpc.h @@ -11,7 +11,6 @@ ******************************************************************** function: LPC low level routines - last mod: $Id: lpc.h 16037 2009-05-26 21:10:58Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/lsp.c b/code/libvorbis-1.3.5/lib/lsp.c index 6a619f7b..85880545 100644 --- a/code/libvorbis-1.3.5/lib/lsp.c +++ b/code/libvorbis-1.3.5/lib/lsp.c @@ -11,7 +11,6 @@ ******************************************************************** function: LSP (also called LSF) conversion routines - last mod: $Id: lsp.c 19453 2015-03-02 22:35:34Z xiphmont $ The LSP generation code is taken (with minimal modification and a few bugfixes) from "On the Computation of the LSP Frequencies" by diff --git a/code/libvorbis-1.3.5/lib/lsp.h b/code/libvorbis-1.3.5/lib/lsp.h index bacfb097..8a8d10e9 100644 --- a/code/libvorbis-1.3.5/lib/lsp.h +++ b/code/libvorbis-1.3.5/lib/lsp.h @@ -11,7 +11,6 @@ ******************************************************************** function: LSP (also called LSF) conversion routines - last mod: $Id: lsp.h 16227 2009-07-08 06:58:46Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/mapping0.c b/code/libvorbis-1.3.5/lib/mapping0.c index 85c7d22d..ccb4493d 100644 --- a/code/libvorbis-1.3.5/lib/mapping0.c +++ b/code/libvorbis-1.3.5/lib/mapping0.c @@ -11,7 +11,6 @@ ******************************************************************** function: channel mapping 0 implementation - last mod: $Id: mapping0.c 19441 2015-01-21 01:17:41Z xiphmont $ ********************************************************************/ @@ -93,7 +92,6 @@ static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb) int i,b; vorbis_info_mapping0 *info=_ogg_calloc(1,sizeof(*info)); codec_setup_info *ci=vi->codec_setup; - memset(info,0,sizeof(*info)); if(vi->channels<=0)goto err_out; b=oggpack_read(opb,1); diff --git a/code/libvorbis-1.3.5/lib/masking.h b/code/libvorbis-1.3.5/lib/masking.h index 3576ab78..955e18c7 100644 --- a/code/libvorbis-1.3.5/lib/masking.h +++ b/code/libvorbis-1.3.5/lib/masking.h @@ -11,7 +11,6 @@ ******************************************************************** function: masking curve data for psychoacoustics - last mod: $Id: masking.h 16227 2009-07-08 06:58:46Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/mdct.c b/code/libvorbis-1.3.5/lib/mdct.c index 08163318..f3f1ed80 100644 --- a/code/libvorbis-1.3.5/lib/mdct.c +++ b/code/libvorbis-1.3.5/lib/mdct.c @@ -12,7 +12,6 @@ function: normalized modified discrete cosine transform power of two length transform only [64 <= n ] - last mod: $Id: mdct.c 16227 2009-07-08 06:58:46Z xiphmont $ Original algorithm adapted long ago from _The use of multirate filter banks for coding of high quality digital audio_, by T. Sporer, diff --git a/code/libvorbis-1.3.5/lib/mdct.h b/code/libvorbis-1.3.5/lib/mdct.h index 3ed94333..3b8c9ba4 100644 --- a/code/libvorbis-1.3.5/lib/mdct.h +++ b/code/libvorbis-1.3.5/lib/mdct.h @@ -11,7 +11,6 @@ ******************************************************************** function: modified discrete cosine transform prototypes - last mod: $Id: mdct.h 16227 2009-07-08 06:58:46Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/misc.h b/code/libvorbis-1.3.5/lib/misc.h index 73b45198..13788445 100644 --- a/code/libvorbis-1.3.5/lib/misc.h +++ b/code/libvorbis-1.3.5/lib/misc.h @@ -11,7 +11,6 @@ ******************************************************************** function: miscellaneous prototypes - last mod: $Id: misc.h 19457 2015-03-03 00:15:29Z giles $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/modes/floor_all.h b/code/libvorbis-1.3.5/lib/modes/floor_all.h index 4292be32..20928aac 100644 --- a/code/libvorbis-1.3.5/lib/modes/floor_all.h +++ b/code/libvorbis-1.3.5/lib/modes/floor_all.h @@ -11,7 +11,6 @@ ******************************************************************** function: key floor settings - last mod: $Id: floor_all.h 17050 2010-03-26 01:34:42Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/modes/psych_11.h b/code/libvorbis-1.3.5/lib/modes/psych_11.h index 844a8ed3..cc5eea24 100644 --- a/code/libvorbis-1.3.5/lib/modes/psych_11.h +++ b/code/libvorbis-1.3.5/lib/modes/psych_11.h @@ -11,7 +11,6 @@ ******************************************************************** function: 11kHz settings - last mod: $Id: psych_11.h 16227 2009-07-08 06:58:46Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/modes/psych_16.h b/code/libvorbis-1.3.5/lib/modes/psych_16.h index 1c10b395..477cb4d9 100644 --- a/code/libvorbis-1.3.5/lib/modes/psych_16.h +++ b/code/libvorbis-1.3.5/lib/modes/psych_16.h @@ -11,7 +11,6 @@ ******************************************************************** function: 16kHz settings - last mod: $Id: psych_16.h 16227 2009-07-08 06:58:46Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/modes/psych_44.h b/code/libvorbis-1.3.5/lib/modes/psych_44.h index f05c0326..6c9eaa4e 100644 --- a/code/libvorbis-1.3.5/lib/modes/psych_44.h +++ b/code/libvorbis-1.3.5/lib/modes/psych_44.h @@ -11,7 +11,6 @@ ******************************************************************** function: key psychoacoustic settings for 44.1/48kHz - last mod: $Id: psych_44.h 16962 2010-03-11 07:30:34Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/modes/psych_8.h b/code/libvorbis-1.3.5/lib/modes/psych_8.h index 0e2dd573..277db843 100644 --- a/code/libvorbis-1.3.5/lib/modes/psych_8.h +++ b/code/libvorbis-1.3.5/lib/modes/psych_8.h @@ -11,7 +11,6 @@ ******************************************************************** function: 8kHz psychoacoustic settings - last mod: $Id: psych_8.h 16227 2009-07-08 06:58:46Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/modes/residue_16.h b/code/libvorbis-1.3.5/lib/modes/residue_16.h index dcaca545..3e05471c 100644 --- a/code/libvorbis-1.3.5/lib/modes/residue_16.h +++ b/code/libvorbis-1.3.5/lib/modes/residue_16.h @@ -11,7 +11,6 @@ ******************************************************************** function: toplevel residue templates 16/22kHz - last mod: $Id: residue_16.h 16962 2010-03-11 07:30:34Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/modes/residue_44.h b/code/libvorbis-1.3.5/lib/modes/residue_44.h index 236c1834..e89bc0e4 100644 --- a/code/libvorbis-1.3.5/lib/modes/residue_44.h +++ b/code/libvorbis-1.3.5/lib/modes/residue_44.h @@ -11,7 +11,6 @@ ******************************************************************** function: toplevel residue templates for 32/44.1/48kHz - last mod: $Id: residue_44.h 16962 2010-03-11 07:30:34Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/modes/residue_44p51.h b/code/libvorbis-1.3.5/lib/modes/residue_44p51.h index a52cc524..7f33e250 100644 --- a/code/libvorbis-1.3.5/lib/modes/residue_44p51.h +++ b/code/libvorbis-1.3.5/lib/modes/residue_44p51.h @@ -11,7 +11,6 @@ ******************************************************************** function: toplevel residue templates for 32/44.1/48kHz uncoupled - last mod: $Id: residue_44p51.h 19013 2013-11-12 04:04:50Z giles $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/modes/residue_44u.h b/code/libvorbis-1.3.5/lib/modes/residue_44u.h index 92c4a09c..e55ac125 100644 --- a/code/libvorbis-1.3.5/lib/modes/residue_44u.h +++ b/code/libvorbis-1.3.5/lib/modes/residue_44u.h @@ -11,7 +11,6 @@ ******************************************************************** function: toplevel residue templates for 32/44.1/48kHz uncoupled - last mod: $Id: residue_44u.h 16962 2010-03-11 07:30:34Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/modes/residue_8.h b/code/libvorbis-1.3.5/lib/modes/residue_8.h index 94c6d84c..ae123a27 100644 --- a/code/libvorbis-1.3.5/lib/modes/residue_8.h +++ b/code/libvorbis-1.3.5/lib/modes/residue_8.h @@ -11,7 +11,6 @@ ******************************************************************** function: toplevel residue templates 8/11kHz - last mod: $Id: residue_8.h 16962 2010-03-11 07:30:34Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/modes/setup_11.h b/code/libvorbis-1.3.5/lib/modes/setup_11.h index 4c2d619c..0cbcaafc 100644 --- a/code/libvorbis-1.3.5/lib/modes/setup_11.h +++ b/code/libvorbis-1.3.5/lib/modes/setup_11.h @@ -11,7 +11,6 @@ ******************************************************************** function: 11kHz settings - last mod: $Id: setup_11.h 16894 2010-02-12 20:32:12Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/modes/setup_16.h b/code/libvorbis-1.3.5/lib/modes/setup_16.h index 336007f9..d59ad70d 100644 --- a/code/libvorbis-1.3.5/lib/modes/setup_16.h +++ b/code/libvorbis-1.3.5/lib/modes/setup_16.h @@ -11,7 +11,6 @@ ******************************************************************** function: 16kHz settings - last mod: $Id: setup_16.h 16894 2010-02-12 20:32:12Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/modes/setup_22.h b/code/libvorbis-1.3.5/lib/modes/setup_22.h index 4fd5e571..bc38af96 100644 --- a/code/libvorbis-1.3.5/lib/modes/setup_22.h +++ b/code/libvorbis-1.3.5/lib/modes/setup_22.h @@ -11,7 +11,6 @@ ******************************************************************** function: 22kHz settings - last mod: $Id: setup_22.h 17026 2010-03-25 05:00:27Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/modes/setup_32.h b/code/libvorbis-1.3.5/lib/modes/setup_32.h index 2275ac96..f66a0bcd 100644 --- a/code/libvorbis-1.3.5/lib/modes/setup_32.h +++ b/code/libvorbis-1.3.5/lib/modes/setup_32.h @@ -11,7 +11,6 @@ ******************************************************************** function: toplevel settings for 32kHz - last mod: $Id: setup_32.h 16894 2010-02-12 20:32:12Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/modes/setup_44.h b/code/libvorbis-1.3.5/lib/modes/setup_44.h index 3b88a89a..a189b5fb 100644 --- a/code/libvorbis-1.3.5/lib/modes/setup_44.h +++ b/code/libvorbis-1.3.5/lib/modes/setup_44.h @@ -11,7 +11,6 @@ ******************************************************************** function: toplevel settings for 44.1/48kHz - last mod: $Id: setup_44.h 16962 2010-03-11 07:30:34Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/modes/setup_44p51.h b/code/libvorbis-1.3.5/lib/modes/setup_44p51.h index 67d99796..3bde7b34 100644 --- a/code/libvorbis-1.3.5/lib/modes/setup_44p51.h +++ b/code/libvorbis-1.3.5/lib/modes/setup_44p51.h @@ -11,7 +11,6 @@ ******************************************************************** function: toplevel settings for 44.1/48kHz 5.1 surround modes - last mod: $Id: setup_44p51.h 19013 2013-11-12 04:04:50Z giles $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/modes/setup_44u.h b/code/libvorbis-1.3.5/lib/modes/setup_44u.h index 568b5f89..7ae3af6b 100644 --- a/code/libvorbis-1.3.5/lib/modes/setup_44u.h +++ b/code/libvorbis-1.3.5/lib/modes/setup_44u.h @@ -11,7 +11,6 @@ ******************************************************************** function: toplevel settings for 44.1/48kHz uncoupled modes - last mod: $Id: setup_44u.h 16962 2010-03-11 07:30:34Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/modes/setup_8.h b/code/libvorbis-1.3.5/lib/modes/setup_8.h index 14c48374..75025568 100644 --- a/code/libvorbis-1.3.5/lib/modes/setup_8.h +++ b/code/libvorbis-1.3.5/lib/modes/setup_8.h @@ -11,7 +11,6 @@ ******************************************************************** function: 8kHz settings - last mod: $Id: setup_8.h 16894 2010-02-12 20:32:12Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/modes/setup_X.h b/code/libvorbis-1.3.5/lib/modes/setup_X.h index a69f5d40..2229a5ef 100644 --- a/code/libvorbis-1.3.5/lib/modes/setup_X.h +++ b/code/libvorbis-1.3.5/lib/modes/setup_X.h @@ -11,7 +11,6 @@ ******************************************************************** function: catch-all toplevel settings for q modes only - last mod: $Id: setup_X.h 16894 2010-02-12 20:32:12Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/os.h b/code/libvorbis-1.3.5/lib/os.h index 8bc3e5fe..416a401d 100644 --- a/code/libvorbis-1.3.5/lib/os.h +++ b/code/libvorbis-1.3.5/lib/os.h @@ -13,7 +13,6 @@ ******************************************************************** function: #ifdef jail to whip a few platforms into the UNIX ideal. - last mod: $Id: os.h 19457 2015-03-03 00:15:29Z giles $ ********************************************************************/ @@ -31,7 +30,7 @@ # ifdef __GNUC__ # define STIN static __inline__ -# elif _WIN32 +# elif defined(_WIN32) # define STIN static __inline # else # define STIN static diff --git a/code/libvorbis-1.3.5/lib/psy.c b/code/libvorbis-1.3.5/lib/psy.c index f7a44c6d..422c6f1e 100644 --- a/code/libvorbis-1.3.5/lib/psy.c +++ b/code/libvorbis-1.3.5/lib/psy.c @@ -11,7 +11,6 @@ ******************************************************************** function: psychoacoustics not including preecho - last mod: $Id: psy.c 18077 2011-09-02 02:49:00Z giles $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/psy.h b/code/libvorbis-1.3.5/lib/psy.h index c1ea8244..ab2534db 100644 --- a/code/libvorbis-1.3.5/lib/psy.h +++ b/code/libvorbis-1.3.5/lib/psy.h @@ -11,7 +11,6 @@ ******************************************************************** function: random psychoacoustics (not including preecho) - last mod: $Id: psy.h 16946 2010-03-03 16:12:40Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/registry.c b/code/libvorbis-1.3.5/lib/registry.c index 3961ed14..74f7ef03 100644 --- a/code/libvorbis-1.3.5/lib/registry.c +++ b/code/libvorbis-1.3.5/lib/registry.c @@ -11,7 +11,6 @@ ******************************************************************** function: registry for time, floor, res backends and channel mappings - last mod: $Id: registry.c 16227 2009-07-08 06:58:46Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/registry.h b/code/libvorbis-1.3.5/lib/registry.h index 3ae04776..599d9599 100644 --- a/code/libvorbis-1.3.5/lib/registry.h +++ b/code/libvorbis-1.3.5/lib/registry.h @@ -11,7 +11,6 @@ ******************************************************************** function: registry for time, floor, res backends and channel mappings - last mod: $Id: registry.h 15531 2008-11-24 23:50:06Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/res0.c b/code/libvorbis-1.3.5/lib/res0.c index ec11488c..6d623d73 100644 --- a/code/libvorbis-1.3.5/lib/res0.c +++ b/code/libvorbis-1.3.5/lib/res0.c @@ -11,7 +11,6 @@ ******************************************************************** function: residue backend 0, 1 and 2 implementation - last mod: $Id: res0.c 19441 2015-01-21 01:17:41Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/scales.h b/code/libvorbis-1.3.5/lib/scales.h index 613f796e..18bc4e75 100644 --- a/code/libvorbis-1.3.5/lib/scales.h +++ b/code/libvorbis-1.3.5/lib/scales.h @@ -11,7 +11,6 @@ ******************************************************************** function: linear scale -> dB, Bark and Mel scales - last mod: $Id: scales.h 16227 2009-07-08 06:58:46Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/sharedbook.c b/code/libvorbis-1.3.5/lib/sharedbook.c index 6bfdf731..4545d4f4 100644 --- a/code/libvorbis-1.3.5/lib/sharedbook.c +++ b/code/libvorbis-1.3.5/lib/sharedbook.c @@ -11,11 +11,11 @@ ******************************************************************** function: basic shared codebook operations - last mod: $Id: sharedbook.c 19457 2015-03-03 00:15:29Z giles $ ********************************************************************/ #include +#include #include #include #include @@ -158,25 +158,34 @@ ogg_uint32_t *_make_words(char *l,long n,long sparsecount){ that's portable and totally safe against roundoff, but I haven't thought of it. Therefore, we opt on the side of caution */ long _book_maptype1_quantvals(const static_codebook *b){ - long vals=floor(pow((float)b->entries,1.f/b->dim)); + long vals; + if(b->entries<1){ + return(0); + } + vals=floor(pow((float)b->entries,1.f/b->dim)); /* the above *should* be reliable, but we'll not assume that FP is ever reliable when bitstream sync is at stake; verify via integer means that vals really is the greatest value of dim for which vals^b->bim <= b->entries */ /* treat the above as an initial guess */ + if(vals<1){ + vals=1; + } while(1){ long acc=1; long acc1=1; int i; for(i=0;idim;i++){ + if(b->entries/valsentries && acc1>b->entries){ + if(i>=b->dim && acc<=b->entries && acc1>b->entries){ return(vals); }else{ - if(acc>b->entries){ + if(idim || acc>b->entries){ vals--; }else{ vals++; diff --git a/code/libvorbis-1.3.5/lib/smallft.c b/code/libvorbis-1.3.5/lib/smallft.c index ae2bc41b..6d528af4 100644 --- a/code/libvorbis-1.3.5/lib/smallft.c +++ b/code/libvorbis-1.3.5/lib/smallft.c @@ -11,7 +11,6 @@ ******************************************************************** function: *unnormalized* fft transform - last mod: $Id: smallft.c 16227 2009-07-08 06:58:46Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/smallft.h b/code/libvorbis-1.3.5/lib/smallft.h index 45649732..9e867c67 100644 --- a/code/libvorbis-1.3.5/lib/smallft.h +++ b/code/libvorbis-1.3.5/lib/smallft.h @@ -11,7 +11,6 @@ ******************************************************************** function: fft transform - last mod: $Id: smallft.h 13293 2007-07-24 00:09:47Z xiphmont $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/synthesis.c b/code/libvorbis-1.3.5/lib/synthesis.c index 932d271a..5f6092c3 100644 --- a/code/libvorbis-1.3.5/lib/synthesis.c +++ b/code/libvorbis-1.3.5/lib/synthesis.c @@ -11,7 +11,6 @@ ******************************************************************** function: single-block PCM synthesis - last mod: $Id: synthesis.c 19441 2015-01-21 01:17:41Z xiphmont $ ********************************************************************/ @@ -117,7 +116,7 @@ int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op){ if(!ci->mode_param[mode]){ return(OV_EBADPACKET); } - + vb->W=ci->mode_param[mode]->blockflag; if(vb->W){ vb->lW=oggpack_read(opb,1); diff --git a/code/libvorbis-1.3.5/lib/vorbisenc.c b/code/libvorbis-1.3.5/lib/vorbisenc.c index b5d621e9..4a4607cb 100644 --- a/code/libvorbis-1.3.5/lib/vorbisenc.c +++ b/code/libvorbis-1.3.5/lib/vorbisenc.c @@ -11,7 +11,6 @@ ******************************************************************** function: simple programmatic interface for encoder mode setup - last mod: $Id: vorbisenc.c 19457 2015-03-03 00:15:29Z giles $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/vorbisfile.c b/code/libvorbis-1.3.5/lib/vorbisfile.c index 1998e63f..f879d31d 100644 --- a/code/libvorbis-1.3.5/lib/vorbisfile.c +++ b/code/libvorbis-1.3.5/lib/vorbisfile.c @@ -11,7 +11,6 @@ ******************************************************************** function: stdio-based convenience library for opening/seeking/decoding - last mod: $Id: vorbisfile.c 19457 2015-03-03 00:15:29Z giles $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/window.c b/code/libvorbis-1.3.5/lib/window.c index 0305b792..b3b7ce01 100644 --- a/code/libvorbis-1.3.5/lib/window.c +++ b/code/libvorbis-1.3.5/lib/window.c @@ -11,7 +11,6 @@ ******************************************************************** function: window functions - last mod: $Id: window.c 19028 2013-12-02 23:23:39Z tterribe $ ********************************************************************/ diff --git a/code/libvorbis-1.3.5/lib/window.h b/code/libvorbis-1.3.5/lib/window.h index 51f97599..6ac26074 100644 --- a/code/libvorbis-1.3.5/lib/window.h +++ b/code/libvorbis-1.3.5/lib/window.h @@ -11,7 +11,6 @@ ******************************************************************** function: window functions - last mod: $Id: window.h 19028 2013-12-02 23:23:39Z tterribe $ ********************************************************************/