[goffice] dtoa: bandaid for 999999999 problem.



commit a46f93a24d7794d0dc2c97cab8c827a47204b82e
Author: Morten Welinder <terra gnome org>
Date:   Fri Apr 4 20:08:32 2014 -0400

    dtoa: bandaid for 999999999 problem.
    
    Let's see what the musl people have to say.  For now, try this
    patch.

 ChangeLog              |    1 +
 goffice/math/go-dtoa.c |    3 +++
 2 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index debb2f5..7e65d0d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2014-04-04  Morten Welinder  <terra gnome org>
 
        * goffice/math/go-dtoa.c (go_dtoa): New function.
+       (fmt_fp): Fix buffer overrun.  Hit "%.3E" for 999999999.
 
        * goffice/utils/go-format.c: Use go_dtoa extensively.
 
diff --git a/goffice/math/go-dtoa.c b/goffice/math/go-dtoa.c
index 58ad350..ab70182 100644
--- a/goffice/math/go-dtoa.c
+++ b/goffice/math/go-dtoa.c
@@ -298,6 +298,9 @@ static int fmt_fp(FAKE_FILE *f, long double y, int w, int p, int fl, int t)
                                *d = *d + i;
                                while (*d > 999999999) {
                                        *d--=0;
+#ifndef MUSL_ORIGINAL
+                                       if (d < a) *--a = 0;
+#endif
                                        (*d)++;
                                }
                                if (d<a) a=d;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]