From 66445ee977f7f65604f16c9b78454da7456bb865 Mon Sep 17 00:00:00 2001 From: Andre Date: Sat, 4 Nov 2006 14:59:40 +0100 Subject: [PATCH] fix handling of corrupt mp3 files When a recoverable error occured we always returned FRAME_HEADER_SIZE in mp3dec, which is clearly wrong if the error did not happen in the first frame. Fix is not to distinguish between recoverable and unrecoverable errors which even simplifies the code a bit. --- mp3dec.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/mp3dec.c b/mp3dec.c index fc2b9d8c..1818d4c0 100644 --- a/mp3dec.c +++ b/mp3dec.c @@ -49,7 +49,6 @@ struct private_mp3dec_data { }; /* TODO: Convert all input if possible */ -#define FRAME_HEADER_SIZE 4 static ssize_t mp3dec(char *inbuffer, size_t len, struct filter_node *fn) { int i, ret; @@ -62,11 +61,8 @@ static ssize_t mp3dec(char *inbuffer, size_t len, struct filter_node *fn) pmd->stream.error = 0; next_frame: ret = mad_header_decode(&pmd->frame.header, &pmd->stream); - if (ret < 0) { - if (!MAD_RECOVERABLE(pmd->stream.error)) - goto out; - return FRAME_HEADER_SIZE; - } + if (ret < 0) + goto out; fn->fc->samplerate = pmd->frame.header.samplerate; fn->fc->channels = MAD_NCHANNELS(&pmd->frame.header); ret = mad_frame_decode(&pmd->frame, &pmd->stream); -- 2.39.5