Skip to content

merge: fix potential free of uninitialized memory#4277

Merged
ethomson merged 1 commit intolibgit2:masterfrom
pks-t:pks/merge-coverity-fix
Jun 21, 2017
Merged

merge: fix potential free of uninitialized memory#4277
ethomson merged 1 commit intolibgit2:masterfrom
pks-t:pks/merge-coverity-fix

Conversation

@pks-t
Copy link
Member

@pks-t pks-t commented Jun 21, 2017

The function merge_diff_mark_similarity_exact may error our early and,
when it does so, free the ours_deletes_by_oid and
theirs_deletes_by_oid variables. While the first one can never be
uninitialized due to the first call actually assigning to it, the second
variable can be freed without being initialized.

Fix the issue by initializing both variables to NULL.

The function `merge_diff_mark_similarity_exact` may error our early and,
when it does so, free the `ours_deletes_by_oid` and
`theirs_deletes_by_oid` variables. While the first one can never be
uninitialized due to the first call actually assigning to it, the second
variable can be freed without being initialized.

Fix the issue by initializing both variables to `NULL`.
@pks-t
Copy link
Member Author

pks-t commented Jun 21, 2017

The build failures are unrelated

@ethomson
Copy link
Member

Yep, good catch. Thanks!

@ethomson ethomson merged commit fa94875 into libgit2:master Jun 21, 2017
@pks-t pks-t deleted the pks/merge-coverity-fix branch September 15, 2017 06:02
@pks-t pks-t added backport and removed backport labels Jan 11, 2018
@pks-t pks-t mentioned this pull request Jan 12, 2018
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