summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--desktop/source/lib/init.cxx13
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx2
-rw-r--r--odk/source/unoapploader/win/unoapploader.c3
-rw-r--r--sal/osl/w32/file_dirvol.cxx28
-rw-r--r--sal/osl/w32/file_url.cxx2
-rw-r--r--sal/osl/w32/pipe.cxx2
-rw-r--r--sal/osl/w32/security.cxx2
-rw-r--r--setup_native/source/win32/customactions/regactivex/regactivex.cxx3
-rw-r--r--setup_native/source/win32/customactions/sellang/sellang.cxx2
-rw-r--r--setup_native/source/win32/customactions/tools/checkversion.cxx2
-rw-r--r--soltools/mkdepend/main.c4
-rw-r--r--vcl/source/fontsubset/sft.cxx14
-rw-r--r--vcl/win/gdi/salprn.cxx1
13 files changed, 60 insertions, 18 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index dfbbdd8386dc..ba77d5ad10d3 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2239,6 +2239,7 @@ static char* doc_getPartInfo(LibreOfficeKitDocument* pThis, int nPart)
OString aString = OUStringToOString(aPartInfo, RTL_TEXTENCODING_UTF8);
char* pMemory = static_cast<char*>(malloc(aString.getLength() + 1));
+ assert(pMemory); // Don't handle OOM conditions
strcpy(pMemory, aString.getStr());
return pMemory;
}
@@ -2259,6 +2260,7 @@ static char* doc_getPartPageRectangles(LibreOfficeKitDocument* pThis)
OUString sRectangles = pDoc->getPartPageRectangles();
OString aString = OUStringToOString(sRectangles, RTL_TEXTENCODING_UTF8);
char* pMemory = static_cast<char*>(malloc(aString.getLength() + 1));
+ assert(pMemory); // Don't handle OOM conditions
strcpy(pMemory, aString.getStr());
return pMemory;
@@ -2280,6 +2282,7 @@ static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart)
OUString sName = pDoc->getPartName( nPart );
OString aString = OUStringToOString(sName, RTL_TEXTENCODING_UTF8);
char* pMemory = static_cast<char*>(malloc(aString.getLength() + 1));
+ assert(pMemory); // Don't handle OOM conditions
strcpy(pMemory, aString.getStr());
return pMemory;
@@ -2301,6 +2304,7 @@ static char* doc_getPartHash(LibreOfficeKitDocument* pThis, int nPart)
OUString sHash = pDoc->getPartHash(nPart);
OString aString = OUStringToOString(sHash, RTL_TEXTENCODING_UTF8);
char* pMemory = static_cast<char*>(malloc(aString.getLength() + 1));
+ assert(pMemory); // Don't handle OOM conditions
strcpy(pMemory, aString.getStr());
return pMemory;
@@ -3100,6 +3104,7 @@ static char* doc_getTextSelection(LibreOfficeKitDocument* pThis, const char* pMi
aRet = pDoc->getTextSelection("text/plain;charset=utf-8", aUsedMimeType);
char* pMemory = static_cast<char*>(malloc(aRet.getLength() + 1));
+ assert(pMemory); // Don't handle OOM conditions
strcpy(pMemory, aRet.getStr());
if (pUsedMimeType)
@@ -3215,6 +3220,7 @@ static char* getLanguages(const char* pCommand)
std::stringstream aStream;
boost::property_tree::write_json(aStream, aTree);
char* pJson = static_cast<char*>(malloc(aStream.str().size() + 1));
+ assert(pJson); // Don't handle OOM conditions
strcpy(pJson, aStream.str().c_str());
pJson[aStream.str().size()] = '\0';
return pJson;
@@ -3253,6 +3259,7 @@ static char* getFonts (const char* pCommand)
std::stringstream aStream;
boost::property_tree::write_json(aStream, aTree);
char* pJson = static_cast<char*>(malloc(aStream.str().size() + 1));
+ assert(pJson); // Don't handle OOM conditions
strcpy(pJson, aStream.str().c_str());
pJson[aStream.str().size()] = '\0';
return pJson;
@@ -3305,6 +3312,7 @@ static char* getFontSubset (const OString& aFontName)
std::stringstream aStream;
boost::property_tree::write_json(aStream, aTree);
char* pJson = static_cast<char*>(malloc(aStream.str().size() + 1));
+ assert(pJson); // Don't handle OOM conditions
strcpy(pJson, aStream.str().c_str());
pJson[aStream.str().size()] = '\0';
return pJson;
@@ -3429,6 +3437,7 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand)
std::stringstream aStream;
boost::property_tree::write_json(aStream, aTree);
char* pJson = static_cast<char*>(malloc(aStream.str().size() + 1));
+ assert(pJson); // Don't handle OOM conditions
strcpy(pJson, aStream.str().c_str());
pJson[aStream.str().size()] = '\0';
return pJson;
@@ -3650,6 +3659,7 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
OString aString = OUStringToOString(aHeaders, RTL_TEXTENCODING_UTF8);
char* pMemory = static_cast<char*>(malloc(aString.getLength() + 1));
+ assert(pMemory); // Don't handle OOM conditions
strcpy(pMemory, aString.getStr());
return pMemory;
}
@@ -3701,6 +3711,7 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
OString aString = pDoc->getCellCursor(nOutputWidth, nOutputHeight, nTileWidth, nTileHeight);
char* pMemory = static_cast<char*>(malloc(aString.getLength() + 1));
+ assert(pMemory); // Don't handle OOM conditions
strcpy(pMemory, aString.getStr());
return pMemory;
}
@@ -4194,6 +4205,7 @@ static char* lo_getError (LibreOfficeKit *pThis)
LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis);
OString aString = OUStringToOString(pLib->maLastExceptionMsg, RTL_TEXTENCODING_UTF8);
char* pMemory = static_cast<char*>(malloc(aString.getLength() + 1));
+ assert(pMemory); // Don't handle OOM conditions
strcpy(pMemory, aString.getStr());
return pMemory;
}
@@ -4290,6 +4302,7 @@ static char* lo_getVersionInfo(SAL_UNUSED_PARAMETER LibreOfficeKit* /*pThis*/)
const OString sVersionStr = OUStringToOString(ReplaceStringHookProc(sVersionStrTemplate), RTL_TEXTENCODING_UTF8);
char* pVersion = static_cast<char*>(malloc(sVersionStr.getLength() + 1));
+ assert(pVersion); // Don't handle OOM conditions
strcpy(pVersion, sVersionStr.getStr());
return pVersion;
}
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index 6949ed903b1e..b2cc8ed40803 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -528,7 +528,7 @@ static void do_msvcr_magic(OUString const &jvm_dll)
}
PIMAGE_DOS_HEADER dos_hdr = static_cast<PIMAGE_DOS_HEADER>(malloc(st.st_size));
-
+ assert(dos_hdr);
if (fread(dos_hdr, st.st_size, 1, f) != 1 ||
memcmp(dos_hdr, "MZ", 2) != 0 ||
dos_hdr->e_lfanew < 0 ||
diff --git a/odk/source/unoapploader/win/unoapploader.c b/odk/source/unoapploader/win/unoapploader.c
index dd5cfaf78439..455f4689adad 100644
--- a/odk/source/unoapploader/win/unoapploader.c
+++ b/odk/source/unoapploader/win/unoapploader.c
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -208,6 +209,7 @@ int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
if ( value != NULL )
size += wcslen( PATHSEPARATOR ) + wcslen( value );
wchar_t* envstr = (wchar_t*) malloc( size*sizeof(wchar_t) );
+ assert(envstr);
wcscpy( envstr, ENVVARNAME );
wcscat( envstr, L"=" );
wcscat( envstr, path );
@@ -312,6 +314,7 @@ wchar_t* createCommandLine( wchar_t const * appendix )
/* create the command line */
cmdline = (wchar_t*) malloc( (wcslen( DQUOTE ) + wcslen( cmdname ) +
wcslen ( DQUOTE ) + wcslen( SPACE ) + wcslen( appendix ) + 1) * sizeof(wchar_t) );
+ assert(cmdline);
wcscpy( cmdline, DQUOTE );
wcscat( cmdline, cmdname );
wcscat( cmdline, DQUOTE );
diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx
index cfdf957ef0de..36a4b5d4013d 100644
--- a/sal/osl/w32/file_dirvol.cxx
+++ b/sal/osl/w32/file_dirvol.cxx
@@ -345,11 +345,12 @@ static HANDLE WINAPI OpenDirectory( rtl_uString* pPath)
}
WCHAR* szFileMask = static_cast< WCHAR* >( malloc( sizeof( WCHAR ) * ( nLen + nSuffLen + 1 ) ) );
-
+ assert(szFileMask); // Don't handle OOM conditions
wcscpy( szFileMask, o3tl::toW(rtl_uString_getStr( pPath )) );
wcscat( szFileMask, pSuffix );
pDirectory = static_cast<LPDIRECTORY>(HeapAlloc(GetProcessHeap(), 0, sizeof(DIRECTORY)));
+ assert(pDirectory); // Don't handle OOM conditions
pDirectory->hFind = FindFirstFileW(szFileMask, &pDirectory->aFirstData);
if (!IsValidHandle(pDirectory->hFind))
@@ -437,6 +438,7 @@ static oslFileError osl_openLocalRoot(
Directory_Impl *pDirImpl;
pDirImpl = static_cast<Directory_Impl*>(malloc( sizeof(Directory_Impl)));
+ assert(pDirImpl); // Don't handle OOM conditions
ZeroMemory( pDirImpl, sizeof(Directory_Impl) );
rtl_uString_newFromString( &pDirImpl->m_pDirectoryPath, strSysPath );
@@ -501,6 +503,7 @@ static oslFileError osl_openFileDirectory(
*pDirectory = nullptr;
Directory_Impl *pDirImpl = static_cast<Directory_Impl*>(malloc(sizeof(Directory_Impl)));
+ assert(pDirImpl); // Don't handle OOM conditions
ZeroMemory( pDirImpl, sizeof(Directory_Impl) );
rtl_uString_newFromString( &pDirImpl->m_pDirectoryPath, strDirectoryPath );
@@ -566,6 +569,7 @@ static oslFileError osl_openNetworkServer(
Directory_Impl *pDirImpl;
pDirImpl = static_cast<Directory_Impl*>(malloc(sizeof(Directory_Impl)));
+ assert(pDirImpl); // Don't handle OOM conditions
ZeroMemory( pDirImpl, sizeof(Directory_Impl) );
pDirImpl->uType = DIRECTORYTYPE_NETROOT;
pDirImpl->hDirectory = hEnum;
@@ -1068,18 +1072,24 @@ oslFileError SAL_CALL osl_getDirectoryItem(rtl_uString *strFilePath, oslDirector
{
DirectoryItem_Impl *pItemImpl =
static_cast<DirectoryItem_Impl*>(malloc(sizeof(DirectoryItem_Impl)));
+ if (!pItemImpl)
+ error = osl_File_E_NOMEM;
- ZeroMemory( pItemImpl, sizeof(DirectoryItem_Impl) );
- osl_acquireDirectoryItem( static_cast<oslDirectoryItem>(pItemImpl) );
+ if (osl_File_E_None == error)
+ {
+ ZeroMemory(pItemImpl, sizeof(DirectoryItem_Impl));
+ osl_acquireDirectoryItem(static_cast<oslDirectoryItem>(pItemImpl));
- CopyMemory( &pItemImpl->FindData, &aFindData, sizeof(WIN32_FIND_DATAW) );
- rtl_uString_newFromString( &pItemImpl->m_pFullPath, strSysFilePath );
+ CopyMemory(&pItemImpl->FindData, &aFindData, sizeof(WIN32_FIND_DATAW));
+ rtl_uString_newFromString(&pItemImpl->m_pFullPath, strSysFilePath);
- // MT: This costs 600ms startup time on fast v60x!
- // GetCaseCorrectPathName( pItemImpl->szFullPath, pItemImpl->szFullPath, sizeof(pItemImpl->szFullPath) );
+ // MT: This costs 600ms startup time on fast v60x!
+ // GetCaseCorrectPathName( pItemImpl->szFullPath, pItemImpl->szFullPath, sizeof(pItemImpl->szFullPath) );
+
+ pItemImpl->uType = DIRECTORYITEM_FILE;
+ *pItem = pItemImpl;
+ }
- pItemImpl->uType = DIRECTORYITEM_FILE;
- *pItem = pItemImpl;
FindClose( hFind );
}
else
diff --git a/sal/osl/w32/file_url.cxx b/sal/osl/w32/file_url.cxx
index b096515902ba..c8291c056674 100644
--- a/sal/osl/w32/file_url.cxx
+++ b/sal/osl/w32/file_url.cxx
@@ -603,7 +603,7 @@ static void osl_encodeURL_( rtl_uString *strURL, rtl_String **pstrEncodedURL )
rtl_uString2String( &strUTF8, rtl_uString_getStr( strURL ), rtl_uString_getLength( strURL ), RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS );
pszEncodedURL = static_cast<sal_Char*>(malloc( (rtl_string_getLength( strUTF8 ) * 3 + 1) * sizeof(sal_Char) ));
-
+ assert(pszEncodedURL); // Don't handle OOM conditions
pURLDest = pszEncodedURL;
pURLScan = rtl_string_getStr( strUTF8 );
nURLScanLen = rtl_string_getLength( strUTF8 );
diff --git a/sal/osl/w32/pipe.cxx b/sal/osl/w32/pipe.cxx
index b128143702a1..f02a8951f3cb 100644
--- a/sal/osl/w32/pipe.cxx
+++ b/sal/osl/w32/pipe.cxx
@@ -136,12 +136,14 @@ oslPipe SAL_CALL osl_createPipe(rtl_uString *strPipeName, oslPipeOptions Options
PSECURITY_DESCRIPTOR pSecDesc;
pSecDesc = static_cast< PSECURITY_DESCRIPTOR >(malloc(SECURITY_DESCRIPTOR_MIN_LENGTH));
+ assert(pSecDesc); // Don't handle OOM conditions
/* add a NULL disc. ACL to the security descriptor */
OSL_VERIFY(InitializeSecurityDescriptor(pSecDesc, SECURITY_DESCRIPTOR_REVISION));
OSL_VERIFY(SetSecurityDescriptorDacl(pSecDesc, TRUE, nullptr, FALSE));
pSecAttr = static_cast< PSECURITY_ATTRIBUTES >(malloc(sizeof(SECURITY_ATTRIBUTES)));
+ assert(pSecAttr); // Don't handle OOM conditions
pSecAttr->nLength = sizeof(SECURITY_ATTRIBUTES);
pSecAttr->lpSecurityDescriptor = pSecDesc;
pSecAttr->bInheritHandle = TRUE;
diff --git a/sal/osl/w32/security.cxx b/sal/osl/w32/security.cxx
index aeecf1b8ca63..f7e14e7e32ae 100644
--- a/sal/osl/w32/security.cxx
+++ b/sal/osl/w32/security.cxx
@@ -19,6 +19,7 @@
#include "system.h"
+#include <cassert>
#include <osl/security.h>
#include <osl/diagnose.h>
#include <osl/thread.h>
@@ -782,6 +783,7 @@ static bool getUserNameImpl(oslSecurity Security, rtl_uString **strName, bool b
WNetGetUserW(nullptr, nullptr, &needed);
pNameW = static_cast<sal_Unicode *>(malloc (needed*sizeof(sal_Unicode)));
+ assert(pNameW); // Don't handle OOM conditions
if (WNetGetUserW(nullptr, o3tl::toW(pNameW), &needed) == NO_ERROR)
{
diff --git a/setup_native/source/win32/customactions/regactivex/regactivex.cxx b/setup_native/source/win32/customactions/regactivex/regactivex.cxx
index 293a8c8a4111..f7234a4725c8 100644
--- a/setup_native/source/win32/customactions/regactivex/regactivex.cxx
+++ b/setup_native/source/win32/customactions/regactivex/regactivex.cxx
@@ -23,6 +23,7 @@
#include <windows.h>
#include <msiquery.h>
+#include <cassert>
#include <string.h>
#include <malloc.h>
@@ -66,6 +67,7 @@ static void RegisterActiveXNative( const wchar_t* pActiveXPath, int nMode, BOOL
if ( nLen > nRemoveLen )
{
wchar_t* pProgramPath = static_cast<wchar_t*>( malloc( (nLen - nRemoveLen + 1) * sizeof(wchar_t) ) );
+ assert(pProgramPath); // Don't handle OOM conditions
wcsncpy( pProgramPath, pActiveXPath, nLen - nRemoveLen );
pProgramPath[ nLen - nRemoveLen ] = 0;
@@ -102,6 +104,7 @@ static BOOL GetMsiPropW( MSIHANDLE hMSI, const wchar_t* pPropName, wchar_t** ppV
sz++;
DWORD nbytes = sz * sizeof( wchar_t );
wchar_t* buff = static_cast<wchar_t*>( malloc( nbytes ) );
+ assert(buff); // Don't handle OOM conditions
ZeroMemory( buff, nbytes );
MsiGetPropertyW( hMSI, pPropName, buff, &sz );
*ppValue = buff;
diff --git a/setup_native/source/win32/customactions/sellang/sellang.cxx b/setup_native/source/win32/customactions/sellang/sellang.cxx
index bde31d03ab76..e82560f4239a 100644
--- a/setup_native/source/win32/customactions/sellang/sellang.cxx
+++ b/setup_native/source/win32/customactions/sellang/sellang.cxx
@@ -27,6 +27,7 @@
#include <msiquery.h>
#include <malloc.h>
+#include <cassert>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -44,6 +45,7 @@ static BOOL GetMsiPropA( MSIHANDLE hMSI, const char* pPropName, char** ppValue )
sz++;
DWORD nbytes = sz * sizeof( char );
char* buff = static_cast<char*>( malloc( nbytes ) );
+ assert(buff); // Don't handle OOM conditions
ZeroMemory( buff, nbytes );
MsiGetPropertyA( hMSI, pPropName, buff, &sz );
*ppValue = buff;
diff --git a/setup_native/source/win32/customactions/tools/checkversion.cxx b/setup_native/source/win32/customactions/tools/checkversion.cxx
index ffb7a8aa4216..daf20963673b 100644
--- a/setup_native/source/win32/customactions/tools/checkversion.cxx
+++ b/setup_native/source/win32/customactions/tools/checkversion.cxx
@@ -21,6 +21,7 @@
#include <windows.h>
#include <msiquery.h>
+#include <cassert>
#include <string.h>
#include <malloc.h>
#include <stdio.h>
@@ -37,6 +38,7 @@ static BOOL GetMsiPropW( MSIHANDLE hMSI, const wchar_t* pPropName, wchar_t** ppV
sz++;
DWORD nbytes = sz * sizeof( wchar_t );
wchar_t* buff = static_cast<wchar_t*>( malloc( nbytes ) );
+ assert(buff); // Don't handle OOM conditions
ZeroMemory( buff, nbytes );
MsiGetPropertyW( hMSI, pPropName, buff, &sz );
*ppValue = buff;
diff --git a/soltools/mkdepend/main.c b/soltools/mkdepend/main.c
index 844edb390ad2..51b6c8606cc9 100644
--- a/soltools/mkdepend/main.c
+++ b/soltools/mkdepend/main.c
@@ -56,6 +56,7 @@ typedef _W64 int ssize_t;
#endif
#include "def.h"
+#include <assert.h>
#include <string.h>
#ifdef hpux
#define sigvec sigvector
@@ -522,7 +523,7 @@ void freefile(struct filepointer *fp)
char *copy(char const *str)
{
char *p = (char *)malloc(strlen(str) + 1);
-
+ assert(p); // Don't handle OOM conditions
strcpy(p, str);
return p;
}
@@ -718,6 +719,7 @@ char* append_slash(char *path)
new_string = path;
} else {
new_string = (char*)malloc(sizeof(char) * (strlen(path) + 2));
+ assert(new_string); // Don't handle OOM conditions
strcpy(new_string, path);
if (native_win_slashes)
strcat(new_string, "\\");
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 972f5fbf09b8..7df64e41a227 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -635,14 +635,15 @@ static int GetCompoundTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPo
return 0;
np = myPoints.size();
-
- pa = static_cast<ControlPoint*>(calloc(np, sizeof(ControlPoint)));
- assert(pa != nullptr);
-
if (np > 0)
- memcpy( pa, &myPoints[0], np*sizeof(ControlPoint) );
+ {
+ pa = static_cast<ControlPoint*>(calloc(np, sizeof(ControlPoint)));
+ assert(pa != nullptr);
- *pointArray = pa;
+ memcpy(pa, &myPoints[0], np * sizeof(ControlPoint));
+
+ *pointArray = pa;
+ }
return np;
}
@@ -2537,6 +2538,7 @@ int GetTTNameRecords(TrueTypeFont const *ttf, NameRecord **nr)
}
NameRecord* rec = static_cast<NameRecord*>(calloc(n, sizeof(NameRecord)));
+ assert(rec);
for (i = 0; i < n; i++) {
int nLargestFixedOffsetPos = 6 + 10 + 12 * i;
diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index d702be988ab1..9f729a14bdde 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -1324,6 +1324,7 @@ static DEVMODEW const * ImplSalSetCopies( DEVMODEW const * pDevMode, sal_uLong n
nCopies = 32765;
sal_uLong nDevSize = pDevMode->dmSize+pDevMode->dmDriverExtra;
LPDEVMODEW pNewDevMode = static_cast<LPDEVMODEW>(std::malloc( nDevSize ));
+ assert(pNewDevMode); // Don't handle OOM conditions
memcpy( pNewDevMode, pDevMode, nDevSize );
pNewDevMode->dmFields |= DM_COPIES;
pNewDevMode->dmCopies = static_cast<short>(static_cast<sal_uInt16>(nCopies));