The following issues were found
src/third_party/abseil-cpp-master/abseil-cpp/absl/flags/flag_test.cc
9 issues
Line: 103
double f2;
};
TEST_F(FlagTest, Traits) {
EXPECT_EQ(flags::StorageKind<int>(),
flags::FlagValueStorageKind::kOneWordAtomic);
EXPECT_EQ(flags::StorageKind<bool>(),
flags::FlagValueStorageKind::kOneWordAtomic);
EXPECT_EQ(flags::StorageKind<double>(),
Reported by Cppcheck.
Line: 475
Column: 16
CWE codes:
120
return absl::ParseFlag(src, &f->value, e);
}
std::string AbslUnparseFlag(const NonTriviallyCopyableAggregate& ntc) {
return absl::StrCat(ntc.value);
}
bool operator==(const NonTriviallyCopyableAggregate& ntc1,
const NonTriviallyCopyableAggregate& ntc2) {
return ntc1.value == ntc2.value;
Reported by FlawFinder.
Line: 632
Column: 17
CWE codes:
120
ABSL_FLAG(int, test_int_flag_with_non_const_default, GetDflt1(),
"test int flag non const default");
ABSL_FLAG(std::string, test_string_flag_with_non_const_default,
absl::StrCat("AAA", "BBB"), "test string flag non const default");
namespace {
TEST_F(FlagTest, TestNonConstexprDefault) {
EXPECT_EQ(absl::GetFlag(FLAGS_test_int_flag_with_non_const_default), 1);
Reported by FlawFinder.
Line: 647
Column: 17
CWE codes:
120
} // namespace
ABSL_FLAG(bool, test_flag_with_non_const_help, true,
absl::StrCat("test ", "flag ", "non const help"));
namespace {
#if !ABSL_FLAGS_STRIP_HELP
TEST_F(FlagTest, TestNonConstexprHelp) {
Reported by FlawFinder.
Line: 716
Column: 16
CWE codes:
120
return true;
}
std::string AbslUnparseFlag(const CustomUDT& f) {
return absl::StrCat(f.a, ":", f.b);
}
} // namespace
ABSL_FLAG(CustomUDT, test_flag_custom_udt, CustomUDT(), "test flag custom UDT");
Reported by FlawFinder.
Line: 784
Column: 16
CWE codes:
120
return true;
}
std::string AbslUnparseFlag(const ConversionTestVal& val) {
return absl::StrCat(val.a);
}
} // namespace
// Flag default values can be specified with a value that converts to the flag
Reported by FlawFinder.
Line: 823
Column: 16
CWE codes:
120
return absl::SimpleAtoi(in, &ndc_out->value);
}
std::string AbslUnparseFlag(const NonDfltConstructible& ndc) {
return absl::StrCat(ndc.value);
}
} // namespace
ABSL_FLAG(NonDfltConstructible, ndc_flag1, NonDfltConstructible('1'),
Reported by FlawFinder.
Line: 852
Column: 56
CWE codes:
120
ABSL_RETIRED_FLAG(bool, old_bool_flag, true, "old descr");
ABSL_RETIRED_FLAG(int, old_int_flag, (int)std::sqrt(10), "old descr");
ABSL_RETIRED_FLAG(std::string, old_str_flag, "", absl::StrCat("old ", "descr"));
bool initializaion_order_fiasco_test = [] {
// Iterate over all the flags during static initialization.
// This should not trigger ASan's initialization-order-fiasco.
auto* handle1 = absl::FindCommandLineFlag("flag_on_separate_file");
Reported by FlawFinder.
Line: 890
Column: 3
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
SmallAlignUDT() : c('A'), s(12) {}
char c;
int16_t s;
char bytes[14];
};
bool AbslParseFlag(absl::string_view, SmallAlignUDT*, std::string*) {
return true;
}
Reported by FlawFinder.
src/third_party/abseil-cpp-master/abseil-cpp/absl/debugging/failure_signal_handler_test.cc
9 issues
Line: 48
raise(signo);
}
TEST_P(FailureSignalHandlerDeathTest, AbslFailureSignal) {
const int signo = GetParam();
std::string exit_regex = absl::StrCat(
"\\*\\*\\* ", absl::debugging_internal::FailureSignalToString(signo),
" received at time=");
#ifndef _WIN32
Reported by Cppcheck.
Line: 50
Column: 34
CWE codes:
120
TEST_P(FailureSignalHandlerDeathTest, AbslFailureSignal) {
const int signo = GetParam();
std::string exit_regex = absl::StrCat(
"\\*\\*\\* ", absl::debugging_internal::FailureSignalToString(signo),
" received at time=");
#ifndef _WIN32
EXPECT_EXIT(InstallHandlerAndRaise(signo), testing::KilledBySignal(signo),
exit_regex);
Reported by FlawFinder.
Line: 100
Column: 28
CWE codes:
120
TEST_P(FailureSignalHandlerDeathTest, AbslFatalSignalsWithWriterFn) {
const int signo = GetParam();
std::string tmp_dir = GetTmpDir();
std::string file = absl::StrCat(tmp_dir, "/signo_", signo);
std::string exit_regex = absl::StrCat(
"\\*\\*\\* ", absl::debugging_internal::FailureSignalToString(signo),
" received at time=");
#ifndef _WIN32
Reported by FlawFinder.
Line: 102
Column: 34
CWE codes:
120
std::string tmp_dir = GetTmpDir();
std::string file = absl::StrCat(tmp_dir, "/signo_", signo);
std::string exit_regex = absl::StrCat(
"\\*\\*\\* ", absl::debugging_internal::FailureSignalToString(signo),
" received at time=");
#ifndef _WIN32
EXPECT_EXIT(InstallHandlerWithWriteToFileAndRaise(file.c_str(), signo),
testing::KilledBySignal(signo), exit_regex);
Reported by FlawFinder.
Line: 121
Column: 24
CWE codes:
120
std::getline(error_output, error_line);
EXPECT_THAT(
error_line,
StartsWith(absl::StrCat(
"*** ", absl::debugging_internal::FailureSignalToString(signo),
" received at ")));
// On platforms where it is possible to get the current CPU, the
// CPU number is also logged. Check that it is present in output.
Reported by FlawFinder.
Line: 148
Column: 20
CWE codes:
120
std::string result =
absl::debugging_internal::FailureSignalToString(info.param);
if (result.empty()) {
result = absl::StrCat(info.param);
}
return result;
}
INSTANTIATE_TEST_SUITE_P(AbslDeathTest, FailureSignalHandlerDeathTest,
Reported by FlawFinder.
Line: 77
Column: 32
CWE codes:
807
20
Suggestion:
Check environment variables carefully before using them
static const char* const kTmpEnvVars[] = {"TEST_TMPDIR", "TMPDIR", "TEMP",
"TEMPDIR", "TMP"};
for (const char* const var : kTmpEnvVars) {
const char* tmp_dir = std::getenv(var);
if (tmp_dir != nullptr) {
return tmp_dir;
}
}
Reported by FlawFinder.
Line: 89
Column: 16
CWE codes:
362
// This function runs in a fork()ed process on most systems.
void InstallHandlerWithWriteToFileAndRaise(const char* file, int signo) {
error_file = fopen(file, "w");
ABSL_RAW_CHECK(error_file != nullptr, "Failed create error_file");
absl::FailureSignalHandlerOptions options;
options.writerfn = WriteToErrorFile;
absl::InstallFailureSignalHandler(options);
raise(signo);
Reported by FlawFinder.
Line: 66
Column: 32
CWE codes:
126
void WriteToErrorFile(const char* msg) {
if (msg != nullptr) {
ABSL_RAW_CHECK(fwrite(msg, strlen(msg), 1, error_file) == 1,
"fwrite() failed");
}
ABSL_RAW_CHECK(fflush(error_file) == 0, "fflush() failed");
}
Reported by FlawFinder.
src/third_party/wiredtiger/test/suite/test_unicode01.py
9 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 sys, wiredtiger, wtscenario, wttest
# test_unicode01.py
# Make sure UTF8 config can be passed to WT_SESSION::create.
# Python turns Unicode strings into UTF-8.
class test_unicode01(wttest.WiredTigerTestCase):
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 sys, wiredtiger, wtscenario, wttest
# test_unicode01.py
# Make sure UTF8 config can be passed to WT_SESSION::create.
# Python turns Unicode strings into UTF-8.
class test_unicode01(wttest.WiredTigerTestCase):
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 sys, wiredtiger, wtscenario, wttest
# test_unicode01.py
# Make sure UTF8 config can be passed to WT_SESSION::create.
# Python turns Unicode strings into UTF-8.
class test_unicode01(wttest.WiredTigerTestCase):
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 sys, wiredtiger, wtscenario, wttest
# test_unicode01.py
# Make sure UTF8 config can be passed to WT_SESSION::create.
# Python turns Unicode strings into UTF-8.
class test_unicode01(wttest.WiredTigerTestCase):
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 sys, wiredtiger, wtscenario, wttest
# test_unicode01.py
# Make sure UTF8 config can be passed to WT_SESSION::create.
# Python turns Unicode strings into UTF-8.
class test_unicode01(wttest.WiredTigerTestCase):
Reported by Pylint.
Line: 34
Column: 1
# test_unicode01.py
# Make sure UTF8 config can be passed to WT_SESSION::create.
# Python turns Unicode strings into UTF-8.
class test_unicode01(wttest.WiredTigerTestCase):
def test_unicode(self):
# We use valid Unicode characters that are examples in
# the Unicode standard.
metadata_string = u'app_metadata={"name" : "Employ\u222b\u67d2\ud4db"}'
self.session.create('table:t', metadata_string)
Reported by Pylint.
Line: 34
Column: 1
# test_unicode01.py
# Make sure UTF8 config can be passed to WT_SESSION::create.
# Python turns Unicode strings into UTF-8.
class test_unicode01(wttest.WiredTigerTestCase):
def test_unicode(self):
# We use valid Unicode characters that are examples in
# the Unicode standard.
metadata_string = u'app_metadata={"name" : "Employ\u222b\u67d2\ud4db"}'
self.session.create('table:t', metadata_string)
Reported by Pylint.
Line: 35
Column: 5
# Make sure UTF8 config can be passed to WT_SESSION::create.
# Python turns Unicode strings into UTF-8.
class test_unicode01(wttest.WiredTigerTestCase):
def test_unicode(self):
# We use valid Unicode characters that are examples in
# the Unicode standard.
metadata_string = u'app_metadata={"name" : "Employ\u222b\u67d2\ud4db"}'
self.session.create('table:t', metadata_string)
Reported by Pylint.
src/third_party/wiredtiger/test/suite/test_hs04.py
9 issues
Line: 33
Column: 1
# Test file_max configuration and reconfiguration for the history store table.
#
import wiredtiger, wttest
from wtscenario import make_scenarios
# Taken from src/include/misc.h.
WT_MB = 1048576
Reported by Pylint.
Line: 60
Column: 5
scenarios = make_scenarios(init_file_max_values, reconfig_file_max_values,
in_memory_values)
def conn_config(self):
config = 'statistics=(fast)'
if self.init_file_max is not None:
config += ',history_store=(file_max={})'.format(self.init_file_max)
if self.in_memory is not None:
config += ',in_memory=' + ('true' if self.in_memory else 'false')
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: 33
Column: 1
# Test file_max configuration and reconfiguration for the history store table.
#
import wiredtiger, wttest
from wtscenario import make_scenarios
# Taken from src/include/misc.h.
WT_MB = 1048576
Reported by Pylint.
Line: 39
Column: 1
# Taken from src/include/misc.h.
WT_MB = 1048576
class test_hs04(wttest.WiredTigerTestCase):
uri = 'table:hs_04'
in_memory_values = [
('false', dict(in_memory=False)),
('none', dict(in_memory=None)),
('true', dict(in_memory=True))
Reported by Pylint.
Line: 39
Column: 1
# Taken from src/include/misc.h.
WT_MB = 1048576
class test_hs04(wttest.WiredTigerTestCase):
uri = 'table:hs_04'
in_memory_values = [
('false', dict(in_memory=False)),
('none', dict(in_memory=None)),
('true', dict(in_memory=True))
Reported by Pylint.
Line: 60
Column: 5
scenarios = make_scenarios(init_file_max_values, reconfig_file_max_values,
in_memory_values)
def conn_config(self):
config = 'statistics=(fast)'
if self.init_file_max is not None:
config += ',history_store=(file_max={})'.format(self.init_file_max)
if self.in_memory is not None:
config += ',in_memory=' + ('true' if self.in_memory else 'false')
Reported by Pylint.
Line: 68
Column: 5
config += ',in_memory=' + ('true' if self.in_memory else 'false')
return config
def get_stat(self, stat):
stat_cursor = self.session.open_cursor('statistics:')
val = stat_cursor[stat][2]
stat_cursor.close()
return val
Reported by Pylint.
Line: 74
Column: 5
stat_cursor.close()
return val
def test_hs(self):
self.session.create(self.uri, 'key_format=S,value_format=S')
if self.in_memory:
# For in-memory configurations, we simply ignore any history store
# related configuration.
Reported by Pylint.
src/third_party/wiredtiger/test/3rdparty/python-subunit-0.0.16/python/subunit/tests/test_subunit_tags.py
9 issues
Line: 21
Column: 1
from io import BytesIO
import testtools
from testtools.matchers import Contains
import subunit
import subunit.test_results
Reported by Pylint.
Line: 22
Column: 1
from io import BytesIO
import testtools
from testtools.matchers import Contains
import subunit
import subunit.test_results
Reported by Pylint.
Line: 9
Column: 2
# license at the users choice. A copy of both licenses are available in the
# project source as Apache-2.0 and BSD. You may not use this file except in
# compliance with one of these two licences.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# license you chose for the specific language governing permissions and
# limitations under that license.
Reported by Pylint.
Line: 28
Column: 1
import subunit.test_results
class TestSubUnitTags(testtools.TestCase):
def setUp(self):
super(TestSubUnitTags, self).setUp()
self.original = BytesIO()
self.filtered = BytesIO()
Reported by Pylint.
Line: 30
Column: 5
class TestSubUnitTags(testtools.TestCase):
def setUp(self):
super(TestSubUnitTags, self).setUp()
self.original = BytesIO()
self.filtered = BytesIO()
def test_add_tag(self):
Reported by Pylint.
Line: 30
Column: 5
class TestSubUnitTags(testtools.TestCase):
def setUp(self):
super(TestSubUnitTags, self).setUp()
self.original = BytesIO()
self.filtered = BytesIO()
def test_add_tag(self):
Reported by Pylint.
Line: 31
Column: 9
class TestSubUnitTags(testtools.TestCase):
def setUp(self):
super(TestSubUnitTags, self).setUp()
self.original = BytesIO()
self.filtered = BytesIO()
def test_add_tag(self):
# Literal values to avoid set sort-order dependencies. Python code show
Reported by Pylint.
Line: 35
Column: 5
self.original = BytesIO()
self.filtered = BytesIO()
def test_add_tag(self):
# Literal values to avoid set sort-order dependencies. Python code show
# derivation.
# reference = BytesIO()
# stream = subunit.StreamResultToBytes(reference)
# stream.status(
Reported by Pylint.
Line: 70
Column: 5
0, subunit.tag_stream(self.original, self.filtered, ["quux"]))
self.assertThat(reference, Contains(self.filtered.getvalue()))
def test_remove_tag(self):
reference = BytesIO()
stream = subunit.StreamResultToBytes(reference)
stream.status(
test_id='test', test_status='inprogress', test_tags=set(['foo']))
stream.status(
Reported by Pylint.
src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/pdf.py
9 issues
Line: 44
Column: 9
try:
env['BUILDERS']['PDF']
except KeyError:
global PDFBuilder
if PDFBuilder is None:
PDFBuilder = SCons.Builder.Builder(action = {},
source_scanner = SCons.Tool.PDFLaTeXScanner,
prefix = '$PDFPREFIX',
suffix = '$PDFSUFFIX',
Reported by Pylint.
Line: 69
Column: 12
env['EPSTOPDFFLAGS'] = SCons.Util.CLVar('')
env['EPSTOPDFCOM'] = '$EPSTOPDF $EPSTOPDFFLAGS ${SOURCE} --outfile=${TARGET}'
def exists(env):
# This only puts a skeleton Builder in place, so if someone
# references this Tool directly, it's always "available."
return 1
# Local Variables:
Reported by Pylint.
Line: 31
Column: 1
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Tool/pdf.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"
import SCons.Builder
import SCons.Tool
PDFBuilder = None
Reported by Pylint.
Line: 36
Column: 1
import SCons.Builder
import SCons.Tool
PDFBuilder = None
EpsPdfAction = SCons.Action.Action('$EPSTOPDFCOM', '$EPSTOPDFCOMSTR')
def generate(env):
try:
Reported by Pylint.
Line: 40
Column: 1
EpsPdfAction = SCons.Action.Action('$EPSTOPDFCOM', '$EPSTOPDFCOMSTR')
def generate(env):
try:
env['BUILDERS']['PDF']
except KeyError:
global PDFBuilder
if PDFBuilder is None:
Reported by Pylint.
Line: 44
Column: 9
try:
env['BUILDERS']['PDF']
except KeyError:
global PDFBuilder
if PDFBuilder is None:
PDFBuilder = SCons.Builder.Builder(action = {},
source_scanner = SCons.Tool.PDFLaTeXScanner,
prefix = '$PDFPREFIX',
suffix = '$PDFSUFFIX',
Reported by Pylint.
Line: 58
Column: 66
env['PDFPREFIX'] = ''
env['PDFSUFFIX'] = '.pdf'
# put the epstopdf builder in this routine so we can add it after
# the pdftex builder so that one is the default for no source suffix
def generate2(env):
bld = env['BUILDERS']['PDF']
#bld.add_action('.ps', EpsPdfAction) # this is covered by direct Ghostcript action in gs.py
bld.add_action('.eps', EpsPdfAction)
Reported by Pylint.
Line: 60
Column: 1
# put the epstopdf builder in this routine so we can add it after
# the pdftex builder so that one is the default for no source suffix
def generate2(env):
bld = env['BUILDERS']['PDF']
#bld.add_action('.ps', EpsPdfAction) # this is covered by direct Ghostcript action in gs.py
bld.add_action('.eps', EpsPdfAction)
env['EPSTOPDF'] = 'epstopdf'
Reported by Pylint.
Line: 69
Column: 1
env['EPSTOPDFFLAGS'] = SCons.Util.CLVar('')
env['EPSTOPDFCOM'] = '$EPSTOPDF $EPSTOPDFFLAGS ${SOURCE} --outfile=${TARGET}'
def exists(env):
# This only puts a skeleton Builder in place, so if someone
# references this Tool directly, it's always "available."
return 1
# Local Variables:
Reported by Pylint.
src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid64_sin.c
9 issues
Line: 474
CWE codes:
758
// Decompose the input and check for NaN and infinity.
s = x >> 63;
if ((x & (3ull<<61)) == (3ull<<61))
{ if ((x & (0xFull<<59)) == (0xFull<<59))
{ if ((x & (0x1Full<<58)) != (0x1Full<<58))
{ // input is infinite, so return NaN
#ifdef BID_SET_STATUS_FLAGS
Reported by Cppcheck.
Line: 499
CWE codes:
758
}
else
{ // "large coefficient" input
e = ((x >> 51) & ((1ull<<10)-1)) - 398;
c = (1ull<<53) + (x & ((1ull<<51)-1));
if ((unsigned long long)(c) > 9999999999999999ull) c = 0ull;
}
}
else
Reported by Cppcheck.
Line: 506
CWE codes:
758
}
else
{ // "small coefficient" input
e = ((x >> 53) & ((1ull<<10)-1)) - 398;
c = x & ((1ull<<53)-1);
}
// Make sure we treat zero even with huge exponent as small
Reported by Cppcheck.
Line: 527
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_decimal64_moduli[e+17];
__mul_64x192_to_256(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: 528
CWE codes:
758
// Since we discard the top word p.w[3], we could specially optimize this.
m = bid_decimal64_moduli[e+17];
__mul_64x192_to_256(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: 534
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[2] >> 62;
sll192_short(p.w[2],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: 535
CWE codes:
758
// use modulo (pi/2) reduction at the start to keep integer parities.
k = p.w[2] >> 62;
sll192_short(p.w[2],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: 573
CWE codes:
758
// Now package it as a double-extended number.
{ BID_F80_CONST tmp;
BID_F80_PACK_TRIG( tmp, sf, ef, p.w[2] );
BID_F80_ASSIGN( xd, tmp );
}
// Multiply by pi/2 so we can use regular binary trig functions.
Reported by Cppcheck.
Line: 573
CWE codes:
758
// Now package it as a double-extended number.
{ BID_F80_CONST tmp;
BID_F80_PACK_TRIG( tmp, sf, ef, p.w[2] );
BID_F80_ASSIGN( xd, tmp );
}
// Multiply by pi/2 so we can use regular binary trig functions.
Reported by Cppcheck.
src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid64_cos.c
9 issues
Line: 495
CWE codes:
758
// Decompose the input and check for NaN and infinity.
s = x >> 63;
if ((x & (3ull<<61)) == (3ull<<61))
{ if ((x & (0xFull<<59)) == (0xFull<<59))
{ if ((x & (0x1Full<<58)) != (0x1Full<<58))
{ // input is infinite, so return NaN
#ifdef BID_SET_STATUS_FLAGS
Reported by Cppcheck.
Line: 520
CWE codes:
758
}
else
{ // "large coefficient" input
e = ((x >> 51) & ((1ull<<10)-1)) - 398;
c = (1ull<<53) + (x & ((1ull<<51)-1));
if ((unsigned long long)(c) > 9999999999999999ull) c = 0ull;
}
}
else
Reported by Cppcheck.
Line: 527
CWE codes:
758
}
else
{ // "small coefficient" input
e = ((x >> 53) & ((1ull<<10)-1)) - 398;
c = x & ((1ull<<53)-1);
}
// Make sure we treat zero even with huge exponent as small
Reported by Cppcheck.
Line: 548
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_decimal64_moduli[e+17];
__mul_64x192_to_256(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: 549
CWE codes:
758
// Since we discard the top word p.w[3], we could specially optimize this.
m = bid_decimal64_moduli[e+17];
__mul_64x192_to_256(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: 555
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[2] >> 62;
sll192_short(p.w[2],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: 556
CWE codes:
758
// use modulo (pi/2) reduction at the start to keep integer parities.
k = p.w[2] >> 62;
sll192_short(p.w[2],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: 594
CWE codes:
758
// Now package it as a double-extended number.
{ BID_F80_CONST tmp;
BID_F80_PACK_TRIG( tmp, sf, ef, p.w[2] );
BID_F80_ASSIGN( xd, tmp );
}
// Multiply by pi/2 so we can use regular binary trig functions.
Reported by Cppcheck.
Line: 594
CWE codes:
758
// Now package it as a double-extended number.
{ BID_F80_CONST tmp;
BID_F80_PACK_TRIG( tmp, sf, ef, p.w[2] );
BID_F80_ASSIGN( xd, tmp );
}
// Multiply by pi/2 so we can use regular binary trig functions.
Reported by Cppcheck.
src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid64_tan.c
9 issues
Line: 475
CWE codes:
758
// Decompose the input and check for NaN and infinity.
s = x >> 63;
if ((x & (3ull<<61)) == (3ull<<61))
{ if ((x & (0xFull<<59)) == (0xFull<<59))
{ if ((x & (0x1Full<<58)) != (0x1Full<<58))
{ // input is infinite, so return NaN
#ifdef BID_SET_STATUS_FLAGS
Reported by Cppcheck.
Line: 500
CWE codes:
758
}
else
{ // "large coefficient" input
e = ((x >> 51) & ((1ull<<10)-1)) - 398;
c = (1ull<<53) + (x & ((1ull<<51)-1));
if ((unsigned long long)(c) > 9999999999999999ull) c = 0ull;
}
}
else
Reported by Cppcheck.
Line: 507
CWE codes:
758
}
else
{ // "small coefficient" input
e = ((x >> 53) & ((1ull<<10)-1)) - 398;
c = x & ((1ull<<53)-1);
}
// Make sure we treat zero even with huge exponent as small
Reported by Cppcheck.
Line: 528
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_decimal64_moduli[e+17];
__mul_64x192_to_256(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: 529
CWE codes:
758
// Since we discard the top word p.w[3], we could specially optimize this.
m = bid_decimal64_moduli[e+17];
__mul_64x192_to_256(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: 535
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[2] >> 62;
sll192_short(p.w[2],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: 536
CWE codes:
758
// use modulo (pi/2) reduction at the start to keep integer parities.
k = p.w[2] >> 62;
sll192_short(p.w[2],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: 574
CWE codes:
758
// Now package it as a double-extended number.
{ BID_F80_CONST tmp;
BID_F80_PACK_TRIG( tmp, sf, ef, p.w[2] );
BID_F80_ASSIGN( xd, tmp );
}
// Multiply by pi/2 so we can use regular binary trig functions.
Reported by Cppcheck.
Line: 574
CWE codes:
758
// Now package it as a double-extended number.
{ BID_F80_CONST tmp;
BID_F80_PACK_TRIG( tmp, sf, ef, p.w[2] );
BID_F80_ASSIGN( xd, tmp );
}
// Multiply by pi/2 so we can use regular binary trig functions.
Reported by Cppcheck.
src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid128_tan.c
9 issues
Line: 12440
CWE codes:
758
// Decompose the input and check for NaN and infinity.
s = x.w[BID_HIGH_128W] >> 63;
if ((x.w[BID_HIGH_128W] & (3ull<<61)) == (3ull<<61))
{ if ((x.w[BID_HIGH_128W] & (0xFull<<59)) == (0xFull<<59))
{ if ((x.w[BID_HIGH_128W] & (0x1Full<<58)) != (0x1Full<<58))
{ // input is infinite, so return NaN
#ifdef BID_SET_STATUS_FLAGS
Reported by Cppcheck.
Line: 12478
CWE codes:
758
}
else
{ // "small coefficient" input, the normal case for finite numbers
e = ((x.w[BID_HIGH_128W] >> 49) & ((1ull<<14)-1)) - 6176;
c.w[1] = x.w[BID_HIGH_128W] & ((1ull<<49)-1);
c.w[0] = x.w[BID_LOW_128W];
if (lt128(542101086242752ull,4003012203950112767ull,c.w[1],c.w[0]))
{ c.w[1] = 0ull; c.w[0] = 0ull; }
}
Reported by Cppcheck.
Line: 12513
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_decimal128_moduli[e+35];
__mul_128x384_to_512(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: 12514
CWE codes:
758
// Since we discard the top word p.w[3], we could specially optimize this.
m = bid_decimal128_moduli[e+35];
__mul_128x384_to_512(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: 12520
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[5] >> 62;
sll256_short(p.w[5],p.w[4],p.w[3],p.w[2],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: 12521
CWE codes:
758
// use modulo (pi/2) reduction at the start to keep integer parities.
k = p.w[5] >> 62;
sll256_short(p.w[5],p.w[4],p.w[3],p.w[2],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: 12560
CWE codes:
758
// Shift right to be in the right place for a quad coefficient
srl128_short(p.w[5],p.w[4],15);
// Mask off integer bit and set up as quad precision number
{ union { BID_F128_TYPE d; BID_UINT128 i; } di;
di.i.w[BID_LOW_128W] = p.w[4];
Reported by Cppcheck.
Line: 12567
CWE codes:
758
{ union { BID_F128_TYPE d; BID_UINT128 i; } di;
di.i.w[BID_LOW_128W] = p.w[4];
di.i.w[BID_HIGH_128W] =
(((BID_UINT64) sf) << 63) + (((BID_UINT64)(ef)) << 48) +
(p.w[5] & ((1ull<<48)-1));
xd = di.d;
}
// Multiply by pi/2 so we can use regular binary trig functions.
Reported by Cppcheck.
Line: 12567
CWE codes:
758
{ union { BID_F128_TYPE d; BID_UINT128 i; } di;
di.i.w[BID_LOW_128W] = p.w[4];
di.i.w[BID_HIGH_128W] =
(((BID_UINT64) sf) << 63) + (((BID_UINT64)(ef)) << 48) +
(p.w[5] & ((1ull<<48)-1));
xd = di.d;
}
// Multiply by pi/2 so we can use regular binary trig functions.
Reported by Cppcheck.