diff options
| -rw-r--r-- | lib/ftoastr.c | 8 | ||||
| -rw-r--r-- | lib/gettext.h | 5 | ||||
| -rw-r--r-- | lib/stat-time.h | 2 | ||||
| -rw-r--r-- | lib/time_rz.c | 15 | ||||
| -rw-r--r-- | m4/getopt.m4 | 9 | ||||
| -rw-r--r-- | m4/gnulib-comp.m4 | 3 |
6 files changed, 33 insertions, 9 deletions
diff --git a/lib/ftoastr.c b/lib/ftoastr.c index ef861e2237a..f2434161db8 100644 --- a/lib/ftoastr.c +++ b/lib/ftoastr.c | |||
| @@ -105,10 +105,10 @@ FTOASTR (char *buf, size_t bufsize, int flags, int width, FLOAT x) | |||
| 105 | /* The following method is simple but slow. | 105 | /* The following method is simple but slow. |
| 106 | For ideas about speeding things up, please see: | 106 | For ideas about speeding things up, please see: |
| 107 | 107 | ||
| 108 | Florian Loitsch, Printing floating-point numbers quickly and accurately | 108 | Andrysco M, Jhala R, Lerner S. Printing floating-point numbers: |
| 109 | with integers. ACM SIGPLAN notices 46, 6 (June 2010), 233-243 | 109 | a faster, always correct method. ACM SIGPLAN notices - POPL '16. |
| 110 | <http://dx.doi.org/10.1145/1809028.1806623>; also see the | 110 | 2016;51(1):555-67 <http://dx.doi.org/10.1145/2914770.2837654>; draft at |
| 111 | 2010-03-21 draft <http://florian.loitsch.com/tmp/article.pdf>. */ | 111 | <http://cseweb.ucsd.edu/~lerner/papers/fp-printing-popl16.pdf>. */ |
| 112 | 112 | ||
| 113 | PROMOTED_FLOAT promoted_x = x; | 113 | PROMOTED_FLOAT promoted_x = x; |
| 114 | char format[sizeof "%-+ 0*.*Lg"]; | 114 | char format[sizeof "%-+ 0*.*Lg"]; |
diff --git a/lib/gettext.h b/lib/gettext.h index 0465d7ad148..e7520af252f 100644 --- a/lib/gettext.h +++ b/lib/gettext.h | |||
| @@ -18,8 +18,9 @@ | |||
| 18 | #ifndef _LIBGETTEXT_H | 18 | #ifndef _LIBGETTEXT_H |
| 19 | #define _LIBGETTEXT_H 1 | 19 | #define _LIBGETTEXT_H 1 |
| 20 | 20 | ||
| 21 | /* NLS can be disabled through the configure --disable-nls option. */ | 21 | /* NLS can be disabled through the configure --disable-nls option |
| 22 | #if ENABLE_NLS | 22 | or through "#define ENABLE NLS 0" before including this file. */ |
| 23 | #if defined ENABLE_NLS && ENABLE_NLS | ||
| 23 | 24 | ||
| 24 | /* Get declarations of GNU message catalog functions. */ | 25 | /* Get declarations of GNU message catalog functions. */ |
| 25 | # include <libintl.h> | 26 | # include <libintl.h> |
diff --git a/lib/stat-time.h b/lib/stat-time.h index 47469892ee2..154d62a01f5 100644 --- a/lib/stat-time.h +++ b/lib/stat-time.h | |||
| @@ -169,7 +169,7 @@ get_stat_birthtime (struct stat const *st) | |||
| 169 | #elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ | 169 | #elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ |
| 170 | /* Native Windows platforms (but not Cygwin) put the "file creation | 170 | /* Native Windows platforms (but not Cygwin) put the "file creation |
| 171 | time" in st_ctime (!). See | 171 | time" in st_ctime (!). See |
| 172 | <http://msdn2.microsoft.com/de-de/library/14h5k7ff(VS.80).aspx>. */ | 172 | <https://msdn.microsoft.com/en-us/library/14h5k7ff(VS.80).aspx>. */ |
| 173 | t.tv_sec = st->st_ctime; | 173 | t.tv_sec = st->st_ctime; |
| 174 | t.tv_nsec = 0; | 174 | t.tv_nsec = 0; |
| 175 | #else | 175 | #else |
diff --git a/lib/time_rz.c b/lib/time_rz.c index adb9c1c2361..c41a8ef47ac 100644 --- a/lib/time_rz.c +++ b/lib/time_rz.c | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | #include <time.h> | 27 | #include <time.h> |
| 28 | 28 | ||
| 29 | #include <errno.h> | 29 | #include <errno.h> |
| 30 | #include <limits.h> | ||
| 30 | #include <stdbool.h> | 31 | #include <stdbool.h> |
| 31 | #include <stddef.h> | 32 | #include <stddef.h> |
| 32 | #include <stdlib.h> | 33 | #include <stdlib.h> |
| @@ -35,6 +36,10 @@ | |||
| 35 | #include "flexmember.h" | 36 | #include "flexmember.h" |
| 36 | #include "time-internal.h" | 37 | #include "time-internal.h" |
| 37 | 38 | ||
| 39 | #ifndef SIZE_MAX | ||
| 40 | # define SIZE_MAX ((size_t) -1) | ||
| 41 | #endif | ||
| 42 | |||
| 38 | #if !HAVE_TZSET | 43 | #if !HAVE_TZSET |
| 39 | static void tzset (void) { } | 44 | static void tzset (void) { } |
| 40 | #endif | 45 | #endif |
| @@ -43,7 +48,7 @@ static void tzset (void) { } | |||
| 43 | the largest "small" request for the GNU C library malloc. */ | 48 | the largest "small" request for the GNU C library malloc. */ |
| 44 | enum { DEFAULT_MXFAST = 64 * sizeof (size_t) / 4 }; | 49 | enum { DEFAULT_MXFAST = 64 * sizeof (size_t) / 4 }; |
| 45 | 50 | ||
| 46 | /* Minimum size of the ABBRS member of struct abbr. ABBRS is larger | 51 | /* Minimum size of the ABBRS member of struct tm_zone. ABBRS is larger |
| 47 | only in the unlikely case where an abbreviation longer than this is | 52 | only in the unlikely case where an abbreviation longer than this is |
| 48 | used. */ | 53 | used. */ |
| 49 | enum { ABBR_SIZE_MIN = DEFAULT_MXFAST - offsetof (struct tm_zone, abbrs) }; | 54 | enum { ABBR_SIZE_MIN = DEFAULT_MXFAST - offsetof (struct tm_zone, abbrs) }; |
| @@ -150,7 +155,13 @@ save_abbr (timezone_t tz, struct tm *tm) | |||
| 150 | if (! (*zone_copy || (zone_copy == tz->abbrs && tz->tz_is_set))) | 155 | if (! (*zone_copy || (zone_copy == tz->abbrs && tz->tz_is_set))) |
| 151 | { | 156 | { |
| 152 | size_t zone_size = strlen (zone) + 1; | 157 | size_t zone_size = strlen (zone) + 1; |
| 153 | if (zone_size < tz->abbrs + ABBR_SIZE_MIN - zone_copy) | 158 | size_t zone_used = zone_copy - tz->abbrs; |
| 159 | if (SIZE_MAX - zone_used < zone_size) | ||
| 160 | { | ||
| 161 | errno = ENOMEM; | ||
| 162 | return false; | ||
| 163 | } | ||
| 164 | if (zone_used + zone_size < ABBR_SIZE_MIN) | ||
| 154 | extend_abbrs (zone_copy, zone, zone_size); | 165 | extend_abbrs (zone_copy, zone, zone_size); |
| 155 | else | 166 | else |
| 156 | { | 167 | { |
diff --git a/m4/getopt.m4 b/m4/getopt.m4 index ac3b38e385e..3ebc7b7edf5 100644 --- a/m4/getopt.m4 +++ b/m4/getopt.m4 | |||
| @@ -32,7 +32,16 @@ AC_DEFUN([gl_FUNC_GETOPT_POSIX], | |||
| 32 | # getopt_long_only. | 32 | # getopt_long_only. |
| 33 | AC_DEFUN([gl_FUNC_GETOPT_GNU], | 33 | AC_DEFUN([gl_FUNC_GETOPT_GNU], |
| 34 | [ | 34 | [ |
| 35 | dnl Set the variable gl_getopt_required, so that all invocations of | ||
| 36 | dnl gl_GETOPT_CHECK_HEADERS in the scope of the current configure file | ||
| 37 | dnl will check for getopt with GNU extensions. | ||
| 38 | dnl This means that if one gnulib-tool invocation requests getopt-posix | ||
| 39 | dnl and another gnulib-tool invocation requests getopt-gnu, it is as if | ||
| 40 | dnl both had requested getopt-gnu. | ||
| 35 | m4_divert_text([INIT_PREPARE], [gl_getopt_required=GNU]) | 41 | m4_divert_text([INIT_PREPARE], [gl_getopt_required=GNU]) |
| 42 | |||
| 43 | dnl No need to invoke gl_FUNC_GETOPT_POSIX here; this is automatically | ||
| 44 | dnl done through the module dependency getopt-gnu -> getopt-posix. | ||
| 36 | ]) | 45 | ]) |
| 37 | 46 | ||
| 38 | # Determine whether to replace the entire getopt facility. | 47 | # Determine whether to replace the entire getopt facility. |
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index bfac944ea05..030304d6777 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 | |||
| @@ -259,6 +259,9 @@ AC_DEFUN([gl_INIT], | |||
| 259 | fi | 259 | fi |
| 260 | gl_STDLIB_MODULE_INDICATOR([getloadavg]) | 260 | gl_STDLIB_MODULE_INDICATOR([getloadavg]) |
| 261 | gl_FUNC_GETOPT_GNU | 261 | gl_FUNC_GETOPT_GNU |
| 262 | dnl Because of the way gl_FUNC_GETOPT_GNU is implemented (the gl_getopt_required | ||
| 263 | dnl mechanism), there is no need to do any AC_LIBOBJ or AC_SUBST here; they are | ||
| 264 | dnl done in the getopt-posix module. | ||
| 262 | gl_FUNC_GETOPT_POSIX | 265 | gl_FUNC_GETOPT_POSIX |
| 263 | if test $REPLACE_GETOPT = 1; then | 266 | if test $REPLACE_GETOPT = 1; then |
| 264 | AC_LIBOBJ([getopt]) | 267 | AC_LIBOBJ([getopt]) |