Commit fe8c42b6 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

When calling fread() in a loop, check for ferror() as well as for feof()

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)
parent ec726796
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 ===
......
......@@ -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))
......
......@@ -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)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment