diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-03-29 09:32:40 +0000 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-03-29 11:20:09 +0000 |
commit | 167b864fb1933d069293760e50e1f204a3d2e63d (patch) | |
tree | 64f30d391f46e1d5bc105dedb28b34b34895c12d /basic/source | |
parent | f51b220b953ec71fb742f799fbe645a93cf3d944 (diff) |
Add an assert
Change-Id: Iee190f27323202d5bb673aaba3116071f294a85b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149695
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'basic/source')
-rw-r--r-- | basic/source/classes/sbxmod.cxx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 9a4fd841c98d..2453caa57c8c 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -2015,13 +2015,14 @@ std::pair<bool, sal_uInt32> SbMethod::StoreData( SvStream& rStrm ) const return { false, 0 }; //tdf#94617 - const sal_Int16 nMax = std::numeric_limits<sal_Int16>::max(); + const sal_uInt32 nMax = std::numeric_limits<sal_Int16>::max(); // tdf#142391 - store method using binary format 0x13 only when actually needed, i.e., // when method starts at an offset that would overflow 16 bits const sal_Int16 nStartTemp = nStart % nMax; sal_uInt16 nDebugFlagsTemp = static_cast<sal_uInt16>(nDebugFlags); if (nStart >= nMax) { + assert(nStart <= nMax * 0x7FFF); // Larger addresses can't be stored in version 13 nDebugFlagsTemp = (nStart / nMax) | 0x8000; nVersion = B_IMG_VERSION_13; } |