Skip to content

Commit

Permalink
FlatImageProcessor : Don't access input with invalid image:viewName
Browse files Browse the repository at this point in the history
We were already performing this check for array inputs, but had omitted it for the single-input case.
  • Loading branch information
johnhaddon committed Feb 28, 2024
1 parent ed68650 commit ff8a5ca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Fixes
-----

- 3Delight : Fixed startup errors on Windows when the `DELIGHT` environment variable wasn't defined [^1].
- FlatImageProcessor : Fixed bug that could cause an input to be evaluated with an invalid `image:viewName`.

Breaking Changes
----------------
Expand Down
10 changes: 8 additions & 2 deletions src/GafferImage/FlatImageProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ void FlatImageProcessor::hashDeep( const GafferImage::ImagePlug *parent, const G
{
// We need to append to the node hash, rather than just overriding with the upstream value,
// so that we can't reuse the plug value from upstream, and have to call compute()
h.append( inPlug()->deepPlug()->hash() );
if( ImageAlgo::viewIsValid( context, inPlug()->viewNames()->readable() ) )
{
h.append( inPlug()->deepPlug()->hash() );
}
}
}

Expand All @@ -128,7 +131,10 @@ bool FlatImageProcessor::computeDeep( const Gaffer::Context *context, const Imag
}
else
{
if( inPlug()->deepPlug()->getValue() )
if(
ImageAlgo::viewIsValid( context, inPlug()->viewNames()->readable() ) &&
inPlug()->deepPlug()->getValue()
)
{
badInput = inPlug();
}
Expand Down

0 comments on commit ff8a5ca

Please sign in to comment.