Title: [290738] trunk/Source/WebCore
Revision
290738
Author
[email protected]
Date
2022-03-02 10:53:56 -0800 (Wed, 02 Mar 2022)

Log Message

AX: Handle null FileList in RenderFileUploadControl::fileTextValue()
https://bugs.webkit.org/show_bug.cgi?id=237349

Reviewed by Chris Fleizach.

In rare circumstances, it's possible for the FileList associated
with RenderFileUploadControl::inputElement (HTMLInputElement::files())
to be null. This causes a crash in RenderFileUploadControl::fileTextValue().

In this patch, we avoid this crash by handling a null `FileList`
and returning a null `String`.

* rendering/RenderFileUploadControl.cpp:
(WebCore::RenderFileUploadControl::fileTextValue const):
Handle null `input.files()` and return a null `String` rather than `ASSERT`ing.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (290737 => 290738)


--- trunk/Source/WebCore/ChangeLog	2022-03-02 18:52:19 UTC (rev 290737)
+++ trunk/Source/WebCore/ChangeLog	2022-03-02 18:53:56 UTC (rev 290738)
@@ -1,3 +1,21 @@
+2022-03-02  Tyler Wilcock  <[email protected]>
+
+        AX: Handle null FileList in RenderFileUploadControl::fileTextValue()
+        https://bugs.webkit.org/show_bug.cgi?id=237349
+
+        Reviewed by Chris Fleizach.
+
+        In rare circumstances, it's possible for the FileList associated
+        with RenderFileUploadControl::inputElement (HTMLInputElement::files())
+        to be null. This causes a crash in RenderFileUploadControl::fileTextValue().
+
+        In this patch, we avoid this crash by handling a null `FileList`
+        and returning a null `String`.
+
+        * rendering/RenderFileUploadControl.cpp:
+        (WebCore::RenderFileUploadControl::fileTextValue const):
+        Handle null `input.files()` and return a null `String` rather than `ASSERT`ing.
+
 2022-03-02  Antoine Quint  <[email protected]>
 
         Outline-width with transition don't animate correctly

Modified: trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp (290737 => 290738)


--- trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp	2022-03-02 18:52:19 UTC (rev 290737)
+++ trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp	2022-03-02 18:53:56 UTC (rev 290738)
@@ -257,7 +257,8 @@
 String RenderFileUploadControl::fileTextValue() const
 {
     auto& input = inputElement();
-    ASSERT(inputElement().files());
+    if (!input.files())
+        return { };
     if (input.files()->length() && !input.displayString().isEmpty())
         return StringTruncator::rightTruncate(input.displayString(), maxFilenameWidth(), style().fontCascade());
     return theme().fileListNameForWidth(input.files(), style().fontCascade(), maxFilenameWidth(), input.multiple());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to