The following issues were found

src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Scanner/Fortran.py
15 issues
__init__ method from base class 'Classic' is not called
Error

Line: 55 Column: 5

                  smart thing to do.
    """

    def __init__(self, name, suffixes, path_variable,
                 use_regex, incl_regex, def_regex, *args, **kw):

        self.cre_use = re.compile(use_regex, re.M)
        self.cre_incl = re.compile(incl_regex, re.M)
        self.cre_def = re.compile(def_regex, re.M)

            

Reported by Pylint.

__init__ method from a non direct base class 'Current' is called
Error

Line: 76 Column: 9

                      kw['skeys'] = suffixes
        kw['name'] = name

        SCons.Scanner.Current.__init__(self, *args, **kw)

    def scan(self, node, env, path=()):

        # cache the includes list in node so we only scan it once:
        if node.includes is not None:

            

Reported by Pylint.

Parameters differ from overridden 'scan' method
Error

Line: 78 Column: 5

              
        SCons.Scanner.Current.__init__(self, *args, **kw)

    def scan(self, node, env, path=()):

        # cache the includes list in node so we only scan it once:
        if node.includes is not None:
            mods_and_includes = node.includes
        else:

            

Reported by Pylint.

Module name "Fortran" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              """SCons.Scanner.Fortran

This module implements the dependency scanner for Fortran code.

"""

#
# Copyright (c) 2001 - 2019 The SCons Foundation
#

            

Reported by Pylint.

Line too long (121/100)
Error

Line: 29 Column: 1

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

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

import re

import SCons.Node
import SCons.Node.FS

            

Reported by Pylint.

Too many arguments (7/5)
Error

Line: 55 Column: 5

                  smart thing to do.
    """

    def __init__(self, name, suffixes, path_variable,
                 use_regex, incl_regex, def_regex, *args, **kw):

        self.cre_use = re.compile(use_regex, re.M)
        self.cre_incl = re.compile(incl_regex, re.M)
        self.cre_def = re.compile(def_regex, re.M)

            

Reported by Pylint.

Too many local variables (17/15)
Error

Line: 78 Column: 5

              
        SCons.Scanner.Current.__init__(self, *args, **kw)

    def scan(self, node, env, path=()):

        # cache the includes list in node so we only scan it once:
        if node.includes is not None:
            mods_and_includes = node.includes
        else:

            

Reported by Pylint.

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

Line: 93 Column: 13

              
            # Remove all USE'd module names that are defined in the same file
            # (case-insensitively)
            d = {}
            for m in defmodules:
                d[m.lower()] = 1
            modules = [m for m in modules if m.lower() not in d]

            # Convert module name to a .mod filename

            

Reported by Pylint.

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

Line: 94 Column: 17

                          # Remove all USE'd module names that are defined in the same file
            # (case-insensitively)
            d = {}
            for m in defmodules:
                d[m.lower()] = 1
            modules = [m for m in modules if m.lower() not in d]

            # Convert module name to a .mod filename
            suffix = env.subst('$FORTRANMODSUFFIX')

            

Reported by Pylint.

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

Line: 115 Column: 13

                      if callable(path):
            path = path()
        for dep in mods_and_includes:
            n, i = self.find_include(dep, source_dir, path)

            if n is None:
                SCons.Warnings.warn(SCons.Warnings.DependencyWarning,
                                    "No dependency generated for file: %s (referenced by: %s) -- file not found" % (i, node))
            else:

            

Reported by Pylint.

src/third_party/mozjs-60/extract/js/src/devtools/rootAnalysis/t/sixgill.py
15 issues
__init__ method from base class 'dict' is not called
Error

Line: 10 Column: 5

              
# Simplified version of the body info.
class Body(dict):
    def __init__(self, body):
        self['BlockIdKind'] = body['BlockId']['Kind']
        if 'Variable' in body['BlockId']:
            self['BlockName'] = body['BlockId']['Variable']['Name'][0].split("$")[-1]
        loc = body['Location']
        self['LineRange'] = (loc[0]['Line'], loc[1]['Line'])

            

Reported by Pylint.

Unused variable 'dst'
Error

Line: 28 Column: 18

                          self['Line2Points'][line].append(point)
        self['SrcPoint2Edges'] = defaultdict(list)
        for edge in self['Edges']:
            src, dst = edge['Index']
            self['SrcPoint2Edges'][src].append(edge)
        self['Line2Edges'] = defaultdict(list)
        for (src, edges) in self['SrcPoint2Edges'].items():
            line = self['Points'][src]
            self['Line2Edges'][line].extend(edges)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from collections import defaultdict

