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

Segmentation fault in function mjs_getretvalpos (at mjs.c:7812) #305

Open
Vancir opened this issue Nov 19, 2024 · 0 comments
Open

Segmentation fault in function mjs_getretvalpos (at mjs.c:7812) #305

Vancir opened this issue Nov 19, 2024 · 0 comments

Comments

@Vancir
Copy link

Vancir commented Nov 19, 2024

I found a segmentation fault bug while mjs (latest, b1b6eac) executes the PoC on Ubuntu 20.04.

Download the PoC: mjs_segv_mjs7812.zip

ASAN Report

==198941==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x0000004dd324 bp 0x7ffe444c3568 sp 0x7ffe444c3558 T0)
==198941==The signal is caused by a READ memory access.
==198941==Hint: this fault was caused by a dereference of a high value address (see register values below).  Disassemble the provided pc to learn which register was used.
    #0 0x4dd324 in mjs_getretvalpos /data/song/projects/latest-programs/mjs/BUILD/mjs.c:7812:3
    #1 0x4dd441 in mjs_return /data/song/projects/latest-programs/mjs/BUILD/mjs.c:7837:13
    #2 0x4dba66 in mjs_do_gc /data/song/projects/latest-programs/mjs/BUILD/mjs.c:7363:3
    #3 0x4dd8ee in mjs_exec_internal /data/song/projects/latest-programs/mjs/BUILD/mjs.c:9044:5
    #4 0x4ddaeb in mjs_exec_file /data/song/projects/latest-programs/mjs/BUILD/mjs.c:9067:11
    #5 0x4e1e65 in main /data/song/projects/latest-programs/mjs/BUILD/mjs.c:11423:11
    #6 0x7f7d37683d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #7 0x7f7d37683e3f in __libc_start_main csu/../csu/libc-start.c:392:3
    #8 0x41f344 in _start (/data/song/projects/latest-programs/mjs/mjs-bin+0x41f344)

Steps to reproduce

git clone https://github.com/cesanta/mjs.git
cd mjs
clang -g -O1 -fsanitize=address -fno-omit-frame-pointer -Wno-error -DMJS_MAIN mjs.c -dl -o mjs_asan
./mjs_asan -f PoC 
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

1 participant