]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/blobdiff - autorandr.py
fix infinite loop in debug_regexp
[deb_pkgs/autorandr.git] / autorandr.py
index c7aa86623b29503d9e60aad794543a159d5792c8..18381df0fff950a2713030c4afe99bf3354c07ba 100755 (executable)
@@ -278,6 +278,8 @@ def debug_regexp(pattern, string):
         bounds = ( 0, len(string) )
         while bounds[0] != bounds[1]:
             half = int((bounds[0] + bounds[1]) / 2)
+            if half == bounds[0]:
+                break
             bounds = (half, bounds[1]) if regex.search(pattern, string[:half], partial=True) else (bounds[0], half - 1)
         partial_length = bounds[0]
         return ("Regular expression matched until position "