diff --git a/.gitattributes b/.gitattributes
index b96e5ab860a55d99b59fd049fa578f252e34ac25..8c0db385fd8acd15871ac2168e41fb2bd00a651b 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -627,7 +627,6 @@ testfont binary
 /src/modules/_Image_GIF/configure.in foreign_ident
 /src/modules/_Image_GIF/gif_lzw.c foreign_ident
 /src/modules/_Image_GIF/gif_lzw.h foreign_ident
-/src/modules/_Image_GIF/image_gif.c foreign_ident
 /src/modules/_Image_JPEG/Makefile.in foreign_ident
 /src/modules/_Image_JPEG/acconfig.h foreign_ident
 /src/modules/_Image_JPEG/configure.in foreign_ident
diff --git a/src/modules/_Image_GIF/image_gif.c b/src/modules/_Image_GIF/image_gif.c
index dfa3eb0745efe6b914bd56f0bb14dfae83b7598f..f89a24ed9b861b8d6d35712195cbbe5617c10fcb 100644
--- a/src/modules/_Image_GIF/image_gif.c
+++ b/src/modules/_Image_GIF/image_gif.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: image_gif.c,v 1.31 2008/08/22 16:22:20 jonasw Exp $
+|| $Id$
 */
 
 /*
@@ -1239,7 +1239,8 @@ void image_gif_netscape_loop_block(INT32 args)
       if (sp[-args].type!=T_INT) 
 	 Pike_error("Image.GIF.netscape_loop_block: illegal argument (exected int)\n");
       else
-	 loops=sp[-args].u.integer;
+	/* Should check range here, but that wouldn't be strictly compatible. */
+	loops= (unsigned short) sp[-args].u.integer;
    } else
       loops=65535;
    pop_n_elems(args);