Module Name: src
Committed By: christos
Date: Tue Jun 15 10:56:52 UTC 2021
Modified Files:
src/lib/libc/gdtoa: hdtoa.c
Log Message:
PR/56247: Greg A. Woods: printf("%La", LDBL_MIN) dumps core
Don't write to ((char *)malloc(size))[-1];
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/gdtoa/hdtoa.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/gdtoa/hdtoa.c
diff -u src/lib/libc/gdtoa/hdtoa.c:1.11 src/lib/libc/gdtoa/hdtoa.c:1.12
--- src/lib/libc/gdtoa/hdtoa.c:1.11 Sat Apr 11 16:48:53 2020
+++ src/lib/libc/gdtoa/hdtoa.c Tue Jun 15 06:56:52 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: hdtoa.c,v 1.11 2020/04/11 20:48:53 christos Exp $ */
+/* $NetBSD: hdtoa.c,v 1.12 2021/06/15 10:56:52 christos Exp $ */
/*-
* Copyright (c) 2004, 2005 David Schultz <[email protected]>
@@ -30,7 +30,7 @@
#if 0
__FBSDID("$FreeBSD: src/lib/libc/gdtoa/_hdtoa.c,v 1.4 2007/01/03 04:57:58 das Exp $");
#else
-__RCSID("$NetBSD: hdtoa.c,v 1.11 2020/04/11 20:48:53 christos Exp $");
+__RCSID("$NetBSD: hdtoa.c,v 1.12 2021/06/15 10:56:52 christos Exp $");
#endif
#include <float.h>
@@ -256,7 +256,7 @@ char *
hldtoa(long double e, const char *xdigs, int ndigits, int *decpt, int *sign,
char **rve)
{
- static const int sigfigs = (LDBL_MANT_DIG + 3) / 4;
+ static const int sigfigs = (LDBL_MANT_DIG + 3) / 4 + 1;
union ieee_ext_u u;
char *s, *s0;
size_t bufsize;