From d178f436636e594e4e6ab009ba398b04de04557e Mon Sep 17 00:00:00 2001 From: cristy Date: Mon, 15 Dec 2014 11:03:40 +0000 Subject: [PATCH] --- coders/pnm.c | 4 +++- coders/xbm.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/coders/pnm.c b/coders/pnm.c index eb2837e2b..2df68020a 100644 --- a/coders/pnm.c +++ b/coders/pnm.c @@ -198,7 +198,7 @@ static unsigned int PNMInteger(Image *image,const unsigned int base, return(0); if (c == (int) '#') PNMComment(image,exception); - } while (isdigit(c) == MagickFalse); + } while ((c == ' ') || (c == '\t') || (c == '\n') || (c == '\r')); if (base == 2) return((unsigned int) (c-(int) '0')); /* @@ -214,6 +214,8 @@ static unsigned int PNMInteger(Image *image,const unsigned int base, break; value+=c-(int) '0'; c=ReadBlobByte(image); + if (c == EOF) + return(0); } while (isdigit(c) != 0); return(value); } diff --git a/coders/xbm.c b/coders/xbm.c index 9400ea759..e952bfb64 100644 --- a/coders/xbm.c +++ b/coders/xbm.c @@ -147,7 +147,7 @@ static unsigned int XBMInteger(Image *image,short int *hex_digits) c=ReadBlobByte(image); if (c == EOF) return(0); - } while (hex_digits[c] < 0); + } while ((c == ' ') || (c == '\t') || (c == '\n') || (c == '\r')); /* Evaluate number. */ @@ -162,6 +162,8 @@ static unsigned int XBMInteger(Image *image,short int *hex_digits) break; value+=hex_digits[c]; c=ReadBlobByte(image); + if (c == EOF) + return(0); } while (hex_digits[c] >= 0); return(value); } -- 2.50.1