Add (failing) regression test for strtod locale TOCTOU bug
In debug builds, this test fails with `SIGABRT` due to an assertion. In release builds, truncation of the fractional part will be detected. Sometimes, this test may also cause memory violation (`SIGSEGV`) due to it being undefined behavior to set locale and use locale-dependent functions concurrently. On Windows, this does not happen since the global locale is protected by a mutex. This test assumes that a locale called "de_DE.UTF-8" exists on the host. If it does not, the test bails out but does not fail. The locale name is hard-coded because it is impossible to query available locales portably. "de_DE.UTF-8" is an accepted format on Ubuntu, macOS, and Windows. Signed-off-by: Jonas Greitemann <jgreitemann@gmail.com>
This commit is contained in:
1 parent
722c03495f
commit
0bc01a066c
2 files changed
+45
No files matched your search
@@ -121,6 +121,10 @@ json_test_set_test_options(test-disabled_exceptions
|
||||
# raise timeout of expensive Unicode test
|
||||
json_test_set_test_options(test-unicode4 TEST_PROPERTIES TIMEOUT 3000)
|
||||
|
||||
# link pthreads to tests that need it
|
||||
find_package(Threads REQUIRED)
|
||||
json_test_set_test_options(test-regression2 LINK_LIBRARIES Threads::Threads)
|
||||
|
||||
#############################################################################
|
||||
# add unit tests
|
||||
#############################################################################
|
||||
|
||||
Reference in new issue
Block a user