connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx | 2 +- hwpfilter/source/hcode.cxx | 7 +++---- tools/source/misc/fix16.cxx | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-)
New commits: commit c8b5ac2a54af99e32f77aa07dec0dda2be074289 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Mon Sep 16 10:01:51 2024 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Tue Sep 24 13:27:26 2024 +0200 cid#1607586 Overflowed return value and cid#1608074 Overflowed return value cid#1607598 Overflowed return value Change-Id: Ib884c10083c01578a7a0926d5f2f3c2d1f7501c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173833 Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx b/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx index ebf3700c667d..51468b472bd5 100644 --- a/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx +++ b/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx @@ -156,7 +156,7 @@ extern "C" SAL_JNI_EXPORT jlong JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Stor if (tmpLongVal > std::numeric_limits<sal_Int32>::max() ) tmpIntVal = std::numeric_limits<sal_Int32>::max(); else // Casting is safe here. - tmpIntVal = static_cast<sal_Int32>(tmpLongVal); + tmpIntVal = static_cast<sal_Int32>(tmpLongVal & 0xFFFFFFFF); tmpLongVal -= tmpIntVal; diff --git a/hwpfilter/source/hcode.cxx b/hwpfilter/source/hcode.cxx index 82930d0ba466..8bb22e06c956 100644 --- a/hwpfilter/source/hcode.cxx +++ b/hwpfilter/source/hcode.cxx @@ -450,24 +450,23 @@ static hchar s_hh2kssm(hchar hh) if (hh >= HCA_TG) return sal::static_int_cast<hchar>(hhtg_tg[hh - HCA_TG]); if (idx == 0x1F) - hh = hh - 0x1F00 + 0x360; + hh = (hh - 0x1F00 + 0x360) & 0xFFFF; else { hh -= HCA_KSS; if (hh >= 0x360) hh += 0xC0; } - idx = hh / 0xC0 + 217; + idx = (hh / 0xC0 + 217) & 0xFFFF; i = hh % 0xC0; if (i >= 95) i -= 2; i += 48; if (i >= 127) i += 18; - return (idx << 8) | i; + return ((idx << 8) | i) & 0xFFFF; } - static hchar lineCharConv(hchar ch) { int flag; diff --git a/tools/source/misc/fix16.cxx b/tools/source/misc/fix16.cxx index 95104bbbb9de..b726acb8f660 100644 --- a/tools/source/misc/fix16.cxx +++ b/tools/source/misc/fix16.cxx @@ -70,7 +70,7 @@ fix16_t fix16_mul(fix16_t inArg0, fix16_t inArg1) return fix16_overflow; } - fix16_t result = static_cast<fix16_t>(product >> 16); + fix16_t result = (product >> 16) & 0xFFFF; result += (product & 0x8000) >> 15; return result;