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

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

Open
guillaumechereau opened this issue Aug 31, 2022 · 0 comments
Open

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

guillaumechereau opened this issue Aug 31, 2022 · 0 comments

Comments

@guillaumechereau
Copy link

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;
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