diff options
author | Tim Terriberry <tterribe@xiph.org> | 2010-10-14 01:09:06 +0000 |
---|---|---|
committer | Tim Terriberry <tterribe@xiph.org> | 2010-10-14 01:09:06 +0000 |
commit | ff67c8b500127406b0b89be773cd3e186cde0cf8 (patch) | |
tree | b368bfab0df172874447134fb6d3669e9017c15a /ivorbisfile_example.c | |
parent | 28854b5669212379c190640063be53b19f12ab88 (diff) | |
download | tremor-ff67c8b500127406b0b89be773cd3e186cde0cf8.tar.gz |
Port r16328 and r16330 from libvorbis.
ivorbisfile_example.c ignores an error code and plows ahead blindly if
libvorbisidec reports the current bitstream section is bad (OV_EBADLINK).
Retrying after the error crashes libvorbisidec due to the unitialized state.
git-svn-id: https://svn.xiph.org/trunk/Tremor@17526 0101bb08-14d6-0310-b084-bc0e0c8e3800
Diffstat (limited to 'ivorbisfile_example.c')
-rw-r--r-- | ivorbisfile_example.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/ivorbisfile_example.c b/ivorbisfile_example.c index 1854fc4..7b0cf10 100644 --- a/ivorbisfile_example.c +++ b/ivorbisfile_example.c @@ -21,8 +21,8 @@ #include <stdio.h> #include <stdlib.h> -#include <vorbis/ivorbiscodec.h> -#include <vorbis/ivorbisfile.h> +#include "ivorbiscodec.h" +#include "ivorbisfile.h" #ifdef _WIN32 /* We need the following two to set stdin/stdout to binary */ #include <io.h> @@ -69,7 +69,12 @@ int main(){ /* EOF */ eof=1; } 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. */ } else { /* we don't bother dealing with sample rate changes, etc, but |