Skip to content

Commit

Permalink
Fix out of bounds index in MarbleTexture. Issue mmp#252
Browse files Browse the repository at this point in the history
  • Loading branch information
mmp committed Oct 12, 2019
1 parent 9adaee8 commit 22eded1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/textures/marble.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class MarbleTexture : public Texture<Spectrum> {
};
#define NC sizeof(c) / sizeof(c[0])
#define NSEG (NC - 3)
int first = std::floor(t * NSEG);
int first = std::min(1, int(std::floor(t * NSEG)));
t = (t * NSEG - first);
Spectrum c0 = Spectrum::FromRGB(c[first]);
Spectrum c1 = Spectrum::FromRGB(c[first + 1]);
Expand Down

0 comments on commit 22eded1

Please sign in to comment.