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 496079 5732bd44616c876672dc98e2b367d0bf24dc1565
parent 496078 d55b025d1cbacd503674842ac2de52fe52c738f1
child 496080 2b6205ac822c79eaaba56a41f8d938aebcaae393
push id48518
push userbmo:tom@mozilla.com
push dateThu, 09 Mar 2017 19:30:51 +0000
bugs1230910
milestone52.0.1
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
@@ -209,17 +209,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())
@@ -269,17 +269,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) {
@@ -326,17 +326,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;