gawk/Huge-numeric-values-that-overflow-should-convert-to-.patch
2019-09-30 10:39:14 -04:00

37 lines
1016 B
Diff

From c7d9eb0bb45e11da69c420488aa7af865f2ed5bd Mon Sep 17 00:00:00 2001
From: "Andrew J. Schorr" <aschorr@telemetry-investments.com>
Date: Fri, 22 Jun 2018 11:48:23 -0400
Subject: [PATCH 072/289] Huge numeric values that overflow should convert to
infinity instead of zero.
---
ChangeLog | 8 ++++++++
node.c | 3 ++-
test/ChangeLog | 5 +++++
test/Makefile.am | 4 +++-
test/Makefile.in | 9 ++++++++-
test/Maketests | 5 +++++
test/numrange.awk | 5 +++++
test/numrange.ok | 2 ++
8 files changed, 38 insertions(+), 3 deletions(-)
create mode 100644 test/numrange.awk
create mode 100644 test/numrange.ok
diff --git a/node.c b/node.c
index fcd2bf33..984cec81 100644
--- a/node.c
+++ b/node.c
@@ -140,7 +140,8 @@ r_force_number(NODE *n)
*cpend = save;
}
- if (errno == 0) {
+ if (errno == 0 || errno == ERANGE) {
+ errno = 0; /* reset in case of ERANGE */
if (ptr == cpend)
goto goodnum;
/* else keep the leading numeric value without updating flags */
--
2.19.1