Skip to content

jsoncpp, as a shared library, should not call abort in Reader::readValue() #1618

@xuhdev

Description

@xuhdev

Describe the bug

jsoncpp, as a shared library, should not call abort merely because there's an error reading a value:

throwRuntimeError("Exceeded stackLimit in readValue().");

See https://en.cppreference.com/w/c/program/abort, abort should only be called to abnormally cause the program to exit. Functions inserted by atexit are also not called, meaning that the host program may have not cleaned up resources properly. But here, exceeding stack limit isn't a sign of abnormalty.

exit is not a good substitute either, see the exit-in-shared-library from Debian:
https://lintian.debian.org/tags/exit-in-shared-library.html

In this case, returning false seems like a better idea.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions