The following issues were found

src/third_party/wiredtiger/test/suite/test_prepare06.py
14 issues
Unable to import 'wiredtiger'
Error

Line: 34 Column: 1

              #

from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wtscenario import make_scenarios

class test_prepare06(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_prepare06'
    uri = 'table:' + tablename

            

Reported by Pylint.

Unused variable 'c'
Error

Line: 51 Column: 9

              
    def test_timestamp_api(self):
        self.session.create(self.uri, 'key_format={},value_format=i'.format(self.key_format))
        c = self.session.open_cursor(self.uri)

        # It is illegal to set the prepare timestamp older than the oldest
        # timestamp.
        self.conn.set_timestamp('oldest_timestamp=' + self.timestamp_str(20))
        self.conn.set_timestamp('stable_timestamp=' + self.timestamp_str(30))

            

Reported by Pylint.

String statement has no effect
Error

Line: 72 Column: 9

                      self.session.timestamp_transaction('durable_timestamp=' + self.timestamp_str(35))
        self.session.commit_transaction()

        '''
        Commented out for now: the system panics if we fail after preparing a transaction.

        # Check setting a prepared transaction timestamps earlier than the
        # oldest timestamp is invalid, if durable timestamp is less than the
        # stable timestamp.

            

Reported by Pylint.

String statement has no effect
Error

Line: 107 Column: 9

                          self.assertEqual(self.session.prepare_transaction('prepare_timestamp=' + self.timestamp_str(40)), 0)
            self.session.rollback_transaction()

        '''
        Commented out for now: the system panics if we fail after preparing a transaction.

        # It is illegal to set a commit timestamp less than the prepare
        # timestamp of a transaction.
        self.session.begin_transaction()

            

Reported by Pylint.

String statement has no effect
Error

Line: 121 Column: 9

                          "/less than the prepare timestamp/")
        '''

        '''
        Commented out for now: the system panics if we fail after preparing a transaction.

        # It is legal to set a commit timestamp older than prepare timestamp of
        # a transaction with roundup_timestamps settings.
        self.session.begin_transaction('roundup_timestamps=(prepared=true)')

            

Reported by Pylint.

Missing module docstring
Error

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.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 34 Column: 1

              #

from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wtscenario import make_scenarios

