check for errors in ShadingSystem::ReParameter()#1998
Merged
Conversation
lgritz
approved these changes
Jun 10, 2025
lgritz
left a comment
Collaborator
There was a problem hiding this comment.
Code LGTM, though needs a clang-format and I think you didn't DCO-sign the commit.
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a potential crash in ShadingSystemImpl::ReParameter by checking if the offset returned by interactive_param_offset() is valid before performing a memcpy.
- Added a condition to verify the offset is non-negative
- Prevents the memcpy from executing if the offset is invalid
Comments suppressed due to low confidence (1)
src/liboslexec/shadingsys.cpp:3442
- Returning true when the offset is invalid might be misleading if an invalid offset should indicate a failure. Consider returning false or logging a warning to clearly signal the issue.
else
…rameter in the live-params records Signed-off-by: Clifford Stein <cstein@imageworks.com>
lgritz
pushed a commit
to lgritz/OpenShadingLanguage
that referenced
this pull request
Jul 2, 2025
…eFoundation#1998) ShadingSystem() wasn't checking whether the offset returned by interactive_param_offset() was valid or not before performing the ReParameter() memcpy(). So, we could copy data to a location outside of a valid memory block and cause a crash. Signed-off-by: Clifford Stein <cstein@imageworks.com>
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.
Description
ShadingSystem() wasn't checking whether the offset returned by interactive_param_offset() was valid or not before performing the ReParameter() memcpy(). So, we could copy data to a location outside of a valid memory block and cause a crash.
Tests
tests pass except for '987 - render-microfacet.opt (Failed)' but I get the same error for main.
Checklist:
already run clang-format v17 before submitting, I definitely will look at
the CI test that runs clang-format and fix anything that it highlights as
being nonconforming.