From 11a859e7d381f40068d50f7425a48e5a8c15e3a3 Mon Sep 17 00:00:00 2001 From: cgohlke Date: Thu, 20 Dec 2012 21:47:45 -0800 Subject: [PATCH] Make FLI image detection more stringent --- PIL/FliImagePlugin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PIL/FliImagePlugin.py b/PIL/FliImagePlugin.py index 706c36a7f..dac8c435d 100644 --- a/PIL/FliImagePlugin.py +++ b/PIL/FliImagePlugin.py @@ -48,7 +48,9 @@ class FliImageFile(ImageFile.ImageFile): # HEAD s = self.fp.read(128) magic = i16(s[4:6]) - if magic not in [0xAF11, 0xAF12]: + if not (magic in [0xAF11, 0xAF12] and + i16(s[14:16]) in [0, 3] and # flags + s[20:22] == '\x00\x00'): # reserved raise SyntaxError, "not an FLI/FLC file" # image characteristics