danielaparker / jsoncons

A C++, header-only library for constructing JSON and JSON-like data formats, with JSON Pointer, JSON Patch, JSON Schema, JSONPath, JMESPath, CSV, MessagePack, CBOR, BSON, UBJSON
https://danielaparker.github.io/jsoncons
Other
699 stars 158 forks source link

Bugs and vulnerabilities in code #421

Closed AndreyAlifanov closed 1 year ago

AndreyAlifanov commented 1 year ago

Hi, PVS-Studio found bugs in code. Can you fix them? Thanks in advance.

1. Message: V1053: Calling the 'done' virtual function indirectly in the constructor may lead to unexpected result at runtime. Check lines: 'json_cursor.hpp:81', 'json_cursor.hpp:358', 'staj_cursor.hpp:1134'. Type: BUG Component: jsoncons/json_cursor.hpp Line: 81

2. Message: V1053: Calling the 'done' virtual function indirectly in the constructor may lead to unexpected result at runtime. Check lines: 'json_cursor.hpp:152', 'json_cursor.hpp:374', 'staj_cursor.hpp:1134'. Type: BUG Component: jsoncons/json_cursor.hpp

3. Message: [CWE-457] V730: Not all members of a class are initialized inside the constructor. Consider inspecting: selector_. Type: VULNERABILITY Component: jsoncons_ext/jsonpath/expression.hpp Line: 3055

4. Message: [CWE-691] V1037: Two or more case-branches perform the same actions. Check lines: 105, 111 Type: VULNERABILITY Component: jsoncons_ext/jsonpath/json_location.hpp Line: 105

5. Message: [CWE-670] V581: The conditional expressions of the 'if' statements situated alongside each other are identical. Check lines: 632, 633. Type: VULNERABILITY Component: jsoncons_ext/jsonpath/jsonpath_expression.hpp Line: 633

danielaparker commented 1 year ago

Fixed on master.