[text] unicode/norm: avoid infinite loop on invalid input

0 views
Skip to first unread message

Gopher Robot (Gerrit)

unread,
Jun 26, 2026, 3:27:12 PM (23 hours ago) Jun 26
to Damien Neil, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Neal Patel, Neal Patel, golang...@luci-project-accounts.iam.gserviceaccount.com, Russ Cox, golang-co...@googlegroups.com

Gopher Robot submitted the change

Change information

Commit message:
unicode/norm: avoid infinite loop on invalid input

Invalid characters are given a Properties with a size of 0.

The nextComposed function can enter an infinite loop when
encountering an invalid character, since it advances
its input by the (possibly 0) character size.

Rather than finding every place which might assume characters
have a non-zero size, change compInfo to return a size-1
Properties for invalid characters and use the property flags
to record validity.

Fixes golang/go#80142
Change-Id: Ie0791faefeddc1e8f671b0ed73f29e906a6a6964
Auto-Submit: Damien Neil <dn...@google.com>
Reviewed-by: Neal Patel <ne...@golang.org>
Reviewed-by: Neal Patel <neal...@google.com>
Files:
  • M unicode/norm/forminfo.go
  • M unicode/norm/iter.go
  • M unicode/norm/normalize.go
  • M unicode/norm/normalize_test.go
Change size: S
Delta: 4 files changed, 25 insertions(+), 17 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: text
Gerrit-Branch: master
Gerrit-Change-Id: Ie0791faefeddc1e8f671b0ed73f29e906a6a6964
Gerrit-Change-Number: 794100
Gerrit-PatchSet: 3
Gerrit-Owner: Damien Neil <dn...@google.com>
Gerrit-Reviewer: Damien Neil <dn...@google.com>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-Reviewer: Neal Patel <ne...@golang.org>
Gerrit-Reviewer: Russ Cox <r...@golang.org>
Gerrit-CC: Neal Patel <neal...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages