[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - connectivity/source
Julien Nabet
serval2412 at yahoo.fr
Tue May 29 05:02:02 UTC 2018
connectivity/source/drivers/firebird/PreparedStatement.cxx | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
New commits:
commit 570279baa7df076413cc6b4f9220a07248db0c1b
Author: Julien Nabet <serval2412 at yahoo.fr>
Date: Sat May 26 18:01:15 2018 +0200
tdf#117446: FB mig, (VAR)BINARY, fix memory management
By default, 8000 bytes are allocated for VARBINARY
The pb is we can need more.
See https://bugs.documentfoundation.org/show_bug.cgi?id=117446#c6
Change-Id: I0ef5811dc01a587491bd9345129d1a41a4d9f095
Reviewed-on: https://gerrit.libreoffice.org/54863
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
(cherry picked from commit 54ddc4ff4c2ff7e8b2c502d6b475cfdc9b8e3cec)
Reviewed-on: https://gerrit.libreoffice.org/54963
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index 0a43d5c93851..fee4029088f4 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -837,12 +837,19 @@ void SAL_CALL OPreparedStatement::setBytes(sal_Int32 nParameterIndex,
setParameterNull(nParameterIndex, false);
const sal_Int32 nMaxSize = 0xFFFF;
Sequence<sal_Int8> xBytesCopy(xBytes);
- // First 2 bytes indicate string size
if (xBytesCopy.getLength() > nMaxSize)
{
xBytesCopy.realloc( nMaxSize );
}
const short nSize = xBytesCopy.getLength();
+ // 8000 corresponds to value from lcl_addDefaultParameters
+ // in dbaccess/source/filter/hsqldb/createparser.cxx
+ if (nSize > 8000)
+ {
+ free(pVar->sqldata);
+ pVar->sqldata = static_cast<char *>(malloc(sizeof(char) * nSize + 2));
+ }
+ // First 2 bytes indicate string size
memcpy(pVar->sqldata, &nSize, 2);
// Actual data
memcpy(pVar->sqldata + 2, xBytesCopy.getConstArray(), nSize);
More information about the Libreoffice-commits
mailing list