Skip to content

Fix use of uninitialized invSpacing value in volume raytracing

Kenneth Moreland requested to merge kmorel/vtk-m:volume-raytracing-crash into master

The SamplerRect worklet had an error where it was possible that the invSpacing stack-local values could be used uninitialized. On the first iteration of the loop in the SamplerRect operation, it calls LocateCell, which is supposed to set invSpacing. Under most conditions it does, but if one of the ray directions is 0 (which can happen with axis-aligned views), one of the invSpacing dimensions was skipped, leaving the value to whatever garbage happened to be on the stack. Later, the invSpacing value was used to interpolate a scalar, which under some circumstances could cause an array index error when looking up a color in the color map.

This fix changes the condition for when the ray direction is 0 to still initialize invSpacing.

Merge request reports