]> Cypherpunks repositories - gostls13.git/commitdiff
net/url: add panic to unhex for imposible error case
authoralirezaarzehgar <alirezaarzehgar82@gmail.com>
Mon, 20 Jan 2025 20:54:28 +0000 (00:24 +0330)
committerGopher Robot <gobot@golang.org>
Mon, 3 Feb 2025 16:19:56 +0000 (08:19 -0800)
Change-Id: I9f39b3d2a1a0a3e510afc874dd071302b2b0c89e
Reviewed-on: https://go-review.googlesource.com/c/go/+/643555
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

src/net/url/url.go

index 8a8de1c6a8bdb5b56942355c1368b8a4773d3ce2..3acde9fb0f3334c2386e659a3b1399edd1a9aeae 100644 (file)
@@ -67,8 +67,9 @@ func unhex(c byte) byte {
                return c - 'a' + 10
        case 'A' <= c && c <= 'F':
                return c - 'A' + 10
+       default:
+               panic("invalid hex character")
        }
-       return 0
 }
 
 type encoding int