[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:36:11 PDT 2021


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

--- Comment #3 from Darin Adler <darin at apple.com> ---
Comment on attachment 440982
  --> https://bugs.webkit.org/attachment.cgi?id=440982
Patch

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.

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

Why remove this?

> Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp:153
>          return ++index;

This is bizarre. It should return index + 1; why use ++?

> 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.

> Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp:176
>                  return --index;

This is bizarre. It should return index - 1; why use --?

-- 
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/6cde56bd/attachment-0001.htm>


More information about the webkit-unassigned mailing list