Commit 2300b88341 for golang

commit 2300b88341ea917e18b4fed04d43daf301258879
Author: Guido Iaquinti <guido.iaquinti@gmail.com>
Date:   Mon Nov 30 20:11:37 2026 +0000

    strconv: reject negative runes in IsGraphic

    isInGraphicList checks the signed rune's upper bound before
    converting it to uint16. Negative values can pass the check and
    alias graphic code points in the lookup table.

    Compare as uint32 (rather than int32) to reject negative runes.

    Fixes #83478.

    Change-Id: I90f6358ed76e5155a4541f675022a904215bbd07
    GitHub-Last-Rev: 7ab44aa44e6f698074f9eb98f247e5e8f9a29539
    GitHub-Pull-Request: golang/go#83479
    Reviewed-on: https://go-review.googlesource.com/c/go/+/868103
    Auto-Submit: Robert Griesemer <gri@google.com>
    LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Michael Matloob <matloob@google.com>
    Reviewed-by: Robert Griesemer <gri@google.com>

diff --git a/src/strconv/quote.go b/src/strconv/quote.go
index 941111ea2f..01d665e4c0 100644
--- a/src/strconv/quote.go
+++ b/src/strconv/quote.go
@@ -580,8 +580,8 @@ func IsGraphic(r rune) bool {
 // from IsGraphic allows quoteWith to avoid two calls to IsPrint.
 // Should be called only if IsPrint fails.
 func isInGraphicList(r rune) bool {
-	// We know r must fit in 16 bits - see makeisprint.go.
-	if r > 0xFFFF {
+	// The graphic list contains only 16-bit code points (see makeisprint.go).
+	if uint32(r) > 0xFFFF {
 		return false
 	}
 	_, found := bsearch(isGraphic, uint16(r))
diff --git a/src/strconv/quote_test.go b/src/strconv/quote_test.go
index ac648e6ab1..60698681ff 100644
--- a/src/strconv/quote_test.go
+++ b/src/strconv/quote_test.go
@@ -27,6 +27,11 @@ func TestIsPrint(t *testing.T) {

 // Verify that our IsGraphic agrees with unicode.IsGraphic.
 func TestIsGraphic(t *testing.T) {
+	// A negative rune whose low 16 bits are U+00A0 is not graphic.
+	if r := rune(0x00A0 - 1<<16); IsGraphic(r) {
+		t.Errorf("IsGraphic(%d)=true incorrect", r)
+	}
+
 	n := 0
 	for r := rune(0); r <= unicode.MaxRune; r++ {
 		if IsGraphic(r) != unicode.IsGraphic(r) {