--- netpbm-free-10.0.orig/pbm/icontopbm.c
+++ netpbm-free-10.0/pbm/icontopbm.c
@@ -82,19 +82,46 @@
     char variable[81], ch;
     int status, value, i, data_length, gotsome;
 
+    /*
+     *
+     * Problem is: if the first two shorts are 0 and 1, then somebody
+     * gave us a windows icon file. We should recognize that ...
+     *
+     */
+    int winicon=0;
+
     gotsome = 0;
     *width = *height = -1;
     for ( ; ; )
 	{
 	while ( ( ch = getc( file ) ) == ',' || ch == '\n' || ch == '\t' ||
 		ch == ' ' )
-	    ;
+	    winicon=-1;
+
+#define CHECKWIN \
+	if ( \
+		((winicon==0) && (ch==0)) || \
+		((winicon==1) && (ch==0)) || \
+		((winicon==2) && (ch==1)) || \
+		((winicon==3) && (ch==0)) \
+	)  \
+	    winicon++; \
+	else \
+	    winicon=-1; \
+	if (winicon==4) { \
+	    fprintf(stderr, "This seems to be a windows icon file, please try winicontoppm\n"); \
+	    exit(1); \
+	}
+
+	CHECKWIN
+
 	for ( i = 0;
 	      ch != '=' && ch != ',' && ch != '\n' && ch != '\t' && ch != ' ';
 	      i++ )
 	    {
 	    variable[i] = ch;
 	    ch = getc( file );
+	    CHECKWIN
 	    }
 	variable[i] = '\0';
 
