The following issues were found

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

Line: 35 Column: 1

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

class test_timestamp05(wttest.WiredTigerTestCase, suite_subprocess):
    uri = 'table:ts05'
    session_config = 'isolation=snapshot'

            

Reported by Pylint.

Unused import random
Error

Line: 33 Column: 1

              #   Timestamps: make sure they don't end up in metadata
#

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

class test_timestamp05(wttest.WiredTigerTestCase, suite_subprocess):

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 35 Column: 1

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

class test_timestamp05(wttest.WiredTigerTestCase, suite_subprocess):
    uri = 'table:ts05'
    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: 35 Column: 1

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

class test_timestamp05(wttest.WiredTigerTestCase, suite_subprocess):
    uri = 'table:ts05'
    session_config = 'isolation=snapshot'

            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 35 Column: 1

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

class test_timestamp05(wttest.WiredTigerTestCase, suite_subprocess):
    uri = 'table:ts05'
    session_config = 'isolation=snapshot'

            

Reported by Pylint.

Missing class docstring
Error

Line: 38 Column: 1

              import wiredtiger, wttest
from wtscenario import make_scenarios

class test_timestamp05(wttest.WiredTigerTestCase, suite_subprocess):
    uri = 'table:ts05'
    session_config = 'isolation=snapshot'

    key_format_values = [
        ('integer-row', dict(key_format='i')),

            

Reported by Pylint.

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

Line: 38 Column: 1

              import wiredtiger, wttest
from wtscenario import make_scenarios

class test_timestamp05(wttest.WiredTigerTestCase, suite_subprocess):
    uri = 'table:ts05'
    session_config = 'isolation=snapshot'

    key_format_values = [
        ('integer-row', dict(key_format='i')),

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 48 Column: 5

                  ]
    scenarios = make_scenarios(key_format_values)

    def test_create(self):
        s = self.session
        conn = self.conn

        # Start timestamps at 50
        conn.set_timestamp('oldest_timestamp=50,stable_timestamp=50')

            

Reported by Pylint.

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

Line: 49 Column: 9

                  scenarios = make_scenarios(key_format_values)

    def test_create(self):
        s = self.session
        conn = self.conn

        # Start timestamps at 50
        conn.set_timestamp('oldest_timestamp=50,stable_timestamp=50')


            

Reported by Pylint.

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_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/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.

src/third_party/wiredtiger/test/3rdparty/python-subunit-0.0.16/python/subunit/filters.py
15 issues
Unable to import 'extras'
Error

Line: 20 Column: 1

              from optparse import OptionParser
import sys

from extras import safe_hasattr
from testtools import CopyStreamResult, StreamResult, StreamResultRouter

from subunit import (
    DiscardStream, ProtocolTestCase, ByteStreamToStreamResult,
    StreamResultToBytes,

            

Reported by Pylint.

Unable to import 'testtools'
Error

Line: 21 Column: 1

              import sys

from extras import safe_hasattr
from testtools import CopyStreamResult, StreamResult, StreamResultRouter

from subunit import (
    DiscardStream, ProtocolTestCase, ByteStreamToStreamResult,
    StreamResultToBytes,
    )

            

Reported by Pylint.

Undefined variable 'file'
Error

Line: 146 Column: 21

                  if output_path is None:
        output_to = sys.stdout
    else:
        output_to = file(output_path, 'wb')

    try:
        result = result_factory(output_to)
        run_tests_from_stream(
            input_stream, result, passthrough_stream, forward_stream,

            

Reported by Pylint.

Uses of a deprecated module 'optparse'
Error

Line: 17 Column: 1

              #


from optparse import OptionParser
import sys

from extras import safe_hasattr
from testtools import CopyStreamResult, StreamResult, StreamResultRouter


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #  subunit: extensions to python unittest to get test results from subprocesses.
#  Copyright (C) 2009  Robert Collins <robertc@robertcollins.net>
#
#  Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
#  license at the users choice. A copy of both licenses are available in the
#  project source as Apache-2.0 and BSD. You may not use this file except in
#  compliance with one of these two licences.
#  
#  Unless required by applicable law or agreed to in writing, software

            

Reported by Pylint.

Trailing whitespace
Error

Line: 8 Column: 2

              #  license at the users choice. A copy of both licenses are available in the
#  project source as Apache-2.0 and BSD. You may not use this file except in
#  compliance with one of these two licences.
#  
#  Unless required by applicable law or agreed to in writing, software
#  distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT
#  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
#  license you chose for the specific language governing permissions and
#  limitations under that license.

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 30 Column: 1

              from subunit.test_results import CatFiles


def make_options(description):
    parser = OptionParser(description=description)
    parser.add_option(
        "--no-passthrough", action="store_true",
        help="Hide all non subunit input.", default=False,
        dest="no_passthrough")

            

Reported by Pylint.

Too many arguments (6/5)
Error

Line: 46 Column: 1

                  return parser


def run_tests_from_stream(input_stream, result, passthrough_stream=None,
    forward_stream=None, protocol_version=1, passthrough_subunit=True):
    """Run tests from a subunit input stream through 'result'.

    Non-test events - top level file attachments - are expected to be
    dropped by v2 StreamResults at the present time (as all the analysis code

            

Reported by Pylint.

Comparison should be protocol_version == 1
Error

Line: 72 Column: 8

                      (when forwarding as subunit non-subunit input is always turned into
        subunit)
    """
    if 1==protocol_version:
        test = ProtocolTestCase(
            input_stream, passthrough=passthrough_stream,
            forward=forward_stream)
    elif 2==protocol_version:
        # In all cases we encapsulate unknown inputs.

            

Reported by Pylint.

Comparison should be protocol_version == 2
Error

Line: 76 Column: 10

                      test = ProtocolTestCase(
            input_stream, passthrough=passthrough_stream,
            forward=forward_stream)
    elif 2==protocol_version:
        # In all cases we encapsulate unknown inputs.
        if forward_stream is not None:
            # Send events to forward_stream as subunit.
            forward_result = StreamResultToBytes(forward_stream)
            # If we're passing non-subunit through, copy:

            

Reported by Pylint.

src/third_party/mozjs-60/extract/mfbt/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.

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/wiredtiger/test/suite/test_lsm02.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 wiredtiger, wtscenario, wttest

# test_lsm02.py
#    Test LSM schema level operations
class test_lsm02(wttest.WiredTigerTestCase):
    uri = 'lsm:test_lsm02'

            

Reported by Pylint.

Unused import wtscenario
Error

Line: 29 Column: 1

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

import wiredtiger, wtscenario, wttest

# test_lsm02.py
#    Test LSM schema level operations
class test_lsm02(wttest.WiredTigerTestCase):
    uri = 'lsm:test_lsm02'

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 29 Column: 1

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

import wiredtiger, wtscenario, wttest

# test_lsm02.py
#    Test LSM schema level operations
class test_lsm02(wttest.WiredTigerTestCase):
    uri = 'lsm:test_lsm02'

            

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, wtscenario, wttest)
Error

Line: 29 Column: 1

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

import wiredtiger, wtscenario, wttest

# test_lsm02.py
#    Test LSM schema level operations
class test_lsm02(wttest.WiredTigerTestCase):
    uri = 'lsm:test_lsm02'

            

Reported by Pylint.

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

Line: 33 Column: 1

              
# test_lsm02.py
#    Test LSM schema level operations
class test_lsm02(wttest.WiredTigerTestCase):
    uri = 'lsm:test_lsm02'

    def add_key(self, uri, key, value):
        cursor = self.session.open_cursor(uri, None, None)
        cursor[key] = value

            

Reported by Pylint.

Missing class docstring
Error

Line: 33 Column: 1

              
# test_lsm02.py
#    Test LSM schema level operations
class test_lsm02(wttest.WiredTigerTestCase):
    uri = 'lsm:test_lsm02'

    def add_key(self, uri, key, value):
        cursor = self.session.open_cursor(uri, None, None)
        cursor[key] = value

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 36 Column: 5

              class test_lsm02(wttest.WiredTigerTestCase):
    uri = 'lsm:test_lsm02'

    def add_key(self, uri, key, value):
        cursor = self.session.open_cursor(uri, None, None)
        cursor[key] = value
        cursor.close()

    def verify_key_exists(self, uri, key, value):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 41 Column: 5

                      cursor[key] = value
        cursor.close()

    def verify_key_exists(self, uri, key, value):
        cursor = self.session.open_cursor(uri, None, None)
        cursor.set_key(key)
        cursor.search()
        if value != cursor.get_value():
            print('Unexpected value from LSM tree')

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 50 Column: 5

                      cursor.close()

    # Put some special values that start with the LSM tombstone
    def test_lsm_tombstone(self):
        self.session.create(self.uri, 'key_format=S,value_format=u')
        v = b'\x14\x14'
        self.add_key(self.uri, 'k1', v)
        self.verify_key_exists(self.uri, 'k1', v)
        v = b'\x14\x14\0\0\0\0\0\0'

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_backup20.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 wiredtiger, wttest
import os, shutil
from helper import compare_files
from suite_subprocess import suite_subprocess
from wtdataset import simple_key
from wtscenario import make_scenarios

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 29 Column: 1

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

import wiredtiger, wttest
import os, shutil
from helper import compare_files
from suite_subprocess import suite_subprocess
from wtdataset import simple_key
from wtscenario import make_scenarios

            

Reported by Pylint.

Unused import shutil
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import wiredtiger, wttest
import os, shutil
from helper import compare_files
from suite_subprocess import suite_subprocess
from wtdataset import simple_key
from wtscenario import make_scenarios


            

Reported by Pylint.

Unused import os
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import wiredtiger, wttest
import os, shutil
from helper import compare_files
from suite_subprocess import suite_subprocess
from wtdataset import simple_key
from wtscenario import make_scenarios


            

Reported by Pylint.

Unused compare_files imported from helper
Error

Line: 31 Column: 1

              
import wiredtiger, wttest
import os, shutil
from helper import compare_files
from suite_subprocess import suite_subprocess
from wtdataset import simple_key
from wtscenario import make_scenarios

# test_backup20.py

            

Reported by Pylint.

Unused simple_key imported from wtdataset
Error

Line: 33 Column: 1

              import os, shutil
from helper import compare_files
from suite_subprocess import suite_subprocess
from wtdataset import simple_key
from wtscenario import make_scenarios

# test_backup20.py
# Test cursor backup force stop without a checkpoint.
# This reproduces the issue from WT-7027 where we hit an assertion

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python
#
# Public Domain 2014-present MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled

            

Reported by Pylint.

Multiple imports on one line (wiredtiger, wttest)
Error

Line: 29 Column: 1

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

import wiredtiger, wttest
import os, shutil
from helper import compare_files
from suite_subprocess import suite_subprocess
from wtdataset import simple_key
from wtscenario import make_scenarios

            

Reported by Pylint.

standard import "import os, shutil" should be placed before "import wiredtiger, wttest"
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import wiredtiger, wttest
import os, shutil
from helper import compare_files
from suite_subprocess import suite_subprocess
from wtdataset import simple_key
from wtscenario import make_scenarios


            

Reported by Pylint.

Multiple imports on one line (os, shutil)
Error

Line: 30 Column: 1

              # OTHER DEALINGS IN THE SOFTWARE.

import wiredtiger, wttest
import os, shutil
from helper import compare_files
from suite_subprocess import suite_subprocess
from wtdataset import simple_key
from wtscenario import make_scenarios


            

Reported by Pylint.

src/third_party/wiredtiger/src/support/modify.c
15 issues
memcpy - Does not check for buffer overflows when copying to destination
Security

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

                      const uint8_t *__data = (const uint8_t *)(__p + (size_t)(nentries)*3); \
        int __i;                                                               \
        for (__i = 0; __i < (nentries); ++__i) {                               \
            memcpy(&(mod).data.size, __p++, sizeof(size_t));                   \
            memcpy(&(mod).offset, __p++, sizeof(size_t));                      \
            memcpy(&(mod).size, __p++, sizeof(size_t));                        \
            (mod).data.data = __data;                                          \
            __data += (mod).data.size;                                         \
            if (__i < (napplied))                                              \

            

Reported by FlawFinder.

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

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

                      int __i;                                                               \
        for (__i = 0; __i < (nentries); ++__i) {                               \
            memcpy(&(mod).data.size, __p++, sizeof(size_t));                   \
            memcpy(&(mod).offset, __p++, sizeof(size_t));                      \
            memcpy(&(mod).size, __p++, sizeof(size_t));                        \
            (mod).data.data = __data;                                          \
            __data += (mod).data.size;                                         \
            if (__i < (napplied))                                              \
                continue;

            

Reported by FlawFinder.

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

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

                      for (__i = 0; __i < (nentries); ++__i) {                               \
            memcpy(&(mod).data.size, __p++, sizeof(size_t));                   \
            memcpy(&(mod).offset, __p++, sizeof(size_t));                      \
            memcpy(&(mod).size, __p++, sizeof(size_t));                        \
            (mod).data.data = __data;                                          \
            __data += (mod).data.size;                                         \
            if (__i < (napplied))                                              \
                continue;


            

Reported by FlawFinder.

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

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

                      const uint8_t *__data = (const uint8_t *)__p + datasz;        \
        int __i;                                                      \
        for (__i = (napplied); __i < (nentries); ++__i) {             \
            memcpy(&(mod).size, --__p, sizeof(size_t));               \
            memcpy(&(mod).offset, --__p, sizeof(size_t));             \
            memcpy(&(mod).data.size, --__p, sizeof(size_t));          \
            (mod).data.data = (__data -= (mod).data.size);

#define WT_MODIFY_FOREACH_END \

            

Reported by FlawFinder.

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

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

                      int __i;                                                      \
        for (__i = (napplied); __i < (nentries); ++__i) {             \
            memcpy(&(mod).size, --__p, sizeof(size_t));               \
            memcpy(&(mod).offset, --__p, sizeof(size_t));             \
            memcpy(&(mod).data.size, --__p, sizeof(size_t));          \
            (mod).data.data = (__data -= (mod).data.size);

#define WT_MODIFY_FOREACH_END \
    }                         \

            

Reported by FlawFinder.

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

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

                      for (__i = (napplied); __i < (nentries); ++__i) {             \
            memcpy(&(mod).size, --__p, sizeof(size_t));               \
            memcpy(&(mod).offset, --__p, sizeof(size_t));             \
            memcpy(&(mod).data.size, --__p, sizeof(size_t));          \
            (mod).data.data = (__data -= (mod).data.size);

#define WT_MODIFY_FOREACH_END \
    }                         \
    }                         \

            

Reported by FlawFinder.

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

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

              
    /* Get the number of modify entries. */
    p = modify;
    memcpy(&tmp, p++, sizeof(size_t));
    nentries = (int)tmp;

    WT_MODIFY_FOREACH_BEGIN (mod, p, nentries, 0) {
        /*
         * If the number of bytes being replaced doesn't match the number of bytes being written,

            

Reported by FlawFinder.

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

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

                      *p++ = entries[i].offset;
        *p++ = entries[i].size;

        memcpy(data, entries[i].data.data, entries[i].data.size);
        data += entries[i].data.size;
    }
    modify->size = WT_PTRDIFF(data, modify->data);
    *modifyp = modify;


            

Reported by FlawFinder.

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

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

                   * buffer.
     */
    if (value->size > offset + data_size && data_size == size) {
        memcpy((uint8_t *)value->data + offset, data, data_size);
        return (0);
    }

    /*
     * If appending bytes past the end of the value, initialize gap bytes and copy the new bytes

            

Reported by FlawFinder.

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

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

                  if (value->size <= offset) {
        if (value->size < offset)
            memset((uint8_t *)value->data + value->size, sformat ? ' ' : 0, offset - value->size);
        memcpy((uint8_t *)value->data + offset, data, data_size);
        value->size = offset + data_size;
        return (0);
    }

    /*

            

Reported by FlawFinder.