diff options
author | Jihoon Kim <jihoon48.kim@samsung.com> | 2024-01-29 20:44:12 +0900 |
---|---|---|
committer | Jihoon Kim <jihoon48.kim@samsung.com> | 2024-01-29 20:44:50 +0900 |
commit | f00e4d030c9dd49e40a8fa08fcae0c1a1be5cf14 (patch) | |
tree | 1e594a89420fa0be1a816ae18fcf831c822e38bc | |
parent | d2386df0d6f8edc61cba739623a360fdeeecb3d2 (diff) | |
download | libxkbcommon-f00e4d030c9dd49e40a8fa08fcae0c1a1be5cf14.tar.gz libxkbcommon-f00e4d030c9dd49e40a8fa08fcae0c1a1be5cf14.tar.bz2 libxkbcommon-f00e4d030c9dd49e40a8fa08fcae0c1a1be5cf14.zip |
Fix overflow issueaccepted/tizen/unified/x/20240205.063940accepted/tizen/unified/20240131.064253accepted/tizen/unified/20240131.064200accepted/tizen/unified/20240131.064100
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.h | 5 |
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; } |