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.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
This commit is contained in:
Caolán McNamara
2024-09-16 10:01:51 +01:00
parent fff43a2e76
commit c8b5ac2a54
3 changed files with 5 additions and 6 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;