Closed
Description
Revision
Build
./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
--error-messages=on --profile=es2015-subset
OS
Linux 4.15.0-58-generic #64-Ubuntu x86_64 GNU/Linux
Test case
var arrb = new ArrayBuffer(2147483648);
var arr = new Uint8Array(arrb);
arr.copyWithin({}, 8)
Backtrace
Run with jerry poc.js
=================================================================
==1326==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf54fe818 at pc 0xf79c5836 bp 0xffcf8508 sp 0xffcf80d8
READ of size 2147483648 at 0xf54fe818 thread T0
#0 0xf79c5835 in memmove (/usr/lib32/libasan.so.4+0x7a835)
#1 0x5668797a in ecma_builtin_typedarray_prototype_copy_within /jerryscript/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.c:1900
#2 0x5667ea93 in ecma_builtin_typedarray_prototype_dispatch_routine /jerryscript/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.inc.h:75
#3 0x5667d4bb in ecma_builtin_dispatch_routine /jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.c:1021
#4 0x5667d71c in ecma_builtin_dispatch_call /jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.c:1046
#5 0x566a01b5 in ecma_op_function_call /jerryscript/jerry-core/ecma/operations/ecma-function-object.c:729
#6 0x5672f59a in opfunc_call /jerryscript/jerry-core/vm/vm.c:581
#7 0x5674494f in vm_execute /jerryscript/jerry-core/vm/vm.c:3636
#8 0x567451fe in vm_run /jerryscript/jerry-core/vm/vm.c:3756
#9 0x5672e400 in vm_run_global /jerryscript/jerry-core/vm/vm.c:282
#10 0x565ede50 in jerry_run /jerryscript/jerry-core/api/jerry.c:576
#11 0x565ea63e in main /jerryscript/jerry-main/main-unix.c:743
#12 0xf778ae80 in __libc_start_main (/lib32/libc.so.6+0x18e80)
#13 0x565e7f10 (/home/xyz/jerryscript/tmpmaster/jerry+0x15f10)
0xf54fe818 is located -2147483624 bytes inside of 2147483672-byte region [0x754fe800,0xf54fe818)
allocated by thread T0 here:
#0 0xf7a30f34 in malloc (/usr/lib32/libasan.so.4+0xe5f34)
#1 0x566cf549 in jmem_heap_alloc /jerryscript/jerry-core/jmem/jmem-heap.c:258
#2 0x566cf5c1 in jmem_heap_gc_and_alloc_block /jerryscript/jerry-core/jmem/jmem-heap.c:293
#3 0x5661c589 in jmem_heap_alloc_block /jerryscript/jerry-core/jmem/jmem-heap.c:327
#4 0x5661c589 in ecma_alloc_extended_object /jerryscript/jerry-core/ecma/base/ecma-alloc.c:109
#5 0x5661c589 in ecma_create_object /jerryscript/jerry-core/ecma/base/ecma-helpers.c:81
#6 0x5668ed8b in ecma_arraybuffer_new_object /jerryscript/jerry-core/ecma/operations/ecma-arraybuffer-object.c:49
#7 0x5668f2eb in ecma_op_create_arraybuffer_object /jerryscript/jerry-core/ecma/operations/ecma-arraybuffer-object.c:149
#8 0x5663a8f9 in ecma_builtin_arraybuffer_dispatch_construct /jerryscript/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer.c:94
#9 0x5667d9b0 in ecma_builtin_dispatch_construct /jerryscript/jerry-core/ecma/builtin-objects/ecma-builtins.c:1080
#10 0x566a17b4 in ecma_op_function_construct /jerryscript/jerry-core/ecma/operations/ecma-function-object.c:1077
#11 0x5672fbb9 in opfunc_construct /jerryscript/jerry-core/vm/vm.c:665
#12 0x56744975 in vm_execute /jerryscript/jerry-core/vm/vm.c:3648
#13 0x567451fe in vm_run /jerryscript/jerry-core/vm/vm.c:3756
#14 0x5672e400 in vm_run_global /jerryscript/jerry-core/vm/vm.c:282
#15 0x565ede50 in jerry_run /jerryscript/jerry-core/api/jerry.c:576
#16 0x565ea63e in main /jerryscript/jerry-main/main-unix.c:743
#17 0xf778ae80 in __libc_start_main (/lib32/libc.so.6+0x18e80)
SUMMARY: AddressSanitizer: heap-buffer-overflow (/usr/lib32/libasan.so.4+0x7a835) in memmove
Shadow bytes around the buggy address:
0x3ea9fcb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x3ea9fcc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x3ea9fcd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x3ea9fce0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x3ea9fcf0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x3ea9fd00: 00 00 00[fa]fa fa fa fa fa fa fa fa fa fa fa fa
0x3ea9fd10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3ea9fd20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3ea9fd30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3ea9fd40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3ea9fd50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==1326==ABORTING