The following issues were found
src/third_party/abseil-cpp-master/abseil-cpp/absl/base/internal/endian_test.cc
6 issues
Line: 148
bytes, gbswap_64(ABSL_INTERNAL_UNALIGNED_LOAD64(bytes)));
}
TEST(EndianessTest, Uint16) {
GBSwapHelper(GenerateAllUint16Values(), &Swap16);
}
TEST(EndianessTest, Uint32) {
GBSwapHelper(GenerateRandomIntegers<uint32_t>(kNumValuesToTest), &Swap32);
Reported by Cppcheck.
Line: 118
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
it != host_values_to_test.end(); ++it) {
T host_value = *it;
char actual_value[sizeof(host_value)];
memcpy(actual_value, &host_value, sizeof(host_value));
byte_swapper(actual_value);
char expected_value[sizeof(host_value)];
memcpy(expected_value, &host_value, sizeof(host_value));
Reported by FlawFinder.
Line: 119
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
T host_value = *it;
char actual_value[sizeof(host_value)];
memcpy(actual_value, &host_value, sizeof(host_value));
byte_swapper(actual_value);
char expected_value[sizeof(host_value)];
memcpy(expected_value, &host_value, sizeof(host_value));
ManualByteSwap(expected_value, sizeof(host_value));
Reported by FlawFinder.
Line: 122
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
memcpy(actual_value, &host_value, sizeof(host_value));
byte_swapper(actual_value);
char expected_value[sizeof(host_value)];
memcpy(expected_value, &host_value, sizeof(host_value));
ManualByteSwap(expected_value, sizeof(host_value));
ASSERT_EQ(0, memcmp(actual_value, expected_value, sizeof(host_value)))
<< "Swap output for 0x" << std::hex << host_value << " does not match. "
Reported by FlawFinder.
Line: 123
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
byte_swapper(actual_value);
char expected_value[sizeof(host_value)];
memcpy(expected_value, &host_value, sizeof(host_value));
ManualByteSwap(expected_value, sizeof(host_value));
ASSERT_EQ(0, memcmp(actual_value, expected_value, sizeof(host_value)))
<< "Swap output for 0x" << std::hex << host_value << " does not match. "
<< "Expected: 0x" << UnalignedLoad<T>(expected_value) << "; "
Reported by FlawFinder.
Line: 229
Column: 12
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
uint32_t u32Buf;
uint64_t u64Buf;
unsigned char buffer[10];
big_endian::Store16(&u16Buf, k16Value);
EXPECT_EQ(u16Buf, k16ValueBE);
uint64_t comp = big_endian::Load16(&u16Buf);
EXPECT_EQ(comp, k16Value);
Reported by FlawFinder.
src/mongo/embedded/mongo_embedded/java/src/com/mongodb/embedded/capi/MongoEmbeddedLibraryImpl.java
6 issues
Line: 46
private static final Logger LOGGER = Loggers.getLogger();
private static final LogCallback LOG_CALLBACK = new LogCallback();
private final CAPI.mongo_embedded_v1_status status;
private final CAPI.mongo_embedded_v1_lib lib;
MongoEmbeddedLibraryImpl(final String yamlConfig, final LogLevel logLevel) {
status = CAPIHelper.createStatusPointer();
CAPI.mongo_embedded_v1_init_params.ByReference initParams = new CAPI.mongo_embedded_v1_init_params.ByReference();
Reported by PMD.
Line: 47
private static final LogCallback LOG_CALLBACK = new LogCallback();
private final CAPI.mongo_embedded_v1_status status;
private final CAPI.mongo_embedded_v1_lib lib;
MongoEmbeddedLibraryImpl(final String yamlConfig, final LogLevel logLevel) {
status = CAPIHelper.createStatusPointer();
CAPI.mongo_embedded_v1_init_params.ByReference initParams = new CAPI.mongo_embedded_v1_init_params.ByReference();
initParams.yaml_config = new CAPI.cstring(yamlConfig != null ? yamlConfig : "");
Reported by PMD.
Line: 73
public void close() {
try {
CAPIHelper.validateErrorCode(status, CAPI.mongo_embedded_v1_lib_fini(lib, status));
} catch (Throwable t) {
throw CAPIHelper.createError("fini", t);
}
CAPIHelper.destroyStatusPointer(status);
}
Reported by PMD.
Line: 85
@Override
public void log(final Pointer user_data, final CAPI.cstring message, final CAPI.cstring component, final CAPI.cstring context,
final int severity) {
String logMessage = format("%-9s [%s] %s", component.toString().toUpperCase(Locale.US), context, message).trim();
if (severity < -2) {
LOGGER.error(logMessage); // Severe/Fatal & Error messages
} else if (severity == -2) {
LOGGER.warn(logMessage); // Warning messages
Reported by PMD.
Line: 85
@Override
public void log(final Pointer user_data, final CAPI.cstring message, final CAPI.cstring component, final CAPI.cstring context,
final int severity) {
String logMessage = format("%-9s [%s] %s", component.toString().toUpperCase(Locale.US), context, message).trim();
if (severity < -2) {
LOGGER.error(logMessage); // Severe/Fatal & Error messages
} else if (severity == -2) {
LOGGER.warn(logMessage); // Warning messages
Reported by PMD.
Line: 91
LOGGER.error(logMessage); // Severe/Fatal & Error messages
} else if (severity == -2) {
LOGGER.warn(logMessage); // Warning messages
} else if (severity < 1) {
LOGGER.info(logMessage); // Info / Log messages
} else {
LOGGER.debug(logMessage); // Debug messages
}
}
Reported by PMD.
src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid_strtod.h
6 issues
Line: 70
Column: 4
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
set_str_end(endptr, ps_in);
return NULL;
}
strcpy(ps, ps_in);
ptail = (char*)ps_in;
ps0 = (char*)ps;
if((*ps == '+') || (*ps=='-')) { ps++; ptail++; }
// Infinity?
Reported by FlawFinder.
Line: 141
Column: 4
CWE codes:
120
Suggestion:
Consider using a function version that stops copying at the end of the buffer
set_wcs_end(endptr,ps_in);
return NULL;
}
wcscpy(ps, ps_in);
ptail = (wchar_t*)ps_in;
ps0 = ps;
if((*ps == L'+') || (*ps==L'-')) {ps++; ptail++;}
// Infinity?
Reported by FlawFinder.
Line: 89
Column: 20
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
ps+=3; ptail+=3;
while(isdigit_macro(*ps)) { ps++; ptail ++; }
set_str_end(endptr, ptail);
if(*ps0=='-') strcpy(ps0,"-QNAN");
else strcpy(ps0, "QNAN");
}
else {
if(!isdigit_macro(*ps) && ((*ps)!='.')) {
if(endptr) *endptr=(char*)ps_in;
Reported by FlawFinder.
Line: 90
Column: 11
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
while(isdigit_macro(*ps)) { ps++; ptail ++; }
set_str_end(endptr, ptail);
if(*ps0=='-') strcpy(ps0,"-QNAN");
else strcpy(ps0, "QNAN");
}
else {
if(!isdigit_macro(*ps) && ((*ps)!='.')) {
if(endptr) *endptr=(char*)ps_in;
free(ps0);
Reported by FlawFinder.
Line: 64
Column: 17
CWE codes:
126
return NULL;
}
while(isspace(*ps_in)) ps_in++;
ps = malloc((strlen(ps_in)+2)*sizeof(char));
if(!ps)
{
set_str_end(endptr, ps_in);
return NULL;
}
Reported by FlawFinder.
Line: 134
Column: 10
CWE codes:
126
return NULL;
}
while(iswspace(*ps_in)) ps_in++;
k = 1+wcslen(ps_in);
ps = malloc((k+1)*sizeof(wchar_t));
if(!ps)
{
set_wcs_end(endptr,ps_in);
return NULL;
Reported by FlawFinder.
src/third_party/wiredtiger/test/suite/test_excl.py
6 issues
Line: 29
Column: 1
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
import wiredtiger, wttest
from wtscenario import make_scenarios
# Test session.create with the exclusive configuration.
class test_create_excl(wttest.WiredTigerTestCase):
scenarios = make_scenarios([
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python
#
# Public Domain 2014-present MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
Reported by Pylint.
Line: 29
Column: 1
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
import wiredtiger, wttest
from wtscenario import make_scenarios
# Test session.create with the exclusive configuration.
class test_create_excl(wttest.WiredTigerTestCase):
scenarios = make_scenarios([
Reported by Pylint.
Line: 33
Column: 1
from wtscenario import make_scenarios
# Test session.create with the exclusive configuration.
class test_create_excl(wttest.WiredTigerTestCase):
scenarios = make_scenarios([
('file', dict(type='file:')),
('table', dict(type='table:'))
])
Reported by Pylint.
Line: 33
Column: 1
from wtscenario import make_scenarios
# Test session.create with the exclusive configuration.
class test_create_excl(wttest.WiredTigerTestCase):
scenarios = make_scenarios([
('file', dict(type='file:')),
('table', dict(type='table:'))
])
Reported by Pylint.
Line: 41
Column: 5
# Create the object with "exclusive", then assert that creation with
# "exclusive" fails.
def test_create_excl(self):
uri = self.type + 'create_excl'
self.session.create(uri, "exclusive")
self.assertRaises(wiredtiger.WiredTigerError,
lambda: self.session.create(uri, "exclusive"))
Reported by Pylint.
src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid32_to_bid64.c
6 issues
Line: 53
CWE codes:
758
}
res = (coefficient_x & 0x000fffff);
res *= 1000000000;
res |= ((((BID_UINT64) coefficient_x) << 32) & 0xfc00000000000000ull);
BID_RETURN_NOFLAGS (res);
}
}
Reported by Cppcheck.
Line: 60
CWE codes:
758
}
res =
very_fast_get_BID64_small_mantissa (((BID_UINT64) sign_x) << 32,
exponent_x +
DECIMAL_EXPONENT_BIAS -
DECIMAL_EXPONENT_BIAS_32,
(BID_UINT64) coefficient_x);
BID_RETURN_NOFLAGS (res);
Reported by Cppcheck.
Line: 89
CWE codes:
758
if (((x) & 0x7800000000000000ull) == 0x7800000000000000ull) {
t64 = (coefficient_x & 0x0003ffffffffffffull);
res = t64/1000000000ull;
res |= ((coefficient_x >> 32) & 0xfc000000);
#ifdef BID_SET_STATUS_FLAGS
if ((x & SNAN_MASK64) == SNAN_MASK64) // sNaN
__set_status_flags (pfpsf, BID_INVALID_EXCEPTION);
#endif
BID_RETURN (res);
Reported by Cppcheck.
Line: 102
CWE codes:
758
exponent_x = 0;
if (exponent_x > DECIMAL_MAX_EXPON_32)
exponent_x = DECIMAL_MAX_EXPON_32;
res = (sign_x >> 32) | (exponent_x << 23);
BID_RETURN (res);
}
exponent_x =
exponent_x - DECIMAL_EXPONENT_BIAS + DECIMAL_EXPONENT_BIAS_32;
Reported by Cppcheck.
Line: 143
CWE codes:
758
exponent_x = 0;
}
coefficient_x += bid_round_const_table[rmode][extra_digits];
__mul_64x64_to_128 (Q, coefficient_x,
bid_reciprocals10_64[extra_digits]);
// now get P/10^extra_digits: shift Q_high right by M[extra_digits]-128
amount = bid_short_recip_scale[extra_digits];
Reported by Cppcheck.
Line: 205
CWE codes:
758
}
res =
get_BID32 ((BID_UINT32) (sign_x >> 32),
exponent_x, coefficient_x, rnd_mode, pfpsf);
BID_RETURN (res);
}
Reported by Cppcheck.
src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid32_tan.c
6 issues
Line: 239
CWE codes:
786
// Pick out the appropriate modulus for the exponent and multiply by coeff
// Since we discard the top word p.w[3], we could specially optimize this.
m = bid_decimal32_moduli[e+8];
__mul_64x128_to_192(p,c,m);
// Shift up by two bits to give an integer part k and a fraction
// modulo (pi/2). Note that we have to do this afterwards rather than
// use modulo (pi/2) reduction at the start to keep integer parities.
Reported by Cppcheck.
Line: 240
CWE codes:
758
// Since we discard the top word p.w[3], we could specially optimize this.
m = bid_decimal32_moduli[e+8];
__mul_64x128_to_192(p,c,m);
// Shift up by two bits to give an integer part k and a fraction
// modulo (pi/2). Note that we have to do this afterwards rather than
// use modulo (pi/2) reduction at the start to keep integer parities.
Reported by Cppcheck.
Line: 246
CWE codes:
758
// modulo (pi/2). Note that we have to do this afterwards rather than
// use modulo (pi/2) reduction at the start to keep integer parities.
k = p.w[1] >> 62;
sll128_short(p.w[1],p.w[0],2);
// If the fraction is >= 1/2, add 1 to integer and complement the fraction
// with an appropriate sign change so we have a "rounded to nearest" version
// (Complementing is slightly different from negation but it's negligible.)
Reported by Cppcheck.
Line: 247
CWE codes:
758
// use modulo (pi/2) reduction at the start to keep integer parities.
k = p.w[1] >> 62;
sll128_short(p.w[1],p.w[0],2);
// If the fraction is >= 1/2, add 1 to integer and complement the fraction
// with an appropriate sign change so we have a "rounded to nearest" version
// (Complementing is slightly different from negation but it's negligible.)
// Set "sf" to the correct sign for the fraction
Reported by Cppcheck.
Line: 278
CWE codes:
758
// and package up as a double-precision number
{ union { double d; BID_UINT64 i; } di;
di.i = (((BID_UINT64) sf) << 63) + ((BID_UINT64) ef << 52) +
((p.w[1] >> 11) & ((1ull<<52)-1));
xd = di.d;
}
Reported by Cppcheck.
Line: 278
CWE codes:
758
// and package up as a double-precision number
{ union { double d; BID_UINT64 i; } di;
di.i = (((BID_UINT64) sf) << 63) + ((BID_UINT64) ef << 52) +
((p.w[1] >> 11) & ((1ull<<52)-1));
xd = di.d;
}
Reported by Cppcheck.
src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid32_sin.c
6 issues
Line: 240
CWE codes:
786
// Pick out the appropriate modulus for the exponent and multiply by coeff
// Since we discard the top word p.w[3], we could specially optimize this.
m = bid_decimal32_moduli[e+8];
__mul_64x128_to_192(p,c,m);
// Shift up by two bits to give an integer part k and a fraction
// modulo (pi/2). Note that we have to do this afterwards rather than
// use modulo (pi/2) reduction at the start to keep integer parities.
Reported by Cppcheck.
Line: 241
CWE codes:
758
// Since we discard the top word p.w[3], we could specially optimize this.
m = bid_decimal32_moduli[e+8];
__mul_64x128_to_192(p,c,m);
// Shift up by two bits to give an integer part k and a fraction
// modulo (pi/2). Note that we have to do this afterwards rather than
// use modulo (pi/2) reduction at the start to keep integer parities.
Reported by Cppcheck.
Line: 247
CWE codes:
758
// modulo (pi/2). Note that we have to do this afterwards rather than
// use modulo (pi/2) reduction at the start to keep integer parities.
k = p.w[1] >> 62;
sll128_short(p.w[1],p.w[0],2);
// If the fraction is >= 1/2, add 1 to integer and complement the fraction
// with an appropriate sign change so we have a "rounded to nearest" version
// (Complementing is slightly different from negation but it's negligible.)
Reported by Cppcheck.
Line: 248
CWE codes:
758
// use modulo (pi/2) reduction at the start to keep integer parities.
k = p.w[1] >> 62;
sll128_short(p.w[1],p.w[0],2);
// If the fraction is >= 1/2, add 1 to integer and complement the fraction
// with an appropriate sign change so we have a "rounded to nearest" version
// (Complementing is slightly different from negation but it's negligible.)
// Set "sf" to the correct sign for the fraction
Reported by Cppcheck.
Line: 279
CWE codes:
758
// and package up as a double-precision number
{ union { double d; BID_UINT64 i; } di;
di.i = (((BID_UINT64) sf) << 63) + ((BID_UINT64) ef << 52) +
((p.w[1] >> 11) & ((1ull<<52)-1));
xd = di.d;
}
Reported by Cppcheck.
Line: 279
CWE codes:
758
// and package up as a double-precision number
{ union { double d; BID_UINT64 i; } di;
di.i = (((BID_UINT64) sf) << 63) + ((BID_UINT64) ef << 52) +
((p.w[1] >> 11) & ((1ull<<52)-1));
xd = di.d;
}
Reported by Cppcheck.
src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid128_rem.c
6 issues
Line: 100
CWE codes:
758
&& ((y.w[1] & NAN_MASK64) != INFINITY_MASK64))
exponent_x = exponent_y;
res.w[1] = sign_x | (((BID_UINT64) exponent_x) << 49);
res.w[0] = 0;
BID_RETURN (res);
}
}
if (!valid_y) {
Reported by Cppcheck.
Line: 147
CWE codes:
758
}
// set exponent of y to exponent_x, scale coefficient_y
T = bid_power10_table_128[diff_expon];
__mul_128x128_to_256 (P256, CY, T);
if (P256.w[2] || P256.w[3]) {
// |x|<|y| in this case
res = x;
BID_RETURN (res);
Reported by Cppcheck.
Line: 155
CWE codes:
758
BID_RETURN (res);
}
CX2.w[1] = (CX.w[1] << 1) | (CX.w[0] >> 63);
CX2.w[0] = CX.w[0] << 1;
if (__unsigned_compare_ge_128 (P256, CX2)) {
// |x|<|y| in this case
res = x;
BID_RETURN (res);
Reported by Cppcheck.
Line: 167
CWE codes:
758
P128.w[1] = P256.w[1];
bid___div_128_by_128 (&CQ, &CR, CX, P128);
CX2.w[1] = (CR.w[1] << 1) | (CR.w[0] >> 63);
CX2.w[0] = CR.w[0] << 1;
if ((__unsigned_compare_gt_128 (CX2, P256))
|| (CX2.w[1] == P256.w[1] && CX2.w[0] == P256.w[0]
&& (CQ.w[0] & 1))) {
__sub_128_128 (CR, P256, CR);
Reported by Cppcheck.
Line: 206
CWE codes:
758
}
T = bid_power10_table_128[scale];
__mul_128x128_low (CXS, CX, T);
bid___div_128_by_128 (&CQ, &CX, CXS, CY);
// check for remainder == 0
if (!CX.w[1] && !CX.w[0]) {
Reported by Cppcheck.
Line: 217
CWE codes:
758
}
}
CX2.w[1] = (CX.w[1] << 1) | (CX.w[0] >> 63);
CX2.w[0] = CX.w[0] << 1;
if ((__unsigned_compare_gt_128 (CX2, CY))
|| (CX2.w[1] == CY.w[1] && CX2.w[0] == CY.w[0] && (CQ.w[0] & 1))) {
__sub_128_128 (CX, CY, CX);
sign_x ^= 0x8000000000000000ull;
Reported by Cppcheck.
src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Scanner/RC.py
6 issues
Line: 33
Column: 1
__revision__ = "src/engine/SCons/Scanner/RC.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"
import re
import SCons.Node.FS
import SCons.Scanner
Reported by Pylint.
Line: 1
Column: 1
"""SCons.Scanner.RC
This module implements the dependency scanner for RC (Interface
Definition Language) files.
"""
#
# Copyright (c) 2001 - 2019 The SCons Foundation
Reported by Pylint.
Line: 31
Column: 1
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Scanner/RC.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"
import re
import SCons.Node.FS
import SCons.Scanner
Reported by Pylint.
Line: 47
Column: 1
return [n for n in nodes if str(n)[-4:] != '.tlb']
def RCScan():
"""Return a prototype Scanner instance for scanning RC source files"""
res_re= r'^(?:\s*#\s*(?:include)|' \
r'.*?\s+(?:ICON|BITMAP|CURSOR|HTML|FONT|MESSAGETABLE|TYPELIB|REGISTRY|D3DFX)' \
r'\s*.*?)' \
Reported by Pylint.
Line: 54
Column: 5
r'.*?\s+(?:ICON|BITMAP|CURSOR|HTML|FONT|MESSAGETABLE|TYPELIB|REGISTRY|D3DFX)' \
r'\s*.*?)' \
r'\s*(<|"| )([^>"\s]+)(?:[>"\s])*$'
resScanner = SCons.Scanner.ClassicCPP("ResourceScanner",
"$RCSUFFIXES",
"CPPPATH",
res_re,
recursive=no_tlb)
Reported by Pylint.
Line: 59
Column: 1
"CPPPATH",
res_re,
recursive=no_tlb)
return resScanner
# Local Variables:
# tab-width:4
# indent-tabs-mode:nil
Reported by Pylint.
src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid128_mul.c
6 issues
Line: 177
CWE codes:
758
}
p_sign = x_sign ^ y_sign; // sign of the product
true_p_exp = (x_exp >> 49) - 6176 + (y_exp >> 49) - 6176;
// true_p_exp, p_exp are used only for 0 * 0, 0 * f, or f * 0
if (true_p_exp < -398)
p_exp = 0; // cannot be less than EXP_MIN
else if (true_p_exp > 369)
p_exp = (BID_UINT64) (369 + 398) << 53; // cannot be more than EXP_MAX
Reported by Cppcheck.
Line: 182
CWE codes:
758
if (true_p_exp < -398)
p_exp = 0; // cannot be less than EXP_MIN
else if (true_p_exp > 369)
p_exp = (BID_UINT64) (369 + 398) << 53; // cannot be more than EXP_MAX
else
p_exp = (BID_UINT64) (true_p_exp + 398) << 53;
if ((C1.w[1] == 0x0 && C1.w[0] == 0x0) ||
(C2.w[1] == 0x0 && C2.w[0] == 0x0)) {
Reported by Cppcheck.
Line: 184
CWE codes:
758
else if (true_p_exp > 369)
p_exp = (BID_UINT64) (369 + 398) << 53; // cannot be more than EXP_MAX
else
p_exp = (BID_UINT64) (true_p_exp + 398) << 53;
if ((C1.w[1] == 0x0 && C1.w[0] == 0x0) ||
(C2.w[1] == 0x0 && C2.w[0] == 0x0)) {
// x = 0 or y = 0
// the result is 0
Reported by Cppcheck.
Line: 396
CWE codes:
758
}
p_sign = x_sign ^ y_sign; // sign of the product
true_p_exp = (x_exp >> 49) - 6176 + (y_exp >> 49) - 6176;
// true_p_exp, p_exp are used only for 0 * 0, 0 * f, or f * 0
if (true_p_exp < -6176)
p_exp = 0; // cannot be less than EXP_MIN
else if (true_p_exp > 6111)
p_exp = (BID_UINT64) (6111 + 6176) << 49; // cannot be more than EXP_MAX
Reported by Cppcheck.
Line: 401
CWE codes:
758
if (true_p_exp < -6176)
p_exp = 0; // cannot be less than EXP_MIN
else if (true_p_exp > 6111)
p_exp = (BID_UINT64) (6111 + 6176) << 49; // cannot be more than EXP_MAX
else
p_exp = (BID_UINT64) (true_p_exp + 6176) << 49;
if ((C1.w[1] == 0x0 && C1.w[0] == 0x0) ||
(C2.w[1] == 0x0 && C2.w[0] == 0x0)) {
Reported by Cppcheck.
Line: 403
CWE codes:
758
else if (true_p_exp > 6111)
p_exp = (BID_UINT64) (6111 + 6176) << 49; // cannot be more than EXP_MAX
else
p_exp = (BID_UINT64) (true_p_exp + 6176) << 49;
if ((C1.w[1] == 0x0 && C1.w[0] == 0x0) ||
(C2.w[1] == 0x0 && C2.w[0] == 0x0)) {
// x = 0 or y = 0
// the result is 0
Reported by Cppcheck.