Skip to content

Json parser successfully parses malformed json without raising an issue (\n in property name) #34

@Rumata888

Description

@Rumata888

Aim

Test if malformed input is handled correctly

Expected Behavior

Assertion failure (the test should have failed)

Bug

Json parser thinks that there can be newlines in property names

To Reproduce

#[test(should_fail)]
fn newline_in_property_name() {
    let json_string ="{\"\n\":0}";

    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+d1f5f105719b1a881f7a68df09917d332bcf19de (git version hash: d1f5f105719b1a881f7a68df09917d332bcf19de, is dirty: true)

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

📋 Backlog

Status

👀 To Triage

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions