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

Malloc return not checked in stbi_write_hdr_core #1645

Open
catenacyber opened this issue May 22, 2024 · 0 comments
Open

Malloc return not checked in stbi_write_hdr_core #1645

catenacyber opened this issue May 22, 2024 · 0 comments

Comments

@catenacyber
Copy link

Describe the bug
https://github.com/nothings/stb/blob/master/stb_image_write.h#L767 does not check the malloc return value, when it can be NULL and later dereferenced

To Reproduce
Found with CodeQL query github/codeql#16524 (only finding in this project)

Expected behavior
Check the return value, and return early as in the other cases like https://github.com/nothings/stb/blob/master/stb_image_write.h#L909

Simple patch like would be to ass

if (scratch == NULL)
  return 0;
NBickford-NV added a commit to NBickford-NV/stb that referenced this issue May 22, 2024
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

1 participant