Title: [239185] trunk/Source/bmalloc
Revision
239185
Author
mark....@apple.com
Date
2018-12-13 16:13:21 -0800 (Thu, 13 Dec 2018)

Log Message

Verify that tryLargeZeroedMemalignVirtual()'s aligned size and alignment values are valid.
https://bugs.webkit.org/show_bug.cgi?id=192682
<rdar://problem/37751522>

Reviewed by Saam Barati.

* bmalloc/bmalloc.cpp:
(bmalloc::api::tryLargeZeroedMemalignVirtual):

Modified Paths

Diff

Modified: trunk/Source/bmalloc/ChangeLog (239184 => 239185)


--- trunk/Source/bmalloc/ChangeLog	2018-12-13 23:25:20 UTC (rev 239184)
+++ trunk/Source/bmalloc/ChangeLog	2018-12-14 00:13:21 UTC (rev 239185)
@@ -1,3 +1,14 @@
+2018-12-13  Mark Lam  <mark....@apple.com>
+
+        Verify that tryLargeZeroedMemalignVirtual()'s aligned size and alignment values are valid.
+        https://bugs.webkit.org/show_bug.cgi?id=192682
+        <rdar://problem/37751522>
+
+        Reviewed by Saam Barati.
+
+        * bmalloc/bmalloc.cpp:
+        (bmalloc::api::tryLargeZeroedMemalignVirtual):
+
 2018-11-21  Dominik Infuehr  <dinfu...@igalia.com>
 
         Enable JIT on ARM/Linux

Modified: trunk/Source/bmalloc/bmalloc/bmalloc.cpp (239184 => 239185)


--- trunk/Source/bmalloc/bmalloc/bmalloc.cpp	2018-12-13 23:25:20 UTC (rev 239184)
+++ trunk/Source/bmalloc/bmalloc/bmalloc.cpp	2018-12-14 00:13:21 UTC (rev 239185)
@@ -39,13 +39,15 @@
     free(object, kind);
 }
 
-void* tryLargeZeroedMemalignVirtual(size_t alignment, size_t size, HeapKind kind)
+void* tryLargeZeroedMemalignVirtual(size_t requiredAlignment, size_t requestedSize, HeapKind kind)
 {
-    BASSERT(isPowerOfTwo(alignment));
+    RELEASE_BASSERT(isPowerOfTwo(requiredAlignment));
 
     size_t pageSize = vmPageSize();
-    alignment = roundUpToMultipleOf(pageSize, alignment);
-    size = roundUpToMultipleOf(pageSize, size);
+    size_t alignment = roundUpToMultipleOf(pageSize, requiredAlignment);
+    size_t size = roundUpToMultipleOf(pageSize, requestedSize);
+    RELEASE_BASSERT(alignment >= requiredAlignment);
+    RELEASE_BASSERT(size >= requestedSize);
 
     kind = mapToActiveHeapKind(kind);
     Heap& heap = PerProcess<PerHeapKind<Heap>>::get()->at(kind);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to