Commit 76b527d6 authored by Jeff Walden's avatar Jeff Walden
Browse files

Bug 1443342 - Don't blacklist nsCSSProps.cpp:SortPropertyAndCount from...

Bug 1443342 - Don't blacklist nsCSSProps.cpp:SortPropertyAndCount from integer-overflow sanitizing.  r=froydnj

--HG--
extra : rebase_source : b5d9da242923e0ae43abf6a508e0298b64741466
parent 212527bd
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -149,10 +149,6 @@ fun:*OT*collect_glyphs*
# These look like harmless layouting-related overflows
src:*/gfx/cairo/libpixman/src/pixman-region.c

# Sorting code in layout/style/nsCSSProps.cpp that probably doesn't
# care about overflows.
fun:*SortPropertyAndCount*

# Code in ipc/chromium/src/base/file_path.cc where a function returns -1
# being cast to unsigned and then overflowed.
fun:*FilePath*Append*
+0 −4
Original line number Diff line number Diff line
@@ -156,10 +156,6 @@ fun:*OT*collect_glyphs*
# These look like harmless layouting-related overflows
src:*/gfx/cairo/libpixman/src/pixman-region.c

# Sorting code in layout/style/nsCSSProps.cpp that probably doesn't
# care about overflows.
fun:*SortPropertyAndCount*

# Code in ipc/chromium/src/base/file_path.cc where a function returns -1
# being cast to unsigned and then overflowed.
fun:*FilePath*Append*
+7 −2
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@
#include "nsCSSProps.h"

#include "mozilla/ArrayUtils.h"
#include "mozilla/Casting.h"

#include "nsCSSKeywords.h"
#include "nsLayoutUtils.h"
@@ -140,9 +141,13 @@ SortPropertyAndCount(const void* s1, const void* s2, void *closure)
{
  const PropertyAndCount *pc1 = static_cast<const PropertyAndCount*>(s1);
  const PropertyAndCount *pc2 = static_cast<const PropertyAndCount*>(s2);

  // Primary sort by count (lowest to highest)
  if (pc1->count != pc2->count)
    return pc1->count - pc2->count;
  if (pc1->count != pc2->count) {
    return AssertedCast<int32_t>(pc1->count) -
           AssertedCast<int32_t>(pc2->count);
  }

  // Secondary sort by property index (highest to lowest)
  return pc2->property - pc1->property;
}