[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

ggaren at apple.com ggaren at apple.com
Wed Dec 22 17:56:06 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 57bfa358919bafce4a9278b895ea3df8ba49ff66
Author: ggaren at apple.com <ggaren at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Dec 2 22:07:47 2010 +0000

    Added a little hardening to OSAllocator.
    
    Reviewed by Sam Weinig.
    
    * wtf/OSAllocatorPosix.cpp:
    (WTF::OSAllocator::release):
    * wtf/OSAllocatorWin.cpp:
    (WTF::OSAllocator::reserve):
    (WTF::OSAllocator::reserveAndCommit):
    (WTF::OSAllocator::commit):
    (WTF::OSAllocator::decommit):
    (WTF::OSAllocator::release): CRASH() if the OS's virtual memory system
    reports an error.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73198 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 0375b29..3c4cb1a 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,19 @@
+2010-12-02  Geoffrey Garen  <ggaren at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Added a little hardening to OSAllocator.
+
+        * wtf/OSAllocatorPosix.cpp:
+        (WTF::OSAllocator::release):
+        * wtf/OSAllocatorWin.cpp:
+        (WTF::OSAllocator::reserve):
+        (WTF::OSAllocator::reserveAndCommit):
+        (WTF::OSAllocator::commit):
+        (WTF::OSAllocator::decommit):
+        (WTF::OSAllocator::release): CRASH() if the OS's virtual memory system
+        reports an error.
+
 2010-12-02  Csaba Osztrogonác  <ossy at webkit.org>
 
         Reviewed by Geoffrey Garen.
diff --git a/JavaScriptCore/wtf/OSAllocatorPosix.cpp b/JavaScriptCore/wtf/OSAllocatorPosix.cpp
index 29b8904..147fefe 100644
--- a/JavaScriptCore/wtf/OSAllocatorPosix.cpp
+++ b/JavaScriptCore/wtf/OSAllocatorPosix.cpp
@@ -77,7 +77,9 @@ void OSAllocator::decommit(void* address, size_t bytes)
 
 void OSAllocator::release(void* address, size_t bytes)
 {
-    munmap(address, bytes);
+    int result = munmap(address, bytes);
+    if (result == -1)
+        CRASH();
 }
 
 } // namespace WTF
diff --git a/JavaScriptCore/wtf/OSAllocatorWin.cpp b/JavaScriptCore/wtf/OSAllocatorWin.cpp
index eb21e37..904331f 100644
--- a/JavaScriptCore/wtf/OSAllocatorWin.cpp
+++ b/JavaScriptCore/wtf/OSAllocatorWin.cpp
@@ -27,34 +27,47 @@
 #include "OSAllocator.h"
 
 #include "windows.h"
+#include <wtf/Assertions.h>
 
 namespace WTF {
 
 void* OSAllocator::reserve(size_t bytes)
 {
-    return VirtualAlloc(0, bytes, MEM_RESERVE, PAGE_READWRITE);
+    void* result = VirtualAlloc(0, bytes, MEM_RESERVE, PAGE_READWRITE);
+    if (!result)
+        CRASH();
+    return result;
 }
 
 void* OSAllocator::reserveAndCommit(size_t bytes)
 {
-    return VirtualAlloc(0, bytes, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
+    void* result = VirtualAlloc(0, bytes, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
+    if (!result)
+        CRASH();
+    return result;
 }
 
 void OSAllocator::commit(void* address, size_t bytes)
 {
-    VirtualAlloc(address, bytes, MEM_COMMIT, PAGE_READWRITE);
+    void* result = VirtualAlloc(address, bytes, MEM_COMMIT, PAGE_READWRITE);
+    if (!result)
+        CRASH();
 }
 
 void OSAllocator::decommit(void* address, size_t bytes)
 {
-    VirtualFree(address, bytes, MEM_DECOMMIT);
+    bool result = VirtualFree(address, bytes, MEM_DECOMMIT);
+    if (!result)
+        CRASH();
 }
 
 void OSAllocator::release(void* address, size_t bytes)
 {
     // According to http://msdn.microsoft.com/en-us/library/aa366892(VS.85).aspx,
     // dwSize must be 0 if dwFreeType is MEM_RELEASE.
-    VirtualFree(address, 0, MEM_RELEASE);
+    bool result = VirtualFree(address, 0, MEM_RELEASE);
+    if (!result)
+        CRASH();
 }
 
 } // namespace WTF

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list