Skip to content

Commit

Permalink
Adapted slice length fuzzy test to new rust nightly checks
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianSchmid committed Feb 11, 2024
1 parent b489fd9 commit c516584
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions etherparse/src/transport/icmpv6_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ mod test {
ip_header in ipv6_any(),
icmp_type in icmpv6_type_any(),
// max length is u32::MAX - header_len (7)
bad_len in (core::u32::MAX - 7) as usize..=core::usize::MAX,
bad_len in (core::u32::MAX - 7) as usize..=(core::isize::MAX as usize),
payload in proptest::collection::vec(any::<u8>(), 0..1024)
) {

Expand Down Expand Up @@ -395,7 +395,7 @@ mod test {
icmp_type in icmpv6_type_any(),
start_checksum in any::<u16>(),
// max length is u32::MAX - header_len (7)
bad_len in (core::u32::MAX - 7) as usize..=core::usize::MAX,
bad_len in (core::u32::MAX - 7) as usize..=(core::isize::MAX as usize),
payload in proptest::collection::vec(any::<u8>(), 0..1024)
) {

Expand Down
2 changes: 1 addition & 1 deletion etherparse/src/transport/icmpv6_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ mod test {
#[cfg(not(any(target_pointer_width = "16", target_pointer_width = "32")))]
#[test]
fn from_slice_too_big_error(
bad_len in ((core::u32::MAX as usize) + 1)..=core::usize::MAX,
bad_len in ((core::u32::MAX as usize) + 1)..=(core::isize::MAX as usize),
) {
// too large packet error case
{
Expand Down
4 changes: 2 additions & 2 deletions etherparse/src/transport/icmpv6_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ mod test {
code_u8 in any::<u8>(),
bytes5to8 in any::<[u8;4]>(),
// max length is u32::MAX - header_len (7)
bad_len in (core::u32::MAX - 7) as usize..=core::usize::MAX,
bad_len in (core::u32::MAX - 7) as usize..=(core::isize::MAX as usize),
payload in proptest::collection::vec(any::<u8>(), 0..64)
) {
use Icmpv6Type::*;
Expand Down Expand Up @@ -718,7 +718,7 @@ mod test {
ip_header in ipv6_any(),
icmpv6_type in icmpv6_type_any(),
// max length is u32::MAX - header_len (7)
bad_len in (core::u32::MAX - 7) as usize..=core::usize::MAX,
bad_len in (core::u32::MAX - 7) as usize..=(core::isize::MAX as usize),
payload in proptest::collection::vec(any::<u8>(), 0..1024)
) {
// size error case
Expand Down
12 changes: 6 additions & 6 deletions etherparse/src/transport/udp_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ mod test {
source_port in any::<u16>(),
destination_port in any::<u16>(),
good_payload_length in 0..=((core::u16::MAX as usize) - UdpHeader::LEN),
bad_payload_length in ((core::u16::MAX as usize) - UdpHeader::LEN + 1)..=usize::MAX,
bad_payload_length in ((core::u16::MAX as usize) - UdpHeader::LEN + 1)..=(isize::MAX as usize),
) {

// normal working call
Expand Down Expand Up @@ -386,7 +386,7 @@ mod test {
destination_port in any::<u16>(),
ipv4 in ipv4_any(),
payload in proptest::collection::vec(any::<u8>(), 0..20),
bad_len in ((core::u16::MAX as usize) - UdpHeader::LEN + 1)..=usize::MAX,
bad_len in ((core::u16::MAX as usize) - UdpHeader::LEN + 1)..=(isize::MAX as usize),
) {
// normal case
assert_eq!(
Expand Down Expand Up @@ -490,7 +490,7 @@ mod test {
dummy_checksum in any::<u16>(),
ipv4 in ipv4_any(),
payload in proptest::collection::vec(any::<u8>(), 0..20),
bad_len in ((core::u16::MAX as usize) - UdpHeader::LEN + 1)..=usize::MAX,
bad_len in ((core::u16::MAX as usize) - UdpHeader::LEN + 1)..=(isize::MAX as usize),
) {
// normal case
{
Expand Down Expand Up @@ -620,7 +620,7 @@ mod test {
destination_port in any::<u16>(),
ipv6 in ipv6_any(),
payload in proptest::collection::vec(any::<u8>(), 0..20),
bad_len in ((core::u16::MAX as usize) - UdpHeader::LEN + 1)..=usize::MAX,
bad_len in ((core::u16::MAX as usize) - UdpHeader::LEN + 1)..=(isize::MAX as usize),
) {
// normal case
assert_eq!(
Expand Down Expand Up @@ -723,7 +723,7 @@ mod test {
destination_port in any::<u16>(),
ipv6 in ipv6_any(),
payload in proptest::collection::vec(any::<u8>(), 0..20),
bad_len in ((core::u32::MAX as usize) - UdpHeader::LEN + 1)..=usize::MAX,
bad_len in ((core::u32::MAX as usize) - UdpHeader::LEN + 1)..=(isize::MAX as usize),
) {
// normal case
assert_eq!(
Expand Down Expand Up @@ -827,7 +827,7 @@ mod test {
dummy_checksum in any::<u16>(),
ipv6 in ipv6_any(),
payload in proptest::collection::vec(any::<u8>(), 0..20),
bad_len in ((core::u32::MAX as usize) - UdpHeader::LEN + 1)..=usize::MAX,
bad_len in ((core::u32::MAX as usize) - UdpHeader::LEN + 1)..=(isize::MAX as usize),
) {
// normal case
{
Expand Down

0 comments on commit c516584

Please sign in to comment.