The following issues were found

src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/matchers/_impl.py
9 issues
method already defined line 125
Error

Line: 144 Column: 9

              
        __unicode__ = __str__

        def __str__(self):
            return self.__unicode__().encode("ascii", "backslashreplace")


class MismatchDecorator(object):
    """Decorate a ``Mismatch``.

            

Reported by Pylint.

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

Line: 83 Column: 13

                      try:
            return self._description
        except AttributeError:
            raise NotImplementedError(self.describe)

    def get_details(self):
        """Get extra details about the mismatch.

        This allows the mismatch to provide extra information beyond the basic

            

Reported by Pylint.

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

Line: 28 Column: 1

                  )


class Matcher(object):
    """A pattern matcher.

    A Matcher must implement match and __str__ to be used by
    testtools.TestCase.assertThat. Matcher.match(thing) returns None when
    thing is completely matched, and a Mismatch object otherwise.

            

Reported by Pylint.

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

Line: 56 Column: 1

                      raise NotImplementedError(self.__str__)


class Mismatch(object):
    """An object describing a mismatch detected by a Matcher."""

    def __init__(self, description=None, details=None):
        """Construct a `Mismatch`.


            

Reported by Pylint.

Unnecessary "else" after "return"
Error

Line: 127 Column: 9

              
    def __str__(self):
        difference = self.mismatch.describe()
        if self.verbose:
            # GZ 2011-08-24: Smelly API? Better to take any object and special
            #                case text inside?
            if istext(self.matchee) or _isbytes(self.matchee):
                matchee = text_repr(self.matchee, multiline=False)
            else:

            

Reported by Pylint.

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

Line: 148 Column: 1

                          return self.__unicode__().encode("ascii", "backslashreplace")


