Skip to content

Fix segmentation fault in the FSMonitor v2 series #3241

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
May 28, 2021

Conversation

dscho
Copy link
Member

@dscho dscho commented May 28, 2021

After upgrading to v2.32.0-rc2, I just ran git rebase --autostash -i HEAD~2 and ran into a segmentation fault. Running this in the debugger reveals that v2 of the FSMonitor series introduced a strlen(since_token), but since_token can be NULL.

It might look like an error to pass NULL here, but it is not because write_packetized_from_buf_no_flush() does not even attempt to look at that pointer if the number of remaining bytes to write is 0.

If there is no current token, we should not segfault.

Such a situation can arise e.g. in an auto-stashing rebase, after the
autostash was applied.

Signed-off-by: Johannes Schindelin <[email protected]>
@dscho dscho added this to the Next release milestone May 28, 2021
@dscho dscho merged commit 1c253aa into git-for-windows:main May 28, 2021
@dscho dscho deleted the fix-fsmonitor-v2-segfault branch May 28, 2021 17:36
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