fix: image move constructor passes wrong stride unit to base constructor#119
Merged
david-tingdahl-nvidia merged 1 commit intonvidia-isaac:publicfrom Mar 6, 2026
Merged
Conversation
Contributor
|
Thanks for finding and fixing this bug. Could easily lead to some pretty confusing/weird errors. It hasn’t affected us much since we rarely use Could you please:
Following this bug, we are also looking into extending the test suite for |
Image move constructor passed the stride in number of elements, while ImageBase expects the stride in number of bytes. This would cause an assert error in debug and potentially corrupt memory access.
1b915d6 to
567ab48
Compare
Contributor
Author
|
Hi, Thanks for the quick response. Good to hear that this was actually an important problem and I guess we were mostly lucky that moving images did not happen much. Without the debug assert, I would have never noticed. Hope the updates on the commit message and the PR description are ok now, as well as the formatting. |
david-tingdahl-nvidia
approved these changes
Mar 6, 2026
Contributor
david-tingdahl-nvidia
left a comment
There was a problem hiding this comment.
Thanks for the fix!
3f42b21
into
nvidia-isaac:public
11 of 12 checks passed
This file contains hidden or 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
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.
Closes #118
This debug assertion in
Imagecould be hit:nvblox/nvblox/include/nvblox/sensors/image.h
Lines 186 to 191 in 48aa18a
, because for the constructor
ImageBase::ImageBase(int rows, int cols, int stride_bytes, int num_elements_per_pixel, OtherElementType* data)theImagemove constructor passed the stride in number of elements instead of number bytes.The fix is straightforward: pass the strides in numbers of bytes instead of numbers of elements on that call.