[gimp] Issue #4663 - "Error loading PSD file: No error" while trying to open a PSD



commit 0ce993c4b96a20b583f3ca945176dcddc3fe351d
Author: Ell <ell_se yahoo com>
Date:   Fri Feb 28 00:44:59 2020 +0200

    Issue #4663 - "Error loading PSD file: No error" while trying to open a PSD
    
    In file-psd, avoid error on load when encountering an uknown image
    resource of size 0.

 plug-ins/file-psd/psd-image-res-load.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/plug-ins/file-psd/psd-image-res-load.c b/plug-ins/file-psd/psd-image-res-load.c
index 73b619d006..50a5c745ab 100644
--- a/plug-ins/file-psd/psd-image-res-load.c
+++ b/plug-ins/file-psd/psd-image-res-load.c
@@ -480,7 +480,7 @@ load_resource_unknown (const PSDimageres  *res_a,
   IFDBG(2) g_debug ("Process unknown image resource block: %d", res_a->id);
 
   data = g_malloc (res_a->data_len);
-  if (fread (data, res_a->data_len, 1, f) < 1)
+  if (res_a->data_len > 0 && fread (data, res_a->data_len, 1, f) < 1)
     {
       psd_set_error (feof (f), errno, error);
       g_free (data);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]