[gimp/gimp-2-10] plug-ins: fix reading of psp tubes when psp file version >= 4.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] plug-ins: fix reading of psp tubes when psp file version >= 4.
- Date: Tue, 1 Sep 2020 17:57:12 +0000 (UTC)
commit 146a8d644bcaeb33c6f45d70ce7eb6edbd2d0d8b
Author: Jacob Boerema <jgboerema gmail com>
Date: Wed Aug 26 19:09:28 2020 -0400
plug-ins: fix reading of psp tubes when psp file version >= 4.
(cherry picked from commit b968a93ab2d196a81729dd1b2cbfa47351c0c47c)
plug-ins/common/file-psp.c | 46 ++++++++++++++++++++++++++++++++++------------
1 file changed, 34 insertions(+), 12 deletions(-)
---
diff --git a/plug-ins/common/file-psp.c b/plug-ins/common/file-psp.c
index 56723d2863..1e2eb36c1d 100644
--- a/plug-ins/common/file-psp.c
+++ b/plug-ins/common/file-psp.c
@@ -1770,6 +1770,7 @@ read_tube_block (FILE *f,
guchar name[514];
guint32 step_size, column_count, row_count, cell_count;
guint32 placement_mode, selection_mode;
+ guint32 chunk_len;
gint i;
GimpPixPipeParams params;
GimpParasite *pipe_parasite;
@@ -1777,21 +1778,42 @@ read_tube_block (FILE *f,
gimp_pixpipe_params_init (¶ms);
- if (fread (&version, 2, 1, f) < 1
- || fread (name, 513, 1, f) < 1
- || fread (&step_size, 4, 1, f) < 1
- || fread (&column_count, 4, 1, f) < 1
- || fread (&row_count, 4, 1, f) < 1
- || fread (&cell_count, 4, 1, f) < 1
- || fread (&placement_mode, 4, 1, f) < 1
- || fread (&selection_mode, 4, 1, f) < 1)
+ if (psp_ver_major >= 4)
{
- g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
- _("Error reading tube data chunk"));
- return -1;
+ name[0] = 0;
+ if (fread (&chunk_len, 4, 1, f) < 1
+ || fread (&version, 2, 1, f) < 1
+ || fread (&step_size, 4, 1, f) < 1
+ || fread (&column_count, 4, 1, f) < 1
+ || fread (&row_count, 4, 1, f) < 1
+ || fread (&cell_count, 4, 1, f) < 1
+ || fread (&placement_mode, 4, 1, f) < 1
+ || fread (&selection_mode, 4, 1, f) < 1)
+ {
+ g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
+ _("Error reading tube data chunk"));
+ return -1;
+ }
+ }
+ else
+ {
+ chunk_len = 0;
+ if (fread (&version, 2, 1, f) < 1
+ || fread (name, 513, 1, f) < 1
+ || fread (&step_size, 4, 1, f) < 1
+ || fread (&column_count, 4, 1, f) < 1
+ || fread (&row_count, 4, 1, f) < 1
+ || fread (&cell_count, 4, 1, f) < 1
+ || fread (&placement_mode, 4, 1, f) < 1
+ || fread (&selection_mode, 4, 1, f) < 1)
+ {
+ g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
+ _("Error reading tube data chunk"));
+ return -1;
+ }
+ name[513] = 0;
}
- name[513] = 0;
version = GUINT16_FROM_LE (version);
params.step = GUINT32_FROM_LE (step_size);
params.cols = GUINT32_FROM_LE (column_count);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]