Andrew's git
/
gitweb.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
commit
grep
author
committer
pickaxe
?
re
apply: do not barf on patch with too large an offset
[gitweb.git]
/
builtin-apply.c
diff --git
a/builtin-apply.c
b/builtin-apply.c
index 2b8ba81d81aa717ea6456f82ea09369fe2a1f937..5ed4e918c0873b641a2f88b08bff9c66d6c4d850 100644
(file)
--- 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 > img->nr)
+ line = img->nr;
+
try = 0;
for (i = 0; i < line; i++)
try += img->line[i].len;