[easytag] Improve handling of empty image files
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag] Improve handling of empty image files
- Date: Mon, 10 Aug 2015 13:41:18 +0000 (UTC)
commit 0d265c866d29c541e4c1d3c32e3995503a72c0a2
Author: David King <amigadave amigadave com>
Date: Wed Jul 29 23:39:36 2015 +0100
Improve handling of empty image files
Raise an error, avoiding a crash, when an image file is empty.
https://bugzilla.redhat.com/show_bug.cgi?id=1248194
src/picture.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/picture.c b/src/picture.c
index f661d04..d11dc0a 100644
--- a/src/picture.c
+++ b/src/picture.c
@@ -469,6 +469,16 @@ et_picture_load_file_data (GFile *file, GError **error)
g_assert (error == NULL || *error == NULL);
+ if (g_memory_output_stream_get_data_size (G_MEMORY_OUTPUT_STREAM (ostream))
+ == 0)
+ {
+ g_object_unref (ostream);
+ /* FIXME: Mark up the string for translation. */
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA, "%s",
+ "Input truncated or empty");
+ return NULL;
+ }
+
bytes = g_memory_output_stream_steal_as_bytes (G_MEMORY_OUTPUT_STREAM (ostream));
g_object_unref (ostream);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]