Skip to content

flipdiff: avoid crash on non-commuting patches#180

Open
SAY-5 wants to merge 1 commit into
twaugh:0.4.xfrom
SAY-5:fix-flipdiff-noncommute
Open

flipdiff: avoid crash on non-commuting patches#180
SAY-5 wants to merge 1 commit into
twaugh:0.4.xfrom
SAY-5:fix-flipdiff-noncommute

Conversation

@SAY-5

@SAY-5 SAY-5 commented Jun 18, 2026

Copy link
Copy Markdown

Pull Request Guidelines

This is a bug fix, so it targets the 0.4.x branch.

Description

flipdiff segfaults when the two patches don't commute, for example on patches produced by git diff. While undoing patch1 from the reconstructed file, remove_line() is asked to remove a line that is no longer present (patch2 already changed it). In that case kill stays NULL and the function dereferences it. This guards the NULL case and returns early, since there is nothing to remove. Fixes #178.

Type of Change

Bug fix (targets 0.4.x)

Testing

Added tests/flip20, which feeds the non-commuting input from the issue to flipdiff and checks it exits successfully instead of crashing.

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
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.

1 participant