[MAD Decoder] Don't crash on bad files
The local and seekable file scanner could crash on bad MPEG files if they failed to decode any frames and broke due to either end of file or other unrecoverable errors, due to a division by zero error attempting to calculate the file bitrate. Now correctly return error state if this occurs, bailing early. Signed-off-by: Christopher Snowhill <kode54@gmail.com>xcode15
parent
051b86cbaf
commit
804e7652a8
|
@ -406,6 +406,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
// Don't commit division by zero on bad files
|
||||
if(stream.next_frame == stream.this_frame) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
if(!_foundiTunSMPB && !_foundXingHeader && !_foundVBRIHeader) {
|
||||
// Now do CBR estimation instead of full file scanning
|
||||
size_t frameCount = (_fileSize - id3_length) / (stream.next_frame - stream.this_frame);
|
||||
|
|
Loading…
Reference in New Issue