Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
test-api.c has an out-of-bounds write (buffer overflow) #2711
This is what I got:
ok 148343051 148341491 0xfff0e4a8 2
DTS_MSG: Stensal DTS detected a fatal program error!
@mlite Thanks for the report. It has revealed a bug in the unit tests.
The problem is in tests/unit-core/test-api.c around lines 881-884:
char buff[jerry_get_string_length (parsed_data)]; /// BUG: buff should have +1 to its size if terminating zero will be added later manually jerry_size_t buff_size = (jerry_size_t) jerry_get_string_length (parsed_data); /// SMELL: jerry_get_string_length is called twice in a row jerry_string_to_char_buffer (parsed_data, (jerry_char_t *) buff, buff_size); buff[buff_size] = '\0'; /// BUG(manifested): writing past the end of the buffer