git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] apply: fix segfault
@ 2008-02-11 22:28 Johannes Schindelin
  2008-02-11 23:06 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2008-02-11 22:28 UTC (permalink / raw)
  To: git, gitster


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.

This fixes it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---

	This just happened to me.

 builtin-apply.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/builtin-apply.c b/builtin-apply.c
index 4578542..ca7096f 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -1830,7 +1830,7 @@ static int find_pos(struct image *img,
 			return try_lno;
 
 	again:
-		if (backwards_lno == 0 && forwards_lno == img->nr)
+		if (backwards_lno == 0 && forwards_lno >= img->nr)
 			break;
 
 		if (i & 1) {
-- 
1.5.4.1264.gb53928

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-02-11 23:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-11 22:28 [PATCH] apply: fix segfault Johannes Schindelin
2008-02-11 23:06 ` Junio C Hamano
2008-02-11 23:28   ` Junio C Hamano
2008-02-11 23:48   ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).