Title: [263654] trunk/Source/WebCore
Revision
263654
Author
an...@apple.com
Date
2020-06-29 04:31:10 -0700 (Mon, 29 Jun 2020)

Log Message

checked overflow in WebCore::findClosestFont
https://bugs.webkit.org/show_bug.cgi?id=213719
<rdar://47765225>

Reviewed by David Kilzer.

* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::findClosestFont):

If indexOfBestCapabilities doesn't find anything it returns notFound and indexing to the vector overflows.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (263653 => 263654)


--- trunk/Source/WebCore/ChangeLog	2020-06-29 10:54:34 UTC (rev 263653)
+++ trunk/Source/WebCore/ChangeLog	2020-06-29 11:31:10 UTC (rev 263654)
@@ -1,3 +1,16 @@
+2020-06-29  Antti Koivisto  <an...@apple.com>
+
+        checked overflow in WebCore::findClosestFont
+        https://bugs.webkit.org/show_bug.cgi?id=213719
+        <rdar://47765225>
+
+        Reviewed by David Kilzer.
+
+        * platform/graphics/cocoa/FontCacheCoreText.cpp:
+        (WebCore::findClosestFont):
+
+        If indexOfBestCapabilities doesn't find anything it returns notFound and indexing to the vector overflows.
+
 2020-06-29  David Kilzer  <ddkil...@apple.com>
 
         REGRESSION (r262776): Leak of NSMutableURLRequest in -[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]

Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp (263653 => 263654)


--- trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp	2020-06-29 10:54:34 UTC (rev 263653)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp	2020-06-29 11:31:10 UTC (rev 263654)
@@ -1156,7 +1156,11 @@
     for (auto& font : familyFonts.installedFonts)
         capabilities.uncheckedAppend(font.capabilities);
     FontSelectionAlgorithm fontSelectionAlgorithm(fontSelectionRequest, capabilities, familyFonts.capabilities);
-    return &familyFonts.installedFonts[fontSelectionAlgorithm.indexOfBestCapabilities()];
+    auto index = fontSelectionAlgorithm.indexOfBestCapabilities();
+    if (index == notFound)
+        return nullptr;
+
+    return &familyFonts.installedFonts[index];
 }
 
 Vector<FontSelectionCapabilities> FontCache::getFontSelectionCapabilitiesInFamily(const AtomString& familyName, AllowUserInstalledFonts allowUserInstalledFonts)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to