Skip to content

Commit 2bea71c

Browse files
committed
fix: MP3 format probe to reject WAV files with minimp3
Without this, minimp3 would incorrectly accept WAV files as MP3 when both `minimp3` and Symphonia's `wav` features are enabled.
1 parent 5253ff2 commit 2bea71c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/decoder/mp3.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,10 @@ where
912912
{
913913
utils::probe_format(data, |reader| {
914914
let mut decoder = Decoder::new(reader);
915-
decoder.next_frame().is_ok()
915+
decoder.next_frame().is_ok_and(|frame| {
916+
// Without this check, minimp3 will think it can decode WAV files. This will trigger by
917+
// running the test suite with features `minimp3` and (Symphonia) `wav` enabled.
918+
frame.bitrate != 0
919+
})
916920
})
917921
}

tests/seek.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,11 @@ fn seek_does_not_break_channel_order(
240240
case("mp3", "symphonia")
241241
)]
242242
#[cfg_attr(
243-
all(feature = "symphonia-ogg", feature = "symphonia-vorbis",),
243+
all(
244+
feature = "symphonia-ogg",
245+
feature = "symphonia-vorbis",
246+
not(feature = "lewton")
247+
),
244248
case("ogg", "symphonia")
245249
)]
246250
fn random_access_seeks(#[case] format: &'static str, #[case] decoder_name: &'static str) {

0 commit comments

Comments
 (0)