Skip to content

Commit 4269f04

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Fix 32-bit ext/hash build
2 parents aa52c29 + 2ee4d35 commit 4269f04

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ext/hash/hash_sha.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,8 @@ PHP_HASH_API void PHP_SHA384Update(PHP_SHA384_CTX * context, const unsigned char
525525
if ((context->count[0] += ((uint64_t) inputLen << 3)) < ((uint64_t) inputLen << 3)) {
526526
context->count[1]++;
527527
}
528-
context->count[1] += (uint64_t) (inputLen >> 61);
528+
/* The cast may seem unnecessary, but on 32-bit this makes sure the result is 0 without invoking undefined behaviour. */
529+
context->count[1] += (uint64_t) inputLen >> 61;
529530

530531
partLen = 128 - index;
531532

@@ -679,7 +680,8 @@ PHP_HASH_API void PHP_SHA512Update(PHP_SHA512_CTX * context, const unsigned char
679680
if ((context->count[0] += ((uint64_t) inputLen << 3)) < ((uint64_t) inputLen << 3)) {
680681
context->count[1]++;
681682
}
682-
context->count[1] += (uint64_t) (inputLen >> 61);
683+
/* The cast may seem unnecessary, but on 32-bit this makes sure the result is 0 without invoking undefined behaviour. */
684+
context->count[1] += (uint64_t) inputLen >> 61;
683685

684686
partLen = 128 - index;
685687

0 commit comments

Comments
 (0)