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

ASSERT error while parsing BJData #3513

Closed
2 tasks done
nlohmann opened this issue Jun 1, 2022 · 1 comment · Fixed by #3514
Closed
2 tasks done

ASSERT error while parsing BJData #3513

nlohmann opened this issue Jun 1, 2022 · 1 comment · Fixed by #3514
Assignees
Labels
aspect: binary formats BSON, CBOR, MessagePack, UBJSON kind: bug solution: proposed fix a fix for the issue has been proposed and waits for confirmation

Comments

@nlohmann
Copy link
Owner

nlohmann commented Jun 1, 2022

Description

OSS-Fuzz reports an assertion: ASSERT: ref_stack.back()->is_array()

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=47756
https://oss-fuzz.com/testcase?key=5094223252160512

Reproduction steps

Parse bytes

5b48 5b24 6923 5502 0301 2039 205d

with with from_bjdata.
clusterfuzz-testcase-minimized-parse_bjdata_fuzzer-5094223252160512.bjdata.zip

Expected vs. actual results

Expected: Parse error.

Actual:

Assertion failed: (ref_stack.back()->is_array()), function end_array, file json_sax.hpp, line 269.

The following SAX events are emitted:

<array>
    <object size="3">
        <key key="_ArraySize_" />
        <array size="2">
            <number_integer val="3" />
            <number_integer val="1" />
        </array>
        <number_unsigned val="9" />   <!-- this should be a key -->
    </array>  <!-- this should be a </object> -->

The error is similar to previous errors.

Minimal code example

See above.

Error messages

Assertion failed: (ref_stack.back()->is_array()), function end_array, file json_sax.hpp, line 269.

Compiler and operating system

OSS-Fuzz

Library version

develop

Validation

@nlohmann nlohmann added kind: bug aspect: binary formats BSON, CBOR, MessagePack, UBJSON labels Jun 1, 2022
@nlohmann
Copy link
Owner Author

nlohmann commented Jun 1, 2022

CC @fangq

fangq added a commit to NeuroJSON/json that referenced this issue Jun 1, 2022
fangq added a commit to NeuroJSON/json that referenced this issue Jun 1, 2022
@nlohmann nlohmann self-assigned this Jun 3, 2022
@nlohmann nlohmann added the solution: proposed fix a fix for the issue has been proposed and waits for confirmation label Jun 3, 2022
@nlohmann nlohmann added this to the Release 3.11.0 milestone Jun 3, 2022
nlohmann pushed a commit that referenced this issue Jun 3, 2022
* Fix #3513, explain is_ndarray flag

* add test for ndarray size following H
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aspect: binary formats BSON, CBOR, MessagePack, UBJSON kind: bug solution: proposed fix a fix for the issue has been proposed and waits for confirmation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant