[PATCH] src/freeze.c (GET_NUMBER): Fix a typo.

Jim Meyering <[email protected]>
Newsgroups gmane.comp.gnu.m4.patches
Message-ID <[email protected]>
"Eric Blake" <[email protected]> wrote:
...
> +      unsigned int n = 0;					\
> +      while (isdigit (character) && n <= INT_MAX / 10)		\
>  	{							\
> -	  (Number) = 10 * (Number) + character - '0';		\
> +	  n = 10 * n + character - '0';				\
>  	  GET_CHARACTER;					\
>  	}							\
> +      if (((AllowNeg) ? INT_MIN: INT_MAX) < n			\
> +	  || isdigit (character))				\
> +	m4_error (context, EXIT_FAILURE, 0, NULL,		\
> +		  _("integer overflow in frozen file"));	\
> +      (Number) = n;						\

Hi Eric,

Thanks for humoring me ;-)
Maybe the test suite never exercises this case?
If it does, I'd expect a bogus "integer overflow in frozen file"
diagnostic.  Here's a patch:

From 3119ecc64bfb086ccddf68acb8ef421413cd181d Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Sun, 11 May 2008 14:56:30 +0200
Subject: [PATCH] * src/freeze.c (GET_NUMBER): Fix a typo.

---
 src/freeze.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/freeze.c b/src/freeze.c
index 186b69b..af40544 100644
--- a/src/freeze.c
+++ b/src/freeze.c
@@ -391,7 +391,7 @@ reload_frozen_state (m4 *context, const char *name)
 	  n = 10 * n + character - '0';				\
 	  GET_CHARACTER;					\
 	}							\
-      if (((AllowNeg) ? INT_MIN: INT_MAX) < n			\
+      if (((AllowNeg) ? -INT_MIN : INT_MAX) < n			\
 	  || isdigit (character))				\
 	m4_error (context, EXIT_FAILURE, 0, NULL,		\
 		  _("integer overflow in frozen file"));	\
--
1.5.5.1.179.gdc42
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.