Skip to content

Integer-overflow (OSS-Fuzz issue 267) #389

@nlohmann

Description

@nlohmann

The library is continuously fuzz tested by Google's OSS-Fuzz. Today, an error was reported:

Detailed report: https://clusterfuzz-external.appspot.com/testcase?key=6062909058711552

Project: json
Fuzzer: libFuzzer_json_parse_fuzzer
Fuzz target binary: parse_fuzzer
Job Type: libfuzzer_ubsan_json
Platform Id: linux

Crash Type: Integer-overflow
Crash Address: 
Crash State:
  nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<cha
  nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<cha
  nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<cha
  

Minimized Testcase (0.34 Kb): https://clusterfuzz-external.appspot.com/download/AMIfv95dNmUALTp5hmbUCvNgnX8D8PnyrgGS7MUFE5Ag4XZV5PfVwXKLx3R-w6MapVK4_oLtah9R6cfasZ3oDG0zpihRP4LjUzOGgyCWsph28ZF4cHoZlRPwQsfXQT-CHwEbfEqhWte9hSB_nv8k6tAq-BwzeUJ87y8lGiAfeRphECPodTdkfMQ?testcase_id=6062909058711552

Issue filed automatically.

See https://github.com/google/oss-fuzz/blob/master/docs/reproducing.md for more information.

This bug is subject to a 90 day disclosure deadline. If 90 days elapse
without an upstream patch, then the bug report will automatically
become visible to the public.

The linked report contains this input file: fuzz-2-json_parse_fuzzer.zip

Furthermore, this error message describes the error.

src/json.hpp:9217:49: runtime error: negation of -9223372036854775808 cannot be represented in type number_integer_t (aka long); cast to an unsigned type to negate this value to itself

This is the line in question:

result.m_value.number_integer = -static_cast<number_integer_t>(value);

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions