Skip to content

Commit 1ed2ac6

Browse files
committed
Avoid a segmentation fault with renaming merges
Under very particular circumstances, merge-recursive's `add_cacheinfo()` function gets a `NULL` returned from `refresh_cache_entry()` without expecting it, and subsequently passes it to `add_cache_entry()` which consequently crashes. Let's not crash. This fixes #952 Signed-off-by: Johannes Schindelin <[email protected]>
1 parent d69a4b1 commit 1ed2ac6

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

merge-recursive.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,7 @@ static int add_cacheinfo(struct merge_options *o,
235235
struct cache_entry *nce;
236236

237237
nce = refresh_cache_entry(ce, CE_MATCH_REFRESH | CE_MATCH_IGNORE_MISSING);
238-
if (!nce)
239-
return err(o, _("addinfo_cache failed for path '%s'"), path);
240-
if (nce != ce)
238+
if (nce && nce != ce)
241239
ret = add_cache_entry(nce, options);
242240
}
243241
return ret;

0 commit comments

Comments
 (0)