Skip to content

ubsan: signed integer overflow in ecma_typedarray_setter_number_to_uint32 #5352

Backlog

Description

@renatahodovan
JerryScript revision

b706935

Build platform

macOS 26.6.2, arm64

Build steps
./tools/build.py --clean --debug --compile-flag=-fsanitize=address,signed-integer-overflow --logging=on --compile-flag="-Wno-error=enum-enum-conversion" --compile-flag="-Wno-unterminated-string-initialization"
Test case
Uint16Array/Uint16Array.of(5<<383)
Output
jerryscript/jerry-core/ecma/operations/ecma-typedarray-object.c:224:34: runtime error: negation of -2147483648 cannot be represented in type 'int32_t' (aka 'int'); cast to an unsigned type to negate this value to itself
    #0 0x00010073b18c in ecma_typedarray_setter_number_to_uint32 ecma-typedarray-object.c:224
    #1 0x00010074303c in ecma_typedarray_set_uint16_element ecma-typedarray-object.c:360
    #2 0x0001006d1718 in ecma_builtin_typedarray_of ecma-builtin-typedarray.c:148
    #3 0x0001006d10c8 in ecma_builtin_typedarray_dispatch_routine ecma-builtin-typedarray.inc.h:41
    #4 0x0001006c4770 in ecma_builtin_dispatch_routine ecma-builtins.c:1460
    #5 0x0001006c41b0 in ecma_builtin_dispatch_call ecma-builtins.c:1489
    #6 0x0001007030ec in ecma_op_function_call_native_built_in ecma-function-object.c:1223
    #7 0x0001007021d8 in ecma_op_function_call ecma-function-object.c:1468
    #8 0x0001007025b4 in ecma_op_function_validated_call ecma-function-object.c:1428
    #9 0x000100829fc8 in opfunc_call vm.c:758
    #10 0x00010080a4b4 in vm_execute vm.c:5236
    #11 0x000100808b5c in vm_run vm.c:5331
    #12 0x000100808634 in vm_run_global vm.c:286
    #13 0x000100619478 in jerry_run jerryscript.c:549
    #14 0x000100830824 in jerryx_source_exec_script sources.c:68
    #15 0x0001006115b4 in main main-desktop.c:156
    #16 0x0001822b84e0 in start+0x1b4c (dyld:arm64e+0x204e0) undefined-behavior jerryscript/jerry-core/ecma/operations/ecma-typedarray-object.c:483:23

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions