Skip to content

Wrong read error #103

@lnkuiper

Description

@lnkuiper

Describe the bug
A wrong read error is given when a JSON string is terminated at a specific place. For example:

{"duck": 42.

Will give a YYJSON_READ_ERROR_INVALID_NUMBER. However, it should be YYJSON_READ_ERROR_UNEXPECTED_END.

Your environment

  • OS: macOS Ventura 13.0
  • Compiler: Apple clang 14

Additional context
I've implemented a streaming read in DuckDB using yyjson, and we read a file block-by-block. The block boundaries are arbitrary, so this happened while running a test.

I've changed occurrences of return_err(cur - 1, INVALID_NUMBER, msg); in yyjson.cpp to return_err(cur, INVALID_NUMBER, msg);, which seems to solve the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions