]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix handling of PBM data
authorEli Zaretskii <eliz@gnu.org>
Sat, 11 Feb 2017 09:09:33 +0000 (11:09 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 11 Feb 2017 09:09:33 +0000 (11:09 +0200)
* src/image.c (pbm_load): Handle PBM data with no blanks between
individual pixel values correctly.  (Bug#25660)

src/image.c

index ad0143be48b0a6a3c3259e26f3cee6717e37c522..a7a94165282cd9f72e6285d17f2d4884757a1147 100644 (file)
@@ -5465,7 +5465,17 @@ pbm_load (struct frame *f, struct image *img)
                c <<= 1;
              }
            else
-             g = pbm_scan_number (&p, end);
+             {
+               int c = 0;
+               /* Skip white-space and comments.  */
+               while ((c = pbm_next_char (&p, end)) != -1 && c_isspace (c))
+                 ;
+
+               if (c == '0' || c == '1')
+                 g = c - '0';
+               else
+                 g = 0;
+             }
 
 #ifdef USE_CAIRO
             *dataptr++ = g ? fga32 : bga32;