diff --git a/Makefile b/Makefile index b53d8d3d..4c96bad7 100644 --- a/Makefile +++ b/Makefile @@ -66,6 +66,9 @@ fuzz: test/src/fuzz.cpp src/json.hpp cppcheck: cppcheck --enable=warning --inconclusive --force --std=c++11 src/json.hpp --error-exitcode=1 +clang_sanitize: clean + CXX=clang++ CXXFLAGS="-g -O2 -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer" $(MAKE) + ########################################################################## # maintainer targets ########################################################################## diff --git a/README.md b/README.md index 9893fedd..c1453408 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,8 @@ [](https://github.com/nlohmann/json/releases) [](https://travis-ci.org/nlohmann/json) -[](https://ci.appveyor.com/project/nlohmann/json) +[](https://ci.appveyor.com/project/nlohmann/json) [](https://coveralls.io/r/nlohmann/json) -[](https://scan.coverity.com/projects/nlohmann-json) [](http://melpon.org/wandbox/permlink/p5o4znPnGHJpDVqN) [](http://nlohmann.github.io/json) [](https://raw.githubusercontent.com/nlohmann/json/master/LICENSE.MIT) diff --git a/src/json.hpp b/src/json.hpp index 3fdcbaa1..0aa45af5 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -2212,7 +2212,8 @@ class basic_json { std::stringstream ss; // fix locale problems - ss.imbue(std::locale(std::locale(), new DecimalSeparator)); + const static std::locale loc(std::locale(), new DecimalSeparator); + ss.imbue(loc); // 6, 15 or 16 digits of precision allows round-trip IEEE 754 // string->float->string, string->double->string or string->long diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index 5107e056..dbc5dec3 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -2212,7 +2212,8 @@ class basic_json { std::stringstream ss; // fix locale problems - ss.imbue(std::locale(std::locale(), new DecimalSeparator)); + const static std::locale loc(std::locale(), new DecimalSeparator); + ss.imbue(loc); // 6, 15 or 16 digits of precision allows round-trip IEEE 754 // string->float->string, string->double->string or string->long