bin/findunusedcode | 2 +- vcl/generic/fontmanager/helper.cxx | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-)
New commits: commit f5d33e5e70d74d18893a67672eac95b84483226b Author: Caolán McNamara <caol...@redhat.com> Date: Sun Jul 20 20:37:40 2014 +0100 Resolves: coverity#706171 Untrusted value as argument limit nBytesToRead to remaining size of file also zero last byte of alloced block, seeing as the block is size+1 and we only read size into it Change-Id: I2729ec7bb9de20731531f32da864c572fa83ce58 diff --git a/vcl/generic/fontmanager/helper.cxx b/vcl/generic/fontmanager/helper.cxx index 0e4bc89..3a31319 100644 --- a/vcl/generic/fontmanager/helper.cxx +++ b/vcl/generic/fontmanager/helper.cxx @@ -248,12 +248,12 @@ bool psp::convertPfbToPfa( ::osl::File& rInFile, ::osl::File& rOutFile ) bool bSuccess = true; bool bEof = false; unsigned char buffer[256]; - sal_uInt64 nRead; - sal_uInt64 nOrgPos = 0; - rInFile.getPos( nOrgPos ); + sal_uInt64 nSize(0); + rInFile.getSize(nSize); while( bSuccess && ! bEof ) { + sal_uInt64 nRead; // read leading bytes bEof = ((0 != rInFile.read( buffer, 6, nRead)) || (nRead != 6)); if( bEof ) @@ -285,7 +285,12 @@ bool psp::convertPfbToPfa( ::osl::File& rInFile, ::osl::File& rOutFile ) } else if( nType == 1 || nType == 2 ) { - boost::scoped_array<unsigned char> pBuffer(new unsigned char[ nBytesToRead+1 ]); + sal_uInt64 nOrgPos(0); + rInFile.getPos(nOrgPos); + nBytesToRead = std::min<sal_uInt64>(nBytesToRead, nSize - nOrgPos); + + boost::scoped_array<unsigned char> pBuffer(new unsigned char[nBytesToRead+1]); + pBuffer[nBytesToRead] = 0; if( ! rInFile.read( pBuffer.get(), nBytesToRead, nRead ) && nRead == nBytesToRead ) { commit 8306c25ef416a22fde6f31311b530b4caea1bba6 Author: Caolán McNamara <caol...@redhat.com> Date: Sun Jul 20 17:22:01 2014 +0100 force a make clean first Change-Id: Icef93accc6953a4484707fb9da01a85963002a21 diff --git a/bin/findunusedcode b/bin/findunusedcode index 8485f44..df865bc 100755 --- a/bin/findunusedcode +++ b/bin/findunusedcode @@ -37,7 +37,7 @@ export AR="callarchive ${AR:-ar}" export dbglevel=2 -make +make clean && make callanalyse \ instdir/program/* \
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits