Changeset 263405 in webkit


Ignore:
Timestamp:
Jun 23, 2020 11:15:49 AM (4 years ago)
Author:
mark.lam@apple.com
Message:

Handle string overflow in DFG graph dump while validating AI.
https://bugs.webkit.org/show_bug.cgi?id=213524
<rdar://problem/64635620>

Reviewed by Saam Barati.

JSTests:

  • stress/string-overflow-in-dfg-graph-dump.js: Added.

Source/JavaScriptCore:

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::validateAIState):

Source/WTF:

  • wtf/StringPrintStream.cpp:

(WTF::StringPrintStream::tryToString):

  • wtf/StringPrintStream.h:
Location:
trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r263335 r263405  
     12020-06-23  Mark Lam  <mark.lam@apple.com>
     2
     3        Handle string overflow in DFG graph dump while validating AI.
     4        https://bugs.webkit.org/show_bug.cgi?id=213524
     5        <rdar://problem/64635620>
     6
     7        Reviewed by Saam Barati.
     8
     9        * stress/string-overflow-in-dfg-graph-dump.js: Added.
     10
    1112020-06-21  Michael Catanzaro  <mcatanzaro@gnome.org>
    212
  • trunk/Source/JavaScriptCore/ChangeLog

    r263400 r263405  
     12020-06-23  Mark Lam  <mark.lam@apple.com>
     2
     3        Handle string overflow in DFG graph dump while validating AI.
     4        https://bugs.webkit.org/show_bug.cgi?id=213524
     5        <rdar://problem/64635620>
     6
     7        Reviewed by Saam Barati.
     8
     9        * ftl/FTLLowerDFGToB3.cpp:
     10        (JSC::FTL::DFG::LowerDFGToB3::validateAIState):
     11
    1122020-06-23  Devin Rousso  <drousso@apple.com>
    213
  • trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp

    r263195 r263405  
    560560            StringPrintStream out;
    561561            m_graph.dump(out);
    562             m_graphDump = out.toString();
     562            auto expectedString = out.tryToString();
     563            m_graphDump = expectedString ? expectedString.value() : String("<out of memory while dumping graph>"_s);
    563564        }
    564565
  • trunk/Source/WTF/ChangeLog

    r263380 r263405  
     12020-06-23  Mark Lam  <mark.lam@apple.com>
     2
     3        Handle string overflow in DFG graph dump while validating AI.
     4        https://bugs.webkit.org/show_bug.cgi?id=213524
     5        <rdar://problem/64635620>
     6
     7        Reviewed by Saam Barati.
     8
     9        * wtf/StringPrintStream.cpp:
     10        (WTF::StringPrintStream::tryToString):
     11        * wtf/StringPrintStream.h:
     12
    1132020-06-22  Saam Barati  <sbarati@apple.com>
    214
  • trunk/Source/WTF/wtf/StringPrintStream.cpp

    r237099 r263405  
    9696}
    9797
     98Expected<String, UTF8ConversionError> StringPrintStream::tryToString()
     99{
     100    ASSERT(m_next == strlen(m_buffer));
     101    if (m_next > String::MaxLength)
     102        return makeUnexpected(UTF8ConversionError::OutOfMemory);
     103    return String::fromUTF8(m_buffer, m_next);
     104}
     105
    98106String StringPrintStream::toString()
    99107{
  • trunk/Source/WTF/wtf/StringPrintStream.h

    r261569 r263405  
    4242   
    4343    WTF_EXPORT_PRIVATE CString toCString();
     44    WTF_EXPORT_PRIVATE Expected<String, UTF8ConversionError> tryToString();
    4445    WTF_EXPORT_PRIVATE String toString();
    4546    WTF_EXPORT_PRIVATE String toStringWithLatin1Fallback();
Note: See TracChangeset for help on using the changeset viewer.