Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes: > When the patch reports a line number that is larger than the number of > lines in the current version of the file, git-apply used to segfault. I have to wonder if the correct fix should be like this instead. Under that condition, I think computation of the initial "try" value already oversteps the line[] array for the original image. diff --git a/builtin-apply.c b/builtin-apply.c index 2b8ba81..177f541 100644 --- a/builtin-apply.c +++ b/builtin-apply.c @@ -1809,6 +1809,9 @@ static int find_pos(struct image *img, else if (match_end) line = img->nr - preimage->nr; + if (line > preimage->nr) + line = preimage->nr; + try = 0; for (i = 0; i < line; i++) try += img->line[i].len; - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html