-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
61 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
target | ||
corpus | ||
artifacts | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[package] | ||
name = "soundcore-lib-fuzz" | ||
version = "0.0.0" | ||
publish = false | ||
edition = "2021" | ||
|
||
[package.metadata] | ||
cargo-fuzz = true | ||
|
||
[dependencies] | ||
libfuzzer-sys = "0.4" | ||
|
||
[dependencies.soundcore-lib] | ||
path = ".." | ||
|
||
# Prevent this from interfering with workspaces | ||
[workspace] | ||
members = ["."] | ||
|
||
[profile.release] | ||
debug = 1 | ||
|
||
[[bin]] | ||
name = "fuzz_target_1" | ||
path = "fuzz_targets/fuzz_target_1.rs" | ||
test = false | ||
doc = false | ||
|
||
[[bin]] | ||
name = "a3951" | ||
path = "fuzz_targets/a3951.rs" | ||
test = false | ||
doc = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#![no_main] | ||
use libfuzzer_sys::fuzz_target; | ||
use soundcore_lib::packets::ResponsePacket; | ||
|
||
fuzz_target!(|data: &[u8]| { | ||
let _ = ResponsePacket::from_bytes(data); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,25 @@ | ||
use serde::{Serialize, Deserialize}; | ||
|
||
use crate::models::{SingleBattery, FirmwareVer, SerialNumber}; | ||
use crate::models::{SingleBattery, FirmwareVer, SerialNumber, TouchTone, WearDetection, ThreeDimensionalEffect, BassUp, LDAC, SupportTwoCnn, InEarBeep, DeviceColor, AutoPowerOff, HearingProtect, AmbientSoundNotice, PowerOnBatteryNotice}; | ||
|
||
|
||
#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq, Hash)] | ||
pub struct A3040StateResponse { | ||
pub battery: SingleBattery, | ||
pub fw: FirmwareVer, | ||
pub sn: SerialNumber, | ||
|
||
pub touch_tone: TouchTone, | ||
pub wear_detection: WearDetection, | ||
pub three_dimensional_effect: ThreeDimensionalEffect, | ||
pub charging_case_battery: u8, // TODO: Extract type? | ||
pub bass_up: BassUp, | ||
pub device_color: DeviceColor, | ||
pub ldac: LDAC, | ||
pub support_two_cnn: SupportTwoCnn, | ||
pub in_ear_beep: InEarBeep, | ||
pub prompt_language: u8, // TODO: Extract type? If == 0, then English. If == 1, then Chinese. | ||
pub auto_power_off: AutoPowerOff, | ||
pub hearing_protect: HearingProtect, | ||
pub ambient_sound_notice: AmbientSoundNotice, | ||
pub power_on_battery_notice: PowerOnBatteryNotice, | ||
} |