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

Invalid memory read in mjs_execute() at mjs.c:9320 #243

Open
fengzhengzhan opened this issue Mar 22, 2023 · 1 comment
Open

Invalid memory read in mjs_execute() at mjs.c:9320 #243

fengzhengzhan opened this issue Mar 22, 2023 · 1 comment

Comments

@fengzhengzhan
Copy link

Invalid memory read in mjs at function mjs_execute in mjs.c:9320.

Environment

Ubuntu 18.04, 64 bit

Steps to reproduce

  1. download file
git clone https://github.com/cesanta/mjs.git mjs
cd mjs
git checkout d6c06a6
  1. compile libming with ASAN
clang -fsanitize=address mjs.c -o mjs_asan
  1. command for reproducing the error
./mjs_asan -f poc

Download poc:
mjs_invalid-memory-read_mjs9320.zip

ASAN report

> ./mjs_asan -f mjs_invalid-memory-read_mjs9320
AddressSanitizer:DEADLYSIGNAL
=================================================================
==23749==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x00000050e0d0 bp 0x7ffdec19de70 sp 0x7ffdec19dcb0 T0)
==23749==The signal is caused by a WRITE memory access.
==23749==Hint: address points to the zero page.
    #0 0x50e0d0 in mjs_execute /root/compiler1804/aflgo_dataset/mjs-issues-57/mjs.c:9320:46
    #1 0x50c2ce in mjs_exec_internal /root/compiler1804/aflgo_dataset/mjs-issues-57/mjs.c:9503:5
    #2 0x50c410 in mjs_exec_file /root/compiler1804/aflgo_dataset/mjs-issues-57/mjs.c:9526:11
    #3 0x50f8df in main /root/compiler1804/aflgo_dataset/mjs-issues-57/mjs.c:11783:13
    #4 0x7fe50601e082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
    #5 0x41c3cd in _start (/home/fzz/Desktop/STFGFuzz/Programs/mjs-issues-57/seeds_crash/mjs_asan+0x41c3cd)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /root/compiler1804/aflgo_dataset/mjs-issues-57/mjs.c:9320:46 in mjs_execute
==23749==ABORTING
@marvi3
Copy link

marvi3 commented May 15, 2023

Hello,
I tried to reproduce the problem but when following you instructions on the build step with clang and the adress-sanitizer I ran into the following problem:

usr/bin/ld: /lib/x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
clang: error: linker command failed with exit code 1

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