| Summary: | Nullptr crash in TypingCommand::willAddTypingToOpenCommand via TypingCommand::deleteKeyPressed | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Ryosuke Niwa <rniwa> | ||||||||||
| Component: | HTML Editing | Assignee: | Nobody <webkit-unassigned> | ||||||||||
| Status: | RESOLVED FIXED | ||||||||||||
| Severity: | Normal | CC: | bfulgham, cgarcia, ews-feeder, fred.wang, gpoo, product-security, rbuis, svillar, webkit-bug-importer, wenson_hsieh | ||||||||||
| Priority: | P2 | Keywords: | InRadar | ||||||||||
| Version: | WebKit Nightly Build | ||||||||||||
| Hardware: | Unspecified | ||||||||||||
| OS: | Unspecified | ||||||||||||
| Attachments: |
|
||||||||||||
|
Description
Ryosuke Niwa
2021-08-18 20:40:23 PDT
I can reproduce this with ASAN release build of WebKitTestRunner at r281219. Created attachment 436289 [details]
Patch
Comment on attachment 436289 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=436289&action=review > Source/WebCore/editing/TypingCommand.cpp:666 > + if (auto range = deleteListSelection.value().firstRange()) { I presume deleteListSelection is "none"? It's confusing that CompositeEditCommand::shouldBreakOutOfEmptyListItem() returns optional<VisibleSelection>. We normally use VisibleSelection.isNone() in these cases. Given shouldBreakOutOfEmptyListItem() is only used in this function, I think we should go ahead & make that change instead of returning checking for both std::nullopt and VisibleSelection being none. Created attachment 436770 [details]
Patch
Comment on attachment 436770 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=436770&action=review > Source/WebCore/editing/TypingCommand.cpp:667 > + auto deleteListSelection = shouldBreakOutOfEmptyListItem(); > + if (!deleteListSelection.isNone()) { > + if (willAddTypingToOpenCommand(DeleteKey, granularity, { }, deleteListSelection.firstRange())) { Define the variable inside if like so: if (auto deleteListSelection = shouldBreakOutOfEmptyListItem(); !deleteListSelection.isNone()) { Created attachment 436848 [details]
Patch
Committed r281795 (241132@main): <https://commits.webkit.org/241132@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 436848 [details]. |