Skip to content

Nul character allowed in JSON? #357

Closed

Description

@edgarogh

Hello, I'm doing differential fuzzing to find issues in my own JSON lexer, and it seems like simd-json allows nul bytes within an array:

fn main() {
    let mut source = Vec::from(b"[-2374611873366417043\0]".as_slice());
    let _ = dbg!(simd_json::to_borrowed_value(&mut source));
}
[src/main.rs:6] simd_json::to_borrowed_value(&mut source) = Ok(
    Array(
        [
            Static(
                I64(
                    -2374611873366417043,
                ),
            ),
        ],
    ),
)

My lexer and Firefox's JSON.parse both reject it. According to the spec, NUL bytes are not part of allowed whitespace characters.

Activity

  1. Licenser commented on Nov 9, 2023

    @Licenser
    Member

    you are right, this should error 👍 I don't have time to look at it right now but it's a bug in simd-json not your library :)

  2. Licenser commented on Jul 9, 2026

    @Licenser
    Member

    fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions