Skip to content

Commit c8e8b17

Browse files
committed
runtime: fix a UBSAN issue
This was identified by UBSAN: signed-integer-overflow. Explicitly mark the value as unsigned to ensure that the value does not overflow. There is a second instance of a raw literal, however, because it is a `*=` the value is implicitly understood to be unsigned.
1 parent 790e1a1 commit c8e8b17

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stdlib/public/runtime/MetadataCache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ class MetadataCacheKey {
471471

472472
private:
473473
uint32_t computeHash() const {
474-
size_t H = 0x56ba80d1 * NumKeyParameters;
474+
size_t H = 0x56ba80d1u * NumKeyParameters;
475475
for (unsigned index = 0; index != NumKeyParameters; ++index) {
476476
H = (H >> 10) | (H << ((sizeof(size_t) * 8) - 10));
477477
H ^= (reinterpret_cast<size_t>(Data[index])

0 commit comments

Comments
 (0)