Don't crash on an invalid (layer I or II) frame

We removed the MP2-layer I and II decoders to save space, but an occasional
bad frame can come in that, by random chance, specifies one of this type.
Was calling NULL because of that.  Now, just skip the frame and no crash.
This commit is contained in:
Earle F. Philhower, III committed 2018-01-19 20:40:00 -08:00
1 parent e5d23a4692
commit 158fe23181
1 file changed
+5
+5
View File
@@ -451,6 +451,11 @@ int mad_frame_decode(struct mad_frame *frame, struct mad_stream *stream)
frame->header.flags &= ~MAD_FLAG_INCOMPLETE;
// EFP3 - On non-MP3 frames, abort instead of crash..we removed MP-II/MP-I decoders
if (!decoder_table[frame->header.layer - 1]) {
goto fail;
}
if (decoder_table[frame->header.layer - 1](stream, frame) == -1) {
if (!MAD_RECOVERABLE(stream->error))
stream->next_frame = stream->this_frame;