Closed wahn closed 4 years ago
Add the following check and you will see that the following lines sometimes produce an index out of bounds:
> git diff diff --git a/src/textures/marble.h b/src/textures/marble.h index 26e231b..054d0b2 100644 --- a/src/textures/marble.h +++ b/src/textures/marble.h @@ -73,6 +73,7 @@ class MarbleTexture : public Texture<Spectrum> { #define NC sizeof(c) / sizeof(c[0]) #define NSEG (NC - 3) int first = std::floor(t * NSEG); + CHECK_LT(first, NSEG); t = (t * NSEG - first); Spectrum c0 = Spectrum::FromRGB(c[first]); Spectrum c1 = Spectrum::FromRGB(c[first + 1]);
> ~/builds/pbrt/release/pbrt breakfast-lamps.pbrt pbrt version 3 (built Apr 1 2019 at 16:44:39) [Detected 8 cores] Copyright (c)1998-2018 Matt Pharr, Greg Humphreys, and Wenzel Jakob. The source code to pbrt (but *not* the book contents) is covered by the BSD License. See the file LICENSE.txt for the conditions of the license. Rendering: [ ] (1.0s|?s) F0828 15:33:15.123517 15723 marble.h:76] Check failed: first < (sizeof(c) / sizeof(c[0]) - 3) (6 vs. 6) *** Check failure stack trace: *** @ 0x73618a google::LogMessage::Fail() @ 0x736439 google::LogMessage::SendToLog() @ 0x7352df google::LogMessage::Flush() @ 0x73ad69 google::LogMessageFatal::~LogMessageFatal() @ 0x5f090a pbrt::MarbleTexture::Evaluate() @ 0x576c42 pbrt::PlasticMaterial::ComputeScatteringFunctions() @ 0x4ca084 pbrt::GeometricPrimitive::ComputeScatteringFunctions() @ 0x6060f8 pbrt::SurfaceInteraction::ComputeScatteringFunctions() @ 0x5265b7 pbrt::RandomWalk() @ 0x528114 pbrt::GenerateLightSubpath() @ 0x52aa17 _ZZN4pbrt14BDPTIntegrator6RenderERKNS_5SceneEENKUlNS_6Point2IiEEE_clES5_ @ 0x4af2d9 pbrt::workerThreadFunc() @ 0x4afe13 std::thread::_Impl<>::_M_run() @ 0x7f24214c1360 (unknown) @ 0x7f2421931e25 start_thread @ 0x7f2420c25bad __clone @ (nil) (unknown) Abort (core dumped)
Fixed--thanks!
Add the following check and you will see that the following lines sometimes produce an index out of bounds: