Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: third_party/zlib/google.patch

Issue 1384773002: Fix VC++ 2015 64-bit truncation warning in zlib (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« third_party/zlib/crc_folding.c ('K') | « third_party/zlib/crc_folding.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/zlib/google.patch
diff --git a/third_party/zlib/google.patch b/third_party/zlib/google.patch
index 3818b11745073fb8afcf71719c84575fda690983..4388317461ccbfc83fe591a948e92153be8bd5d7 100644
--- a/third_party/zlib/google.patch
+++ b/third_party/zlib/google.patch
@@ -1,3 +1,17 @@
+diff -ru zlib-1.2.5/crc_folding.c zlib/crc_folding.c
+--- zlib-1.2.5/crc_folding.c
++++ zlib/crc_folding.c
+@@ -283,7 +283,9 @@
+ 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;
+ if (algn_diff) {
+ xmm_crc_part = _mm_loadu_si128((__m128i *)src);
+ _mm_storeu_si128((__m128i *)dst, xmm_crc_part);
diff -ru zlib-1.2.5/gzlib.c zlib/gzlib.c
--- zlib-1.2.5/gzlib.c
+++ zlib/gzlib.c
« third_party/zlib/crc_folding.c ('K') | « third_party/zlib/crc_folding.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698