Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit 3d4a43c

Browse files
Jimmy Huanggrgustaf
authored andcommitted
[console] Fixed console print segfault on arrays (#1861)
The ZVAL_MUTABLE string was not initialized to a jerry_value_t when the function returns, the auto-release mechanism will will segfault. Fixes #1858 Signed-off-by: Jimmy Huang <[email protected]>
1 parent 98f1567 commit 3d4a43c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/zjs_console.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ static bool value2str(const jerry_value_t value, char *buf, int maxlen,
5454
// is true
5555
// returns: true if the representation was complete or false if it
5656
// was abbreviated
57-
ZVAL_MUTABLE str_val;
57+
ZVAL_MUTABLE str_val = ZJS_UNDEFINED;
5858
bool is_string = false;
5959

6060
if (jerry_value_is_array(value)) {
61-
unsigned int len = jerry_get_array_length(value);
61+
u32_t len = jerry_get_array_length(value);
6262
sprintf(buf, "[Array - length %u]", len);
6363
return false;
6464
} else if (jerry_value_is_boolean(value)) {

0 commit comments

Comments
 (0)