Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-02-12 02:32:29 +0300
committerJunio C Hamano <gitster@pobox.com>2008-02-12 02:48:10 +0300
commit52f3c81a9d41af019ab8f05051c5251f078b12e5 (patch)
tree6cebba3fe821be8561a7c6ff1d648748450774c7 /builtin-apply.c
parentb2979ff599a6bcf9dbf5e2ef1e32b81a1b88e115 (diff)
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>
Diffstat (limited to 'builtin-apply.c')
-rw-r--r--builtin-apply.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin-apply.c b/builtin-apply.c
index 2b8ba81d81..5ed4e918c0 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 > img->nr)
+ line = img->nr;
+
try = 0;
for (i = 0; i < line; i++)
try += img->line[i].len;