tools/source/stream/stream.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
New commits: commit 4eda033a0077b608a9a17ffb09485ad3d7dc0948 Author: Caolán McNamara <caol...@redhat.com> Date: Mon Mar 13 14:57:50 2017 +0000 ofz#853 oom in svm Change-Id: Ibe41e1edb717b4e740971f4b972abdea769460eb diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index f838edb..b1efb69 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -1961,7 +1961,9 @@ OString read_uInt8s_ToOString(SvStream& rStrm, std::size_t nLen) rtl_String *pStr = nullptr; if (nLen) { - nLen = std::min(nLen, static_cast<std::size_t>(SAL_MAX_INT32)); + nLen = std::min<std::size_t>(nLen, SAL_MAX_INT32); + //limit allocation to size of file, but + 1 to set eof state + nLen = std::min<sal_uInt64>(nLen, rStrm.remainingSize() + 1); //alloc a (ref-count 1) rtl_String of the desired length. //rtl_String's buffer is uninitialized, except for null termination pStr = rtl_string_alloc(sal::static_int_cast<sal_Int32>(nLen)); @@ -1990,7 +1992,9 @@ OUString read_uInt16s_ToOUString(SvStream& rStrm, std::size_t nLen) rtl_uString *pStr = nullptr; if (nLen) { - nLen = std::min(nLen, static_cast<std::size_t>(SAL_MAX_INT32)); + nLen = std::min<std::size_t>(nLen, SAL_MAX_INT32); + //limit allocation to size of file, but + 1 to set eof state + nLen = std::min<sal_uInt64>(nLen, (rStrm.remainingSize() + 2) / 2); //alloc a (ref-count 1) rtl_uString of the desired length. //rtl_String's buffer is uninitialized, except for null termination pStr = rtl_uString_alloc(sal::static_int_cast<sal_Int32>(nLen));
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits