[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 15:53:31 PDT 2021


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

--- Comment #6 from Gabriel Nava Marino <gnavamarino at apple.com> ---
View in context: https://bugs.webkit.org/attachment.cgi?id=440982&action=review

>> Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp:150
>> +        bool isLead = U16_IS_LEAD(text[index]) && (index + 1) < text.length() && U16_IS_TRAIL(text[index + 1]);
> 
> Given that this is WTF::String, we don’t need the rang checks on index. The subscript operator does enough range checking.

Thank you for the clarification. I will remove the range checks.

>> Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp:-152
>> -        RELEASE_ASSERT(index + 1 < text.length());
> 
> Why remove this?

This is enforced via early return in the if statement range check above. However, since I will remove the range checks, I will re-add this back here.

>> Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp:153
>>          return ++index;
> 
> This is bizarre. It should return index + 1; why use ++?

I will update to use index + 1.

>> Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp:172
>> +                bool isTrail = index && U16_IS_LEAD(text[index - 1]) && index < text.length() && U16_IS_TRAIL(text[index]);
> 
> Given that this is WTF::String, we don’t need the additional range checks on index. The subscript operator does enough range checking.

Thank you for the clarification. I will remove the range checks from here as well.

>> Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp:176
>>                  return --index;
> 
> This is bizarre. It should return index - 1; why use --?

I will update to use index - 1.

-- 
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/20211012/b56370b8/attachment-0001.htm>


More information about the webkit-unassigned mailing list