[Webkit-unassigned] [Bug 231606] ASSERT hit in surrogatePairAwareIndex and surrogatePairAwareStart lambdas for text with unpaired surrogates

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Oct 12 17:46:42 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=231606

--- Comment #13 from Gabriel Nava Marino <gnavamarino at apple.com> ---
(In reply to Darin Adler from comment #12)
> Comment on attachment 440982 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=440982&action=review
> 
> > Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp:155
> >  
> 
> It would be:
> 
>     auto right = std::min<unsigned>(left + offset, (startPosition + length -
> 1));
>     U16_SET_CP_LIMIT(text, 0, right, text.length());
> 
>     auto middle = surrogatePairAwareIndex((left + right) / 2);
>     U16_SET_CP_LIMIT(text, 0, middle, text.length());

Thank you, I will try this! Although I just notice that currently, surrogatePairAwareIndex returns the index at trail whereas U16_SET_CP_LIMIT returns the index past it:

#define U16_SET_CP_LIMIT(s, start, i, length) UPRV_BLOCK_MACRO_BEGIN { \
    if((start)<(i) && ((i)<(length) || (length)<0) && U16_IS_LEAD((s)[(i)-1]) && U16_IS_TRAIL((s)[i])) { \
        ++(i); \
    } \
} UPRV_BLOCK_MACRO_END

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20211013/daf47a0b/attachment.htm>


More information about the webkit-unassigned mailing list