StringUtils.h contains potentially undefined behaviour when checking for whitespace.
|
const auto it = std::find_if(str.begin(), str.end(), [](char ch) { return !std::isspace(ch); }); |
and
|
std::find_if(str.rbegin(), str.rend(), [](char ch) { return !std::isspace(ch); }); |
Both should be converted to something equivalent to std::isspace(static_cast<unsigned char>(ch)).
From cppreference:
Like all other functions from cctype, the behavior of std::isspace is undefined if the argument's value is neither representable as unsigned char nor equal to EOF. To use these functions safely with plain chars (or signed chars), the argument should first be converted to unsigned char
I'm hitting asserts when loading a specific ICC profile for a virtual display in these functions when compiling on windows with MSVC:
Debug Assertion Failed!
Program: <redacted>
File: minkernel\crts\ucrt\src\appcrt\convert\isctype.cpp
Line: 36
Expression: c >= -1 && c <= 255
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
StringUtils.h contains potentially undefined behaviour when checking for whitespace.
OpenColorIO/src/utils/StringUtils.h
Line 109 in c7ad353
and
OpenColorIO/src/utils/StringUtils.h
Line 126 in c7ad353
Both should be converted to something equivalent to
std::isspace(static_cast<unsigned char>(ch)).From cppreference:
I'm hitting asserts when loading a specific ICC profile for a virtual display in these functions when compiling on windows with MSVC: