[gimp] plug-ins: consider reading less bytes than we need an error in psd-util.
- From: Jacob Boerema <jboerema src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins: consider reading less bytes than we need an error in psd-util.
- Date: Wed, 12 May 2021 21:56:02 +0000 (UTC)
commit 3da302adce5564f9ebf41ce7caa2ac99353059f4
Author: Jacob Boerema <jgboerema gmail com>
Date: Wed May 12 16:42:58 2021 -0400
plug-ins: consider reading less bytes than we need an error in psd-util.
plug-ins/file-psd/psd-util.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/plug-ins/file-psd/psd-util.c b/plug-ins/file-psd/psd-util.c
index 63f2a7fa97..9ea1260f41 100644
--- a/plug-ins/file-psd/psd-util.c
+++ b/plug-ins/file-psd/psd-util.c
@@ -191,8 +191,12 @@ psd_read (GInputStream *input,
*/
if (count > 0)
{
- g_input_stream_read_all (input, (void *) data, count,
- &bytes_read, NULL, error);
+ /* We consider reading less bytes than we want an error. */
+ if (g_input_stream_read_all (input, (void *) data, count,
+ &bytes_read, NULL, error) &&
+ bytes_read < count)
+ g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
+ _("Unexpected end of file"));
}
return bytes_read;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]