summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdk-pixbuf/ChangeLog9
-rw-r--r--gdk-pixbuf/gdk-pixbuf-io.c6
-rw-r--r--gdk-pixbuf/io-ani.c2
3 files changed, 13 insertions, 4 deletions
diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog
index 94250ae4d5..6226282ed9 100644
--- a/gdk-pixbuf/ChangeLog
+++ b/gdk-pixbuf/ChangeLog
@@ -1,3 +1,12 @@
+2004-04-13 Matthias Clasen <mclasen@redhat.com>
+
+ * io-ani.c (gdk_pixbuf__ani_image_load_animation):
+ * gdk-pixbuf-io.c (gdk_pixbuf_get_file_info)
+ (_gdk_pixbuf_generic_image_load)
+ (gdk_pixbuf_new_from_file_at_size): When calling fread()
+ in a loop, check for ferror() as well as for feof() to
+ avoid infinite loops on directories. (#137804, Alex Converse)
+
Mon Mar 15 15:01:59 2004 Owen Taylor <otaylor@redhat.com>
* === Released 2.4.0 ===
diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c
index b916421d05..37fba20df3 100644
--- a/gdk-pixbuf/gdk-pixbuf-io.c
+++ b/gdk-pixbuf/gdk-pixbuf-io.c
@@ -698,7 +698,7 @@ _gdk_pixbuf_generic_image_load (GdkPixbufModule *module,
if (!context)
return NULL;
- while (!feof (f)) {
+ while (!feof (f) && !ferror (f)) {
length = fread (buffer, 1, sizeof (buffer), f);
if (length > 0)
if (!module->load_increment (context, buffer, length, error)) {
@@ -911,7 +911,7 @@ gdk_pixbuf_new_from_file_at_size (const char *filename,
g_signal_connect (loader, "size-prepared", G_CALLBACK (size_prepared_cb), &info);
- while (!feof (f)) {
+ while (!feof (f) && !ferror (f)) {
length = fread (buffer, 1, sizeof (buffer), f);
if (length > 0)
if (!gdk_pixbuf_loader_write (loader, buffer, length, error)) {
@@ -1012,7 +1012,7 @@ gdk_pixbuf_get_file_info (const gchar *filename,
g_signal_connect (loader, "size-prepared", G_CALLBACK (info_cb), &info);
- while (!feof (f)) {
+ while (!feof (f) && !ferror (f)) {
length = fread (buffer, 1, sizeof (buffer), f);
if (length > 0) {
if (!gdk_pixbuf_loader_write (loader, buffer, length, NULL))
diff --git a/gdk-pixbuf/io-ani.c b/gdk-pixbuf/io-ani.c
index f7565b533d..00a9fc11b3 100644
--- a/gdk-pixbuf/io-ani.c
+++ b/gdk-pixbuf/io-ani.c
@@ -626,7 +626,7 @@ gdk_pixbuf__ani_image_load_animation (FILE *f, GError **error)
if (!context)
return NULL;
- while (!feof (f)) {
+ while (!feof (f) && !ferror (f)) {
length = fread (buffer, 1, sizeof (buffer), f);
if (length > 0)
if (!gdk_pixbuf__ani_image_load_increment (context, buffer, length, error)) {