changeset 16659:9e40bc4c1bde stable

diffhelpers: harden testhunk
author Matt Mackall <mpm@selenic.com>
date Sat, 12 May 2012 10:02:47 +0200 (2012-05-12)
parents fcb97d9a26cd
children 2fdd1902ed2d
files mercurial/diffhelpers.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/diffhelpers.c
+++ b/mercurial/diffhelpers.c
@@ -135,7 +135,7 @@
 		return NULL;
 	alen = PyList_Size(a);
 	blen = PyList_Size(b);
-	if (alen > blen - bstart) {
+	if (alen > blen - bstart || bstart < 0) {
 		return Py_BuildValue("l", -1);
 	}
 	for (i = 0; i < alen; i++) {