Commit 23361c7f authored by Monty's avatar Monty
Browse files

Fix for Trac #1573.

This is two bugs.  The first is that vorbisfile_example.c ignores an
error code and plows ahead blindly if libvorbisfile reports the
current bitstream section is bad (OV_EBADLINK).

The second is that retrying after the error crashes libvorbisfile due
to the unitialized state.


svn path=/trunk/vorbis/; revision=16328
parent 2aeaf1c1
...@@ -70,7 +70,12 @@ int main(){ ...@@ -70,7 +70,12 @@ int main(){
/* EOF */ /* EOF */
eof=1; eof=1;
} else if (ret < 0) { } else if (ret < 0) {
/* error in the stream. Not a problem, just reporting it in if(ret==OV_EBADLINK){
fprintf(stderr,"Corrupt bitstream section! Exiting.\n");
exit(1);
}
/* some other error in the stream. Not a problem, just reporting it in
case we (the app) cares. In this case, we don't. */ case we (the app) cares. In this case, we don't. */
} else { } else {
/* we don't bother dealing with sample rate changes, etc, but /* we don't bother dealing with sample rate changes, etc, but
......
...@@ -232,9 +232,10 @@ static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){ ...@@ -232,9 +232,10 @@ static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){
v->analysisp=1; v->analysisp=1;
}else{ }else{
/* finish the codebooks */ /* finish the codebooks */
if(!ci->fullbooks){ if(!ci->fullbooks)
ci->fullbooks=_ogg_calloc(ci->books,sizeof(*ci->fullbooks)); ci->fullbooks=_ogg_calloc(ci->books,sizeof(*ci->fullbooks));
for(i=0;i<ci->books;i++){ for(i=0;i<ci->books;i++){
if(ci->book_param[i]!=NULL){
if(vorbis_book_init_decode(ci->fullbooks+i,ci->book_param[i])) if(vorbis_book_init_decode(ci->fullbooks+i,ci->book_param[i]))
return -1; return -1;
/* decode codebooks are now standalone after init */ /* decode codebooks are now standalone after init */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment