Remove duplicate check for number of exception arguments
authorJan Vorlicek <janvorli@microsoft.com>
Fri, 20 Feb 2015 23:28:15 +0000 (00:28 +0100)
committerJan Vorlicek <janvorli@microsoft.com>
Fri, 20 Feb 2015 23:28:15 +0000 (00:28 +0100)
I have added a check for the exception arguments in my last commit, but it turns
out there was already one, only in a wrong place. So the exceptionRecord.NumberParameters
was set incorrectly to the unclipped value.

src/pal/src/exception/seh-unwind.cpp

index 873f62b..919c000 100644 (file)
@@ -223,8 +223,11 @@ RaiseException(IN DWORD dwExceptionCode,
         dwExceptionCode ^= RESERVED_SEH_BIT;
     }
 
-    if (nNumberOfArguments > EXCEPTION_MAXIMUM_PARAMETERS) 
+    if (nNumberOfArguments > EXCEPTION_MAXIMUM_PARAMETERS)
     {
+        WARN("Number of arguments (%d) exceeds the limit "
+            "EXCEPTION_MAXIMUM_PARAMETERS (%d); ignoring extra parameters.\n",
+            nNumberOfArguments, EXCEPTION_MAXIMUM_PARAMETERS);
         nNumberOfArguments = EXCEPTION_MAXIMUM_PARAMETERS;
     }
 
@@ -238,13 +241,6 @@ RaiseException(IN DWORD dwExceptionCode,
     exceptionRecord.NumberParameters = nNumberOfArguments;
     if (nNumberOfArguments)
     {
-        if (nNumberOfArguments > EXCEPTION_MAXIMUM_PARAMETERS)
-        {
-            WARN("Number of arguments (%d) exceeds the limit "
-                 "EXCEPTION_MAXIMUM_PARAMETERS (%d); ignoring extra parameters.\n",
-                  nNumberOfArguments, EXCEPTION_MAXIMUM_PARAMETERS);
-            nNumberOfArguments = EXCEPTION_MAXIMUM_PARAMETERS;
-        }
         CopyMemory(exceptionRecord.ExceptionInformation, lpArguments,
                    nNumberOfArguments * sizeof(ULONG_PTR));
     }