-
-
Notifications
You must be signed in to change notification settings - Fork 706
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
Fix 22838 - BitArray.count reads beyond data #8401
Conversation
This fixes issue 22838 https://issues.dlang.org/show_bug.cgi?id=22838 All hail AddressSanitizer! ;-)
|
Thanks for your pull request and interest in making D better, @JohanEngelen! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla references
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "stable + phobos#8401" |
|
Please include the test case |
The test case is already there :) The bug is triggered by a unittest (see bug report). The invalid memory access is of course only found when enabling ASan. |
|
The test is already there. The failure is visible only when running with AddressSanitizer, which we don't do as part of our unit tests, so there is nothing to add. Is it possible to write a unit test which purposefully clobbers respective memory so that the failure is visible outside AddressSanitizer, though? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that was the only case where _ptr[fullWords] was accessed before checking that endBits is non-zero.
|
Reopening the PR with the same branch as another confused the CI I think. |
No. It is an invalid read, but the calculation of bit count still works, because of the masking with endMask. Edit: |
I started implementing it in dmd during the Christmas holiday but then I realized it was supposed to be a holiday and stopped. |
|
CI errors are not due to this PR |
|
[AFAIK, CI doesn't like direct branches on the upstream repo. That's mainly intended for bigger features targeting |
This fixes issue 22838
https://issues.dlang.org/show_bug.cgi?id=22838
All hail AddressSanitizer! ;-)