Skip to content

Commit 45f628c

Browse files
committed
feat(fuzz): add cargo-fuzz targets and fix 3 parser bugs
Add 5 fuzz targets for stackforge-core parsers: - packet_parse: full Packet::parse() entry point - dns_layer: DNS name decompression, question/RR parsing - tls_layer: TLS record, handshake, SSLv2 parsing - http_layers: HTTP/1.x, HTTP/2 frames, HPACK decoding - field_access: direct field accessors across protocol layers Bugs found and fixed by fuzzing: - HPACK integer decode: arithmetic overflow in varint continuation - MQTT variable-length integer: multiply overflow before bounds check - ARP parser: off-by-one in length guard (offset+5 vs offset+6)
1 parent 3690740 commit 45f628c

4 files changed

Lines changed: 15 additions & 3 deletions

File tree

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/stackforge-core/src/layer/arp.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,10 @@ impl Layer for ArpLayer {
905905
fn extract_padding<'a>(&self, buf: &'a [u8]) -> (&'a [u8], &'a [u8]) {
906906
self.extract_padding(buf)
907907
}
908+
909+
fn field_names(&self) -> &'static [&'static str] {
910+
ArpLayer::field_names()
911+
}
908912
}
909913

910914
// ============================================================================

crates/stackforge-core/src/layer/dhcp/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,10 @@ impl Layer for DhcpLayer {
385385
let d = self.data(buf);
386386
d.len()
387387
}
388+
389+
fn field_names(&self) -> &'static [&'static str] {
390+
DHCP_FIELD_NAMES
391+
}
388392
}
389393

390394
/// Check if a UDP payload looks like a DHCP packet.

crates/stackforge-core/src/layer/ipv4/header.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,10 @@ impl Layer for Ipv4Layer {
863863
fn extract_padding<'a>(&self, buf: &'a [u8]) -> (&'a [u8], &'a [u8]) {
864864
self.extract_padding(buf)
865865
}
866+
867+
fn field_names(&self) -> &'static [&'static str] {
868+
Ipv4Layer::field_names()
869+
}
866870
}
867871

868872
#[cfg(test)]

0 commit comments

Comments
 (0)