diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-11-05 16:37:27 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-11-05 21:03:25 +0000 |
commit | 7d6c07fa2b48376013b9f8784496d9c1207708f2 (patch) | |
tree | 1f2364150dbd9cda414d865fbd0be5aa171f51a1 /basic/source | |
parent | coverity#1242865 Untrusted loop bound (diff) | |
download | core-7d6c07fa2b48376013b9f8784496d9c1207708f2.tar.gz core-7d6c07fa2b48376013b9f8784496d9c1207708f2.zip |
coverity#1242689 Untrusted loop bound
Change-Id: Ie226805ef8d430eb3f7b3abaa54ac3af31f72f7b
Diffstat (limited to 'basic/source')
-rw-r--r-- | basic/source/basmgr/basmgr.cxx | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 15056527baca..b0f05216a4a0 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -860,7 +860,15 @@ void BasicManager::LoadBasicManager( SotStorage& rStorage, const OUString& rBase DBG_ASSERT( false, "BasicManager-Stream defect!" ); return; } - for ( sal_uInt16 nL = 0; nL < nLibs; nL++ ) + const size_t nMinBasicLibSize(8); + const size_t nMaxPossibleLibs = xManagerStream->remainingSize() / nMinBasicLibSize; + if (nLibs > nMaxPossibleLibs) + { + SAL_WARN("basic", "Parsing error: " << nMaxPossibleLibs << + " max possible entries, but " << nLibs << " claimed, truncating"); + nLibs = nMaxPossibleLibs; + } + for (sal_uInt16 nL = 0; nL < nLibs; ++nL) { BasicLibInfo* pInfo = BasicLibInfo::Create( *xManagerStream ); |