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

[rmodels] Read uninitialized values in GenMeshTangents() #3998

Open
ListeriaM opened this issue May 21, 2024 · 1 comment
Open

[rmodels] Read uninitialized values in GenMeshTangents() #3998

ListeriaM opened this issue May 21, 2024 · 1 comment
Labels
help needed - please! I need help with this issue

Comments

@ListeriaM
Copy link
Contributor

This commit (c4a51a3) will skip the last iteration if mesh->vertexCount % 3 == 0 (I suppose this is the normal case), which results in the last values for tan1 and tan2 being uninitialized. In any case this reads uninitialized memory from the end of tan1 and tan2 in the next loop regardless of the value of mesh->vertexCount. Did you mean to use i <= mesh->vertexCount - 3? Maybe a better option would be to assert that mesh->vertexCount % 3 == 0 and keep the old loop, since otherwise the last 1 or 2 values from tan1 and tan2 will always be uninitialized, which is probably not what you want.

\cc @sgalindo

@ListeriaM ListeriaM changed the title [rmodels] Fix out of bounds error in GenMeshTangents for loop [rmodels] Read uninitialized values in GenMeshTangents May 21, 2024
@raysan5
Copy link
Owner

raysan5 commented May 21, 2024

@ListeriaM Thanks for the further review, I didn't notice it...

@raysan5 raysan5 changed the title [rmodels] Read uninitialized values in GenMeshTangents [rmodels] Read uninitialized values in GenMeshTangents() May 22, 2024
@raysan5 raysan5 added the help needed - please! I need help with this issue label May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help needed - please! I need help with this issue
Projects
None yet
Development

No branches or pull requests

2 participants