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

src/dfa/closure_posix.cc: pack() tweaks #224

Merged
merged 2 commits into from Oct 22, 2018

Conversation

@trofi
Copy link
Contributor

commented Oct 22, 2018

No description provided.

trofi added some commits Oct 22, 2018

src/dfa/closure_posix.cc: fix signed shift overflow
signed shift overflow is not defined by C standard.
clang++ -fsanitize=undefined detects it as:

```
src/dfa/closure_posix.cc:207:32: runtime error: left shift of negative value -1
```

This change wraps bit shift arithmetics into unsigned types.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
src/dfa/closure_posix.cc: fix pack() to drop two highest bits
```c
longest | (leftmost << 30);
```
assumes `longest` does not exceed 30 bits. It could if
it's a negative value originally.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

@skvadrik skvadrik merged commit 22b73ed into skvadrik:master Oct 22, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@skvadrik

This comment has been minimized.

Copy link
Owner

commented Oct 22, 2018

Merged! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.