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

Remove undefined behavior caught by LLVM 10 UBSAN. #2108

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Gaelan
Copy link
Contributor

@Gaelan Gaelan commented Apr 28, 2020

LLVM 10's UBSAN catches several cases of undefined behavior when running the test suite:

  • jv_get cast array indices to an int, even if the index is out of range. I added a bounds check.
  • Several places do pointer math on null pointers, which is undefined behavior. I fixed this by special casing null.

Additionally, I added -fno-sanitize-recover=undefined to the CFLAGS, which is necessary to make UBSAN actually crash the program (and therefore fail the tests) instead of just logging an error.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 84.139% when pulling 5dc92fe on Gaelan:llvm10-ubsan into ccc79e5 on stedolan:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants