mercurial/mpatch.c
branchstable
changeset 38189 faa924469635
parent 38188 1acfc35d478c
child 38190 1ec4cb8cbc87
--- a/mercurial/mpatch.c	Sat Apr 28 02:04:56 2018 -0400
+++ b/mercurial/mpatch.c	Sat Apr 28 10:09:12 2018 -0400
@@ -248,7 +248,8 @@
 	char *p = buf;
 
 	while (f != l->tail) {
-		if (f->start < last || f->end > len || last < 0) {
+		if (f->start < last || f->start > len || f->end > len ||
+		    last < 0) {
 			return MPATCH_ERR_INVALID_PATCH;
 		}
 		memcpy(p, orig + last, f->start - last);