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

Heap-use-after-free src/jsiValue.c:41 in Jsi_DecrRefCount #74

Closed
hope-fly opened this issue Dec 24, 2021 · 0 comments
Closed

Heap-use-after-free src/jsiValue.c:41 in Jsi_DecrRefCount #74

hope-fly opened this issue Dec 24, 2021 · 0 comments

Comments

@hope-fly
Copy link

Jsish revision

Commit: 9fa798e

Version: v3.5.0

Build platform

Ubuntu 18.04.5 LTS (Linux 5.4.0-44-generic x86_64)

Build steps
export CFLAGS='-fsanitize=address'
make
Test case
function JSEtest() {
  Object.prototype = 1;
}

JSEtest();

Execution steps & Output
$ ./jsish/jsish poc.js
==44651==ERROR: AddressSanitizer: heap-use-after-free on address 0x6030000001c0 at pc 0x5556b3bd8724 bp 0x7ffdd9e16980 sp 0x7ffdd9e16970
READ of size 4 at 0x6030000001c0 thread T0
    #0 0x5556b3bd8723 in Jsi_DecrRefCount src/jsiValue.c:41
    #1 0x5556b3c1177b in jsiInterpDelete src/jsiInterp.c:1933
    #2 0x5556b4428047 in jsi_main src/main.c:49
    #3 0x7fd6540bcbf6 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21bf6)
    #4 0x5556b3bb7969 in _start (/usr/local/bin/jsish+0xe8969)

0x6030000001c0 is located 0 bytes inside of 32-byte region [0x6030000001c0,0x6030000001e0)
freed by thread T0 here:
    #0 0x7fd654d2b7a8 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xde7a8)
    #1 0x5556b3bd86cf in Jsi_DecrRefCount src/jsiValue.c:52

previously allocated by thread T0 here:
    #0 0x7fd654d2bd28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x5556b3c28aa4 in Jsi_Calloc src/jsiUtils.c:57

SUMMARY: AddressSanitizer: heap-use-after-free src/jsiValue.c:41 in Jsi_DecrRefCount
Shadow bytes around the buggy address:
  0x0c067fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c067fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c067fff8000: fa fa fd fd fd fd fa fa fd fd fd fa fa fa fd fd
  0x0c067fff8010: fd fd fa fa fd fd fd fa fa fa fd fd fd fd fa fa
  0x0c067fff8020: fd fd fd fd fa fa fd fd fd fd fa fa fd fd fd fd
=>0x0c067fff8030: fa fa fd fd fd fd fa fa[fd]fd fd fd fa fa fd fd
  0x0c067fff8040: fd fd fa fa fd fd fd fd fa fa fd fd fd fd fa fa
  0x0c067fff8050: fd fd fd fd fa fa fd fd fd fd fa fa fd fd fd fd
  0x0c067fff8060: fa fa fd fd fd fd fa fa fd fd fd fd fa fa fd fd
  0x0c067fff8070: fd fd fa fa fd fd fd fd fa fa fd fd fd fd fa fa
  0x0c067fff8080: fd fd fd fd fa fa fd fd fd fd fa fa fd fd fd fd
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
pcmacdon referenced this issue Dec 27, 2021
FossilOrigin-Name: d5dceac3d0939cc603da1d0674731e1bcec9277e1d49cebf2adf2782b5f181af
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants