-
Notifications
You must be signed in to change notification settings - Fork 357
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 some longstanding (no)-fsanitize sloppiness #90
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Off by one in bitbuffer that we were only hitting in tests (hopefully) * a malloc+delete no-no * explicit init of a cv::Mat() in CimbDecoderTest I'd like to enable `-fsanitize=undefined,address` by default (at least for dev builds), but we'll need to fix some library dependencies first.
sz3
commented
Feb 8, 2024
@@ -57,7 +57,7 @@ cv::Mat load_img(string path) | |||
vector<unsigned char> data(bytes.data(), bytes.data() + bytes.size()); | |||
|
|||
int width, height, channels; | |||
std::unique_ptr<uint8_t[]> imgdata(stbi_load_from_memory(data.data(), static_cast<int>(data.size()), &width, &height, &channels, STBI_rgb_alpha)); | |||
std::unique_ptr<uint8_t[], void (*)(void*)> imgdata(stbi_load_from_memory(data.data(), static_cast<int>(data.size()), &width, &height, &channels, STBI_rgb_alpha), ::free); |
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.
A neat trick I learned from the oracle that is stackoverflow
sz3
commented
Feb 8, 2024
@@ -61,15 +61,15 @@ class bitbuffer | |||
|
|||
bool write(unsigned data, unsigned index, int length) | |||
{ | |||
resize(index+length-1); | |||
resize(index+length); |
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.
😱
sz3
added a commit
to sz3/cfc
that referenced
this pull request
Feb 9, 2024
Off by one, memory corruption, we got it all... #29 sz3/libcimbar#89 sz3/libcimbar#90 Thanks to @notune for the AdjacentCellFinder fix! Co-authored-by: Noah<[email protected]>
sz3
added a commit
that referenced
this pull request
Mar 13, 2024
368c2c4 Merge pull request #90 from sz3/bugfix-santitize-future 258991b Fix some longstanding (no)-fsanitize sloppiness e77b598 Merge pull request #89 from sz3/bugfix-flood-decode-bounds-check ead73ea fix memory corruption bug 0fe367f Fix the error check in FloodDecodePositions 97f4af3 Merge pull request #87 from sz3/build-and-css-bugfix-24-2 0f2d718 Tweak to make package-portable-linux slightly less docker dependent d2ddcc2 Use innerWidth to avert android firefox shenanigans 8f9caa1 If negative z-index is bad vibes, we should set z-index+1 various places 38b8068 Update index.html 0119374 Merge pull request #85 from sz3/pin-cmake-portable-build 452eb71 Pin "portable" linux script to use an old (known good) cmake 05d5e38 Merge pull request #82 from sz3/ios-css-bugfix 69a7d41 Fix bug/change in ios (un)focus behavior? git-subtree-dir: app/src/cpp/libcimbar git-subtree-split: 368c2c4
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
unique_ptr
deallocator tofree
)I'd like to enable
-fsanitize=undefined,address
by default (at least for dev builds), but we'll need to fix some library dependencies first.