MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / fuzz_fixext_skip_offsets

Function fuzz_fixext_skip_offsets

nodedb-query/src/msgpack_scan/reader.rs:994–1013  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

992 /// Verify all fixext types consume the correct byte count.
993 #[test]
994 fn fuzz_fixext_skip_offsets() {
995 // (tag, expected_bytes_consumed)
996 let cases: &[(u8, usize)] = &[
997 (0xd4, 3), // FIXEXT1: 1+1+1
998 (0xd5, 4), // FIXEXT2: 1+1+2
999 (0xd6, 6), // FIXEXT4: 1+1+4
1000 (0xd7, 10), // FIXEXT8: 1+1+8
1001 (0xd8, 18), // FIXEXT16: 1+1+16
1002 ];
1003 for &(tag, size) in cases {
1004 let mut buf = vec![0u8; size + 4];
1005 buf[0] = tag;
1006 let result = skip_value(&buf, 0);
1007 assert_eq!(
1008 result,
1009 Some(size),
1010 "fixext tag 0x{tag:02x} should advance by {size} bytes"
1011 );
1012 }
1013 }
1014
1015 /// Out-of-bounds offset must return `None` — not panic.
1016 #[test]

Callers

nothing calls this directly

Calls 1

skip_valueFunction · 0.85

Tested by

no test coverage detected