Skip to content

pcal: avoid memory leak when allocation fails#470

Closed
catenacyber wants to merge 1 commit intopnggroup:libpng16from
catenacyber:nalloc
Closed

pcal: avoid memory leak when allocation fails#470
catenacyber wants to merge 1 commit intopnggroup:libpng16from
catenacyber:nalloc

Conversation

@catenacyber
Copy link
Contributor

Sets PNG_FREE_PCAL as soon as pcal_params is allocated so that even if one of pcal_params[i] allocation fails, the array pcal_params still gets freed by png_free_data

Found by nallocfuzz cf google/oss-fuzz#9902

Sets PNG_FREE_PCAL as soon as pcal_params is allocated so that
even if one of pcal_params[i] allocation fails, the array
pcal_params still gets freed by png_free_data
@catenacyber
Copy link
Contributor Author

friendly ping @ctruta ?

@ctruta
Copy link
Member

ctruta commented Jun 20, 2023

friendly ping @ctruta ?

Friendly pong :-)

Apologies for the long wait. I just returned to the project.

Thank you for the discovery and for the fix. I reworked your fix by moving the setting of the PNG_FREE_PCAL flag even earlier than that. I also looked around at the rest of the PNG_FREE_... flags inside that module, and I put them in a more consistent order.

@ctruta ctruta closed this Jun 20, 2023
@catenacyber
Copy link
Contributor Author

Thanks for the better fix :-)

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.

2 participants