Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Runtime error when running with clang -fsanitize=undefined #166

@guillaumechereau

Description

@guillaumechereau

To reproduce, I built the code 'examples' with the following command on my mac:

cd examples
clang test_json.c ../json.c -I ../ -fsanitize=undefined

Then when I run:

./a.out ../tests/valid-0000.json

I get this runtime warning:

../json.c:437:34: runtime error: applying non-zero offset 8 to null pointer

It seems to work if I replace in the code the line:

json_car **char = (json_char **) &top->u.object.values;

by:

intptr_t *chars = (intptr_t *) &top->u.object.values;

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