]> Cypherpunks repositories - gostls13.git/commit
archive/zip: fix handling of replacement rune in UTF8 check
authorRuss Cox <rsc@golang.org>
Wed, 15 Nov 2017 16:47:31 +0000 (11:47 -0500)
committerRuss Cox <rsc@golang.org>
Wed, 15 Nov 2017 21:30:30 +0000 (21:30 +0000)
commit3a181dc7bc8fd0c61d6090a85f87c934f1874802
tree716c5e505adec8bbcebf6ab2635cadf7ffb3c812
parent7de9e5e199fb9a39e5564ead221b3615d6f89341
archive/zip: fix handling of replacement rune in UTF8 check

The replacement rune is a valid rune and can appear as itself in valid UTF8
(it encodes as three bytes). To check for invalid UTF8 it is necessary to
look for utf8.DecodeRune returning the replacement rune and size==1.

Change-Id: I169be8d1fe61605c921ac13cc2fde94f80f3463c
Reviewed-on: https://go-review.googlesource.com/78126
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
src/archive/zip/writer.go
src/archive/zip/writer_test.go