[PATCH] apply: fix segfault

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---

	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

-
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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux