]> Pileus Git - ~andy/gtk/commitdiff
When calling fread() in a loop, check for ferror() as well as for feof()
authorMatthias Clasen <mclasen@redhat.com>
Tue, 13 Apr 2004 14:57:03 +0000 (14:57 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Tue, 13 Apr 2004 14:57:03 +0000 (14:57 +0000)
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)

gdk-pixbuf/ChangeLog
gdk-pixbuf/gdk-pixbuf-io.c
gdk-pixbuf/io-ani.c

index 94250ae4d521da07d97557cc86bf6c8a070f3854..6226282ed93e1a8ce6a08fc325e0232d5743dad8 100644 (file)
@@ -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 ===
index b916421d05d1e4de11c80356dd16a8a232303276..37fba20df3373e227e55580a842180e49fb98d2f 100644 (file)
@@ -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))
index f7565b533d8712e75ff8a8da4ca6e683a9d1be38..00a9fc11b376e8f8efd9a1a9090f4973259d3294 100644 (file)
@@ -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)) {