Bug 1230910 Replace GetExceptionCode() with a constant choice of EXCEPTION_ACCESS_VIOLATION. draft
authorTom Ritter <tom@mozilla.com>
Thu, 09 Mar 2017 17:46:23 +0000
changeset 656099 0d1523f9a2a3bf125075117810d4c55eeca28d3a
parent 656098 8629955dbef6634d51f21f71900e5277fba9cb0d
child 656100 358c63cf9a095722b966036374fa585332b7467e
push id77058
push userbmo:tom@mozilla.com
push dateWed, 30 Aug 2017 18:21:00 +0000
bugs1230910
milestone57.0a1
Bug 1230910 Replace GetExceptionCode() with a constant choice of EXCEPTION_ACCESS_VIOLATION. While MinGW appears to define the macro (mapping it to the function _exception_code) there is no definition of the function, so it results in a linker error. MozReview-Commit-ID: E5qZSA2Hsff
security/sandbox/chromium/sandbox/win/src/sandbox_nt_util.cc
--- a/security/sandbox/chromium/sandbox/win/src/sandbox_nt_util.cc
+++ b/security/sandbox/chromium/sandbox/win/src/sandbox_nt_util.cc
@@ -218,17 +218,17 @@ bool ValidParameter(void* buffer, size_t
   return true;
 }
 
 NTSTATUS CopyData(void* destination, const void* source, size_t bytes) {
   NTSTATUS ret = STATUS_SUCCESS;
   __try1(ehandler) {
     g_nt.memcpy(destination, source, bytes);
   } __except1 {
-    ret = GetExceptionCode();
+    ret = EXCEPTION_ACCESS_VIOLATION;//GetExceptionCode();
   }
   return ret;
 }
 
 NTSTATUS AllocAndGetFullPath(HANDLE root,
                              wchar_t* path,
                              wchar_t** full_path) {
   if (!InitHeap())
@@ -278,17 +278,17 @@ NTSTATUS AllocAndGetFullPath(HANDLE root
       off += 1;
       ret = CopyData(off, path, wcslen(path) * sizeof(wchar_t));
       if (!NT_SUCCESS(ret))
         break;
       off += wcslen(path);
       *off = L'\0';
     } while (false);
   } __except1 {
-    ret = GetExceptionCode();
+    ret = EXCEPTION_ACCESS_VIOLATION;//GetExceptionCode();
   }
 
   if (!NT_SUCCESS(ret)) {
     if (*full_path) {
       operator delete(*full_path, NT_ALLOC);
       *full_path = NULL;
     }
     if (handle_name) {
@@ -335,17 +335,17 @@ NTSTATUS AllocAndCopyName(const OBJECT_A
       if (attributes)
         *attributes = in_object->Attributes;
 
       if (root)
         *root = in_object->RootDirectory;
       ret = STATUS_SUCCESS;
     } while (false);
   } __except1 {
-    ret = GetExceptionCode();
+    ret = EXCEPTION_ACCESS_VIOLATION;//GetExceptionCode();
   }
 
   if (!NT_SUCCESS(ret) && *out_name) {
     operator delete(*out_name, NT_ALLOC);
     *out_name = NULL;
   }
 
   return ret;