Skip to content

Commit 3ceaad7

Browse files
bogdasar1985horenmar
authored andcommitted
fixing UB
1 parent 5c50232 commit 3ceaad7

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/catch2/internal/catch_clara_upstream.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ namespace detail {
667667
}
668668
inline auto convertInto( std::string const &source, bool &target ) -> ParserResult {
669669
std::string srcLC = source;
670-
std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( char c ) { return static_cast<char>( std::tolower(c) ); } );
670+
std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( unsigned char c ) { return static_cast<char>( std::tolower(c) ); } );
671671
if (srcLC == "y" || srcLC == "1" || srcLC == "true" || srcLC == "yes" || srcLC == "on")
672672
target = true;
673673
else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off")

src/catch2/internal/catch_string_manip.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace Catch {
1818

1919
namespace {
2020
char toLowerCh(char c) {
21-
return static_cast<char>( std::tolower( c ) );
21+
return static_cast<char>( std::tolower( static_cast<unsigned char>(c) ) );
2222
}
2323
}
2424

third_party/clara.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ namespace detail {
667667
}
668668
inline auto convertInto( std::string const &source, bool &target ) -> ParserResult {
669669
std::string srcLC = source;
670-
std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( char c ) { return static_cast<char>( ::tolower(c) ); } );
670+
std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( unsigned char c ) { return static_cast<char>( ::tolower( c ) ); } );
671671
if (srcLC == "y" || srcLC == "1" || srcLC == "true" || srcLC == "yes" || srcLC == "on")
672672
target = true;
673673
else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off")

0 commit comments

Comments
 (0)