Add fuzz/c/std/cbor_fuzzer.c

This commit is contained in:
Nigel Tao committed 2020-08-10 22:29:08 +10:00
1 parent 2397d02997
commit 28ef6a7862
6 files changed
+453 -6

No files matched your search

+23
View File
@@ -18,8 +18,29 @@ pub status "#unsupported recursion depth"
pri status "#internal error: inconsistent I/O"
pri status "#internal error: inconsistent token length"
// --------
// DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE is the largest workbuf length that a
// decoder will request.
pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE : base.u64 = 0
// DECODER_DEPTH_MAX_INCL is the maximum supported recursion depth: how deeply
// nested [] arrays and {} maps can be.
//
// The CBOR spec itself does not define a limit, but allows implementations to
// set their own limits.
pub const DECODER_DEPTH_MAX_INCL : base.u64 = 1024
// DECODER_DST_TOKEN_BUFFER_LENGTH_MIN_INCL is the minimum length of the dst
// wuffs_base__token_buffer passed to the decoder.
pub const DECODER_DST_TOKEN_BUFFER_LENGTH_MIN_INCL : base.u64 = 2
// DECODER_SRC_IO_BUFFER_LENGTH_MIN_INCL is the minimum length of the src
// wuffs_base__io_buffer passed to the decoder.
pub const DECODER_SRC_IO_BUFFER_LENGTH_MIN_INCL : base.u64 = 9
// --------
// TOKEN_VALUE_MAJOR is the base-38 encoding of "cbor".
pub const TOKEN_VALUE_MAJOR : base.u32 = 0x0C_061D
@@ -53,6 +74,8 @@ pub const TOKEN_VALUE_MINOR__SIMPLE_VALUE : base.u32 = 0x080_0000
// token has zero length.
pub const TOKEN_VALUE_MINOR__TAG : base.u32 = 0x040_0000
// --------
pri const LITERALS : array[4] base.u32[..= 0x1FF_FFFF] = [
(base.TOKEN__VBC__LITERAL << 21) | base.TOKEN__VBD__LITERAL__FALSE,
(base.TOKEN__VBC__LITERAL << 21) | base.TOKEN__VBD__LITERAL__TRUE,
+4
View File
@@ -22,6 +22,10 @@ pub status "#unsupported recursion depth"
pri status "#internal error: inconsistent I/O"
// --------
// DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE is the largest workbuf length that a
// decoder will request.
pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE : base.u64 = 0
// DECODER_DEPTH_MAX_INCL is the maximum supported recursion depth: how deeply