Bug 1443342 - Blacklist nsZipArchive.cpp's entry-name hashing function from being checked for unsigned integer overflows, because it knowingly relies on them. r=froydnj
authorJeff Walden <jwalden@mit.edu>
Thu, 01 Mar 2018 17:11:39 -0800
changeset 461867 f0a425ee1c3e01dec622b94a382bfda8844bfab6
parent 461866 6c03114535c2f46772920fec5ac13f724537500d
child 461868 0ac335714eb84703979c29503305fd82c035eec0
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1443342
milestone60.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1443342 - Blacklist nsZipArchive.cpp's entry-name hashing function from being checked for unsigned integer overflows, because it knowingly relies on them. r=froydnj
build/sanitizers/ubsan_signed_overflow_blacklist.txt
build/sanitizers/ubsan_unsigned_overflow_blacklist.txt
modules/libjar/nsZipArchive.cpp
--- a/build/sanitizers/ubsan_signed_overflow_blacklist.txt
+++ b/build/sanitizers/ubsan_signed_overflow_blacklist.txt
@@ -248,19 +248,16 @@ src:*/xpcom/ds/PLDHashTable.cpp
 fun:*GradientShaderCache*Build32bitCache*
 
 # Hashing functions in Cairo
 fun:*_hash_matrix_fnv*
 fun:*_hash_mix_bits*
 fun:*_cairo_hash_string*
 fun:*_cairo_hash_bytes*
 
-# Hash function in modules/libjar/nsZipArchive.cpp
-fun:*HashName*
-
 # intl code hashing functions
 fun:*ustr_hash*CharsN*
 fun:*hashEntry*
 
 # harfbuzz hash/digest functions
 fun:*hb_set_digest_lowest_bits_t*
 
 # Hash function in gfx
--- a/build/sanitizers/ubsan_unsigned_overflow_blacklist.txt
+++ b/build/sanitizers/ubsan_unsigned_overflow_blacklist.txt
@@ -255,19 +255,16 @@ src:*/xpcom/ds/PLDHashTable.cpp
 fun:*GradientShaderCache*Build32bitCache*
 
 # Hashing functions in Cairo
 fun:*_hash_matrix_fnv*
 fun:*_hash_mix_bits*
 fun:*_cairo_hash_string*
 fun:*_cairo_hash_bytes*
 
-# Hash function in modules/libjar/nsZipArchive.cpp
-fun:*HashName*
-
 # intl code hashing functions
 fun:*ustr_hash*CharsN*
 fun:*hashEntry*
 
 # harfbuzz hash/digest functions
 fun:*hb_set_digest_lowest_bits_t*
 
 # Hash function in gfx
--- a/modules/libjar/nsZipArchive.cpp
+++ b/modules/libjar/nsZipArchive.cpp
@@ -13,16 +13,17 @@
 #define READTYPE  int32_t
 #include "zlib.h"
 #ifdef MOZ_JAR_BROTLI
 #include "brotli/decode.h" // brotli
 #endif
 #include "nsISupportsUtils.h"
 #include "prio.h"
 #include "plstr.h"
+#include "mozilla/Attributes.h"
 #include "mozilla/Logging.h"
 #include "mozilla/UniquePtrExtensions.h"
 #include "stdlib.h"
 #include "nsWildCard.h"
 #include "nsZipArchive.h"
 #include "nsString.h"
 #include "prenv.h"
 #if defined(XP_WIN)
@@ -959,16 +960,17 @@ nsZipFind::~nsZipFind()
 // helper functions
 //------------------------------------------
 
 /*
  * HashName
  *
  * returns a hash key for the entry name
  */
+MOZ_NO_SANITIZE_UNSIGNED_OVERFLOW
 static uint32_t HashName(const char* aName, uint16_t len)
 {
   MOZ_ASSERT(aName != 0);
 
   const uint8_t* p = (const uint8_t*)aName;
   const uint8_t* endp = p + len;
   uint32_t val = 0;
   while (p != endp) {