Index: third_party/zlib/crc_folding.c |
diff --git a/third_party/zlib/crc_folding.c b/third_party/zlib/crc_folding.c |
index 98c559cee39cc422f4b04b5e937dea818c1feba1..1ca44cc3ac1c7e393d787ca107d9f17c96655765 100644 |
--- a/third_party/zlib/crc_folding.c |
+++ b/third_party/zlib/crc_folding.c |
@@ -283,7 +283,9 @@ ZLIB_INTERNAL void crc_fold_copy(deflate_state *const s, |
goto partial; |
} |
- algn_diff = 0 - (unsigned long)src & 0xF; |
+ // Double cast to avoid truncation errors in 64-bit builds by making the |
+ // truncation explicit. |
+ algn_diff = 0 - (unsigned long)(size_t)src & 0xF; |
Peter Kasting
2015/10/05 03:56:04
I'm sorry, I don't understand what this is doing.
brucedawson
2015/10/05 16:03:23
The "known-negative in an unsigned" is definitely
Peter Kasting
2015/10/05 18:33:03
I think changing the source is OK, but maybe one o
|
if (algn_diff) { |
xmm_crc_part = _mm_loadu_si128((__m128i *)src); |
_mm_storeu_si128((__m128i *)dst, xmm_crc_part); |