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:
committed by
Zoltan Herczeg
parent
18283d22c0
commit
91912689ad
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user