Fix some issues reported by klocwork (#1233)

Change memcpy to bh_memcpy_s and add some asserts to
enhance the security.
This commit is contained in:
Xu Jun
2022-06-16 19:50:47 +08:00
committed by GitHub
parent 188d5e70e9
commit 4b38205023
6 changed files with 38 additions and 22 deletions

View File

@ -1091,7 +1091,7 @@ static float
freebsd_fminf(float x, float y)
{
if (is_little_endian()) {
IEEEf2bits_L u[2];
IEEEf2bits_L u[2] = { 0 };
u[0].f = x;
u[1].f = y;
@ -1107,7 +1107,7 @@ freebsd_fminf(float x, float y)
return (u[u[1].bits.sign].f);
}
else {
IEEEf2bits_B u[2];
IEEEf2bits_B u[2] = { 0 };
u[0].f = x;
u[1].f = y;
@ -1130,7 +1130,7 @@ static float
freebsd_fmaxf(float x, float y)
{
if (is_little_endian()) {
IEEEf2bits_L u[2];
IEEEf2bits_L u[2] = { 0 };
u[0].f = x;
u[1].f = y;
@ -1146,7 +1146,7 @@ freebsd_fmaxf(float x, float y)
return (u[u[0].bits.sign].f);
}
else {
IEEEf2bits_B u[2];
IEEEf2bits_B u[2] = { 0 };
u[0].f = x;
u[1].f = y;