Bug 142872

Summary: [Content Extensions] Test regular expression parse failures
Product: WebKit Reporter: Alex Christensen <achristensen>
Component: WebCore Misc.Assignee: Alex Christensen <achristensen>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch benjamin: review+

Alex Christensen
Reported 2015-03-19 12:19:17 PDT
I made things I think can never happen into assertions. I had some questions, though. They're in the first patch.
Attachments
Patch (9.14 KB, patch)
2015-03-19 12:25 PDT, Alex Christensen
benjamin: review+
Alex Christensen
Comment 1 2015-03-19 12:25:02 PDT
Benjamin Poulain
Comment 2 2015-03-19 14:35:47 PDT
Comment on attachment 249048 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=249048&action=review > Source/WebCore/contentextensions/URLFilterParser.cpp:481 > + ASSERT(m_openGroups.isEmpty()); > + ASSERT(m_subtreeStart != m_subtreeEnd); Let's make them into ASSERT_WITH_MESSAGE to say why they should not happen. > Source/WebCore/contentextensions/URLFilterParser.cpp:527 > - if (!m_floatingTerm.isValid()) > - fail(URLFilterParser::MisplacedQuantifier); > + ASSERT(m_floatingTerm.isValid()); Wouldn't this happen with greedy quantifiers? > Source/WebCore/contentextensions/URLFilterParser.cpp:-727 > - ASSERT(!pattern.isEmpty()); > - Those are no longer excluded by the JSON parser? > Source/WebCore/contentextensions/URLFilterParser.h:44 > enum ParseStatus { This thing is really weird. > Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp:355 > + testPatternStatus("(?!)", ContentExtensions::URLFilterParser::ParseStatus::Group); > + testPatternStatus("(?=)", ContentExtensions::URLFilterParser::ParseStatus::Group); Please also test that those two produce errors with a non-empty term inside. > Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp:370 > + // I think these should all be YarrErrors, but they're not. Should we do something about this? What the heck. I have no explanation.
Alex Christensen
Comment 3 2015-03-19 15:38:44 PDT
Comment on attachment 249048 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=249048&action=review >> Source/WebCore/contentextensions/URLFilterParser.cpp:527 >> + ASSERT(m_floatingTerm.isValid()); > > Wouldn't this happen with greedy quantifiers? I'm adding .*a and .*?a, but they do not hit this assert. >> Source/WebCore/contentextensions/URLFilterParser.cpp:-727 >> - > > Those are no longer excluded by the JSON parser? I added a test case that tests an empty string. They probably are excluded by the JSON parser, but the following if statement will catch them.
Alex Christensen
Comment 4 2015-03-19 15:39:04 PDT
Note You need to log in before you can comment on or make changes to this bug.