###### JerryScript revision
5962562e2dd1528472e6bea38e354b6ea73f559d

###### Build platform
Ubuntu 20.04.1 LTS (Linux 5.4.0-42-generic x86_64)
gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0

###### 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=-O2 --debug \
--system-allocator=on --linker-flag=-fuse-ld=gold
```

###### Test case
```javascript
new (class C2 { x = 5 })
```

###### Output
```sh
==9633==ERROR: AddressSanitizer: dynamic-stack-buffer-overflow on address 0xffd311ec at pc 0x566f201e bp 0xffd30ee8 sp 0xffd30ed8
WRITE of size 4 at 0xffd311ec thread T0
    #0 0x566f201d in vm_loop /home/jerryscript/jerry-core/vm/vm.c:3034
    #1 0x566d8988 in vm_execute /home/jerryscript/jerry-core/vm/vm.c:4953
    #2 0x566da514 in vm_run /home/jerryscript/jerry-core/vm/vm.c:5060
    #3 0x566fbae2 in opfunc_init_class_fields /home/jerryscript/jerry-core/vm/opcodes.c:1021
    #4 0x5673cb00 in ecma_op_function_call_native /home/jerryscript/jerry-core/ecma/operations/ecma-function-object.c:1244
    #5 0x5674517d in ecma_op_function_construct_native /home/jerryscript/jerry-core/ecma/operations/ecma-function-object.c:1474
    #6 0x5674517d in ecma_op_function_construct /home/jerryscript/jerry-core/ecma/operations/ecma-function-object.c:1552
    #7 0x566d8f35 in opfunc_construct /home/jerryscript/jerry-core/vm/vm.c:907
    #8 0x566d8f35 in vm_execute /home/jerryscript/jerry-core/vm/vm.c:4980
    #9 0x566da514 in vm_run /home/jerryscript/jerry-core/vm/vm.c:5060
    #10 0x56781451 in vm_run_global /home/jerryscript/jerry-core/vm/vm.c:350
    #11 0x56781451 in jerry_run /home/jerryscript/jerry-core/api/jerry.c:608
    #12 0x56781451 in jerry_run /home/jerryscript/jerry-core/api/jerry.c:582
    #13 0x5665bef7 in main /home/jerryscript/jerry-main/main-unix.c:123
    #14 0xf774dee4 in __libc_start_main (/lib32/libc.so.6+0x1eee4)
    #15 0x5665dd94 in _start (/home/jerryscript/build/bin/jerry+0xcd94)

Address 0xffd311ec is located in stack of thread T0
SUMMARY: AddressSanitizer: dynamic-stack-buffer-overflow /home/jerryscript/jerry-core/vm/vm.c:3034 in vm_loop
Shadow bytes around the buggy address:
  0x3ffa61e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x3ffa61f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x3ffa6200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x3ffa6210: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x3ffa6220: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x3ffa6230: 00 00 00 00 ca ca ca ca 00 00 00 00 00[04]cb cb
  0x3ffa6240: cb cb cb cb 00 00 00 00 00 00 00 00 00 00 00 00
  0x3ffa6250: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x3ffa6260: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x3ffa6270: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x3ffa6280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
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
  Shadow gap:              cc
==9633==ABORTING
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/) with [grammarinator](https://github.com/renatahodovan/grammarinator).</sup>

Dynamic stack buffer overflow in class initializers
This is a GitHub Issue
repo:jerryscript
owner:jerryscript-project
Title : Dynamic stack buffer overflow in class initializers
Issue date:

--- start body ---
###### JerryScript revision
5962562e2dd1528472e6bea38e354b6ea73f559d

###### Build platform
Ubuntu 20.04.1 LTS (Linux 5.4.0-42-generic x86_64)
gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0

###### 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=-O2 --debug \
--system-allocator=on --linker-flag=-fuse-ld=gold
```

###### Test case
```javascript
new (class C2 { x = 5 })
```

###### Output
```sh
==9633==ERROR: AddressSanitizer: dynamic-stack-buffer-overflow on address 0xffd311ec at pc 0x566f201e bp 0xffd30ee8 sp 0xffd30ed8
WRITE of size 4 at 0xffd311ec thread T0
    #0 0x566f201d in vm_loop /home/jerryscript/jerry-core/vm/vm.c:3034
    #1 0x566d8988 in vm_execute /home/jerryscript/jerry-core/vm/vm.c:4953
    #2 0x566da514 in vm_run /home/jerryscript/jerry-core/vm/vm.c:5060
    #3 0x566fbae2 in opfunc_init_class_fields /home/jerryscript/jerry-core/vm/opcodes.c:1021
    #4 0x5673cb00 in ecma_op_function_call_native /home/jerryscript/jerry-core/ecma/operations/ecma-function-object.c:1244
    #5 0x5674517d in ecma_op_function_construct_native /home/jerryscript/jerry-core/ecma/operations/ecma-function-object.c:1474
    #6 0x5674517d in ecma_op_function_construct /home/jerryscript/jerry-core/ecma/operations/ecma-function-object.c:1552
    #7 0x566d8f35 in opfunc_construct /home/jerryscript/jerry-core/vm/vm.c:907
    #8 0x566d8f35 in vm_execute /home/jerryscript/jerry-core/vm/vm.c:4980
    #9 0x566da514 in vm_run /home/jerryscript/jerry-core/vm/vm.c:5060
    #10 0x56781451 in vm_run_global /home/jerryscript/jerry-core/vm/vm.c:350
    #11 0x56781451 in jerry_run /home/jerryscript/jerry-core/api/jerry.c:608
    #12 0x56781451 in jerry_run /home/jerryscript/jerry-core/api/jerry.c:582
    #13 0x5665bef7 in main /home/jerryscript/jerry-main/main-unix.c:123
    #14 0xf774dee4 in __libc_start_main (/lib32/libc.so.6+0x1eee4)
    #15 0x5665dd94 in _start (/home/jerryscript/build/bin/jerry+0xcd94)

Address 0xffd311ec is located in stack of thread T0
SUMMARY: AddressSanitizer: dynamic-stack-buffer-overflow /home/jerryscript/jerry-core/vm/vm.c:3034 in vm_loop
Shadow bytes around the buggy address:
  0x3ffa61e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x3ffa61f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x3ffa6200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x3ffa6210: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x3ffa6220: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x3ffa6230: 00 00 00 00 ca ca ca ca 00 00 00 00 00[04]cb cb
  0x3ffa6240: cb cb cb cb 00 00 00 00 00 00 00 00 00 00 00 00
  0x3ffa6250: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x3ffa6260: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x3ffa6270: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x3ffa6280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
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
  Shadow gap:              cc
==9633==ABORTING
```
<sup>Found by [Fuzzinator](http://fuzzinator.readthedocs.io/) with [grammarinator](https://github.com/renatahodovan/grammarinator).</sup>

--- end body ---
