Bug 201769

Summary: Web Inspector: HTML Formatting: Handle infinite loop for incomplete script data
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: Web InspectorAssignee: Joseph Pecoraro <joepeck>
Status: RESOLVED FIXED    
Severity: Normal CC: hi, inspector-bugzilla-changes, joepeck, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
[PATCH] Proposed Fix
none
[PATCH] Proposed Fix hi: review+

Joseph Pecoraro
Reported 2019-09-13 13:05:54 PDT
HTML Formatting: Handle infinite loop for incomplete script data Steps to Reproduce: 1. Attempt to format something like "<script src="foo.js"> </sc" => Infinite loop
Attachments
[PATCH] Proposed Fix (4.03 KB, patch)
2019-09-13 13:06 PDT, Joseph Pecoraro
no flags
[PATCH] Proposed Fix (6.09 KB, patch)
2019-09-13 16:42 PDT, Joseph Pecoraro
hi: review+
Joseph Pecoraro
Comment 1 2019-09-13 13:06:51 PDT
Created attachment 378749 [details] [PATCH] Proposed Fix
Joseph Pecoraro
Comment 2 2019-09-13 16:35:43 PDT
Comment on attachment 378749 [details] [PATCH] Proposed Fix Revising this with some more edge cases.
Joseph Pecoraro
Comment 3 2019-09-13 16:42:41 PDT
Created attachment 378762 [details] [PATCH] Proposed Fix
Devin Rousso
Comment 4 2019-09-13 18:06:47 PDT
Comment on attachment 378762 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=378762&action=review r=me, looks reasonable :) > Source/WebInspectorUI/UserInterface/Workers/Formatter/HTMLParser.js:181 > + if (this._isEOF() && this._data.endsWith("<")) Could you move this check into the `if (text)` above, since we would’ve consumed up to a “<“ there anyways? I think then we could still use `_handleEOF`. > Source/WebInspectorUI/UserInterface/Workers/Formatter/HTMLParser.js:199 > + this._handleEOF(startPos); Could we have `_handleEOF` return whether `_isEOF` so we don’t have to check it twice?
Joseph Pecoraro
Comment 5 2019-09-13 18:53:54 PDT
Comment on attachment 378762 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=378762&action=review >> Source/WebInspectorUI/UserInterface/Workers/Formatter/HTMLParser.js:181 >> + if (this._isEOF() && this._data.endsWith("<")) > > Could you move this check into the `if (text)` above, since we would’ve consumed up to a “<“ there anyways? I think then we could still use `_handleEOF`. I think we will need to do both anyways. For example `<` (empty text, but last character is "<"), and `a<` (non-empty text, but last character is "<"). Or am I overlooking something? >> Source/WebInspectorUI/UserInterface/Workers/Formatter/HTMLParser.js:199 >> + this._handleEOF(startPos); > > Could we have `_handleEOF` return whether `_isEOF` so we don’t have to check it twice? Sure
Joseph Pecoraro
Comment 6 2019-09-13 18:58:14 PDT
Radar WebKit Bug Importer
Comment 7 2019-09-13 18:59:21 PDT
Note You need to log in before you can comment on or make changes to this bug.