-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
left to do: * use released version of h264-reader * fix definition of is random access point to take into account nuh layer id, check if we're doing the right thing with stsa * fill in validate_order
- Loading branch information
Showing
17 changed files
with
2,631 additions
and
144 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ jobs: | |
matrix: | ||
rust: | ||
- stable | ||
- 1.67 | ||
- 1.77 | ||
include: | ||
- rust: stable | ||
extra_components: rustfmt | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,60 @@ | ||
// Copyright (C) 2021 Scott Lamb <[email protected]> | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
|
||
#![no_main] | ||
use libfuzzer_sys::fuzz_target; | ||
use std::num::NonZeroU32; | ||
|
||
fuzz_target!(|data: &[u8]| { | ||
let mut data = data; | ||
let mut depacketizer = retina::codec::Depacketizer::new( | ||
"video", "h265", 90_000, None, Some("profile-id=1;sprop-sps=QgEBAWAAAAMAsAAAAwAAAwBaoAWCAeFja5JFL83BQYFBAAADAAEAAAMADKE=;sprop-pps=RAHA8saNA7NA;sprop-vps=QAEMAf//AWAAAAMAsAAAAwAAAwBarAwAAAMABAAAAwAyqA==")).unwrap(); | ||
let mut timestamp = retina::Timestamp::new(0, NonZeroU32::new(90_000).unwrap(), 0).unwrap(); | ||
let mut sequence_number: u16 = 0; | ||
let conn_ctx = retina::ConnectionContext::dummy(); | ||
let stream_ctx = retina::StreamContext::dummy(); | ||
let pkt_ctx = retina::PacketContext::dummy(); | ||
loop { | ||
let (hdr, rest) = match data.split_first() { | ||
Some(r) => r, | ||
None => return, | ||
}; | ||
let ts_change = (hdr & 0b001) != 0; | ||
let mark = (hdr & 0b010) != 0; | ||
let loss = (hdr & 0b100) != 0; | ||
let len = usize::from(hdr >> 3); | ||
if rest.len() < len { | ||
return; | ||
} | ||
let (payload, rest) = rest.split_at(len); | ||
data = rest; | ||
if loss { | ||
sequence_number = sequence_number.wrapping_add(1); | ||
} | ||
if ts_change { | ||
timestamp = timestamp.try_add(1).unwrap(); | ||
} | ||
let pkt = retina::rtp::ReceivedPacketBuilder { | ||
ctx: pkt_ctx, | ||
stream_id: 0, | ||
timestamp, | ||
ssrc: 0, | ||
sequence_number, | ||
loss: u16::from(loss), | ||
payload_type: 96, | ||
mark, | ||
} | ||
.build(payload.iter().copied()) | ||
.unwrap(); | ||
// println!("pkt: {:#?}", pkt); | ||
if depacketizer.push(pkt).is_err() { | ||
return; | ||
} | ||
while let Some(item) = depacketizer.pull(&conn_ctx, &stream_ctx).transpose() { | ||
if item.is_err() { | ||
return; | ||
} | ||
} | ||
sequence_number = sequence_number.wrapping_add(1); | ||
} | ||
}); |
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,23 @@ | ||
// Copyright (C) 2024 Scott Lamb <[email protected]> | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
|
||
#![no_main] | ||
use libfuzzer_sys::fuzz_target; | ||
|
||
use retina::codec::h265::nal; | ||
|
||
fuzz_target!(|data: &[u8]| { | ||
let Ok((h, bits)) = nal::split(data) else { | ||
return; | ||
}; | ||
|
||
match h.unit_type() { | ||
nal::UnitType::SpsNut => { | ||
let _ = nal::Sps::from_bits(bits); | ||
} | ||
nal::UnitType::PpsNut => { | ||
let _ = nal::Pps::from_bits(bits); | ||
} | ||
_ => {} | ||
} | ||
}); |
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
Oops, something went wrong.