Skip to content

Commit

Permalink
fixing UB
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdasar1985 authored and horenmar committed Jul 22, 2020
1 parent 5c50232 commit 3ceaad7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/catch2/internal/catch_clara_upstream.hpp
Expand Up @@ -667,7 +667,7 @@ namespace detail {
}
inline auto convertInto( std::string const &source, bool &target ) -> ParserResult {
std::string srcLC = source;
std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( char c ) { return static_cast<char>( std::tolower(c) ); } );
std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( unsigned char c ) { return static_cast<char>( std::tolower(c) ); } );
if (srcLC == "y" || srcLC == "1" || srcLC == "true" || srcLC == "yes" || srcLC == "on")
target = true;
else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off")
Expand Down
2 changes: 1 addition & 1 deletion src/catch2/internal/catch_string_manip.cpp
Expand Up @@ -18,7 +18,7 @@ namespace Catch {

namespace {
char toLowerCh(char c) {
return static_cast<char>( std::tolower( c ) );
return static_cast<char>( std::tolower( static_cast<unsigned char>(c) ) );
}
}

Expand Down
2 changes: 1 addition & 1 deletion third_party/clara.hpp
Expand Up @@ -667,7 +667,7 @@ namespace detail {
}
inline auto convertInto( std::string const &source, bool &target ) -> ParserResult {
std::string srcLC = source;
std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( char c ) { return static_cast<char>( ::tolower(c) ); } );
std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( unsigned char c ) { return static_cast<char>( ::tolower( c ) ); } );
if (srcLC == "y" || srcLC == "1" || srcLC == "true" || srcLC == "yes" || srcLC == "on")
target = true;
else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off")
Expand Down

0 comments on commit 3ceaad7

Please sign in to comment.