summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJihoon Kim <jihoon48.kim@samsung.com>2024-01-29 20:44:12 +0900
committerJihoon Kim <jihoon48.kim@samsung.com>2024-01-29 20:44:50 +0900
commitf00e4d030c9dd49e40a8fa08fcae0c1a1be5cf14 (patch)
tree1e594a89420fa0be1a816ae18fcf831c822e38bc
parentd2386df0d6f8edc61cba739623a360fdeeecb3d2 (diff)
downloadlibxkbcommon-f00e4d030c9dd49e40a8fa08fcae0c1a1be5cf14.tar.gz
libxkbcommon-f00e4d030c9dd49e40a8fa08fcae0c1a1be5cf14.tar.bz2
libxkbcommon-f00e4d030c9dd49e40a8fa08fcae0c1a1be5cf14.zip
Overflowed constant (INTEGER_OVERFLOW) overflow_const: Expression *out, which is equal to 3161, where *out * 16 + c - offset is known to be equal to 89, overflows the type that receives it, an unsigned integer 8 bits wide. Change-Id: I81fc7a20558c9b78f5c56647ae99c65189e42360 Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
-rw-r--r--src/scanner-utils.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/scanner-utils.h b/src/scanner-utils.h
index 674ecaa..e6cd192 100644
--- a/src/scanner-utils.h
+++ b/src/scanner-utils.h
@@ -203,11 +203,14 @@ static inline bool
scanner_hex(struct scanner *s, uint8_t *out)
{
int i;
+ unsigned int result = 0;
for (i = 0, *out = 0; is_xdigit(scanner_peek(s)) && i < 2; i++) {
const char c = scanner_next(s);
const char offset = (c >= '0' && c <= '9' ? '0' :
c >= 'a' && c <= 'f' ? 'a' - 10 : 'A' - 10);
- *out = *out * 16 + c - offset;
+
+ result = *out * 16 + c - offset;
+ *out = (uint8_t)result;
}
return i > 0;
}