-
Notifications
You must be signed in to change notification settings - Fork 352
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
Crash in MaterialXCore::Element::setChildIndex()
due to off-by-one error in index check
#1581
Comments
This looks like a good catch, thanks @StefanHabel, and feel free to post your fix if you have the bandwidth! |
StefanHabel
added a commit
to StefanHabel/MaterialX
that referenced
this issue
Oct 22, 2023
Extended the existing test case: valid values for `index` in the test case are `0` and `1` only. Minimal repro via Python bindings: ```bash $ python3 -c 'import MaterialX as mx; d = mx.createDocument(); b = d.addBackdrop(); d.setChildIndex(b.getName(), 1)' ``` Without this patch: ```bash Segmentation fault ``` With this patch: ```python Traceback (most recent call last): File "<string>", line 1, in <module> LookupError: Invalid child index ``` Ran the tests locally via `make && make test`: ```bash 100% tests passed, 0 tests failed out of 73 ``` Update AcademySoftwareFoundation#1581 Signed-off-by: Stefan Habel <[email protected]>
Thanks for this report, @StefanHabel, as well as for the fix in #1582! |
Thanks very much @jstone-lucasfilm ! 🙌 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I believe I found an off-by-one crash bug in
MaterialXCore::Element::setChildIndex()
.Minimal repro via Python bindings:
$ python3 -c 'import MaterialX as mx; d = mx.createDocument(); b = d.addBackdrop(); d.setChildIndex(b.getName(), 1)' Segmentation fault
Expected behavior:
Fix:
Found while working on #342
The text was updated successfully, but these errors were encountered: