[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-658
From: |
Arnold Robbins |
Subject: |
[gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-658-g5d781d9 |
Date: |
Thu, 16 Apr 2015 10:14:19 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, gawk-4.1-stable has been updated
via 5d781d9d27f2ab30679853317df3f5e9ad94be80 (commit)
from 3fc38ff001d5a4345def6ce960918612ed209518 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=5d781d9d27f2ab30679853317df3f5e9ad94be80
commit 5d781d9d27f2ab30679853317df3f5e9ad94be80
Author: Arnold D. Robbins <address@hidden>
Date: Thu Apr 16 13:14:06 2015 +0300
Additional checking for strftime.
diff --git a/ChangeLog b/ChangeLog
index 6398cbf..53e82de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-16 Arnold D. Robbins <address@hidden>
+
+ * builtin.c (do_strftime): Use a double for the timestamp and
+ check that the value is within range for a time_t.
+
2015-04-14 Arnold D. Robbins <address@hidden>
* builtin.c (do_strftime): Restore checking for negative result and
diff --git a/builtin.c b/builtin.c
index fc67094..804bd60 100644
--- a/builtin.c
+++ b/builtin.c
@@ -1864,7 +1864,7 @@ do_strftime(int nargs)
NODE *t1, *t2, *t3, *ret;
struct tm *tm;
time_t fclock;
- long clock_val;
+ double clock_val;
char *bufp;
size_t buflen, bufsize;
char buf[BUFSIZ];
@@ -1873,6 +1873,8 @@ do_strftime(int nargs)
int do_gmt;
NODE *val = NULL;
NODE *sub = NULL;
+ static const time_t time_t_min = TYPE_MINIMUM(time_t);
+ static const time_t time_t_max = TYPE_MAXIMUM(time_t);
/* set defaults first */
format = def_strftime_format; /* traditional date format */
@@ -1912,7 +1914,7 @@ do_strftime(int nargs)
if (do_lint && (t2->flags & (NUMCUR|NUMBER)) == 0)
lintwarn(_("strftime: received non-numeric
second argument"));
(void) force_number(t2);
- clock_val = get_number_si(t2);
+ clock_val = get_number_d(t2);
fclock = (time_t) clock_val;
/*
* 4/2015: Protect against negative value being assigned
@@ -1920,6 +1922,11 @@ do_strftime(int nargs)
*/
if (clock_val < 0 && fclock > 0)
fatal(_("strftime: second argument less than 0
or too big for time_t"));
+
+ /* And check that the value is in range */
+ if (clock_val < time_t_min || clock_val > time_t_max)
+ fatal(_("strftime: second argument out of range
for time_t"));
+
DEREF(t2);
}
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 5 +++++
builtin.c | 11 +++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-658-g5d781d9,
Arnold Robbins <=