Skip to content

Fix crash when minipbrt::Loader::load(filename) could not open the file provided and crash with loop subdiv #10

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Uedaki
Copy link
Contributor

@Uedaki Uedaki commented Dec 29, 2023

Fix 1

When failing to open a file (minipbrt.cpp:4676), minipbrt would call set_error() prior to the creation m_filedata allocated few lines after. This would create a crash when set_error() is trying to access the pointer to retrieve the filename and the error offset.

Fix 2

I encountered a crash when trying to triangulate a loop subdiv. It seems that the number of points was not divided by 3 after the call to float_vector_param generating a crash inside the LoopSubdiv::triangle_mesh() function which is trying to copy num_points * 3 floats from float P[num_points] to float trimesh->P[num_points * 3]. I fixed the issue by dividing the number of points by 3 when creating a loop subdiv.

@Uedaki Uedaki changed the title Fix crash when minipbrt::Loader::load(filename) could not open the file provided Fix crash when minipbrt::Loader::load(filename) could not open the file provided and crash with loop subdiv Apr 12, 2025
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

Successfully merging this pull request may close these issues.

1 participant