class MismatchDecorator(object):
    """Decorate a ``Mismatch``.

    Forwards all messages to the original mismatch object.  Probably the best
    way to use this is inherit from this class and then provide your own
    custom decoration logic.

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 166 Column: 5

                  def __repr__(self):
        return '<testtools.matchers.MismatchDecorator(%r)>' % (self.original,)

    def describe(self):
        return self.original.describe()

    def get_details(self):
        return self.original.get_details()


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 169 Column: 5

                  def describe(self):
        return self.original.describe()

    def get_details(self):
        return self.original.get_details()


# Signal that this is part of the testing framework, and that code from this
# should not normally appear in tracebacks.

            

Reported by Pylint.

Constant name "__unittest" doesn't conform to UPPER_CASE naming style
Error

Line: 175 Column: 1

              
# Signal that this is part of the testing framework, and that code from this
# should not normally appear in tracebacks.
__unittest = True

            

Reported by Pylint.

src/third_party/timelib-2021.06/timelib.c
9 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 38 Column: 7 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

              
#define TIMELIB_LLABS(y) (y < 0 ? (y * -1) : y)

const char *timelib_error_messages[10] = {
	"No error",
	"Can not allocate buffer for parsing",
	"Corrupt tzfile: The transitions in the file don't always increase",
	"Corrupt tzfile: The expected 64-bit preamble is missing",
	"Corrupt tzfile: No abbreviation could be found for a transition",

            

Reported by FlawFinder.

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

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

              timelib_time* timelib_time_clone(timelib_time *orig)
{
	timelib_time *tmp = timelib_time_ctor();
	memcpy(tmp, orig, sizeof(timelib_time));
	if (orig->tz_abbr) {
		tmp->tz_abbr = timelib_strdup(orig->tz_abbr);
	}
	if (orig->tz_info) {
		tmp->tz_info = orig->tz_info;

            

Reported by FlawFinder.

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

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

              timelib_rel_time* timelib_rel_time_clone(timelib_rel_time *rel)
{
	timelib_rel_time *tmp = timelib_rel_time_ctor();
	memcpy(tmp, rel, sizeof(timelib_rel_time));
	return tmp;
}

void timelib_time_tz_abbr_update(timelib_time* tm, const char* tz_abbr)
{

            

Reported by FlawFinder.

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

Line: 215 Column: 23 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

              	return (h * SECS_PER_HOUR) + (m * 60) + s;
}

static const unsigned char timelib_tolower_map[256] = {
	0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
	0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
	0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
	0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
	0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,

            

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: 124 Column: 23 CWE codes: 126

              void timelib_time_tz_abbr_update(timelib_time* tm, const char* tz_abbr)
{
	unsigned int i;
	size_t tz_abbr_len = strlen(tz_abbr);

	TIMELIB_TIME_FREE(tm->tz_abbr);
	tm->tz_abbr = timelib_strdup(tz_abbr);
	for (i = 0; i < tz_abbr_len; i++) {
		tm->tz_abbr[i] = toupper(tz_abbr[i]);

            

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: 243 Column: 16 CWE codes: 126

              int timelib_strcasecmp(const char *s1, const char *s2)
{
	size_t len;
	size_t len1 = strlen(s1);
	size_t len2 = strlen(s2);
	int c1, c2;

	if (s1 == s2) {
		return 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: 244 Column: 16 CWE codes: 126

              {
	size_t len;
	size_t len1 = strlen(s1);
	size_t len2 = strlen(s2);
	int c1, c2;

	if (s1 == s2) {
		return 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: 266 Column: 16 CWE codes: 126

              int timelib_strncasecmp(const char *s1, const char *s2, size_t length)
{
	size_t len;
	size_t len1 = strlen(s1);
	size_t len2 = strlen(s2);
	int c1, c2;

	if (s1 == s2) {
		return 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: 267 Column: 16 CWE codes: 126

              {
	size_t len;
	size_t len1 = strlen(s1);
	size_t len2 = strlen(s2);
	int c1, c2;

	if (s1 == s2) {
		return 0;
	}

            

Reported by FlawFinder.

src/third_party/unwind/dist/src/dwarf/Gfind_proc_info-lsb.c
9 issues
Uninitialized variable: table_size
Error

Line: 825 CWE codes: 908

                             unw_word_t table, size_t table_size, int32_t rel_ip,
               struct table_entry *e, int32_t *last_ip_offset, void *arg)
{
  unsigned long table_len = table_size / sizeof (struct table_entry);
  unw_accessors_t *a = unw_get_accessors_int (as);
  unsigned long lo, hi, mid;
  unw_word_t e_addr = 0;
  int32_t start = 0;
  int ret;

            

Reported by Cppcheck.

Uninitialized variable: table_len
Error

Line: 934 CWE codes: 908

              #ifndef UNW_LOCAL_ONLY
      int32_t last_ip_offset = di->end_ip - ip_base;
      segbase = di->u.rti.segbase;
      if ((ret = remote_lookup (as, (uintptr_t) table, table_len,
                                ip - ip_base, &ent, &last_ip_offset, arg)) < 0)
        return ret;
      if (ret)
	{
	  e = &ent;

            

Reported by Cppcheck.

Uninitialized variable: table
Error

Line: 934 CWE codes: 908

              #ifndef UNW_LOCAL_ONLY
      int32_t last_ip_offset = di->end_ip - ip_base;
      segbase = di->u.rti.segbase;
      if ((ret = remote_lookup (as, (uintptr_t) table, table_len,
                                ip - ip_base, &ent, &last_ip_offset, arg)) < 0)
        return ret;
      if (ret)
	{
	  e = &ent;

            

Reported by Cppcheck.

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

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

                    *bufsize = shdr->sh_size;
      GET_MEMORY(*buf, *bufsize);

      memcpy(*buf, shdr->sh_offset + ei.image, *bufsize);

      Debug (4, "read %zd bytes of .debug_frame from offset %zd\n",
	     *bufsize, shdr->sh_offset);
#if defined(SHF_COMPRESSED)
    }

            

Reported by FlawFinder.

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

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

              
        if (len + 1 <= name_size)
          {
            memcpy (name, mi.path, len + 1);
            found = 1;
          }
        break;
      }
  maps_close (&mi);

            

Reported by FlawFinder.

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

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

                                 unw_word_t start, unw_word_t end)
{
  struct unw_debug_frame_list *w, *fdesc = 0;
  char path[PATH_MAX];
  char *name = path;
  int err;
  char *buf;
  size_t bufsize;


            

Reported by FlawFinder.

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

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

                Elf_W (Addr) eh_frame = 0;
  Elf_W (Shdr)* shdr;
  const char *file = info->dlpi_name;
  char exepath[PATH_MAX];

  if (strlen(file) == 0)
    {
      tdep_get_exe_image_path(exepath);
      file = exepath;

            

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: 199 Column: 22 CWE codes: 126

                while (maps_next (&mi, &segbase, &hi, &mapoff))
    if (ip >= segbase && ip < hi)
      {
        size_t len = strlen (mi.path);

        if (len + 1 <= name_size)
          {
            memcpy (name, mi.path, len + 1);
            found = 1;

            

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: 486 Column: 7 CWE codes: 126

                const char *file = info->dlpi_name;
  char exepath[PATH_MAX];

  if (strlen(file) == 0)
    {
      tdep_get_exe_image_path(exepath);
      file = exepath;
    }


            

Reported by FlawFinder.

buildscripts/idl/idl/generator.py
9 issues
Attempted relative import beyond top-level package
Error

Line: 40 Column: 1

              from abc import ABCMeta, abstractmethod
from typing import Dict, Iterable, List, Mapping, Tuple, Union

from . import (ast, bson, common, cpp_types, enum_types, generic_field_list_types, struct_types,
               writer)


def _get_field_member_name(field):
    # type: (ast.Field) -> str

            

Reported by Pylint.

Use of insecure MD2, MD4, MD5, or SHA1 hash function.
Security blacklist

Line: 2368
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b303-md5

                                  self._writer.write_line(
                        '%s %s%s;' % (param.cpp_vartype, param.cpp_varname, init))

        blockname = 'idl_' + hashlib.sha1(header_file_name.encode()).hexdigest()
        with self._block('MONGO_SERVER_PARAMETER_REGISTER(%s)(InitializerContext*) {' % (blockname),
                         '}'):
            # ServerParameter instances.
            for param_no, param in enumerate(params):
                self.gen_description_comment(param.description)

            

Reported by Bandit.

Use of insecure MD2, MD4, MD5, or SHA1 hash function.
Security blacklist

Line: 2537
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b303-md5

              
        # pylint: disable=consider-using-ternary
        blockname = (initializer and initializer.name) or (
            'idl_' + hashlib.sha1(header_file_name.encode()).hexdigest())

        if initializer and initializer.register:
            with self._block(
                    'Status %s(optionenvironment::OptionSection* options_ptr) {' %
                    initializer.register, '}'):

            

Reported by Bandit.

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

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

                  def gen_validators(self, field):
        # type: (ast.Field) -> None
        """Generate the C++ validators definition for a field."""
        assert field.validator

        cpp_type_info = cpp_types.get_cpp_type_without_optional(field)
        param_type = cpp_type_info.get_storage_type()

        if not cpp_types.is_primitive_type(param_type):

            

Reported by Bandit.

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

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

                          method_name = writer.get_method_name(ast_type.deserializer)
            return '%s.%s()' % (element_name, method_name)

        assert not ast_type.is_variant

        # Custom method, call the method on object.
        bson_cpp_type = cpp_types.get_bson_cpp_type(ast_type)

        if bson_cpp_type:

            

Reported by Bandit.

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

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

                                                          method_name=method_name, expression=expression)

            # BSONObjects are allowed to be pass through without deserialization
            assert ast_type.bson_serialization_type == ['object']
            return expression

        # Call a static class method with the signature:
        # Class Class::method(const BSONElement& value)
        method_name = writer.get_method_name_from_qualified_method_name(ast_type.deserializer)

            

Reported by Bandit.

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

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

                  def _gen_array_deserializer(self, field, bson_element, ast_type):
        # type: (ast.Field, str, ast.Type) -> None
        """Generate the C++ deserializer piece for an array field."""
        assert ast_type.is_array
        cpp_type_info = cpp_types.get_cpp_type_from_cpp_type_name(field, ast_type.cpp_type, True)
        cpp_type = cpp_type_info.get_type_name()

        self._writer.write_line('std::uint32_t expectedFieldNumber{0};')
        self._writer.write_line(

            

Reported by Bandit.

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

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

                                                      (_get_field_constant_name(field)))
                array_value = '%s::parse(tempContext, sequenceObject)' % (field.type.cpp_type, )
            else:
                assert field.type.bson_serialization_type == ['object']
                if field.type.deserializer:
                    array_value = '%s(sequenceObject)' % (field.type.deserializer)
                else:
                    array_value = "sequenceObject"


            

Reported by Bandit.

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

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

                                  self._writer.write_line(
                        '%s object(localNS);' % (common.title_case(struct.cpp_name)))
                else:
                    assert False, "Missing case"
            else:
                self._writer.write_line('auto object = mongo::idl::preparsedValue<%s>();' %
                                        common.title_case(struct.cpp_name))

            self._writer.write_line(method_info.get_call('object'))

            

Reported by Bandit.

src/third_party/mozjs-60/extract/js/src/vm/Interpreter.cpp
9 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 4302 Column: 5 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              
DEFAULT()
{
    char numBuf[12];
    SprintfLiteral(numBuf, "%d", *REGS.pc);
    JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_BAD_BYTECODE, numBuf);
    goto error;
}


            

Reported by FlawFinder.

equal - Function does not check the second iterator for over-read conditions
Security

Line: 784 Column: 77 CWE codes: 126
Suggestion: This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it

              }

static inline bool
EqualGivenSameType(JSContext* cx, HandleValue lval, HandleValue rval, bool* equal)
{
    MOZ_ASSERT(SameType(lval, rval));

    if (lval.isString())
        return EqualStrings(cx, lval.toString(), rval.toString(), equal);

            

Reported by FlawFinder.

equal - Function does not check the second iterator for over-read conditions
Security

Line: 789 Column: 67 CWE codes: 126
Suggestion: This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it

                  MOZ_ASSERT(SameType(lval, rval));

    if (lval.isString())
        return EqualStrings(cx, lval.toString(), rval.toString(), equal);
    if (lval.isDouble()) {
        *equal = (lval.toDouble() == rval.toDouble());
        return true;
    }
    if (lval.isGCThing()) {  // objects or symbols

            

Reported by FlawFinder.

equal - Function does not check the second iterator for over-read conditions
Security

Line: 799 Column: 57 CWE codes: 126
Suggestion: This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it

                      return true;
    }
    *equal = lval.get().payloadAsRawUint32() == rval.get().payloadAsRawUint32();
    MOZ_ASSERT_IF(lval.isUndefined() || lval.isNull(), *equal);
    return true;
}

static inline bool
LooselyEqualBooleanAndOther(JSContext* cx, HandleValue lval, HandleValue rval, bool* result)

            

Reported by FlawFinder.

equal - Function does not check the second iterator for over-read conditions
Security

Line: 903 Column: 76 CWE codes: 126
Suggestion: This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it

              }

bool
js::StrictlyEqual(JSContext* cx, HandleValue lval, HandleValue rval, bool* equal)
{
    if (SameType(lval, rval))
        return EqualGivenSameType(cx, lval, rval, equal);

    if (lval.isNumber() && rval.isNumber()) {

            

Reported by FlawFinder.

equal - Function does not check the second iterator for over-read conditions
Security

Line: 906 Column: 51 CWE codes: 126
Suggestion: This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it

              js::StrictlyEqual(JSContext* cx, HandleValue lval, HandleValue rval, bool* equal)
{
    if (SameType(lval, rval))
        return EqualGivenSameType(cx, lval, rval, equal);

    if (lval.isNumber() && rval.isNumber()) {
        *equal = (lval.toNumber() == rval.toNumber());
        return true;
    }

            

Reported by FlawFinder.

equal - Function does not check the second iterator for over-read conditions
Security

Line: 2463 Column: 14 CWE codes: 126
Suggestion: This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it

                  JS_BEGIN_MACRO                                                            \
        HandleValue lval = REGS.stackHandleAt(-2);                            \
        HandleValue rval = REGS.stackHandleAt(-1);                            \
        bool equal;                                                           \
        if (!StrictlyEqual(cx, lval, rval, &equal))                           \
            goto error;                                                       \
        (COND) = equal OP true;                                               \
        REGS.sp--;                                                            \
    JS_END_MACRO

            

Reported by FlawFinder.

equal - Function does not check the second iterator for over-read conditions
Security

Line: 2464 Column: 45 CWE codes: 126
Suggestion: This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it

                      HandleValue lval = REGS.stackHandleAt(-2);                            \
        HandleValue rval = REGS.stackHandleAt(-1);                            \
        bool equal;                                                           \
        if (!StrictlyEqual(cx, lval, rval, &equal))                           \
            goto error;                                                       \
        (COND) = equal OP true;                                               \
        REGS.sp--;                                                            \
    JS_END_MACRO


            

Reported by FlawFinder.

equal - Function does not check the second iterator for over-read conditions
Security

Line: 2466 Column: 18 CWE codes: 126
Suggestion: This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it

                      bool equal;                                                           \
        if (!StrictlyEqual(cx, lval, rval, &equal))                           \
            goto error;                                                       \
        (COND) = equal OP true;                                               \
        REGS.sp--;                                                            \
    JS_END_MACRO

CASE(JSOP_STRICTEQ)
{

            

Reported by FlawFinder.

src/third_party/mozjs-60/extract/js/src/vm/Debugger.cpp
9 issues
There is an unknown macro here somewhere. Configuration is required. If JS_PUBLIC_API is a macro then please configure it.
Error

Line: 11588

                  return true;
}

JS_PUBLIC_API(bool)
JS::dbg::IsDebugger(JSObject& obj)
{
    JSObject* unwrapped = CheckedUnwrap(&obj);
    return unwrapped &&
           js::GetObjectClass(unwrapped) == &Debugger::class_ &&

            

Reported by Cppcheck.

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

Line: 377 Column: 17 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

                                  DumpBacktrace(cx);
                }
                const char* filename = script->filename() ? script->filename() : "(none)";
                char linenoStr[15];
                SprintfLiteral(linenoStr, "%zu", script->lineno());
                unsigned flags = warning ? JSREPORT_WARNING : JSREPORT_ERROR;
                // FIXME: filename should be UTF-8 (bug 987069).
                return JS_ReportErrorFlagsAndNumberLatin1(cx, flags, GetErrorMessage, nullptr,
                                                          JSMSG_DEBUGGEE_WOULD_RUN,

            

Reported by FlawFinder.

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

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

                  if (!arr)
        return false;
    if (bytecode)
        memcpy(arr->as<TypedArrayObject>().viewDataUnshared(), bytecode->begin(), arrLength);

    args.rval().setObject(*arr);
    return true;
}


            

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: 1731 Column: 38 CWE codes: 126

                                  MutableHandleValue rval)
{
    rval.setUndefined();
    JSAtom* atom = Atomize(cx, name, strlen(name));
    if (!atom)
        return false;

    RootedId id(cx, AtomToId(atom));
    RootedValue fval(cx);

            

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: 8328 Column: 34 CWE codes: 126

                      MOZ_CRASH("bad DebuggerFrameImplementation value");
    }

    JSAtom* str = Atomize(cx, s, strlen(s));
    if (!str)
        return false;

    args.rval().setString(str);
    return true;

            

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: 10022 Column: 42 CWE codes: 126

                      className = GetObjectClassName(cx, referent);
    }

    JSAtom* str = Atomize(cx, className, strlen(className));
    if (!str)
        return false;

    result.set(str);
    return true;

            

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: 10961 Column: 34 CWE codes: 126

                      break;
    }

    JSAtom* str = Atomize(cx, s, strlen(s), PinAtom);
    if (!str)
        return false;

    args.rval().setString(str);
    return true;

            

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: 11446 Column: 38 CWE codes: 126

                  // We should have checked for false Objects before calling this.
    MOZ_ASSERT(value);

    JSAtom* atom = Atomize(cx, name, strlen(name));
    if (!atom)
        return false;
    RootedId id(cx, AtomToId(atom));

    return DefineDataProperty(cx, value, id, trusted);

            

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: 11676 Column: 48 CWE codes: 126

              {
    RootedValue val(cx, UndefinedValue());
    if (strVal) {
        JSAtom* atomized = Atomize(cx, strVal, strlen(strVal));
        if (!atomized)
            return false;
        val = StringValue(atomized);
    }
    return DefineDataProperty(cx, obj, propName, val);

            

Reported by FlawFinder.

src/third_party/wiredtiger/test/suite/test_timestamp16.py
9 issues
Unable to import 'wiredtiger'
Error

Line: 36 Column: 1

              
import random
from suite_subprocess import suite_subprocess
import wiredtiger, wttest

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

            

Reported by Pylint.

Unused import random
Error

Line: 34 Column: 1

              #   end of a txn.
#

import random
from suite_subprocess import suite_subprocess
import wiredtiger, wttest

class test_timestamp16(wttest.WiredTigerTestCase, suite_subprocess):
    tablename = 'test_timestamp16'

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 36 Column: 1

              
import random
from suite_subprocess import suite_subprocess
import wiredtiger, wttest

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

            

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: 36 Column: 1

              
import random
from suite_subprocess import suite_subprocess
import wiredtiger, wttest

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

            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 36 Column: 1

              
import random
from suite_subprocess import suite_subprocess
import wiredtiger, wttest

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

            

Reported by Pylint.

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

Line: 38 Column: 1

              from suite_subprocess import suite_subprocess
import wiredtiger, wttest

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

    def test_read_timestamp_cleared(self):

            

Reported by Pylint.

Missing class docstring
Error

Line: 38 Column: 1

              from suite_subprocess import suite_subprocess
import wiredtiger, wttest

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

    def test_read_timestamp_cleared(self):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 43 Column: 5

                  uri = 'table:' + tablename
    session_config = 'isolation=snapshot'

    def test_read_timestamp_cleared(self):
        # Ensure that the read timestamp doesn't move our checkpoint.
        self.session.create(self.uri, 'key_format=i,value_format=i')
        self.session.begin_transaction('read_timestamp=100')
        self.session.rollback_transaction()
        self.session.checkpoint('use_timestamp=true')

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_timestamp17.py
9 issues
Unable to import 'wiredtiger'
Error

Line: 38 Column: 1

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

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

            

Reported by Pylint.

Unused import random
Error

Line: 36 Column: 1

              #   moved.
#

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

class test_timestamp17(wttest.WiredTigerTestCase, suite_subprocess):

            

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: 38 Column: 1

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

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

            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 38 Column: 1

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

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

            

Reported by Pylint.

Missing class docstring
Error

Line: 41 Column: 1

              import wiredtiger, wttest
from wtscenario import make_scenarios

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

    key_format_values = [

            

Reported by Pylint.

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

Line: 41 Column: 1

              import wiredtiger, wttest
from wtscenario import make_scenarios

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

    key_format_values = [

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 52 Column: 5

                  ]
    scenarios = make_scenarios(key_format_values)

    def test_inconsistent_timestamping(self):
        self.session.create(self.uri, 'key_format={},value_format=i'.format(self.key_format))
        self.session.begin_transaction()
        cur1 = self.session.open_cursor(self.uri)
        cur1[1] = 1
        self.session.commit_transaction('commit_timestamp=25')

            

Reported by Pylint.

Too many statements (88/50)
Error

Line: 52 Column: 5

                  ]
    scenarios = make_scenarios(key_format_values)

    def test_inconsistent_timestamping(self):
        self.session.create(self.uri, 'key_format={},value_format=i'.format(self.key_format))
        self.session.begin_transaction()
        cur1 = self.session.open_cursor(self.uri)
        cur1[1] = 1
        self.session.commit_transaction('commit_timestamp=25')

            

Reported by Pylint.

src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/setup.py
9 issues
Module 'email' has no 'MessageError' member
Error

Line: 33 Column: 12

                      return None
    try:
        pkg_info = email.message_from_file(pkg_info_file)
    except email.MessageError:
        return None
    return pkg_info.get('Version', None)


def get_version():

            

Reported by Pylint.

standard import "from distutils.command.build_py import build_py" should be placed before "from setuptools import setup"
Error

Line: 5 Column: 1

              """Distutils installer for testtools."""

from setuptools import setup
from distutils.command.build_py import build_py
import email
import os
import sys

import testtools

            

Reported by Pylint.

standard import "import email" should be placed before "from setuptools import setup"
Error

Line: 6 Column: 1

              
from setuptools import setup
from distutils.command.build_py import build_py
import email
import os
import sys

import testtools
cmd_class = {}

            

Reported by Pylint.

standard import "import os" should be placed before "from setuptools import setup"
Error

Line: 7 Column: 1

              from setuptools import setup
from distutils.command.build_py import build_py
import email
import os
import sys

import testtools
cmd_class = {}
if getattr(testtools, 'TestCommand', None) is not None:

            

Reported by Pylint.

standard import "import sys" should be placed before "from setuptools import setup"
Error

Line: 8 Column: 1

              from distutils.command.build_py import build_py
import email
import os
import sys

import testtools
cmd_class = {}
if getattr(testtools, 'TestCommand', None) is not None:
    cmd_class['test'] = testtools.TestCommand

            

Reported by Pylint.

Missing class docstring
Error

Line: 16 Column: 1

                  cmd_class['test'] = testtools.TestCommand


class testtools_build_py(build_py):
    def build_module(self, module, module_file, package):
        if sys.version_info >= (3,) and module == '_compat2x':
            return
        return build_py.build_module(self, module, module_file, package)
cmd_class['build_py'] = testtools_build_py

            

Reported by Pylint.

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

Line: 16 Column: 1

                  cmd_class['test'] = testtools.TestCommand


class testtools_build_py(build_py):
    def build_module(self, module, module_file, package):
        if sys.version_info >= (3,) and module == '_compat2x':
            return
        return build_py.build_module(self, module, module_file, package)
cmd_class['build_py'] = testtools_build_py

            

Reported by Pylint.

Either all return statements in a function should return an expression, or none of them should.
Error

Line: 17 Column: 5

              

class testtools_build_py(build_py):
    def build_module(self, module, module_file, package):
        if sys.version_info >= (3,) and module == '_compat2x':
            return
        return build_py.build_module(self, module, module_file, package)
cmd_class['build_py'] = testtools_build_py


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 54 Column: 1

                  return "snapshot-%s" % (version,)


def get_long_description():
    manual_path = os.path.join(
        os.path.dirname(__file__), 'doc/overview.rst')
    return open(manual_path).read()



            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_hs04.py
9 issues
Unable to import 'wiredtiger'
Error

Line: 33 Column: 1

              #   Test file_max configuration and reconfiguration for the history store table.
#

import wiredtiger, wttest
from wtscenario import make_scenarios

# Taken from src/include/misc.h.
WT_MB = 1048576


            

Reported by Pylint.

An attribute defined in wttest line 401 hides this method
Error

Line: 60 Column: 5

                  scenarios = make_scenarios(init_file_max_values, reconfig_file_max_values,
                               in_memory_values)

    def conn_config(self):
        config = 'statistics=(fast)'
        if self.init_file_max is not None:
            config += ',history_store=(file_max={})'.format(self.init_file_max)
        if self.in_memory is not None:
            config += ',in_memory=' + ('true' if self.in_memory else 'false')

            

Reported by Pylint.

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: 33 Column: 1

              #   Test file_max configuration and reconfiguration for the history store table.
#

import wiredtiger, wttest
from wtscenario import make_scenarios

# Taken from src/include/misc.h.
WT_MB = 1048576


            

Reported by Pylint.

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

Line: 39 Column: 1

              # Taken from src/include/misc.h.
WT_MB = 1048576

class test_hs04(wttest.WiredTigerTestCase):
    uri = 'table:hs_04'
    in_memory_values = [
        ('false', dict(in_memory=False)),
        ('none', dict(in_memory=None)),
        ('true', dict(in_memory=True))

            

Reported by Pylint.

Missing class docstring
Error

Line: 39 Column: 1

              # Taken from src/include/misc.h.
WT_MB = 1048576

class test_hs04(wttest.WiredTigerTestCase):
    uri = 'table:hs_04'
    in_memory_values = [
        ('false', dict(in_memory=False)),
        ('none', dict(in_memory=None)),
        ('true', dict(in_memory=True))

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 60 Column: 5

                  scenarios = make_scenarios(init_file_max_values, reconfig_file_max_values,
                               in_memory_values)

    def conn_config(self):
        config = 'statistics=(fast)'
        if self.init_file_max is not None:
            config += ',history_store=(file_max={})'.format(self.init_file_max)
        if self.in_memory is not None:
            config += ',in_memory=' + ('true' if self.in_memory else 'false')

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 68 Column: 5

                          config += ',in_memory=' + ('true' if self.in_memory else 'false')
        return config

    def get_stat(self, stat):
        stat_cursor = self.session.open_cursor('statistics:')
        val = stat_cursor[stat][2]
        stat_cursor.close()
        return val


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 74 Column: 5

                      stat_cursor.close()
        return val

    def test_hs(self):
        self.session.create(self.uri, 'key_format=S,value_format=S')

        if self.in_memory:
            # For in-memory configurations, we simply ignore any history store
            # related configuration.

            

Reported by Pylint.