Add warn_unused_result attribute to ecma_string_to_utf8_string. Add assertions that specified buffer size is sufficient in places, where return value of ecma_string_to_utf8_string wasn't checked prior to the changes.

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
This commit is contained in:
Ruben Ayrapetyan
2015-08-27 17:12:26 +03:00
parent 6ee561e821
commit a26c454219
12 changed files with 99 additions and 52 deletions
+2 -1
View File
@@ -154,7 +154,8 @@ opfunc_assignment (vm_instr_t instr, /**< instruction */
lit_utf8_size_t re_utf8_buffer_size = ecma_string_get_size (string_p);
MEM_DEFINE_LOCAL_ARRAY (re_utf8_buffer_p, re_utf8_buffer_size, lit_utf8_byte_t);
ecma_string_to_utf8_string (string_p, re_utf8_buffer_p, (ssize_t) re_utf8_buffer_size);
ssize_t sz = ecma_string_to_utf8_string (string_p, re_utf8_buffer_p, (ssize_t) re_utf8_buffer_size);
JERRY_ASSERT (sz >= 0);
lit_utf8_byte_t *ch_p = re_utf8_buffer_p;
lit_utf8_byte_t *last_slash_p = NULL;