# Simplified version of the body info.
class Body(dict):

            

Reported by Pylint.

Missing class docstring
Error

Line: 9 Column: 1

              from collections import defaultdict

# Simplified version of the body info.
class Body(dict):
    def __init__(self, body):
        self['BlockIdKind'] = body['BlockId']['Kind']
        if 'Variable' in body['BlockId']:
            self['BlockName'] = body['BlockId']['Variable']['Name'][0].split("$")[-1]
        loc = body['Location']

            

Reported by Pylint.

Line too long (114/100)
Error

Line: 20 Column: 1

                      self['Edges'] = body.get('PEdge', [])
        self['Points'] = { i: p['Location']['Line'] for i, p in enumerate(body['PPoint'], 1) }
        self['Index'] = body['Index']
        self['Variables'] = { x['Variable']['Name'][0].split("$")[-1]: x['Type'] for x in body['DefineVariable'] }

        # Indexes
        self['Line2Points'] = defaultdict(list)
        for point, line in self['Points'].items():
            self['Line2Points'][line].append(point)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 35 Column: 5

                          line = self['Points'][src]
            self['Line2Edges'][line].extend(edges)

    def edges_from_line(self, line):
        return self['Line2Edges'][line]

    def edge_from_line(self, line):
        edges = self.edges_from_line(line)
        assert(len(edges) == 1)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 38 Column: 5

                  def edges_from_line(self, line):
        return self['Line2Edges'][line]

    def edge_from_line(self, line):
        edges = self.edges_from_line(line)
        assert(len(edges) == 1)
        return edges[0]

    def edges_from_point(self, point):

            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 40
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              
    def edge_from_line(self, line):
        edges = self.edges_from_line(line)
        assert(len(edges) == 1)
        return edges[0]

    def edges_from_point(self, point):
        return self['SrcPoint2Edges'][point]


            

Reported by Bandit.

Unnecessary parens after 'assert' keyword
Error

Line: 40 Column: 1

              
    def edge_from_line(self, line):
        edges = self.edges_from_line(line)
        assert(len(edges) == 1)
        return edges[0]

    def edges_from_point(self, point):
        return self['SrcPoint2Edges'][point]


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 43 Column: 5

                      assert(len(edges) == 1)
        return edges[0]

    def edges_from_point(self, point):
        return self['SrcPoint2Edges'][point]

    def edge_from_point(self, point):
        edges = self.edges_from_point(point)
        assert(len(edges) == 1)

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_readonly01.py
15 issues
An attribute defined in wttest line 401 hides this method
Error

Line: 78 Column: 5

              
    scenarios = make_scenarios(basecfg_list, dir_list, log_list, types)

    def conn_config(self):
        params = \
            'error_prefix="%s",' % self.shortid() + \
            '%s' % self.logcfg + \
            '%s' % self.basecfg
        if self.create:

            

Reported by Pylint.

Unused import shutil
Error

Line: 33 Column: 1

              #   Readonly: Test readonly mode.
#

import fnmatch, os, shutil, time
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
import wttest

class test_readonly01(wttest.WiredTigerTestCase, suite_subprocess):

            

Reported by Pylint.

Unused import fnmatch
Error

Line: 33 Column: 1

              #   Readonly: Test readonly mode.
#

import fnmatch, os, shutil, time
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
import wttest

class test_readonly01(wttest.WiredTigerTestCase, suite_subprocess):

            

Reported by Pylint.

Unused import time
Error

Line: 33 Column: 1

              #   Readonly: Test readonly mode.
#

import fnmatch, os, shutil, time
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
import wttest

class test_readonly01(wttest.WiredTigerTestCase, suite_subprocess):

            

Reported by Pylint.

Chmod setting a permissive mask 0o555 on file (NOT PARSED).
Security

Line: 104
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b103_set_bad_file_permissions.html

                          for f in os.listdir(self.home):
                if os.path.isfile(f):
                    os.chmod(f, 0o444)
            os.chmod(self.home, 0o555)
        self.conn = self.setUpConnectionOpen(self.home)
        self.session = self.setUpSessionOpen(self.conn)

    def readonly(self):
        # Here's the strategy:

            

Reported by Bandit.

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 (fnmatch, os, shutil, time)
Error

Line: 33 Column: 1

              #   Readonly: Test readonly mode.
#

import fnmatch, os, shutil, time
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
import wttest

class test_readonly01(wttest.WiredTigerTestCase, suite_subprocess):

            

Reported by Pylint.

Missing class docstring
Error

Line: 38 Column: 1

              from wtscenario import make_scenarios
import wttest

class test_readonly01(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_readonly01'
    create = True
    entries = 10000

    #

            

Reported by Pylint.

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

Line: 38 Column: 1

              from wtscenario import make_scenarios
import wttest

class test_readonly01(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_readonly01'
    create = True
    entries = 10000

    #

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 78 Column: 5

              
    scenarios = make_scenarios(basecfg_list, dir_list, log_list, types)

    def conn_config(self):
        params = \
            'error_prefix="%s",' % self.shortid() + \
            '%s' % self.logcfg + \
            '%s' % self.basecfg
        if self.create:

            

Reported by Pylint.

src/third_party/zlib-1.2.11/gzwrite.c
15 issues
vsprintf - Potential format string problem
Security

Line: 417 Column: 11 CWE codes: 134
Suggestion: Make format string constant

                  next[state->size - 1] = 0;
#ifdef NO_vsnprintf
#  ifdef HAS_vsprintf_void
    (void)vsprintf(next, format, va);
    for (len = 0; len < state->size; len++)
        if (next[len] == 0) break;
#  else
    len = vsprintf(next, format, va);
#  endif

            

Reported by FlawFinder.

vsprintf - Potential format string problem
Security

Line: 421 Column: 11 CWE codes: 134
Suggestion: Make format string constant

                  for (len = 0; len < state->size; len++)
        if (next[len] == 0) break;
#  else
    len = vsprintf(next, format, va);
#  endif
#else
#  ifdef HAS_vsnprintf_void
    (void)vsnprintf(next, state->size, format, va);
    len = strlen(next);

            

Reported by FlawFinder.

vsnprintf - If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate
Security

Line: 425 Column: 11 CWE codes: 134
Suggestion: Use a constant for the format specification

              #  endif
#else
#  ifdef HAS_vsnprintf_void
    (void)vsnprintf(next, state->size, format, va);
    len = strlen(next);
#  else
    len = vsnprintf(next, state->size, format, va);
#  endif
#endif

            

Reported by FlawFinder.

vsnprintf - If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate
Security

Line: 428 Column: 11 CWE codes: 134
Suggestion: Use a constant for the format specification

                  (void)vsnprintf(next, state->size, format, va);
    len = strlen(next);
#  else
    len = vsnprintf(next, state->size, format, va);
#  endif
#endif

    /* check that printf() results fit in buffer */
    if (len == 0 || (unsigned)len >= state->size || next[state->size - 1] != 0)

            

Reported by FlawFinder.

sprintf - Potential format string problem
Security

Line: 511 Column: 5 CWE codes: 134
Suggestion: Make format string constant

                  next[state->size - 1] = 0;
#ifdef NO_snprintf
#  ifdef HAS_sprintf_void
    sprintf(next, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12,
            a13, a14, a15, a16, a17, a18, a19, a20);
    for (len = 0; len < size; len++)
        if (next[len] == 0)
            break;
#  else

            

Reported by FlawFinder.

sprintf - Potential format string problem
Security

Line: 517 Column: 11 CWE codes: 134
Suggestion: Make format string constant

                      if (next[len] == 0)
            break;
#  else
    len = sprintf(next, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11,
                  a12, a13, a14, a15, a16, a17, a18, a19, a20);
#  endif
#else
#  ifdef HAS_snprintf_void
    snprintf(next, state->size, format, a1, a2, a3, a4, a5, a6, a7, a8, a9,

            

Reported by FlawFinder.

snprintf - If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate
Security

Line: 522 Column: 5 CWE codes: 134
Suggestion: Use a constant for the format specification

              #  endif
#else
#  ifdef HAS_snprintf_void
    snprintf(next, state->size, format, a1, a2, a3, a4, a5, a6, a7, a8, a9,
             a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
    len = strlen(next);
#  else
    len = snprintf(next, state->size, format, a1, a2, a3, a4, a5, a6, a7, a8,
                   a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);

            

Reported by FlawFinder.

snprintf - If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate
Security

Line: 526 Column: 11 CWE codes: 134
Suggestion: Use a constant for the format specification

                           a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
    len = strlen(next);
#  else
    len = snprintf(next, state->size, format, a1, a2, a3, a4, a5, a6, a7, a8,
                   a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
#  endif
#endif

    /* check that printf() results fit in buffer */

            

Reported by FlawFinder.

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

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

                          copy = state->size - have;
            if (copy > len)
                copy = len;
            memcpy(state->in + have, buf, copy);
            state->strm.avail_in += copy;
            state->x.pos += copy;
            buf = (const char *)buf + copy;
            len -= copy;
            if (len && gz_comp(state, Z_NO_FLUSH) == -1)

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 309 Column: 14 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

                  int c;
{
    unsigned have;
    unsigned char buf[1];
    gz_statep state;
    z_streamp strm;

    /* get internal structure */
    if (file == NULL)

            

Reported by FlawFinder.

src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/PathList.py
15 issues
Redefining built-in 'type'
Error

Line: 109 Column: 17

                          try:
                found = '$' in p
            except (AttributeError, TypeError):
                type = TYPE_OBJECT
            else:
                if not found:
                    type = TYPE_STRING_NO_SUBST
                else:
                    type = TYPE_STRING_SUBST

            

Reported by Pylint.

Redefining built-in 'type'
Error

Line: 129 Column: 13

                      PathList for a specific target and source.
        """
        result = []
        for type, value in self.pathlist:
            if type == TYPE_STRING_SUBST:
                value = env.subst(value, target=target, source=source,
                                  conv=node_conv)
                if SCons.Util.is_Sequence(value):
                    result.extend(SCons.Util.flatten(value))

            

Reported by Pylint.

Module name "PathList" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              #
# Copyright (c) 2001 - 2019 The SCons Foundation
#
# 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

            

Reported by Pylint.

Line too long (114/100)
Error

Line: 24 Column: 1

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

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

__doc__ = """SCons.PathList

A module for handling lists of directory paths (the sort of things
that get set as CPPPATH, LIBPATH, etc.) with as much caching of data and

            

Reported by Pylint.

Class '_PathList' inherits from object, can be safely removed from bases in python3
Error

Line: 69 Column: 1

                      result = get()
    return result

class _PathList(object):
    """
    An actual PathList object.
    """
    def __init__(self, pathlist):
        """

            

Reported by Pylint.

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

Line: 104 Column: 9

                      elif not SCons.Util.is_Sequence(pathlist):
            pathlist = [pathlist]

        pl = []
        for p in pathlist:
            try:
                found = '$' in p
            except (AttributeError, TypeError):
                type = TYPE_OBJECT

            

Reported by Pylint.

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

Line: 105 Column: 13

                          pathlist = [pathlist]

        pl = []
        for p in pathlist:
            try:
                found = '$' in p
            except (AttributeError, TypeError):
                type = TYPE_OBJECT
            else:

            

Reported by Pylint.

More than one statement on a single line
Error

Line: 119 Column: 24

              
        self.pathlist = tuple(pl)

    def __len__(self): return len(self.pathlist)

    def __getitem__(self, i): return self.pathlist[i]

    def subst_path(self, env, target, source):
        """

            

Reported by Pylint.

More than one statement on a single line
Error

Line: 121 Column: 31

              
    def __len__(self): return len(self.pathlist)

    def __getitem__(self, i): return self.pathlist[i]

    def subst_path(self, env, target, source):
        """
        Performs construction variable substitution on a pre-digested
        PathList for a specific target and source.

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 146 Column: 1

                      return tuple(result)


class PathListCache(object):
    """
    A class to handle caching of PathList lookups.

    This class gets instantiated once and then deleted from the namespace,
    so it's used as a Singleton (although we don't enforce that in the

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_util19.py
15 issues
Unable to import 'wiredtiger'
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

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

# test_util19.py
#   Utilities: wt downgrade
class test_util19(wttest.WiredTigerTestCase, suite_subprocess):

            

Reported by Pylint.

An attribute defined in wttest line 401 hides this method
Error

Line: 63 Column: 5

              
    scenarios = make_scenarios(create_release, downgrade_release)

    def conn_config(self):
        conf_str = 'log=(archive=false,enabled,file_max=%s),' % self.log_max
        if (self.create_rel != 'none'):
            conf_str += 'compatibility=(release="%s"),' % (self.create_rel)
        return conf_str


            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

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

# test_util19.py
#   Utilities: wt downgrade
class test_util19(wttest.WiredTigerTestCase, suite_subprocess):

            

Reported by Pylint.

Anomalous backslash in string: '\.'. String constant might be missing an r prefix.
Error

Line: 90 Column: 37

                      self.runWt(['-C', wt_config , 'downgrade', downgrade_opt], reopensession=False, outfilename='downgrade.out')
        # Based on the downgrade version we can test if the corresponding log compatibility version
        # has been set.
        compat_str = '/WT_CONNECTION\.reconfigure: .*: COMPATIBILITY: Version now %d/' % self.log_downgrade_compat
        if self.log_downgrade_compat != self.log_latest_compat:
            self.check_file_contains('downgrade.out', compat_str)
        else:
            self.check_file_not_contains('downgrade.out', compat_str)


            

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.

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

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

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

# test_util19.py
#   Utilities: wt downgrade
class test_util19(wttest.WiredTigerTestCase, suite_subprocess):

            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

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

# test_util19.py
#   Utilities: wt downgrade
class test_util19(wttest.WiredTigerTestCase, suite_subprocess):

            

Reported by Pylint.

Missing class docstring
Error

Line: 35 Column: 1

              
# test_util19.py
#   Utilities: wt downgrade
class test_util19(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_util19.a'
    uri = 'table:' + tablename
    entries = 100
    log_max = "100K"
    log_latest_compat = 5

            

Reported by Pylint.

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

Line: 35 Column: 1

              
# test_util19.py
#   Utilities: wt downgrade
class test_util19(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_util19.a'
    uri = 'table:' + tablename
    entries = 100
    log_max = "100K"
    log_latest_compat = 5

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 63 Column: 5

              
    scenarios = make_scenarios(create_release, downgrade_release)

    def conn_config(self):
        conf_str = 'log=(archive=false,enabled,file_max=%s),' % self.log_max
        if (self.create_rel != 'none'):
            conf_str += 'compatibility=(release="%s"),' % (self.create_rel)
        return conf_str


            

Reported by Pylint.

src/mongo/db/exec/document_value/value.cpp
15 issues
memcpy - Does not check for buffer overflows when copying to destination
Security

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

              
        case jstOID:
            MONGO_STATIC_ASSERT(sizeof(_storage.oid) == OID::kOIDSize);
            memcpy(_storage.oid, elem.OID().view().view(), OID::kOIDSize);
            break;

        case Bool:
            _storage.boolValue = elem.boolean();
            break;

            

Reported by FlawFinder.

read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 1355 Column: 40 CWE codes: 120 20

              }

Value Value::deserializeForSorter(BufReader& buf, const SorterDeserializeSettings& settings) {
    const BSONType type = BSONType(buf.read<signed char>());  // need sign extension for MinKey
    switch (type) {
        // type-only types
        case EOO:
        case MinKey:
        case MaxKey:

            

Reported by FlawFinder.

read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 1369 Column: 30 CWE codes: 120 20

                      case jstOID:
            return Value(OID::from(buf.skip(OID::kOIDSize)));
        case NumberInt:
            return Value(buf.read<LittleEndian<int>>().value);
        case NumberLong:
            return Value(buf.read<LittleEndian<long long>>().value);
        case NumberDouble:
            return Value(buf.read<LittleEndian<double>>().value);
        case NumberDecimal: {

            

Reported by FlawFinder.

read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 1371 Column: 30 CWE codes: 120 20

                      case NumberInt:
            return Value(buf.read<LittleEndian<int>>().value);
        case NumberLong:
            return Value(buf.read<LittleEndian<long long>>().value);
        case NumberDouble:
            return Value(buf.read<LittleEndian<double>>().value);
        case NumberDecimal: {
            auto lo = buf.read<LittleEndian<std::uint64_t>>().value;
            auto hi = buf.read<LittleEndian<std::uint64_t>>().value;

            

Reported by FlawFinder.

read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 1373 Column: 30 CWE codes: 120 20

                      case NumberLong:
            return Value(buf.read<LittleEndian<long long>>().value);
        case NumberDouble:
            return Value(buf.read<LittleEndian<double>>().value);
        case NumberDecimal: {
            auto lo = buf.read<LittleEndian<std::uint64_t>>().value;
            auto hi = buf.read<LittleEndian<std::uint64_t>>().value;
            return Value(Decimal128{Decimal128::Value{lo, hi}});
        }

            

Reported by FlawFinder.

read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 1375 Column: 27 CWE codes: 120 20

                      case NumberDouble:
            return Value(buf.read<LittleEndian<double>>().value);
        case NumberDecimal: {
            auto lo = buf.read<LittleEndian<std::uint64_t>>().value;
            auto hi = buf.read<LittleEndian<std::uint64_t>>().value;
            return Value(Decimal128{Decimal128::Value{lo, hi}});
        }
        case Bool:
            return Value(bool(buf.read<char>()));

            

Reported by FlawFinder.

read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 1376 Column: 27 CWE codes: 120 20

                          return Value(buf.read<LittleEndian<double>>().value);
        case NumberDecimal: {
            auto lo = buf.read<LittleEndian<std::uint64_t>>().value;
            auto hi = buf.read<LittleEndian<std::uint64_t>>().value;
            return Value(Decimal128{Decimal128::Value{lo, hi}});
        }
        case Bool:
            return Value(bool(buf.read<char>()));
        case Date:

            

Reported by FlawFinder.

read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 1380 Column: 35 CWE codes: 120 20

                          return Value(Decimal128{Decimal128::Value{lo, hi}});
        }
        case Bool:
            return Value(bool(buf.read<char>()));
        case Date:
            return Value(Date_t::fromMillisSinceEpoch(buf.read<LittleEndian<long long>>().value));
        case bsonTimestamp:
            return Value(buf.read<Timestamp>());


            

Reported by FlawFinder.

read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 1382 Column: 59 CWE codes: 120 20

                      case Bool:
            return Value(bool(buf.read<char>()));
        case Date:
            return Value(Date_t::fromMillisSinceEpoch(buf.read<LittleEndian<long long>>().value));
        case bsonTimestamp:
            return Value(buf.read<Timestamp>());

        // types that are like strings
        case String:

            

Reported by FlawFinder.

read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 1384 Column: 30 CWE codes: 120 20

                      case Date:
            return Value(Date_t::fromMillisSinceEpoch(buf.read<LittleEndian<long long>>().value));
        case bsonTimestamp:
            return Value(buf.read<Timestamp>());

        // types that are like strings
        case String:
        case Symbol:
        case Code: {

            

Reported by FlawFinder.

src/third_party/s2/strings/strutil.cc
15 issues
snprintf - If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate
Security

Line: 66 Column: 3 CWE codes: 134
Suggestion: Use a constant for the format specification

              
string FloatToString(float f, const char* format) {
  char buf[80];
  snprintf(buf, sizeof(buf), format, f);
  return string(buf);
}

string IntToString(int i, const char* format) {
  char buf[80];

            

Reported by FlawFinder.

snprintf - If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate
Security

Line: 72 Column: 3 CWE codes: 134
Suggestion: Use a constant for the format specification

              
string IntToString(int i, const char* format) {
  char buf[80];
  snprintf(buf, sizeof(buf), format, i);
  return string(buf);
}

string Int64ToString(int64 i64, const char* format) {
  char buf[80];

            

Reported by FlawFinder.

snprintf - If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate
Security

Line: 78 Column: 3 CWE codes: 134
Suggestion: Use a constant for the format specification

              
string Int64ToString(int64 i64, const char* format) {
  char buf[80];
  snprintf(buf, sizeof(buf), format, i64);
  return string(buf);
}

string UInt64ToString(uint64 ui64, const char* format) {
  char buf[80];

            

Reported by FlawFinder.

snprintf - If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate
Security

Line: 84 Column: 3 CWE codes: 134
Suggestion: Use a constant for the format specification

              
string UInt64ToString(uint64 ui64, const char* format) {
  char buf[80];
  snprintf(buf, sizeof(buf), format, ui64);
  return string(buf);
}

// Default arguments
string FloatToString(float f)   { return FloatToString(f, "%7f"); }

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 59 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

              // ----------------------------------------------------------------------

string FpToString(Fprint fp) {
  char buf[17];
  snprintf(buf, sizeof(buf), "%016llx", fp);
  return string(buf);
}

string FloatToString(float f, const char* format) {

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 65 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

              }

string FloatToString(float f, const char* format) {
  char buf[80];
  snprintf(buf, sizeof(buf), format, f);
  return string(buf);
}

string IntToString(int i, const char* format) {

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 71 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

              }

string IntToString(int i, const char* format) {
  char buf[80];
  snprintf(buf, sizeof(buf), format, i);
  return string(buf);
}

string Int64ToString(int64 i64, const char* format) {

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 77 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

              }

string Int64ToString(int64 i64, const char* format) {
  char buf[80];
  snprintf(buf, sizeof(buf), format, i64);
  return string(buf);
}

string UInt64ToString(uint64 ui64, const char* format) {

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 83 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

              }

string UInt64ToString(uint64 ui64, const char* format) {
  char buf[80];
  snprintf(buf, sizeof(buf), format, ui64);
  return string(buf);
}

// Default arguments

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 131 Column: 14 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

              // Sigh, also not actually defined here, copied from:
// https://github.com/splitfeed/android-market-api-php/blob/master/proto/protoc-gen-php/strutil.cc

static const char two_ASCII_digits[100][2] = {
  {'0','0'}, {'0','1'}, {'0','2'}, {'0','3'}, {'0','4'},
  {'0','5'}, {'0','6'}, {'0','7'}, {'0','8'}, {'0','9'},
  {'1','0'}, {'1','1'}, {'1','2'}, {'1','3'}, {'1','4'},
  {'1','5'}, {'1','6'}, {'1','7'}, {'1','8'}, {'1','9'},
  {'2','0'}, {'2','1'}, {'2','2'}, {'2','3'}, {'2','4'},

            

Reported by FlawFinder.

src/third_party/wiredtiger/test/suite/test_tiered05.py
15 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 os, time, wiredtiger, wttest
from wiredtiger import stat
StorageSource = wiredtiger.StorageSource  # easy access to constants

# test_tiered05.py
#    Basic tiered storage API test error for tiered manager and flush_tier.

            

Reported by Pylint.

Unable to import 'wiredtiger'
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import os, time, wiredtiger, wttest
from wiredtiger import stat
StorageSource = wiredtiger.StorageSource  # easy access to constants

# test_tiered05.py
#    Basic tiered storage API test error for tiered manager and flush_tier.
class test_tiered05(wttest.WiredTigerTestCase):

            

Reported by Pylint.

An attribute defined in wttest line 401 hides this method
Error

Line: 50 Column: 5

                          extlist.skip_if_missing = True
        extlist.extension('storage_sources', self.extension_name)

    def conn_config(self):
        os.mkdir(self.bucket)
        return \
          'tiered_manager=(wait=%d),' % self.wait + \
          'tiered_storage=(auth_token=%s,' % self.auth_token + \
          'bucket=%s,' % self.bucket + \

            

Reported by Pylint.

Unused stat imported from wiredtiger
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import os, time, wiredtiger, wttest
from wiredtiger import stat
StorageSource = wiredtiger.StorageSource  # easy access to constants

# test_tiered05.py
#    Basic tiered storage API test error for tiered manager and flush_tier.
class test_tiered05(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Using deprecated method assertEquals()
Error

Line: 67 Column: 20

                      time.sleep(self.wait)
        msg = "/storage manager thread is configured/"
        self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
            lambda:self.assertEquals(self.session.flush_tier(None), 0), msg)

if __name__ == '__main__':
    wttest.run()

            

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, time, 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 os, time, wiredtiger, wttest
from wiredtiger import stat
StorageSource = wiredtiger.StorageSource  # easy access to constants

# test_tiered05.py
#    Basic tiered storage API test error for tiered manager and flush_tier.

            

Reported by Pylint.

Imports from package os are not grouped
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, time, wiredtiger, wttest
from wiredtiger import stat
StorageSource = wiredtiger.StorageSource  # easy access to constants

# test_tiered05.py
#    Basic tiered storage API test error for tiered manager and flush_tier.

            

Reported by Pylint.

third party import "from wiredtiger import stat" should be placed before "import os, time, wiredtiger, wttest"
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import os, time, wiredtiger, wttest
from wiredtiger import stat
StorageSource = wiredtiger.StorageSource  # easy access to constants

# test_tiered05.py
#    Basic tiered storage API test error for tiered manager and flush_tier.
class test_tiered05(wttest.WiredTigerTestCase):

            

Reported by Pylint.

Missing class docstring
Error

Line: 35 Column: 1

              
# test_tiered05.py
#    Basic tiered storage API test error for tiered manager and flush_tier.
class test_tiered05(wttest.WiredTigerTestCase):
    uri = "table:test_tiered05"

    auth_token = "test_token"
    bucket = "my_bucket"
    bucket_prefix = "my_prefix"

            

Reported by Pylint.

src/third_party/mozjs-60/include/mozilla/EndianUtils.h
15 issues
memcpy - Does not check for buffer overflows when copying to destination
Security

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

                  assertAligned(aSrc);

    if (SourceEndian == DestEndian) {
      memcpy(aDest, aSrc, aCount * sizeof(T));
      return;
    }

    uint8_t* byteDestPtr = static_cast<uint8_t*>(aDest);
    for (size_t i = 0; i < aCount; ++i) {

            

Reported by FlawFinder.

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

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

                      uint8_t mBuffer[sizeof(T)];
      } u;
      u.mVal = maybeSwap<SourceEndian, DestEndian>(aSrc[i]);
      memcpy(byteDestPtr, u.mBuffer, sizeof(T));
      byteDestPtr += sizeof(T);
    }
  }

  /**

            

Reported by FlawFinder.

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

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

                  assertAligned(aDest);

    if (SourceEndian == DestEndian) {
      memcpy(aDest, aSrc, aCount * sizeof(T));
      return;
    }

    const uint8_t* byteSrcPtr = static_cast<const uint8_t*>(aSrc);
    for (size_t i = 0; i < aCount; ++i) {

            

Reported by FlawFinder.

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

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

                      T mVal;
        uint8_t mBuffer[sizeof(T)];
      } u;
      memcpy(u.mBuffer, byteSrcPtr, sizeof(T));
      aDest[i] = maybeSwap<SourceEndian, DestEndian>(u.mVal);
      byteSrcPtr += sizeof(T);
    }
  }
};

            

Reported by FlawFinder.

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

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

                    T mVal;
      uint8_t mBuffer[sizeof(T)];
    } u;
    memcpy(u.mBuffer, aPtr, sizeof(T));
    return maybeSwap<ThisEndian, MOZ_NATIVE_ENDIANNESS>(u.mVal);
  }

  /**
   * Write a value of type T, in native endianness, to |aPtr|, in ThisEndian

            

Reported by FlawFinder.

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

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

                static void write(void* aPtr, T aValue)
  {
    T tmp = maybeSwap<MOZ_NATIVE_ENDIANNESS, ThisEndian>(aValue);
    memcpy(aPtr, &tmp, sizeof(T));
  }

  Endian() = delete;
  Endian(const Endian& aTther) = delete;
  void operator=(const Endian& aOther) = delete;

            

Reported by FlawFinder.

read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 351 Column: 12 CWE codes: 120 20

                /** Read a uint16_t in ThisEndian endianness from |aPtr| and return it. */
  static MOZ_MUST_USE uint16_t readUint16(const void* aPtr)
  {
    return read<uint16_t>(aPtr);
  }

  /** Read a uint32_t in ThisEndian endianness from |aPtr| and return it. */
  static MOZ_MUST_USE uint32_t readUint32(const void* aPtr)
  {

            

Reported by FlawFinder.

read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 357 Column: 12 CWE codes: 120 20

                /** Read a uint32_t in ThisEndian endianness from |aPtr| and return it. */
  static MOZ_MUST_USE uint32_t readUint32(const void* aPtr)
  {
    return read<uint32_t>(aPtr);
  }

  /** Read a uint64_t in ThisEndian endianness from |aPtr| and return it. */
  static MOZ_MUST_USE uint64_t readUint64(const void* aPtr)
  {

            

Reported by FlawFinder.

read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 363 Column: 12 CWE codes: 120 20

                /** Read a uint64_t in ThisEndian endianness from |aPtr| and return it. */
  static MOZ_MUST_USE uint64_t readUint64(const void* aPtr)
  {
    return read<uint64_t>(aPtr);
  }

  /** Read a uintptr_t in ThisEndian endianness from |aPtr| and return it. */
  static MOZ_MUST_USE uintptr_t readUintptr(const void* aPtr)
  {

            

Reported by FlawFinder.

read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 369 Column: 12 CWE codes: 120 20

                /** Read a uintptr_t in ThisEndian endianness from |aPtr| and return it. */
  static MOZ_MUST_USE uintptr_t readUintptr(const void* aPtr)
  {
    return read<uintptr_t>(aPtr);
  }

  /** Read an int16_t in ThisEndian endianness from |aPtr| and return it. */
  static MOZ_MUST_USE int16_t readInt16(const void* aPtr)
  {

            

Reported by FlawFinder.