include/vcl/bmpacc.hxx | 6 +++--- sal/osl/unx/time.cxx | 17 ++++------------- sal/rtl/ustring.cxx | 8 ++++---- sc/source/filter/starcalc/scflt.cxx | 11 ++++++++++- vcl/source/gdi/bmpacc.cxx | 4 ++-- 5 files changed, 23 insertions(+), 23 deletions(-)
New commits: commit 51e2d23521f99254f09fcc459e7b41600cb9f76d Author: Caolán McNamara <caol...@redhat.com> Date: Sat Feb 7 20:55:58 2015 +0000 coverity#1267681 Dereference before null check Change-Id: I629b12d53ef3bbadeb43e9555a8499252c1a1800 diff --git a/include/vcl/bmpacc.hxx b/include/vcl/bmpacc.hxx index bc43dbf..f2f1399 100644 --- a/include/vcl/bmpacc.hxx +++ b/include/vcl/bmpacc.hxx @@ -348,14 +348,14 @@ inline Scanline BitmapReadAccess::GetBuffer() const inline Scanline BitmapReadAccess::GetScanline( long nY ) const { - assert(mpBuffer && "Access is not valid!"); + assert(mpBuffer && mpScanBuf && "Access is not valid!"); assert(nY < mpBuffer->mnHeight && "y-coordinate out of range!"); - return( mpBuffer ? mpScanBuf[ nY ] : NULL ); + return mpScanBuf[nY]; } inline BitmapColor BitmapReadAccess::GetPixel( long nY, long nX ) const { - assert(mpBuffer && "Access is not valid!"); + assert(mpBuffer && mpScanBuf && "Access is not valid!"); assert(nX < mpBuffer->mnWidth && "x-coordinate out of range!"); assert(nY < mpBuffer->mnHeight && "y-coordinate out of range!"); return mFncGetPixel( mpScanBuf[ nY ], nX, maColorMask ); diff --git a/vcl/source/gdi/bmpacc.cxx b/vcl/source/gdi/bmpacc.cxx index 7ad7387..33e5038 100644 --- a/vcl/source/gdi/bmpacc.cxx +++ b/vcl/source/gdi/bmpacc.cxx @@ -426,7 +426,7 @@ BitmapWriteAccess::~BitmapWriteAccess() void BitmapWriteAccess::CopyScanline( long nY, const BitmapReadAccess& rReadAcc ) { - DBG_ASSERT( ( nY >= 0 ) && ( nY < mpBuffer->mnHeight ), "y-coordinate in destination out of range!" ); + assert(nY >= 0 && nY < mpBuffer->mnHeight && "y-coordinate in destination out of range!"); DBG_ASSERT( nY < rReadAcc.Height(), "y-coordinate in source out of range!" ); DBG_ASSERT( ( HasPalette() && rReadAcc.HasPalette() ) || ( !HasPalette() && !rReadAcc.HasPalette() ), "No copying possible between palette bitmap and TC bitmap!" ); @@ -446,7 +446,7 @@ void BitmapWriteAccess::CopyScanline( long nY, ConstScanline aSrcScanline, { const sal_uLong nFormat = BMP_SCANLINE_FORMAT( nSrcScanlineFormat ); - DBG_ASSERT( ( nY >= 0 ) && ( nY < mpBuffer->mnHeight ), "y-coordinate in destination out of range!" ); + assert(nY >= 0 && nY < mpBuffer->mnHeight && "y-coordinate in destination out of range!"); DBG_ASSERT( ( HasPalette() && nFormat <= BMP_FORMAT_8BIT_PAL ) || ( !HasPalette() && nFormat > BMP_FORMAT_8BIT_PAL ), "No copying possible between palette and non palette scanlines!" ); commit 1479190c8690f1f72b0bcd62e8a4c81ddbb6b206 Author: Caolán McNamara <caol...@redhat.com> Date: Sat Feb 7 20:49:08 2015 +0000 coverity#1267668 Logically dead code Change-Id: Id9458f55efa4d27914c24b8ab7c4ced081e19626 diff --git a/sal/osl/unx/time.cxx b/sal/osl/unx/time.cxx index 1fbd2fb..4abd99d 100644 --- a/sal/osl/unx/time.cxx +++ b/sal/osl/unx/time.cxx @@ -25,7 +25,6 @@ #include <osl/diagnose.h> #include <osl/time.h> #include <time.h> -#include <assert.h> #include <unistd.h> #ifdef __MACH__ @@ -269,14 +268,11 @@ void sal_initGlobalTimer(void) clock_get_time(cclock, &startTime); mach_port_deallocate(mach_task_self(), cclock); #else /* ! (MACOSX || IOS) */ - int res; #if defined(USE_CLOCK_GETTIME) - res = clock_gettime(CLOCK_REALTIME, &startTime); + clock_gettime(CLOCK_REALTIME, &startTime); #else /* Ndef USE_CLOCK_GETTIME */ - res = gettimeofday( &startTime, NULL ); + gettimeofday( &startTime, NULL ); #endif /* NDef USE_CLOCK_GETTIME */ - assert(res == 0); - (void) res; #endif /* ! (MACOSX || IOS) */ } @@ -296,17 +292,12 @@ sal_uInt32 SAL_CALL osl_getGlobalTimer() nSeconds = ( nSeconds * 1000 ) + (long) (( currentTime.tv_nsec - startTime.tv_nsec) / 1000000 ); #else osl_time_t currentTime; - int res; #if defined(USE_CLOCK_GETTIME) - res = clock_gettime(CLOCK_REALTIME, ¤tTime); + clock_gettime(CLOCK_REALTIME, ¤tTime); #else - res = gettimeofday( ¤tTime, NULL ); + gettimeofday( ¤tTime, NULL ); #endif - assert(res == 0); - - if (res != 0) - return 0; nSeconds = (sal_uInt32)( currentTime.tv_sec - startTime.tv_sec ); #if defined(USE_CLOCK_GETTIME) commit 5e691dbfb3b2f7803b27f35e6abeb2e0fbc02668 Author: Caolán McNamara <caol...@redhat.com> Date: Sat Feb 7 20:36:58 2015 +0000 make this a comment a coverity queller Change-Id: I0eccec058f506be69f6c95a1a6d97be64cb734bc diff --git a/sal/rtl/ustring.cxx b/sal/rtl/ustring.cxx index cd42e47..90e5ba1 100644 --- a/sal/rtl/ustring.cxx +++ b/sal/rtl/ustring.cxx @@ -569,10 +569,10 @@ void SAL_CALL rtl_uString_newFromCodePoints( ++n; } } - /* Builds on the assumption that sal_Int32 uses 32 bit two's complement - representation with wrap around (the necessary number of UTF-16 code - units will be no larger than 2 * SAL_MAX_INT32, represented as - sal_Int32 -2): */ + /* coverity[dead_error_condition] - Builds on the assumption that sal_Int32 + uses 32 bit two's complement representation with wrap around (the + necessary number of UTF-16 code units will be no larger than 2 * + SAL_MAX_INT32, represented as sal_Int32 -2): */ if (n < 0) { *newString = NULL; return; commit cfb0c6d7a3fb07fdfbbee712bf8cc3121f922e4d Author: Caolán McNamara <caol...@redhat.com> Date: Sat Feb 7 20:30:50 2015 +0000 coverity#1242895 Untrusted loop bound Change-Id: Ib54ed3f18c91142f1c217f618d88e36a646cf931 diff --git a/sc/source/filter/starcalc/scflt.cxx b/sc/source/filter/starcalc/scflt.cxx index 63c9b0e..c2c1dab 100644 --- a/sc/source/filter/starcalc/scflt.cxx +++ b/sc/source/filter/starcalc/scflt.cxx @@ -1534,7 +1534,16 @@ void Sc10Import::LoadTables() return; } - rStream.ReadUInt16( DataCount ); + rStream.ReadUInt16(DataCount); + const size_t nMinRecordSize = sizeof(sal_uInt16)*2; + const size_t nMaxRecords = rStream.remainingSize() / nMinRecordSize; + if (DataCount > nMaxRecords) + { + SAL_WARN("sc", "Parsing error: " << nMaxRecords << + " max possible entries, but " << DataCount << " claimed, truncating"); + DataCount = nMaxRecords; + } + DataStart = 0; for (i=0; i < DataCount; i++) {
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits