diff options
author | Péter Gál <pgal.u-szeged@partner.samsung.com> | 2018-06-11 03:19:39 +0200 |
---|---|---|
committer | yichoi <duddlf.choi@samsung.com> | 2018-06-11 10:19:39 +0900 |
commit | d637e319336bc2ccde7c34e481c338e0a096ab37 (patch) | |
tree | 9101af6b65ef0c348cced1f0b76af5820b7c9478 /jerry-core | |
parent | 2d0e37ff7468e222b6f3ec55d1a2181da5be2db7 (diff) |
On simple strings the utf8 substring copy api call created an assert (#2389)
When the `jerry_substring_to_utf8_char_buffer` was called
with direct strings the assert incorrectly assumed that the
string is a ref counted string and tried to access the
refcount value resulting in a failed assert.
Added direct string check for the underlying implementation
and created a test case for such simple string.
JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
Diffstat (limited to 'jerry-core')
-rw-r--r-- | jerry-core/ecma/base/ecma-helpers-string.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/jerry-core/ecma/base/ecma-helpers-string.c b/jerry-core/ecma/base/ecma-helpers-string.c index 2aab6f0a..ac5a403e 100644 --- a/jerry-core/ecma/base/ecma-helpers-string.c +++ b/jerry-core/ecma/base/ecma-helpers-string.c @@ -1226,7 +1226,7 @@ ecma_substring_copy_to_utf8_buffer (const ecma_string_t *string_desc_p, /**< ecm lit_utf8_size_t buffer_size) /**< size of buffer */ { JERRY_ASSERT (string_desc_p != NULL); - JERRY_ASSERT (string_desc_p->refs_and_container >= ECMA_STRING_REF_ONE); + JERRY_ASSERT (ECMA_IS_DIRECT_STRING (string_desc_p) || string_desc_p->refs_and_container >= ECMA_STRING_REF_ONE); JERRY_ASSERT (buffer_p != NULL || buffer_size == 0); lit_utf8_size_t size = 0; |