commit | d0a499bc65d0a100e7c2c8041a6e1a98e8877af9 | [log] [tgz] |
---|---|---|
author | Joe Tsai <joetsai@digital-static.net> | Thu Apr 30 17:45:48 2020 -0700 |
committer | Joe Tsai <joetsai@digital-static.net> | Fri May 01 17:23:32 2020 +0000 |
tree | 0c80080b76042fe9767067a09fc2d0b3ec6a296c | |
parent | 3ebaa92e92fa8b5e8a8b1c78a4a439cd89c7c8af [diff] [blame] |
internal/impl: validate UTF-8 for proto3 optional strings Change-Id: I090e7c5adac47818831c63d3d999cb7fea5ac696 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/231357 Reviewed-by: Damien Neil <dneil@google.com>
diff --git a/internal/impl/codec_tables.go b/internal/impl/codec_tables.go index c934c8d..e899712 100644 --- a/internal/impl/codec_tables.go +++ b/internal/impl/codec_tables.go
@@ -338,6 +338,9 @@ return nil, coderDoublePtr } case pref.StringKind: + if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) { + return nil, coderStringPtrValidateUTF8 + } if ft.Kind() == reflect.String { return nil, coderStringPtr }