=== modified file 'modules/system/image.gd.inc'
--- modules/system/image.gd.inc 2010-07-20 05:17:47 +0000
+++ modules/system/image.gd.inc 2010-07-21 03:56:38 +0000
@@ -148,7 +148,7 @@ function image_gd_rotate(stdClass $image
   // transparency flags. For GIF images, keep a record of the transparent color.
   if ($image->info['extension'] == 'gif') {
     $transparent_index = imagecolortransparent($image->resource);
-    if ($transparent_index != 0) {
+    if ($transparent_index != 0 && $transparent_index < imagecolorstotal($image->resource)) {
       $transparent_gif_color = imagecolorsforindex($image->resource, $transparent_index);
     }
   }

