musepack: Add fuzz and bench targets

This commit is contained in:
Serial 2023-05-23 18:46:24 -04:00 committed by Alex
parent 62190b8f9f
commit b2a604eb3d
3 changed files with 15 additions and 0 deletions

View file

@ -36,6 +36,7 @@ fn content_infer_read(c: &mut Criterion) {
(FLAC, "../tests/files/assets/minimal/full_test.flac"),
(MP4, "../tests/files/assets/minimal/m4a_codec_aac.m4a"),
(MP3, "../tests/files/assets/minimal/full_test.mp3"),
(MPC, "../tests/files/assets/minimal/mpc_sv8.mpc"),
(OPUS, "../tests/files/assets/minimal/full_test.opus"),
(RIFF, "../tests/files/assets/minimal/wav_format_pcm.wav"),
(SPEEX, "../tests/files/assets/minimal/full_test.spx"),

View file

@ -22,6 +22,10 @@ members = ["."]
name = "filetype_from_buffer"
path = "fuzz_targets/filetype_from_buffer.rs"
[[bin]]
name = "mpcfile_read_from"
path = "fuzz_targets/mpcfile_read_from.rs"
[[bin]]
name = "mpegfile_read_from"
path = "fuzz_targets/mpegfile_read_from.rs"

View file

@ -0,0 +1,10 @@
#![no_main]
use std::io::Cursor;
use libfuzzer_sys::fuzz_target;
use lofty::{AudioFile, ParseOptions};
fuzz_target!(|data: Vec<u8>| {
let _ = lofty::musepack::MpcFile::read_from(&mut Cursor::new(data), ParseOptions::new());
});