Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect pointer addition in SpectralFilm can lead to out-of-bounds memory access. #450

Closed
mpriestman opened this issue Oct 20, 2024 · 0 comments

Comments

@mpriestman
Copy link
Contributor

In the constructor for SpectralFilm, the splatBuffer pointer is incremented by NSpectrumSamples. I think this is wrong, and it should be incremented by nBuckets instead.

https://github.com/mmp/pbrt-v4/blob/master/src/pbrt/film.cpp#L885

When nBuckets is greater than NSpectrumSamples, then no crash, but I think you'll get incorrect behaviour as the bucketSplats arrays will be overlapping. If nBuckets is less than NSpectrumSamples, then you'll end up reading/writing off the end of the allocated memory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants