changeset 37802:090c89a8db32 stable

diffhelpers: backport 9e40bc4c1bde from C implementation 9e40bc4c1bde just says "harden testhunk." I don't think this would be the case, but it makes some sense to avoid negative index.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 19 Apr 2018 23:33:17 +0900
parents 5cab6f5016fa
children 72f6498c040b
files mercurial/diffhelpers.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/diffhelpers.py	Fri Apr 20 20:38:29 2018 +0900
+++ b/mercurial/diffhelpers.py	Thu Apr 19 23:33:17 2018 +0900
@@ -69,7 +69,7 @@
     """
     alen = len(a)
     blen = len(b)
-    if alen > blen - bstart:
+    if alen > blen - bstart or bstart < 0:
         return False
     for i in xrange(alen):
         if a[i][1:] != b[i + bstart]: