[gimp] Bug 771558 - PSD files with a layer additional data length...
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 771558 - PSD files with a layer additional data length...
- Date: Sun, 9 Oct 2016 20:30:29 +0000 (UTC)
commit 3139cb93051d1259825cdabda7d658f723870c31
Author: Matthias Junker-Petschick <razzle razzle de>
Date: Fri Sep 16 23:05:41 2016 +0200
Bug 771558 - PSD files with a layer additional data length...
...not divisible by 4 are incorrectly reported as corrupt
file-psd: Do not round up the extra data length field when reading
layer info.
Fixes the PSD layer extra information handling in read_layer_info() by
not rounding up the data length field to a multiple of 4.
Layers can contain extra data, which is encoded at the end of layer
records. The length of this data should always be stored rounded up to
an even byte count. When loading a PSD file, it can be expected that
this value is already rounded up and this operation should not be
necessary. If an uneven byte count is encountered, a warning is
emitted but the loading process is not aborted.
plug-ins/file-psd/psd-load.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/plug-ins/file-psd/psd-load.c b/plug-ins/file-psd/psd-load.c
index 3b9d73e..d13294b 100644
--- a/plug-ins/file-psd/psd-load.c
+++ b/plug-ins/file-psd/psd-load.c
@@ -815,9 +815,14 @@ read_layer_info (PSDimage *img_a,
block_rem -= 12;
- //Round up to the nearest even byte
- while (res_a.data_len % 4 != 0)
- res_a.data_len++;
+ if (res_a.data_len % 2 != 0)
+ {
+ /* Warn the user about an invalid length value but
+ * try to recover graciously. See bug #771558.
+ */
+ g_printerr ("psd-load: Layer extra data length should "
+ "be even, but it is %d.", res_a.data_len);
+ }
if (res_a.data_len > block_rem)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]