Skip to content

Commit 8313184

Browse files
committed
Ensure that Symbol.toStringTag property is copied to buffer as a cesu8 string
This path fixes #2769. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
1 parent d4e27d3 commit 8313184

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ ecma_builtin_helper_object_to_string_tag_helper (ecma_value_t tag_value) /**< st
7878
}
7979

8080
/* Copy to buffer the #@@toStringTag# string */
81-
buffer_ptr += ecma_string_copy_to_utf8_buffer (tag_str_p, buffer_ptr,
82-
(lit_utf8_size_t) ((str_buffer + buffer_size) - buffer_ptr));
81+
buffer_ptr += ecma_string_copy_to_cesu8_buffer (tag_str_p, buffer_ptr,
82+
(lit_utf8_size_t) ((str_buffer + buffer_size) - buffer_ptr));
8383

8484
JERRY_ASSERT (buffer_ptr <= str_buffer + buffer_size);
8585

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright JS Foundation and other contributors, http://js.foundation
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
delete JSON[Symbol.toStringTag];
16+
JSON[Symbol.toStringTag ] = "𖠀";
17+
assert (Map.prototype.toString.call(JSON) === "[object 𖠀]");

0 commit comments

Comments
 (0)