Commit 2d544500 authored by Martin Steghöfer's avatar Martin Steghöfer Committed by Thomas Daede

Fix oggdec crash/hang: Don't ignore stream errors

oggdec treats all negative return values coming from ov_read
as OV_HOLE errors and therefore as recoverable. So even in the
case of fatal errors it keeps on calling ov_read, which may
either crash (libvorbis' data structures may be uninitialized)
or simply not progress and therefore trap oggdec in an
infinite loop.

Fix this by distinguishing between recoverable and
non-recoverable errors. In the case of fatal errors, exit
gracefully with an error message. The error string is
"borrowed" from ogg123 and therefore already translated into
several languages.

parent 4853f6e7
......@@ -310,12 +310,19 @@ static int decode_file(FILE *in, FILE *out, char *infile, char *outfile)
if(ret < 0 ) {
if( !quiet ) {
fprintf(stderr, _("WARNING: hole in data (%d)\n"), ret);
if(ret == OV_HOLE) {
if(!quiet) {
fprintf(stderr, _("WARNING: hole in data (%d)\n"), ret);
else if(ret < 0) {
if(!quiet) {
fprintf(stderr, _("=== Vorbis library reported a stream error.\n"));
return 1;
if(channels > 2 && !raw) {
/* Then permute! */
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