Fix hash calculation for strings created using jerry_create_string_from_utf8 (#1912)

The hash was being calculated over the bytes *after* the actual string bytes.

JerryScript-DCO-1.0-Signed-off-by: Martijn The martijn.the@intel.com
This commit is contained in:
Martijn Thé
2017-07-10 08:53:58 +02:00
committed by Zoltan Herczeg
parent 18283d22c0
commit 91912689ad
2 changed files with 29 additions and 1 deletions
+2 -1
View File
@@ -298,6 +298,7 @@ ecma_new_ecma_string_from_utf8_converted_to_cesu8 (const lit_utf8_byte_t *string
data_p = (lit_utf8_byte_t *) (long_string_desc_p + 1);
}
const lit_utf8_byte_t *const begin_data_p = data_p;
pos = 0;
while (pos < string_size)
@@ -324,7 +325,7 @@ ecma_new_ecma_string_from_utf8_converted_to_cesu8 (const lit_utf8_byte_t *string
JERRY_ASSERT (pos == string_size);
string_desc_p->hash = lit_utf8_string_calc_hash (data_p, converted_string_size);
string_desc_p->hash = lit_utf8_string_calc_hash (begin_data_p, converted_string_size);
}
return string_desc_p;