From a6210a35cdcef384a53c49f020163180d854d04e Mon Sep 17 00:00:00 2001 From: Daniel Garcia Moreno Date: Tue, 16 Jul 2013 10:24:59 +0200 Subject: [PATCH] Fixed filesplit corner case infinite loop --- filesplit.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/filesplit.py b/filesplit.py index b06d99a..ef7129d 100644 --- a/filesplit.py +++ b/filesplit.py @@ -63,7 +63,7 @@ def split_file(separator, prefix, input_file, new_file_func=None): # corner case: separator is between this buf and next one. In this # case, we write to current output everything before that and # iterate - if separator[0] in buf[-sep_len:]: + if len(buf) > sep_len and separator[0] in buf[-sep_len:]: output.write(buf[:-sep_len]) buf = buf[-sep_len:] continue -- 1.7.1