summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-01-08 14:44:10 (GMT)
committerKitware Robot <kwrobot@kitware.com>2024-01-08 14:44:30 (GMT)
commit2cc792ba29668f3d8d4a2a03ff79baba947ec3c2 (patch)
tree6d24ea89a737d98a4918919a0a8840064713439d
parentddb608b1d95398774324761d68d71c8112882236 (diff)
parent5e8c176e2ac38617b35eb9152ef76d949ef736e8 (diff)
downloadCMake-2cc792ba29668f3d8d4a2a03ff79baba947ec3c2.zip
CMake-2cc792ba29668f3d8d4a2a03ff79baba947ec3c2.tar.gz
CMake-2cc792ba29668f3d8d4a2a03ff79baba947ec3c2.tar.bz2
Merge topic 'fix-isspace-usage-for-signed-char'
5e8c176e2a cmExecuteProcessCommand: Cast c to unsigned char before cast to int Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !9132
-rw-r--r--Source/cmExecuteProcessCommand.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx
index e764545..483a601 100644
--- a/Source/cmExecuteProcessCommand.cxx
+++ b/Source/cmExecuteProcessCommand.cxx
@@ -35,7 +35,11 @@
namespace {
bool cmExecuteProcessCommandIsWhitespace(char c)
{
- return (isspace(static_cast<int>(c)) || c == '\n' || c == '\r');
+ // isspace takes 'int' but documents that the value must be representable
+ // by 'unsigned char', or EOF. Cast to 'unsigned char' to avoid sign
+ // extension while casting to 'int'.
+ return (isspace(static_cast<int>(static_cast<unsigned char>(c))) ||
+ c == '\n' || c == '\r');
}
void cmExecuteProcessCommandFixText(std::vector<char>& output,