Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nul character allowed in JSON? #357

Open
edgarogh opened this issue Nov 7, 2023 · 1 comment
Open

Nul character allowed in JSON? #357

edgarogh opened this issue Nov 7, 2023 · 1 comment

Comments

@edgarogh
Copy link

edgarogh commented Nov 7, 2023

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.

@Licenser
Copy link
Member

Licenser commented Nov 9, 2023

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants