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 27, 2024
1 parent 0199292 commit 3ad974a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
1.4.x.x (relative to 1.4.0.0b1)
=======

Fixes
-----

- 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 3ad974a

Please sign in to comment.