From: Daniel Garcia Moreno Date: Tue, 16 Jul 2013 08:24:59 +0000 (+0200) Subject: Fixed filesplit corner case infinite loop X-Git-Tag: v2.2~160 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=a6210a35cdcef384a53c49f020163180d854d04e;p=python-delta-tar Fixed filesplit corner case infinite loop --- 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