From 2f94c30baddaa6267961b3d61a86c438c3e9ac2c Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Tue, 13 Dec 2016 21:46:07 +0100 Subject: [PATCH] :white_check_mark: added a regression test for #380 / #390 --- README.md | 1 + test/src/unit-regression.cpp | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/README.md b/README.md index 04bdf192..fa045f7f 100644 --- a/README.md +++ b/README.md @@ -583,6 +583,7 @@ I deeply appreciate the help of the following people. - [TurpentineDistillery](https://github.com/TurpentineDistillery) pointed to [`std::locale::classic()`](http://en.cppreference.com/w/cpp/locale/locale/classic) to avoid too much locale joggling, found some nice performance improvements in the parser and improved the benchmarking code. - [cgzones](https://github.com/cgzones) had an idea how to fix the Coverity scan. - [Jared Grubb](https://github.com/jaredgrubb) silenced a nasty documentation warning. +- [Yixin Zhang](https://github.com/qwename) fixed an integer overflow check. Thanks a lot for helping out! diff --git a/test/src/unit-regression.cpp b/test/src/unit-regression.cpp index f6d05eff..3125c44e 100644 --- a/test/src/unit-regression.cpp +++ b/test/src/unit-regression.cpp @@ -533,4 +533,11 @@ TEST_CASE("regression tests") json j3 = json::parse("-9223372036854775809"); CHECK(j3.is_number_float()); } + + SECTION("issue #380 - bug in overflow detection when parsing integers") + { + json j = json::parse("166020696663385964490"); + CHECK(j.is_number_float()); + CHECK(j.dump() == "1.66020696663386e+20"); + } }