[gimp] plug-ins: Take zero length layer names into account in psp reader.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins: Take zero length layer names into account in psp reader.
- Date: Mon, 24 Aug 2020 09:30:40 +0000 (UTC)
commit d7089c93b25088fd785e874cdb396b72fae8d982
Author: Jacob Boerema <jgboerema gmail com>
Date: Sun Aug 23 18:30:41 2020 -0400
plug-ins: Take zero length layer names into account in psp reader.
plug-ins/common/file-psp.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/plug-ins/common/file-psp.c b/plug-ins/common/file-psp.c
index d91f700804..e2bc5ba810 100644
--- a/plug-ins/common/file-psp.c
+++ b/plug-ins/common/file-psp.c
@@ -1510,9 +1510,11 @@ read_layer_block (FILE *f,
{
if (fread (&chunk_len, 4, 1, f) < 1
|| fread (&namelen, 2, 1, f) < 1
- || ((namelen = GUINT16_FROM_LE (namelen)) && FALSE)
+ /* A zero length layer name is apparently valid. To not get a warning for
+ namelen < 0 always being false we use this more complicated comparison. */
+ || ((namelen = GUINT16_FROM_LE (namelen)) && (FALSE || namelen == 0))
|| (name = g_malloc (namelen + 1)) == NULL
- || fread (name, namelen, 1, f) < 1
+ || (namelen > 0 && fread (name, namelen, 1, f) < 1)
|| fread (&type, 1, 1, f) < 1
|| fread (&image_rect, 16, 1, f) < 1
|| fread (&saved_image_rect, 16, 1, f) < 1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]