class test_prepare06(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_prepare06'
    uri = 'table:' + tablename

            

Reported by Pylint.

third party import "import wiredtiger, wttest" should be placed before "from suite_subprocess import suite_subprocess"
Error

Line: 34 Column: 1

              #

from suite_subprocess import suite_subprocess
import wiredtiger, wttest
from wtscenario import make_scenarios

class test_prepare06(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_prepare06'
    uri = 'table:' + tablename

            

Reported by Pylint.

Class name "test_prepare06" doesn't conform to PascalCase naming style
Error

Line: 37 Column: 1

              import wiredtiger, wttest
from wtscenario import make_scenarios

class test_prepare06(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_prepare06'
    uri = 'table:' + tablename
    session_config = 'isolation=snapshot'

    key_format_values = [

            

Reported by Pylint.

Missing class docstring
Error

Line: 37 Column: 1

              import wiredtiger, wttest
from wtscenario import make_scenarios

class test_prepare06(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_prepare06'
    uri = 'table:' + tablename
    session_config = 'isolation=snapshot'

    key_format_values = [

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_util07.py
14 issues
Unable to import 'wiredtiger'
Error

Line: 31 Column: 1

              
import os, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest

# test_util07.py
#    Utilities: wt read
class test_util07(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_util07.a'

            

Reported by Pylint.

Unused import os
Error

Line: 29 Column: 1

              # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

import os, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest

# test_util07.py
#    Utilities: wt read

            

Reported by Pylint.

Unused import struct
Error

Line: 29 Column: 1

              # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

import os, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest

# test_util07.py
#    Utilities: wt read

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 31 Column: 1

              
import os, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest

# test_util07.py
#    Utilities: wt read
class test_util07(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_util07.a'

            

Reported by Pylint.

Parameters differ from overridden 'close_conn' method
Error

Line: 51 Column: 5

                          cursor[key] = val
        cursor.close()

    def close_conn(self):
        """
        Close the connection if already open.
        """
        if self.conn != None:
            self.conn.close()

            

Reported by Pylint.

Parameters differ from overridden 'open_conn' method
Error

Line: 59 Column: 5

                          self.conn.close()
            self.conn = None

    def open_conn(self):
        """
        Open the connection if already closed.
        """
        if self.conn == None:
            self.conn = self.setUpConnectionOpen(".")

            

Reported by Pylint.

Missing module docstring
Error

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.

Multiple imports on one line (os, struct)
Error

Line: 29 Column: 1

              # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

import os, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest

# test_util07.py
#    Utilities: wt read

            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 31 Column: 1

              
import os, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest

# test_util07.py
#    Utilities: wt read
class test_util07(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_util07.a'

            

Reported by Pylint.

third party import "import wiredtiger, wttest" should be placed before "from suite_subprocess import suite_subprocess"
Error

Line: 31 Column: 1

              
import os, struct
from suite_subprocess import suite_subprocess
import wiredtiger, wttest

# test_util07.py
#    Utilities: wt read
class test_util07(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_util07.a'

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_alter01.py
14 issues
Unable to import 'wiredtiger'
Error

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_alter01.py
#    Smoke-test the session alter operations.
class test_alter01(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Unused import wiredtiger
Error

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_alter01.py
#    Smoke-test the session alter operations.
class test_alter01(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Missing module docstring
Error

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.

Multiple imports on one line (wiredtiger, wttest)
Error

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_alter01.py
#    Smoke-test the session alter operations.
class test_alter01(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Missing class docstring
Error

Line: 34 Column: 1

              
# test_alter01.py
#    Smoke-test the session alter operations.
class test_alter01(wttest.WiredTigerTestCase):
    name = "alter01"
    entries = 100
    # Settings for access_pattern_hint
    types = [
        ('file', dict(uri='file:', use_cg=False, use_index=False)),

            

Reported by Pylint.

Class name "test_alter01" doesn't conform to PascalCase naming style
Error

Line: 34 Column: 1

              
# test_alter01.py
#    Smoke-test the session alter operations.
class test_alter01(wttest.WiredTigerTestCase):
    name = "alter01"
    entries = 100
    # Settings for access_pattern_hint
    types = [
        ('file', dict(uri='file:', use_cg=False, use_index=False)),

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 65 Column: 5

                  cache_alter=('', 'false', 'true')
    scenarios = make_scenarios(types, hints, resid, reopen)

    def verify_metadata(self, metastr):
        if metastr == '':
            return
        cursor = self.session.open_cursor('metadata:', None, None)
        #
        # Walk through all the metadata looking for the entries that are

            

Reported by Pylint.

Comparison 'found == True' should be 'found is True' if checking for the singleton value True, or 'bool(found)' if testing for truthiness
Error

Line: 86 Column: 25

                              found = True
                self.assertTrue(value.find(metastr) != -1)
        cursor.close()
        self.assertTrue(found == True)

    # Alter: Change the access pattern hint after creation
    def test_alter01_access(self):
        uri = self.uri + self.name
        create_params = 'key_format=i,value_format=i,'

            

Reported by Pylint.

Too many statements (55/50)
Error

Line: 89 Column: 5

                      self.assertTrue(found == True)

    # Alter: Change the access pattern hint after creation
    def test_alter01_access(self):
        uri = self.uri + self.name
        create_params = 'key_format=i,value_format=i,'
        complex_params = ''
        #
        # If we're not explicitly setting the parameter, then don't

            

Reported by Pylint.

Too many branches (17/12)
Error

Line: 89 Column: 5

                      self.assertTrue(found == True)

    # Alter: Change the access pattern hint after creation
    def test_alter01_access(self):
        uri = self.uri + self.name
        create_params = 'key_format=i,value_format=i,'
        complex_params = ''
        #
        # If we're not explicitly setting the parameter, then don't

            

Reported by Pylint.

src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/textfile.py
13 issues
Unused import os
Error

Line: 51 Column: 1

              
import SCons

import os
import re

from SCons.Node import Node
from SCons.Node.Python import Value
from SCons.Util import is_String, is_Sequence, is_Dict, to_bytes, PY3

            

Reported by Pylint.

Consider explicitly re-raising using the 'from' keyword
Error

Line: 134 Column: 9

                      else:
            target_file = open(target[0].get_path(), TEXTFILE_FILE_WRITE_MODE)
    except (OSError, IOError):
        raise SCons.Errors.UserError("Can't write target file %s" % target[0])

    # separate lines by 'linesep' only if linesep is not empty
    lsep = None
    for line in source:
        if lsep:

            

Reported by Pylint.

Unused argument 'source'
Error

Line: 147 Column: 22

                  target_file.close()


def _strfunc(target, source, env):
    return "Creating '%s'" % target[0]


def _convert_list_R(newlist, sources):
    for elem in sources:

            

Reported by Pylint.

Unused argument 'env'
Error

Line: 147 Column: 30

                  target_file.close()


def _strfunc(target, source, env):
    return "Creating '%s'" % target[0]


def _convert_list_R(newlist, sources):
    for elem in sources:

            

Reported by Pylint.

Unused argument 'env'
Error

Line: 161 Column: 35

                          newlist.append(Value(elem))


def _convert_list(target, source, env):
    if len(target) != 1:
        raise SCons.Errors.UserError("Only one target file allowed")
    newlist = []
    _convert_list_R(newlist, source)
    return target, newlist

            

Reported by Pylint.

Unused argument 'env'
Error

Line: 201 Column: 12

                  env['SUBSTFILESUFFIX'] = ''


def exists(env):
    return 1

# Local Variables:
# tab-width:4
# indent-tabs-mode:nil

            

Reported by Pylint.

Line too long (119/100)
Error

Line: 47 Column: 1

                  is unpredictable whether the expansion will occur.
"""

__revision__ = "src/engine/SCons/Tool/textfile.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"

import SCons

import os
import re

            

Reported by Pylint.

standard import "import os" should be placed before "import SCons"
Error

Line: 51 Column: 1

              
import SCons

import os
import re

from SCons.Node import Node
from SCons.Node.Python import Value
from SCons.Util import is_String, is_Sequence, is_Dict, to_bytes, PY3

            

Reported by Pylint.

standard import "import re" should be placed before "import SCons"
Error

Line: 52 Column: 1

              import SCons

import os
import re

from SCons.Node import Node
from SCons.Node.Python import Value
from SCons.Util import is_String, is_Sequence, is_Dict, to_bytes, PY3


            

Reported by Pylint.

Too many branches (19/12)
Error

Line: 89 Column: 1

                  return contents


def _action(target, source, env):

    # prepare the line separator
    linesep = env['LINESEPARATOR']
    if linesep is None:
        linesep = LINESEP # os.linesep

            

Reported by Pylint.

src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/rpm.py
13 issues
subprocess call with shell=True identified, security issue.
Security injection

Line: 73
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b602_subprocess_popen_with_shell_equals_true.html

                  handle  = subprocess.Popen(get_cmd(source, env),
                               stdout=subprocess.PIPE,
                               stderr=subprocess.STDOUT,
                               shell=True)
    with handle.stdout:
        output = SCons.Util.to_str(handle.stdout.read())
    status = handle.wait()

    if status:

            

Reported by Bandit.

XXX: assume that LC_ALL=C is set while running rpmbuild
Error

Line: 83 Column: 3

                                                    errstr=output,
                                      filename=str(target[0]))
    else:
        # XXX: assume that LC_ALL=C is set while running rpmbuild
        output_files = re.compile('Wrote: (.*)').findall(output)

        for output, input in zip(output_files, target):
            rpm_output = os.path.basename(output)
            expected   = os.path.basename(input.get_path())

            

Reported by Pylint.

Redefining built-in 'input'
Error

Line: 86 Column: 21

                      # XXX: assume that LC_ALL=C is set while running rpmbuild
        output_files = re.compile('Wrote: (.*)').findall(output)

        for output, input in zip(output_files, target):
            rpm_output = os.path.basename(output)
            expected   = os.path.basename(input.get_path())

            assert expected == rpm_output, "got %s but expected %s" % (rpm_output, expected)
            shutil.copy(output, input.get_abspath())

            

Reported by Pylint.

Unused argument 'target'
Error

Line: 99 Column: 16

              
    return status

def string_rpm(target, source, env):
    try:
        return env['RPMCOMSTR']
    except KeyError:
        return get_cmd(source, env)


            

Reported by Pylint.

Line too long (114/100)
Error

Line: 36 Column: 1

              # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

__revision__ = "src/engine/SCons/Tool/rpm.py bee7caf9defd6e108fc2998a2520ddb36a967691 2019-12-17 02:07:09 bdeegan"

import os
import re
import shutil
import subprocess

            

Reported by Pylint.

Consider possible security implications associated with subprocess module.
Security blacklist

Line: 41
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

              import os
import re
import shutil
import subprocess

import SCons.Builder
import SCons.Node.FS
import SCons.Util
import SCons.Action

            

Reported by Bandit.

Missing function or method docstring
Error

Line: 49 Column: 1

              import SCons.Action
import SCons.Defaults

def get_cmd(source, env):
    tar_file_with_included_specfile = source
    if SCons.Util.is_List(source):
        tar_file_with_included_specfile = source[0]
    return "%s %s %s"%(env['RPM'], env['RPMFLAGS'],
                       tar_file_with_included_specfile.get_abspath())

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 56 Column: 1

                  return "%s %s %s"%(env['RPM'], env['RPMFLAGS'],
                       tar_file_with_included_specfile.get_abspath())

def build_rpm(target, source, env):
    # create a temporary rpm build root.
    tmpdir = os.path.join(os.path.dirname(target[0].get_abspath()), 'rpmtemp')
    if os.path.exists(tmpdir):
        shutil.rmtree(tmpdir)


            

Reported by Pylint.

Variable name "d" doesn't conform to snake_case naming style
Error

Line: 63 Column: 9

                      shutil.rmtree(tmpdir)

    # now create the mandatory rpm directory structure.
    for d in ['RPMS', 'SRPMS', 'SPECS', 'BUILD']:
        os.makedirs(os.path.join(tmpdir, d))

    # set the topdir as an rpmflag.
    env.Prepend(RPMFLAGS = '--define \'_topdir %s\'' % tmpdir)


            

Reported by Pylint.

Unnecessary "else" after "raise"
Error

Line: 78 Column: 5

                      output = SCons.Util.to_str(handle.stdout.read())
    status = handle.wait()

    if status:
        raise SCons.Errors.BuildError(node=target[0],
                                      errstr=output,
                                      filename=str(target[0]))
    else:
        # XXX: assume that LC_ALL=C is set while running rpmbuild

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_metadata_cursor03.py
13 issues
Unable to import 'wiredtiger'
Error

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, wttest
from wtscenario import make_scenarios

# test_metadata03.py
#    Test atomic schema operations on create.
class test_metadata03(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Unused import sys
Error

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, wttest
from wtscenario import make_scenarios

# test_metadata03.py
#    Test atomic schema operations on create.
class test_metadata03(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Unused import wiredtiger
Error

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, wttest
from wtscenario import make_scenarios

# test_metadata03.py
#    Test atomic schema operations on create.
class test_metadata03(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Unused argument 'origcnt'
Error

Line: 61 Column: 30

                      c.close()
        return count

    def verify_logrecs(self, origcnt):
        #
        # Walk through all the log and make sure that creating any table
        # only writes two log records to the log.  The two records are the
        # commit entry itself and the sync record for the metadata file.
        #

            

Reported by Pylint.

Unused variable 'count'
Error

Line: 67 Column: 9

                      # only writes two log records to the log.  The two records are the
        # commit entry itself and the sync record for the metadata file.
        #
        count = self.count_logrecs()
        # To be re-enabled when WT-3965 is fixed.
        #self.assertTrue(count == origcnt + 2)

    # Test that creating and dropping tables does not write individual
    # log records.

            

Reported by Pylint.

Missing module docstring
Error

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.

Multiple imports on one line (sys, wiredtiger, wttest)
Error

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, wttest
from wtscenario import make_scenarios

# test_metadata03.py
#    Test atomic schema operations on create.
class test_metadata03(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Class name "test_metadata03" doesn't conform to PascalCase naming style
Error

Line: 34 Column: 1

              
# test_metadata03.py
#    Test atomic schema operations on create.
class test_metadata03(wttest.WiredTigerTestCase):
    conn_config = 'log=(enabled)'
    types = [
        ('file', dict(uri='file:', use_cg=False, use_index=False)),
        ('lsm', dict(uri='lsm:', use_cg=False, use_index=False)),
        ('table-cg', dict(uri='table:', use_cg=True, use_index=False)),

            

Reported by Pylint.

Missing class docstring
Error

Line: 34 Column: 1

              
# test_metadata03.py
#    Test atomic schema operations on create.
class test_metadata03(wttest.WiredTigerTestCase):
    conn_config = 'log=(enabled)'
    types = [
        ('file', dict(uri='file:', use_cg=False, use_index=False)),
        ('lsm', dict(uri='lsm:', use_cg=False, use_index=False)),
        ('table-cg', dict(uri='table:', use_cg=True, use_index=False)),

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 48 Column: 5

                  # Count actual log records in the log. Log cursors walk the individual
    # operations of a transaction as well as the entire record. Skip counting
    # any individual commit operations and only count entire records.
    def count_logrecs(self):
        count = 0
        c = self.session.open_cursor('log:', None, None)
        while c.next() == 0:
            # lsn.file, lsn.offset, opcount
            keys = c.get_key()

            

Reported by Pylint.

src/third_party/mozjs-60/extract/mfbt/lz4.c
13 issues
fprintf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 331 Column: 21 CWE codes: 134
Suggestion: Use a constant for the format specification

              static int g_debuglog_enable = 1;
#  define DEBUGLOG(l, ...) {                                  \
                if ((g_debuglog_enable) && (l<=LZ4_DEBUG)) {  \
                    fprintf(stderr, __FILE__ ": ");           \
                    fprintf(stderr, __VA_ARGS__);             \
                    fprintf(stderr, " \n");                   \
            }   }
#else
#  define DEBUGLOG(l, ...)      {}    /* disabled */

            

Reported by FlawFinder.

fprintf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 332 Column: 21 CWE codes: 134
Suggestion: Use a constant for the format specification

              #  define DEBUGLOG(l, ...) {                                  \
                if ((g_debuglog_enable) && (l<=LZ4_DEBUG)) {  \
                    fprintf(stderr, __FILE__ ": ");           \
                    fprintf(stderr, __VA_ARGS__);             \
                    fprintf(stderr, " \n");                   \
            }   }
#else
#  define DEBUGLOG(l, ...)      {}    /* disabled */
#endif

            

Reported by FlawFinder.

memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 241 Column: 5 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

              
static void LZ4_write16(void* memPtr, U16 value)
{
    memcpy(memPtr, &value, sizeof(value));
}

static void LZ4_write32(void* memPtr, U32 value)
{
    memcpy(memPtr, &value, sizeof(value));

            

Reported by FlawFinder.

memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 246 Column: 5 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

              
static void LZ4_write32(void* memPtr, U32 value)
{
    memcpy(memPtr, &value, sizeof(value));
}

#endif /* LZ4_FORCE_MEMORY_ACCESS */



            

Reported by FlawFinder.

memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 275 Column: 5 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

              
static void LZ4_copy8(void* dst, const void* src)
{
    memcpy(dst,src,8);
}

/* customized variant of memcpy, which can overwrite up to 8 bytes beyond dstEnd */
LZ4_FORCE_O2_INLINE_GCC_PPC64LE
void LZ4_wildCopy(void* dstPtr, const void* srcPtr, void* dstEnd)

            

Reported by FlawFinder.

memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 727 Column: 9 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

                      } else {
            *op++ = (BYTE)(lastRun<<ML_BITS);
        }
        memcpy(op, anchor, lastRun);
        op += lastRun;
    }

    /* End */
    return (int) (((char*)op)-dest);

            

Reported by FlawFinder.

memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 944 Column: 9 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

                      } else {
            *op++ = (BYTE)(lastRunSize<<ML_BITS);
        }
        memcpy(op, anchor, lastRunSize);
        op += lastRunSize;
    }

    /* End */
    *srcSizePtr = (int) (((const char*)ip)-src);

            

Reported by FlawFinder.

memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 1225 Column: 17 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

                          const BYTE* const matchPtr = op + ll - off;  /* pointer underflow risk ? */
            if ((off >= 18) /* do not deal with overlapping matches */ & (matchPtr >= lowPrefix)) {
                size_t const ml = (token & ML_MASK) + MINMATCH;
                memcpy(op, ip, 16); op += ll; ip += ll + 2 /*offset*/;
                memcpy(op, matchPtr, 18); op += ml;
                continue;
            }
        }


            

Reported by FlawFinder.

memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 1226 Column: 17 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

                          if ((off >= 18) /* do not deal with overlapping matches */ & (matchPtr >= lowPrefix)) {
                size_t const ml = (token & ML_MASK) + MINMATCH;
                memcpy(op, ip, 16); op += ll; ip += ll + 2 /*offset*/;
                memcpy(op, matchPtr, 18); op += ml;
                continue;
            }
        }

        /* decode literal length */

            

Reported by FlawFinder.

memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 1254 Column: 13 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

                              if ((!endOnInput) && (cpy != oend)) goto _output_error;       /* Error : block decoding must stop exactly there */
                if ((endOnInput) && ((ip+length != iend) || (cpy > oend))) goto _output_error;   /* Error : input must be consumed */
            }
            memcpy(op, ip, length);
            ip += length;
            op += length;
            break;     /* Necessarily EOF, due to parsing restrictions */
        }
        LZ4_wildCopy(op, ip, cpy);

            

Reported by FlawFinder.

src/third_party/mozjs-60/extract/js/src/wasm/WasmBinaryToText.cpp
13 issues
strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 71 Column: 33 CWE codes: 126

                  c.buffer.stringBuffer().clear();

    return c.buffer.append("There was a problem when rendering the wasm text format: ") &&
           c.buffer.append(msg, strlen(msg)) &&
           c.buffer.append("\nYou should consider file a bug on Bugzilla in the "
                           "Core:::JavaScript Engine::JIT component at "
                           "https://bugzilla.mozilla.org/enter_bug.cgi.");
}


            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 559 Column: 35 CWE codes: 126

                    default:               return Fail(c, "unexpected unary operator");
    }

    return c.buffer.append(opStr, strlen(opStr));
}

static bool
RenderBinaryOperator(WasmRenderContext& c, AstBinaryOperator& binary)
{

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 623 Column: 35 CWE codes: 126

                    default:                return Fail(c, "unexpected binary operator");
    }

    return c.buffer.append(opStr, strlen(opStr));
}

static bool
RenderTernaryOperator(WasmRenderContext& c, AstTernaryOperator& ternary)
{

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 646 Column: 35 CWE codes: 126

                    default:           return Fail(c, "unexpected ternary operator");
    }

    return c.buffer.append(opStr, strlen(opStr));
}

static bool
RenderComparisonOperator(WasmRenderContext& c, AstComparisonOperator& comp)
{

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 698 Column: 35 CWE codes: 126

                    default:           return Fail(c, "unexpected comparison operator");
    }

    return c.buffer.append(opStr, strlen(opStr));
}

static bool
RenderConversionOperator(WasmRenderContext& c, AstConversionOperator& conv)
{

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 749 Column: 35 CWE codes: 126

                    case Op::I64Eqz:            opStr = "i64.eqz"; break;
      default:                      return Fail(c, "unexpected conversion operator");
    }
    return c.buffer.append(opStr, strlen(opStr));
}

#ifdef ENABLE_WASM_SATURATING_TRUNC_OPS
static bool
RenderExtraConversionOperator(WasmRenderContext& c, AstExtraConversionOperator& conv)

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 775 Column: 35 CWE codes: 126

                    case NumericOp::I64TruncUSatF64:   opStr = "i64.trunc_u:sat/f64"; break;
      default:                      return Fail(c, "unexpected extra conversion operator");
    }
    return c.buffer.append(opStr, strlen(opStr));
}
#endif

static bool
RenderIf(WasmRenderContext& c, AstIf& if_)

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 1102 Column: 34 CWE codes: 126

                    default:                            return Fail(c, "unexpected cmpxchg operator");
    }

    if (!c.buffer.append(opname, strlen(opname)))
        return false;

    return RenderLoadStoreAddress(c, cmpxchg.address(), 0);
}


            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 1130 Column: 34 CWE codes: 126

                    default:                         return Fail(c, "unexpected load operator");
    }

    if (!c.buffer.append(opname, strlen(opname)))
        return false;

    return RenderLoadStoreAddress(c, load.address(), 0);
}


            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 1196 Column: 34 CWE codes: 126

                    default:                         return Fail(c, "unexpected rmw operator");
    }

    if (!c.buffer.append(opname, strlen(opname)))
        return false;

    return RenderLoadStoreAddress(c, rmw.address(), 0);
}


            

Reported by FlawFinder.

site_scons/site_tools/auto_archive.py
13 issues
Unable to import 'SCons'
Error

Line: 26 Column: 1

              import sys
import os

import SCons

PACKAGE_ALIAS_MAP = "AIB_PACKAGE_ALIAS_MAP"
AUTO_ARCHIVE_MAKE_ARCHIVE_CONTENT = """
import os
import sys

            

Reported by Pylint.

TODO: silent roles shouldn't be included here
Error

Line: 92 Column: 3

              def get_package_name(env, component, role):
    """Return the package file name for the component and role combination."""
    basename = env[PACKAGE_ALIAS_MAP].get(
        # TODO: silent roles shouldn't be included here
        (component, role), "{component}-{role}".format(component=component, role=role)
    )

    return basename


            

Reported by Pylint.

TODO: perhaps caching of packages / tarballs should be
Error

Line: 168 Column: 3

                          AIB_ROLE=role,
        )

        # TODO: perhaps caching of packages / tarballs should be
        # configurable? It's possible someone would want to do it.
        env.NoCache(archive)
        return archive

    return auto_archive

            

Reported by Pylint.

TODO: relpath is costly, and we do it for every file in the archive here.
Error

Line: 244 Column: 3

                  # platforms and handle \ / on Windows.
    escape_func = env.get("ESCAPE", lambda x: x)

    # TODO: relpath is costly, and we do it for every file in the archive here.
    # We should find a way to avoid the repeated relpath invocation, probably by
    # bucketing by directory.
    relative_files = [
        escape_func(os.path.relpath(file.get_abspath(), common_ancestor.get_abspath()))
        for file in transitive_files

            

Reported by Pylint.

Unused argument 'env'
Error

Line: 258 Column: 12

                  )


def exists(env):
    return True


def generate(env):
    if not env.get("AUTO_INSTALL_ENABLED"):

            

Reported by Pylint.

TODO: $BUILD_ROOT should be $VARIANT_DIR after we fix our dir
Error

Line: 281 Column: 3

              
    env.AddMethod(add_package_name_alias, "AddPackageNameAlias")

    # TODO: $BUILD_ROOT should be $VARIANT_DIR after we fix our dir
    # setup later on.
    make_archive_script = env.Textfile(
        target="$BUILD_ROOT/aib_make_archive.py",
        source=[AUTO_ARCHIVE_MAKE_ARCHIVE_CONTENT],
    )

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # Copyright 2020 MongoDB Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:

            

Reported by Pylint.

Variable name "s" doesn't conform to snake_case naming style
Error

Line: 110 Column: 9

                  # Find all the files directly contained in the component DAG for entry and
    # it's dependencies.
    while stack:
        s = stack.pop()
        if s in cache:
            continue
        cache.add(s)

        stack.extend(s.dependencies)

            

Reported by Pylint.

Variable name "s" doesn't conform to snake_case naming style
Error

Line: 125 Column: 9

                  # we found from the component DAG.

    while stack:
        s = stack.pop()
        if s in cache:
            continue
        cache.add(s)

        files.append(s)

            

Reported by Pylint.

Too many local variables (17/15)
Error

Line: 176 Column: 1

                  return auto_archive


def archive_builder(source, target, env, for_signature):
    """Build archives of the AutoInstall'd sources."""
    if not source:
        return []

    source = env.Flatten([source])

            

Reported by Pylint.

src/third_party/icu4c-57.1/source/common/utext.cpp
13 issues
access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 38 Column: 24 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

              
static UBool
utext_access(UText *ut, int64_t index, UBool forward) {
    return ut->pFuncs->access(ut, index, forward);
}



U_CAPI UBool U_EXPORT2

            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 113 Column: 21 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                      // Access the new position.  Assume a forward iteration from here,
        // which will also be optimimum for a single random access.
        // Reverse iterations may suffer slightly.
        ut->pFuncs->access(ut, index, TRUE);
    } else if((int32_t)(index - ut->chunkNativeStart) <= ut->nativeIndexingLimit) {
        // utf-16 indexing.
        ut->chunkOffset=(int32_t)(index-ut->chunkNativeStart);
    } else {
         ut->chunkOffset=ut->pFuncs->mapNativeIndexToUTF16(ut, index);

            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 126 Column: 29 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                      UChar c= ut->chunkContents[ut->chunkOffset];
        if (U16_IS_TRAIL(c)) {
            if (ut->chunkOffset==0) {
                ut->pFuncs->access(ut, ut->chunkNativeStart, FALSE);
            }
            if (ut->chunkOffset>0) {
                UChar lead = ut->chunkContents[ut->chunkOffset-1];
                if (U16_IS_LEAD(lead)) {
                    ut->chunkOffset--;

            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 188 Column: 25 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                  UChar32  c;
    if (ut->chunkOffset==ut->chunkLength) {
        // Current position is just off the end of the chunk.
        if (ut->pFuncs->access(ut, ut->chunkNativeLimit, TRUE) == FALSE) {
            // Off the end of the text.
            return U_SENTINEL;
        }
    }


            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 218 Column: 25 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                      //        the original position before the unpaired lead still needs to be restored.
        int64_t  nativePosition = ut->chunkNativeLimit;
        int32_t  originalOffset = ut->chunkOffset;
        if (ut->pFuncs->access(ut, nativePosition, TRUE)) {
            trail = ut->chunkContents[ut->chunkOffset];
        }
        UBool r = ut->pFuncs->access(ut, nativePosition, FALSE);  // reverse iteration flag loads preceding chunk
        U_ASSERT(r==TRUE);
        ut->chunkOffset = originalOffset;

            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 221 Column: 31 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                      if (ut->pFuncs->access(ut, nativePosition, TRUE)) {
            trail = ut->chunkContents[ut->chunkOffset];
        }
        UBool r = ut->pFuncs->access(ut, nativePosition, FALSE);  // reverse iteration flag loads preceding chunk
        U_ASSERT(r==TRUE);
        ut->chunkOffset = originalOffset;
        if(!r) {
            return U_SENTINEL;
        }

            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 269 Column: 25 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                  UChar32       c;

    if (ut->chunkOffset >= ut->chunkLength) {
        if (ut->pFuncs->access(ut, ut->chunkNativeLimit, TRUE) == FALSE) {
            return U_SENTINEL;
        }
    }

    c = ut->chunkContents[ut->chunkOffset++];

            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 283 Column: 25 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                  }

    if (ut->chunkOffset >= ut->chunkLength) {
        if (ut->pFuncs->access(ut, ut->chunkNativeLimit, TRUE) == FALSE) {
            // c is an unpaired lead surrogate at the end of the text.
            // return it as it is.
            return c;
        }
    }

            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 309 Column: 25 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                  UChar32       c;

    if (ut->chunkOffset <= 0) {
        if (ut->pFuncs->access(ut, ut->chunkNativeStart, FALSE) == FALSE) {
            return U_SENTINEL;
        }
    }
    ut->chunkOffset--;
    c = ut->chunkContents[ut->chunkOffset];

            

Reported by FlawFinder.

access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 323 Column: 25 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

                  }

    if (ut->chunkOffset <= 0) {
        if (ut->pFuncs->access(ut, ut->chunkNativeStart, FALSE) == FALSE) {
            // c is an unpaired trail surrogate at the start of the text.
            // return it as it is.
            return c;
        }
    }

            

Reported by FlawFinder.