| Index: runtime/vm/unicode.cc
|
| diff --git a/runtime/vm/unicode.cc b/runtime/vm/unicode.cc
|
| index 8e1649e91714c5de1f530152318d5264c23f7425..615e87b56127c64c6f0d72ebc05d5de8d55e0697 100644
|
| --- a/runtime/vm/unicode.cc
|
| +++ b/runtime/vm/unicode.cc
|
| @@ -102,7 +102,8 @@ bool Utf8::IsValid(const uint8_t* utf8_array, intptr_t array_len) {
|
| if (!((is_malformed == false) &&
|
| (j == num_trail_bytes) &&
|
| !Utf::IsOutOfRange(ch) &&
|
| - !IsNonShortestForm(ch, j))) {
|
| + !IsNonShortestForm(ch, j) &&
|
| + !Utf16::IsSurrogate(ch))) {
|
| return false;
|
| }
|
| }
|
| @@ -200,7 +201,8 @@ intptr_t Utf8::Decode(const uint8_t* utf8_array,
|
| if (!((is_malformed == false) &&
|
| (i == num_trail_bytes) &&
|
| !Utf::IsOutOfRange(ch) &&
|
| - !IsNonShortestForm(ch, i))) {
|
| + !IsNonShortestForm(ch, i) &&
|
| + !Utf16::IsSurrogate(ch))) {
|
| *dst = -1;
|
| return 0;
|
| }
|
|
|