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_stack_size (at mjs.c:7849) #304

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

Segmentation fault in function mjs_stack_size (at mjs.c:7849) #304

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_mjs7849.zip

ASAN Report

==866928==ERROR: AddressSanitizer: SEGV on unknown address 0x0000000000d8 (pc 0x0000004dd2e8 bp 0x7ffdde783148 sp 0x7ffdde783148 T0)
==866928==The signal is caused by a READ memory access.
==866928==Hint: address points to the zero page.
    #0 0x4dd2e8 in mjs_stack_size /data/song/projects/latest-programs/mjs/BUILD/mjs.c:7849:13
    #1 0x4dd040 in vptr /data/song/projects/latest-programs/mjs/BUILD/mjs.c:7853:14
    #2 0x4dd317 in mjs_getretvalpos /data/song/projects/latest-programs/mjs/BUILD/mjs.c:7810:21
    #3 0x4dd441 in mjs_return /data/song/projects/latest-programs/mjs/BUILD/mjs.c:7837:13
    #4 0x4db66c in mjs_ffi_cb_free /data/song/projects/latest-programs/mjs/BUILD/mjs.c:10140:3
    #5 0x4dd8ee in mjs_exec_internal /data/song/projects/latest-programs/mjs/BUILD/mjs.c:9044:5
    #6 0x4ddaeb in mjs_exec_file /data/song/projects/latest-programs/mjs/BUILD/mjs.c:9067:11
    #7 0x4e1df7 in main /data/song/projects/latest-programs/mjs/BUILD/mjs.c:11406:13
    #8 0x7f236f6dfd8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #9 0x7f236f6dfe3f in __libc_start_main csu/../csu/libc-start.c:392:3
    #10 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