Skip to content
Snippets Groups Projects

Fix use of uninitialized invSpacing value in volume raytracing

Merged Kenneth Moreland requested to merge kmorel/vtk-m:volume-raytracing-crash into master
  1. Jun 07, 2016
    • Kenneth Moreland's avatar
      Fix use of uninitialized invSpacing value · 88344582
      Kenneth Moreland authored
      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.
      88344582
Loading