Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/gdtoa PR/56247: Greg A. Woods: printf("%La", LDBL_M...



details:   https://anonhg.NetBSD.org/src/rev/3894f39c1e8e
branches:  trunk
changeset: 1021732:3894f39c1e8e
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Jun 15 10:56:52 2021 +0000

description:
PR/56247: Greg A. Woods: printf("%La", LDBL_MIN) dumps core
Don't write to ((char *)malloc(size))[-1];

diffstat:

 lib/libc/gdtoa/hdtoa.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 059cb4d1b58b -r 3894f39c1e8e lib/libc/gdtoa/hdtoa.c
--- a/lib/libc/gdtoa/hdtoa.c    Tue Jun 15 09:00:33 2021 +0000
+++ b/lib/libc/gdtoa/hdtoa.c    Tue Jun 15 10:56:52 2021 +0000
@@ -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 <das%FreeBSD.ORG@localhost>
@@ -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 @@
 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;



Home | Main Index | Thread Index | Old Index