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

Fixed off-by-one index check in setChildIndex #1582

Commits on Oct 22, 2023

  1. Fixed an off-by-one index check in Element::setChildIndex().

    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]>
    StefanHabel committed Oct 22, 2023
    Configuration menu
    Copy the full SHA
    7d065ef View commit details
    Browse the repository at this point in the history