From 3ea17df4955268347f65f7fc3bd153fe4edbd1b5 Mon Sep 17 00:00:00 2001 From: Nedeljko Babic Date: Tue, 27 Mar 2012 11:40:24 +0200 Subject: 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. [Import part of the changes from Tremor (ff67c8b 2010-10-14)] --- ivorbisfile_example.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ivorbisfile_example.c b/ivorbisfile_example.c index c99cfd2..7b0cf10 100644 --- a/ivorbisfile_example.c +++ b/ivorbisfile_example.c @@ -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 -- cgit v1.2.1