Skip to content

Initialize rev before using &rev.pending #2008

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

Merged
merged 1 commit into from
Jan 9, 2019
Merged

Conversation

kraai
Copy link

@kraai kraai commented Jan 4, 2019

If reset_tree returns a non-zero value, stash_working_tree calls
object_array_clear with &rev.pending before rev is initialized. This
causes a segmentation fault. Prevent this by initializing rev before
calling reset_tree.

This fixes #2006.

Signed-off-by: Matthew Kraai [email protected]

Copy link
Member

@dscho dscho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent find! Just a minor request to change the test, and we're good to go!

t/t3903-stash.sh Outdated
echo new >file4 &&
git add --intent-to-add file4 &&
test_must_fail git stash &&
git rm -f file4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be moved up 1 line and should read test_when_finished "git rm -f file4" instead.

If reset_tree returns a non-zero value, stash_working_tree calls
object_array_clear with &rev.pending before rev is initialized.  This
causes a segmentation fault.  Prevent this by initializing rev before
calling reset_tree.

This fixes git-for-windows#2006.

Signed-off-by: Matthew Kraai <[email protected]>
@dscho dscho merged commit 6b28658 into git-for-windows:master Jan 9, 2019
@dscho dscho added this to the v2.20.1(2) milestone Jan 9, 2019
@dscho
Copy link
Member

dscho commented Jan 9, 2019

Thanks!

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.

Segmentation fault running git stash with git add -N file
2 participants