[Libreoffice-commits] core.git: sal/rtl
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Fri Oct 1 16:04:38 UTC 2021
sal/rtl/math.cxx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 0471dccf9c81b4851078033d286a215954c488ed
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Fri Oct 1 15:12:49 2021 +0200
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Fri Oct 1 18:04:02 2021 +0200
Calculate buffer size correctly
A mistake in eae24a9488814e77254d175c11fc4a138c1dbd30
Change-Id: I0da64366e4c39b3f5559e8a1c757a94d811f041f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122869
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index ce939b907655..2d1c1257ef97 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -506,7 +506,7 @@ void doubleToString(typename T::String ** pResult,
// max(nDigits) = max(nDecPlaces) + 1 + max(nExp) + 1 = 20 + 1 + 308 + 1 = 330
// max(nBuf) = max(nDigits) + max(nDecPlaces) + 10 + max(nDigits) * 2 = 330 * 3 + 20 + 10 = 1020
assert(nBuf <= 1024);
- typename T::Char* pBuf = static_cast<typename T::Char*>(alloca(nBuf));
+ typename T::Char* pBuf = static_cast<typename T::Char*>(alloca(nBuf * sizeof(typename T::Char)));
typename T::Char * p = pBuf;
if ( bSign )
*p++ = '-';
More information about the Libreoffice-commits
mailing list