Bug 234989

Summary: WebKit::nsTextAlignmentFromTextAlignment() falls through ASSERT_NOT_REACHED()
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: WebKit2Assignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, darin, kkinnunen, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 234932    
Bug Blocks:    
Attachments:
Description Flags
Patch none

Description David Kilzer (:ddkilzer) 2022-01-07 14:41:33 PST
WebKit::nsTextAlignmentFromTextAlignment() falls through ASSERT_NOT_REACHED().

In the `default` case, `nsTextAlignment` is returned uninitialized.

static NSTextAlignment nsTextAlignmentFromTextAlignment(TextAlignment textAlignment)
{   
    NSTextAlignment nsTextAlignment;
    switch (textAlignment) {
    case NoAlignment:
        nsTextAlignment = NSTextAlignmentNatural;
        break;
    case LeftAlignment: 
        nsTextAlignment = NSTextAlignmentLeft;
        break;
    case RightAlignment:
        nsTextAlignment = NSTextAlignmentRight;
        break;
    case CenterAlignment: 
        nsTextAlignment = NSTextAlignmentCenter;
        break;
    case JustifiedAlignment:
        nsTextAlignment = NSTextAlignmentJustified;
        break;
    default:
        ASSERT_NOT_REACHED();
    }
    
    return nsTextAlignment;
}

See Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm.
Comment 1 Radar WebKit Bug Importer 2022-01-07 14:41:59 PST
<rdar://problem/87273264>
Comment 2 Chris Dumez 2022-01-19 10:51:12 PST
Created attachment 449494 [details]
Patch
Comment 3 EWS 2022-01-19 14:21:48 PST
Committed r288241 (246195@main): <https://commits.webkit.org/246195@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 449494 [details].