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

Json parser successfully parses malformed json without raising an issue #30

Open
Rumata888 opened this issue Jan 11, 2025 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Rumata888
Copy link

Aim

Test if malformed input is handled correctly

Expected Behavior

Assertion failure (the test should have failed

Bug

Json parser ignores ""}" in the end

To Reproduce

#[test(should_fail)]
fn closing_bracket() {
    let json_string = "{ } \"}";

    let json_string_bytes = json_string.as_bytes();
    let mut json_buffer = [32; 512];
    for i in 0..json_string_bytes.len() {
        json_buffer[512 - json_string_bytes.len() + i] = json_string_bytes[i];
    }
    let json = JSON512b::parse_json(json_buffer);
}

Workaround

None

Workaround Description

No response

Additional Context

No response

Project Impact

None

Blocker Context

No response

Nargo Version

nargo version = 1.0.0-beta.1 noirc version = 1.0.0-beta.1+6d85cd6d52eebdaa7a91a019dddf21df4351f707

NoirJS Version

No response

Proving Backend Tooling & Version

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

@Rumata888 Rumata888 added the bug Something isn't working label Jan 11, 2025
@Rumata888
Copy link
Author

There is a similar issue. I don't know it it's separate or the same:

#[test(should_fail)]
fn forward_slash() {
    let json_string = "{}\"\t/}";

    let json_string_bytes = json_string.as_bytes();
    let mut json_buffer = [32; 512];
    for i in 0..json_string_bytes.len() {
        json_buffer[512 - json_string_bytes.len() + i] = json_string_bytes[i];
    }
    let json = JSON512b::parse_json(json_buffer);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants