apply: do not barf on patch with too large an offset
Previously a patch that records too large a line number caused the offset matching code in git-apply to overstep its internal buffer. Noticed by Johannes Schindelin. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
@ -1809,6 +1809,9 @@ static int find_pos(struct image *img,
|
||||
else if (match_end)
|
||||
line = img->nr - preimage->nr;
|
||||
|
||||
if (line > img->nr)
|
||||
line = img->nr;
|
||||
|
||||
try = 0;
|
||||
for (i = 0; i < line; i++)
|
||||
try += img->line[i].len;
|
||||
|
Reference in New Issue
Block a user