Skip to content

Segmentation fault in function getprop_builtin_string (at mjs.c:8421) #303

@Vancir

Description

@Vancir

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

Download the PoC: mjs_segv_mjs8421.zip

ASAN Report

==3004153==ERROR: AddressSanitizer: SEGV on unknown address 0x0000004f40b9 (pc 0x0000004f40b9 bp 0x7fff52e4b110 sp 0x7fff52e4adf8 T0)
==3004153==The signal is caused by a WRITE memory access.
    #0 0x4f40b9 in getprop_builtin_string /data/song/projects/latest-programs/mjs/BUILD/mjs.c:8421:14
    #1 0x4dd8ee in mjs_exec_internal /data/song/projects/latest-programs/mjs/BUILD/mjs.c:9044:5
    #2 0x4ddaeb in mjs_exec_file /data/song/projects/latest-programs/mjs/BUILD/mjs.c:9067:11
    #3 0x4e1df7 in main /data/song/projects/latest-programs/mjs/BUILD/mjs.c:11406:13
    #4 0x7f320b4dad8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #5 0x7f320b4dae3f in __libc_start_main csu/../csu/libc-start.c:392:3
    #6 0x41f344 in _start (/data/song/projects/latest-programs/mjs/mjs-bin+0x41f344)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /data/song/projects/latest-programs/mjs/BUILD/mjs.c:8421:14 in getprop_builtin_string

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 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions