Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion JERRY_CONTEXT (jmem_heap_allocated_size) == 0 in jmem_heap_finalize #3049

Closed
renatahodovan opened this issue Sep 4, 2019 · 0 comments · Fixed by #3052
Closed
Labels
bug Undesired behaviour ES2015 Related to ES2015 features

Comments

@renatahodovan
Copy link
Contributor

JerryScript revision

1088273

Build platform

Linux-4.15.0-54-generic-x86_64-with-Ubuntu-18.04-bionic

Build steps
./tools/build.py --clean --debug --compile-flag=-fsanitize=address \
--compile-flag=-m32 --compile-flag=-fno-omit-frame-pointer \
--compile-flag=-fno-common --compile-flag=-g \
--strip=off --system-allocator=on --logging=on \
--linker-flag=-fuse-ld=gold --error-messages=on --profile=es2015-subset
Test case
var func = function (a, b) { return a + b };
['A'].findIndex(func)
Output
ICE: Assertion 'JERRY_CONTEXT (jmem_heap_allocated_size) == 0' failed at jerryscript/jerry-core/jmem/jmem-heap.c(jmem_heap_finalize):106.
Error: ERR_FAILED_INTERNAL_ASSERTION

=================================================================
==9950==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 14 byte(s) in 1 object(s) allocated from:
    #0 0xf7a2b1cf in __interceptor_malloc (/usr/lib32/libasan.so.5+0x1121cf)
    #1 0x56688520 in jmem_heap_alloc jerryscript/jerry-core/jmem/jmem-heap.c:258
    #2 0x5668858c in jmem_heap_gc_and_alloc_block jerryscript/jerry-core/jmem/jmem-heap.c:293
    #3 0x56688619 in jmem_heap_alloc_block jerryscript/jerry-core/jmem/jmem-heap.c:327
    #4 0x566b69ca in ecma_alloc_string_buffer jerryscript/jerry-core/ecma/base/ecma-alloc.c:194
    #5 0x56639c4b in ecma_new_ecma_string_from_utf8_buffer jerryscript/jerry-core/ecma/base/ecma-helpers-string.c:293
    #6 0x56639c4b in ecma_append_chars_to_string jerryscript/jerry-core/ecma/base/ecma-helpers-string.c:720
    #7 0x5663a6f3 in ecma_concat_ecma_strings jerryscript/jerry-core/ecma/base/ecma-helpers-string.c:783
    #8 0x56713515 in opfunc_addition jerryscript/jerry-core/vm/opcodes-ecma-arithmetics.c:170
    #9 0x566ae504 in vm_loop jerryscript/jerry-core/vm/vm.c:2263
    #10 0x566b5eb5 in vm_execute jerryscript/jerry-core/vm/vm.c:3616
    #11 0x566b67b9 in vm_run jerryscript/jerry-core/vm/vm.c:3742
    #12 0x5666d452 in ecma_op_function_call jerryscript/jerry-core/ecma/operations/ecma-function-object.c:807
    #13 0x566bfe39 in ecma_builtin_array_prototype_object_find jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.c:1987
    #14 0x566c0675 in ecma_builtin_array_prototype_dispatch_routine jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.c:2259
    #15 0x5665ac41 in ecma_builtin_dispatch_routine jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.c:1025
    #16 0x5665ae9f in ecma_builtin_dispatch_call jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.c:1050
    #17 0x5666d0f1 in ecma_op_function_call jerryscript/jerry-core/ecma/operations/ecma-function-object.c:729
    #18 0x566a4f33 in opfunc_call jerryscript/jerry-core/vm/vm.c:581
    #19 0x566b5f15 in vm_execute jerryscript/jerry-core/vm/vm.c:3622
    #20 0x566b67b9 in vm_run jerryscript/jerry-core/vm/vm.c:3742
    #21 0x566a4238 in vm_run_global jerryscript/jerry-core/vm/vm.c:282
    #22 0x56622212 in jerry_run jerryscript/jerry-core/api/jerry.c:570
    #23 0x5661ee56 in main jerryscript/jerry-main/main-unix.c:743
    #24 0xf7739750 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x1e750)

SUMMARY: AddressSanitizer: 14 byte(s) leaked in 1 allocation(s).
Backtrace
bt
#0  0xf7fd5059 in __kernel_vsyscall ()
#1  0xf77fc832 in raise () from /lib/i386-linux-gnu/libc.so.6
#2  0xf77fdcc1 in abort () from /lib/i386-linux-gnu/libc.so.6
#3  0x5657ac87 in jerry_port_fatal (code=ERR_FAILED_INTERNAL_ASSERTION) at jerryscript/jerry-port/default/default-fatal.c:71
#4  0x566173a1 in jerry_fatal (code=ERR_FAILED_INTERNAL_ASSERTION) at jerryscript/jerry-core/jrt/jrt-fatals.c:58
#5  0x566173e2 in jerry_assert_fail (assertion=0x566aa680 "JERRY_CONTEXT (jmem_heap_allocated_size) == 0", file=0x566aa620 "jerryscript/jerry-core/jmem/jmem-heap.c", function=0x5667e1c0 <__func__.4608.lto_priv.111> "jmem_heap_finalize", line=106) at jerryscript/jerry-core/jrt/jrt-fatals.c:82
#6  0x566165df in jmem_heap_finalize () at jerryscript/jerry-core/jmem/jmem-heap.c:106
#7  0x56616405 in jmem_finalize () at jerryscript/jerry-core/jmem/jmem-allocator.c:170
#8  0x566401be in jerry_cleanup () at jerryscript/jerry-core/api/jerry.c:231
#9  0x5663dfb0 in main (argc=3, argv=0xffffcc14) at jerryscript/jerry-main/main-unix.c:941

Found by Fuzzinator with grammarinator.

@rerobika rerobika added bug Undesired behaviour ES2015 Related to ES2015 features labels Sep 4, 2019
rerobika added a commit to rerobika/jerryscript that referenced this issue Sep 4, 2019
dbatyai pushed a commit that referenced this issue Sep 4, 2019
…ex] (#3052)

This patch fixes #3049.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik [email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Undesired behaviour ES2015 Related to ES2015 features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants