Title: [270817] branches/safari-610-branch/Source
Revision
270817
Author
[email protected]
Date
2020-12-14 17:29:06 -0800 (Mon, 14 Dec 2020)

Log Message

Cherry-pick r270449. rdar://problem/72298505

    Add safety checks to xsltParamArrayFromParameterMap()
    <https://webkit.org/b/219407>
    <rdar://problem/71853069>

    Reviewed by Darin Adler.

    Source/WebCore:

    * xml/XSLTProcessorLibxslt.cpp:
    (WebCore::xsltParamArrayFromParameterMap):

    Source/WTF:

    * wtf/PlatformHave.h:
    (HAVE_LIBXSLT_FIX_FOR_RADAR_71864140): Add.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270449 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-610-branch/Source/WTF/ChangeLog (270816 => 270817)


--- branches/safari-610-branch/Source/WTF/ChangeLog	2020-12-15 01:28:48 UTC (rev 270816)
+++ branches/safari-610-branch/Source/WTF/ChangeLog	2020-12-15 01:29:06 UTC (rev 270817)
@@ -1,3 +1,36 @@
+2020-12-14  Alan Coon  <[email protected]>
+
+        Cherry-pick r270449. rdar://problem/72298505
+
+    Add safety checks to xsltParamArrayFromParameterMap()
+    <https://webkit.org/b/219407>
+    <rdar://problem/71853069>
+    
+    Reviewed by Darin Adler.
+    
+    Source/WebCore:
+    
+    * xml/XSLTProcessorLibxslt.cpp:
+    (WebCore::xsltParamArrayFromParameterMap):
+    
+    Source/WTF:
+    
+    * wtf/PlatformHave.h:
+    (HAVE_LIBXSLT_FIX_FOR_RADAR_71864140): Add.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270449 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-12-04  David Kilzer  <[email protected]>
+
+            Add safety checks to xsltParamArrayFromParameterMap()
+            <https://webkit.org/b/219407>
+            <rdar://problem/71853069>
+
+            Reviewed by Darin Adler.
+
+            * wtf/PlatformHave.h:
+            (HAVE_LIBXSLT_FIX_FOR_RADAR_71864140): Add.
+
 2020-12-08  Russell Epstein  <[email protected]>
 
         Cherry-pick r270052. rdar://problem/72099688

Modified: branches/safari-610-branch/Source/WTF/wtf/PlatformHave.h (270816 => 270817)


--- branches/safari-610-branch/Source/WTF/wtf/PlatformHave.h	2020-12-15 01:28:48 UTC (rev 270816)
+++ branches/safari-610-branch/Source/WTF/wtf/PlatformHave.h	2020-12-15 01:29:06 UTC (rev 270817)
@@ -710,3 +710,10 @@
 #define HAVE_AVSPEECHSYNTHESIS_SYSTEMVOICE 1
 #endif
 #endif
+
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 110200) \
+    || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140400) \
+    || (PLATFORM(WATCHOS) && __WATCH_OS_VERSION_MAX_ALLOWED >= 70300) \
+    || (PLATFORM(APPLETV) && __TV_OS_VERSION_MAX_ALLOWED >= 140400)
+#define HAVE_LIBXSLT_FIX_FOR_RADAR_71864140 1
+#endif

Modified: branches/safari-610-branch/Source/WebCore/ChangeLog (270816 => 270817)


--- branches/safari-610-branch/Source/WebCore/ChangeLog	2020-12-15 01:28:48 UTC (rev 270816)
+++ branches/safari-610-branch/Source/WebCore/ChangeLog	2020-12-15 01:29:06 UTC (rev 270817)
@@ -1,5 +1,38 @@
 2020-12-14  Alan Coon  <[email protected]>
 
+        Cherry-pick r270449. rdar://problem/72298505
+
+    Add safety checks to xsltParamArrayFromParameterMap()
+    <https://webkit.org/b/219407>
+    <rdar://problem/71853069>
+    
+    Reviewed by Darin Adler.
+    
+    Source/WebCore:
+    
+    * xml/XSLTProcessorLibxslt.cpp:
+    (WebCore::xsltParamArrayFromParameterMap):
+    
+    Source/WTF:
+    
+    * wtf/PlatformHave.h:
+    (HAVE_LIBXSLT_FIX_FOR_RADAR_71864140): Add.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270449 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-12-04  David Kilzer  <[email protected]>
+
+            Add safety checks to xsltParamArrayFromParameterMap()
+            <https://webkit.org/b/219407>
+            <rdar://problem/71853069>
+
+            Reviewed by Darin Adler.
+
+            * xml/XSLTProcessorLibxslt.cpp:
+            (WebCore::xsltParamArrayFromParameterMap):
+
+2020-12-14  Alan Coon  <[email protected]>
+
         Cherry-pick r270373. rdar://problem/72298666
 
     iframe with `sandbox=allow-top-navigation-by-user-activation` can navigate top frame when the user interacts with an iframe from another origin

Modified: branches/safari-610-branch/Source/WebCore/xml/XSLTProcessorLibxslt.cpp (270816 => 270817)


--- branches/safari-610-branch/Source/WebCore/xml/XSLTProcessorLibxslt.cpp	2020-12-15 01:28:48 UTC (rev 270816)
+++ branches/safari-610-branch/Source/WebCore/xml/XSLTProcessorLibxslt.cpp	2020-12-15 01:29:06 UTC (rev 270817)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the XSL implementation.
  *
- * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple, Inc. All rights reserved.
+ * Copyright (C) 2004-2020 Apple, Inc. All rights reserved.
  * Copyright (C) 2005, 2006 Alexey Proskuryakov <[email protected]>
  *
  * This library is free software; you can redistribute it and/or
@@ -48,6 +48,7 @@
 #include <libxslt/xslt.h>
 #include <libxslt/xsltutils.h>
 #include <wtf/Assertions.h>
+#include <wtf/CheckedArithmetic.h>
 
 #if OS(DARWIN) && !PLATFORM(GTK)
 #include "SoftLinkLibxslt.h"
@@ -223,9 +224,10 @@
     if (parameters.isEmpty())
         return 0;
 
-    const char** parameterArray = (const char**)fastMalloc(((parameters.size() * 2) + 1) * sizeof(char*));
+    auto size = (((Checked<size_t>(parameters.size()) * 2U) + 1U) * sizeof(char*)).unsafeGet();
+    auto** parameterArray = static_cast<const char**>(fastMalloc(size));
 
-    unsigned index = 0;
+    size_t index = 0;
     for (auto& parameter : parameters) {
         parameterArray[index++] = fastStrDup(parameter.key.utf8().data());
         parameterArray[index++] = fastStrDup(parameter.value.utf8().data());
@@ -232,6 +234,10 @@
     }
     parameterArray[index] = nullptr;
 
+#if !PLATFORM(WIN) && !HAVE(LIBXSLT_FIX_FOR_RADAR_71864140)
+    RELEASE_ASSERT(index <= std::numeric_limits<int>::max());
+#endif
+
     return parameterArray;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to