AZW3 Output: Do not error out if the input document contains embedded fonts of less than 1040 bytes. Fixes #1052892 (conversion error - epub to azw3 - bytearray index out of range)

This commit is contained in:
Kovid Goyal 2012-09-19 17:43:15 +05:30
parent c294de86e0
commit 060836c133

View File

@ -481,7 +481,7 @@ def write_font_record(data, obfuscate=True, compress=True):
if compress:
flags |= 0b1
data = zlib.compress(data, 9)
if obfuscate:
if obfuscate and len(data) >= 1040:
flags |= 0b10
xor_key = os.urandom(key_len)
key = bytearray(xor_key)