]> Cypherpunks repositories - gostls13.git/commitdiff
encoding/pem: fix for TestFuzz, PEM type should not contain a colon
authorIvan Kutuzov <arbrix@gmail.com>
Fri, 31 Aug 2018 15:14:04 +0000 (09:14 -0600)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 3 Sep 2018 15:04:25 +0000 (15:04 +0000)
Fixes #22238

Change-Id: I8184f789bd4120f3e71c9374c7c2fcbfa95935bf
Reviewed-on: https://go-review.googlesource.com/132635
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/encoding/pem/pem_test.go

index 6a1751621835f3afd9db998b1ec9b8da11456eae..a1b5afac0866d781e250714171b3ae942085bde6 100644 (file)
@@ -213,7 +213,9 @@ func TestFuzz(t *testing.T) {
        }
 
        testRoundtrip := func(block Block) bool {
-               if isBad(block.Type) {
+               // Reject bad Type
+               // Type with colons will proceed as key/val pair and cause an error.
+               if isBad(block.Type) || strings.Contains(block.Type, ":") {
                        return true
                }
                for key, val := range block.Headers {