Tests/Fuzz: Fix arguments to Picture::from_flac_bytes

This commit is contained in:
Serial 2023-09-30 12:53:21 -04:00 committed by Alex
parent 9ae927ceb0
commit aea857cec2
2 changed files with 7 additions and 5 deletions

View file

@ -1,7 +1,9 @@
#![no_main] #![no_main]
use lofty::ParsingMode;
use libfuzzer_sys::fuzz_target; use libfuzzer_sys::fuzz_target;
fuzz_target!(|data: &[u8]| { fuzz_target!(|data: &[u8]| {
let _ = lofty::Picture::from_flac_bytes(data, true); let _ = lofty::Picture::from_flac_bytes(data, true, ParsingMode::Relaxed);
let _ = lofty::Picture::from_flac_bytes(data, false); let _ = lofty::Picture::from_flac_bytes(data, false, ParsingMode::Relaxed);
}); });

View file

@ -1,5 +1,5 @@
use lofty::id3::v2::{AttachedPictureFrame, Id3v2Version}; use lofty::id3::v2::{AttachedPictureFrame, Id3v2Version};
use lofty::{Picture, PictureInformation, PictureType, TextEncoding}; use lofty::{ParsingMode, Picture, PictureInformation, PictureType, TextEncoding};
use std::fs::File; use std::fs::File;
use std::io::Read; use std::io::Read;
@ -96,7 +96,7 @@ fn as_ape_bytes() {
fn flac_metadata_block_picture() { fn flac_metadata_block_picture() {
let buf = get_buf("tests/picture/assets/png_640x628.vorbis"); let buf = get_buf("tests/picture/assets/png_640x628.vorbis");
let (pic, _) = Picture::from_flac_bytes(&buf, true).unwrap(); let (pic, _) = Picture::from_flac_bytes(&buf, true, ParsingMode::Strict).unwrap();
assert_eq!(create_original_picture(), pic); assert_eq!(create_original_picture(), pic);
} }