The following issues were found

src/third_party/unwind/dist/tests/Gia64-test-nat.c
7 issues
Uninitialized variable: bsp
Error

Line: 155 CWE codes: 908

              #endif

  flushrs ();
  arg0 = (save_func_t **) *bsp;
  bsp = (unsigned long *) rse_skip_regs ((uint64_t) bsp, 1);
  arg1 = (unsigned long *) *bsp;

  (*arg0[0]) (arg0 + 1, arg1);


            

Reported by Cppcheck.

Uninitialized variable: bsp
Error

Line: 155 CWE codes: 908

              #endif

  flushrs ();
  arg0 = (save_func_t **) *bsp;
  bsp = (unsigned long *) rse_skip_regs ((uint64_t) bsp, 1);
  arg1 = (unsigned long *) *bsp;

  (*arg0[0]) (arg0 + 1, arg1);


            

Reported by Cppcheck.

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

Line: 49 Column: 7 CWE codes: 134
Suggestion: Use a constant for the format specification

              #define MAX_VALUES_PER_FUNC	4

#define panic(args...)							  \
	do { printf (args); ++nerrors; } while (0)

typedef void save_func_t (void *funcs, unsigned long *vals);
typedef unw_word_t *check_func_t (unw_cursor_t *c, unsigned long *vals);

extern void flushrs (void);

            

Reported by FlawFinder.

random - This function is not sufficiently random for security-related functions such as key and nonce creation
Security

Line: 120 Column: 20 CWE codes: 327
Suggestion: Use a more secure technique for acquiring random values

              static unw_word_t
random_word (void)
{
  unw_word_t val = random ();

  if (sizeof (unw_word_t) > 4)
    val |= ((unw_word_t) random ()) << 32;

  return val;

            

Reported by FlawFinder.

random - This function is not sufficiently random for security-related functions such as key and nonce creation
Security

Line: 123 Column: 26 CWE codes: 327
Suggestion: Use a more secure technique for acquiring random values

                unw_word_t val = random ();

  if (sizeof (unw_word_t) > 4)
    val |= ((unw_word_t) random ()) << 32;

  return val;
}

void

            

Reported by FlawFinder.

random - This function is not sufficiently random for security-related functions such as key and nonce creation
Security

Line: 581 Column: 19 CWE codes: 327
Suggestion: Use a more secure technique for acquiring random values

                  /* Make first test always go the full depth... */
    num_checks = MAX_CHECKS;
  else
    num_checks = (random () % MAX_CHECKS) + 1;

  for (i = 0; i < num_checks * MAX_VALUES_PER_FUNC; ++i)
    values[i] = random_word ();

  for (i = 0; i < num_checks; ++i)

            

Reported by FlawFinder.

random - This function is not sufficiently random for security-related functions such as key and nonce creation
Security

Line: 592 Column: 10 CWE codes: 327
Suggestion: Use a more secure technique for acquiring random values

              	/* Make first test once go through each test... */
	index = i % (int) ARRAY_SIZE (all_funcs);
      else
	index = random () % (int) ARRAY_SIZE (all_funcs);
      funcs[i] = all_funcs[index].func;
      checks[i] = all_funcs[index].check;
    }

  funcs[num_checks] = start_checks;

            

Reported by FlawFinder.

src/third_party/wiredtiger/test/checkpoint/test_checkpoint.c
7 issues
atoi - Unless checked, the resulting number can exceed the expected range
Security

Line: 83 Column: 30 CWE codes: 190
Suggestion: If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended)

                          working_dir = __wt_optarg;
            break;
        case 'k': /* rows */
            g.nkeys = (u_int)atoi(__wt_optarg);
            break;
        case 'l': /* log */
            if ((g.logfp = fopen(__wt_optarg, "w")) == NULL) {
                fprintf(stderr, "%s: %s\n", __wt_optarg, strerror(errno));
                return (EXIT_FAILURE);

            

Reported by FlawFinder.

fopen - Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents?
Security

Line: 86 Column: 28 CWE codes: 362

                          g.nkeys = (u_int)atoi(__wt_optarg);
            break;
        case 'l': /* log */
            if ((g.logfp = fopen(__wt_optarg, "w")) == NULL) {
                fprintf(stderr, "%s: %s\n", __wt_optarg, strerror(errno));
                return (EXIT_FAILURE);
            }
            break;
        case 'n': /* operations */

            

Reported by FlawFinder.

atoi - Unless checked, the resulting number can exceed the expected range
Security

Line: 92 Column: 29 CWE codes: 190
Suggestion: If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended)

                          }
            break;
        case 'n': /* operations */
            g.nops = (u_int)atoi(__wt_optarg);
            break;
        case 'p': /* prepare */
            g.prepare = true;
            break;
        case 'r': /* runs */

            

Reported by FlawFinder.

atoi - Unless checked, the resulting number can exceed the expected range
Security

Line: 98 Column: 20 CWE codes: 190
Suggestion: If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended)

                          g.prepare = true;
            break;
        case 'r': /* runs */
            runs = atoi(__wt_optarg);
            break;
        case 's':
            g.sweep_stress = true;
            break;
        case 't':

            

Reported by FlawFinder.

atoi - Unless checked, the resulting number can exceed the expected range
Security

Line: 122 Column: 25 CWE codes: 190
Suggestion: If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended)

                          }
            break;
        case 'T':
            g.ntables = atoi(__wt_optarg);
            break;
        case 'W':
            g.nworkers = atoi(__wt_optarg);
            break;
        case 'x':

            

Reported by FlawFinder.

atoi - Unless checked, the resulting number can exceed the expected range
Security

Line: 125 Column: 26 CWE codes: 190
Suggestion: If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended)

                          g.ntables = atoi(__wt_optarg);
            break;
        case 'W':
            g.nworkers = atoi(__wt_optarg);
            break;
        case 'x':
            g.use_timestamps = true;
            break;
        default:

            

Reported by FlawFinder.

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

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

                    handle_error, handle_message, NULL, NULL /* Close handler. */
    };
    int ret;
    char config[512];

    /*
     * If we want to stress sweep, we have a lot of additional configuration settings to set.
     */
    if (g.sweep_stress)

            

Reported by FlawFinder.

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

Line: 707 Column: 15 CWE codes: 126

              {
    const char* name = parseNodeNames[size_t(getKind())];
    out.printf("(%s ", name);
    indent += strlen(name) + 2;
    DumpParseTree(pn_kid, out, indent);
    out.printf(")");
}

void

            

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

              {
    const char* name = parseNodeNames[size_t(getKind())];
    out.printf("(%s ", name);
    indent += strlen(name) + 2;
    DumpParseTree(pn_left, out, indent);
    IndentNewLine(out, indent);
    DumpParseTree(pn_right, out, indent);
    out.printf(")");
}

            

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

              {
    const char* name = parseNodeNames[size_t(getKind())];
    out.printf("(%s ", name);
    indent += strlen(name) + 2;
    DumpParseTree(pn_kid1, out, indent);
    IndentNewLine(out, indent);
    DumpParseTree(pn_kid2, out, indent);
    IndentNewLine(out, indent);
    DumpParseTree(pn_kid3, out, indent);

            

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

              {
    const char* name = parseNodeNames[size_t(getKind())];
    out.printf("(%s ", name);
    indent += strlen(name) + 2;
    DumpParseTree(pn_body, out, indent);
    out.printf(")");
}

void

            

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

                  const char* name = parseNodeNames[size_t(getKind())];
    out.printf("(%s [", name);
    if (pn_head != nullptr) {
        indent += strlen(name) + 3;
        DumpParseTree(pn_head, out, indent);
        ParseNode* pn = pn_head->pn_next;
        while (pn != nullptr) {
            IndentNewLine(out, indent);
            DumpParseTree(pn, out, indent);

            

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

              
    const char* name = parseNodeNames[size_t(getKind())];
    out.printf("(%s ", name);
    indent += strlen(name) + 2;
    DumpParseTree(expr(), out, indent);
    out.printf(")");
}

void

            

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

              {
    const char* name = parseNodeNames[size_t(getKind())];
    out.printf("(%s [", name);
    int nameIndent = indent + strlen(name) + 3;
    if (!isEmptyScope()) {
        LexicalScope::Data* bindings = scopeBindings();
        for (uint32_t i = 0; i < bindings->length; i++) {
            JSAtom* name = bindings->names[i].name();
            JS::AutoCheckCannotGC nogc;

            

Reported by FlawFinder.

src/mongo/db/fts/unicode/gen_casefold_map.py
7 issues
Unused import os
Error

Line: 3 Column: 1

              #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys

from gen_helper import getCopyrightNotice, openNamespaces, closeNamespaces, \
    include



            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys

from gen_helper import getCopyrightNotice, openNamespaces, closeNamespaces, \
    include



            

Reported by Pylint.

Unnecessary parens after 'if' keyword
Error

Line: 31 Column: 1

                  for line in cf_file:
        # Filter out blank lines and lines that start with #
        data = line[:line.find('#')]
        if(data == ""):
            continue

        # Parse the data on the line
        values = data.split("; ")
        assert(len(values) == 4)

            

Reported by Pylint.

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

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

              
        # Parse the data on the line
        values = data.split("; ")
        assert(len(values) == 4)

        status = values[1]
        if status == 'C' or status == 'S':
            # We only include the "Common" and "Simple" mappings. "Full" case
            # folding mappings expand certain letters to multiple codepoints,

            

Reported by Bandit.

Unnecessary parens after 'assert' keyword
Error

Line: 36 Column: 1

              
        # Parse the data on the line
        values = data.split("; ")
        assert(len(values) == 4)

        status = values[1]
        if status == 'C' or status == 'S':
            # We only include the "Common" and "Simple" mappings. "Full" case
            # folding mappings expand certain letters to multiple codepoints,

            

Reported by Pylint.

Consider merging these comparisons with "in" to "status in ('C', 'S')"
Error

Line: 39 Column: 12

                      assert(len(values) == 4)

        status = values[1]
        if status == 'C' or status == 'S':
            # We only include the "Common" and "Simple" mappings. "Full" case
            # folding mappings expand certain letters to multiple codepoints,
            # which we currently do not support.
            original_codepoint = int(values[0], 16)
            codepoint_mapping  = int(values[2], 16)

            

Reported by Pylint.

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

Line: 47 Column: 5

                          codepoint_mapping  = int(values[2], 16)
            case_mappings[original_codepoint] = codepoint_mapping

    turkishMapping = {
        0x49: 0x131,  # I -> ı
        0x130: 0x069,   # İ -> i
    }

    out.write(

            

Reported by Pylint.

src/third_party/wiredtiger/test/3rdparty/testtools-0.9.34/testtools/tests/test_helpers.py
7 issues
Missing module docstring
Error

Line: 1 Column: 1

              # Copyright (c) 2010-2012 testtools developers. See LICENSE for details.

from testtools import TestCase
from testtools.tests.helpers import (
    FullStackRunTest,
    hide_testtools_stack,
    is_stack_hidden,
    )


            

Reported by Pylint.

Missing class docstring
Error

Line: 11 Column: 1

                  )


class TestStackHiding(TestCase):

    run_tests_with = FullStackRunTest

    def setUp(self):
        super(TestStackHiding, self).setUp()

            

Reported by Pylint.

Consider using Python 3 style super() without arguments
Error

Line: 16 Column: 9

                  run_tests_with = FullStackRunTest

    def setUp(self):
        super(TestStackHiding, self).setUp()
        self.addCleanup(hide_testtools_stack, is_stack_hidden())

    def test_is_stack_hidden_consistent_true(self):
        hide_testtools_stack(True)
        self.assertEqual(True, is_stack_hidden())

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 19 Column: 5

                      super(TestStackHiding, self).setUp()
        self.addCleanup(hide_testtools_stack, is_stack_hidden())

    def test_is_stack_hidden_consistent_true(self):
        hide_testtools_stack(True)
        self.assertEqual(True, is_stack_hidden())

    def test_is_stack_hidden_consistent_false(self):
        hide_testtools_stack(False)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 23 Column: 5

                      hide_testtools_stack(True)
        self.assertEqual(True, is_stack_hidden())

    def test_is_stack_hidden_consistent_false(self):
        hide_testtools_stack(False)
        self.assertEqual(False, is_stack_hidden())


def test_suite():

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 28 Column: 1

                      self.assertEqual(False, is_stack_hidden())


def test_suite():
    from unittest import TestLoader
    return TestLoader().loadTestsFromName(__name__)

            

Reported by Pylint.

Import outside toplevel (unittest.TestLoader)
Error

Line: 29 Column: 5

              

def test_suite():
    from unittest import TestLoader
    return TestLoader().loadTestsFromName(__name__)

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_debug_mode09.py
7 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.

from wiredtiger import stat
import wttest

# test_debug_mode09.py
# Test the debug mode setting for update_restore_evict.
# Force update restore eviction, whenever we evict a page. The debug mode

            

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.

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

Line: 38 Column: 1

              # is only effective on high cache pressure as WiredTiger can potentially decide
# to do an update restore evict on a page, when the cache pressure requirements are not met.
# This means setting eviction target low and cache size high.
class test_debug_mode09(wttest.WiredTigerTestCase):
    conn_config = 'cache_size=10MB,statistics=(all),eviction_target=10,debug_mode=(update_restore_evict=true)'
    uri = "table:test_debug_mode09"

    # Insert a bunch of data to trigger eviction
    def trigger_eviction(self, uri):

            

Reported by Pylint.

Missing class docstring
Error

Line: 38 Column: 1

              # is only effective on high cache pressure as WiredTiger can potentially decide
# to do an update restore evict on a page, when the cache pressure requirements are not met.
# This means setting eviction target low and cache size high.
class test_debug_mode09(wttest.WiredTigerTestCase):
    conn_config = 'cache_size=10MB,statistics=(all),eviction_target=10,debug_mode=(update_restore_evict=true)'
    uri = "table:test_debug_mode09"

    # Insert a bunch of data to trigger eviction
    def trigger_eviction(self, uri):

            

Reported by Pylint.

Line too long (110/100)
Error

Line: 39 Column: 1

              # to do an update restore evict on a page, when the cache pressure requirements are not met.
# This means setting eviction target low and cache size high.
class test_debug_mode09(wttest.WiredTigerTestCase):
    conn_config = 'cache_size=10MB,statistics=(all),eviction_target=10,debug_mode=(update_restore_evict=true)'
    uri = "table:test_debug_mode09"

    # Insert a bunch of data to trigger eviction
    def trigger_eviction(self, uri):
        cursor = self.session.open_cursor(uri)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 43 Column: 5

                  uri = "table:test_debug_mode09"

    # Insert a bunch of data to trigger eviction
    def trigger_eviction(self, uri):
        cursor = self.session.open_cursor(uri)
        for i in range(0, 20000):
            self.session.begin_transaction()
            cursor[i] = 'b' * 500
            self.session.commit_transaction()

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 50 Column: 5

                          cursor[i] = 'b' * 500
            self.session.commit_transaction()

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

        self.trigger_eviction(self.uri)

        # Read the statistics of pages that have been update restored without update_restore

            

Reported by Pylint.

src/third_party/kms-message/src/kms_request.c
7 issues
memcpy - Does not check for buffer overflows when copying to destination
Security

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

                 }

   if (opt && opt->crypto.sha256) {
      memcpy (&request->crypto, &opt->crypto, sizeof (opt->crypto));
   } else {
      request->crypto.sha256 = kms_sha256;
      request->crypto.sha256_hmac = kms_sha256_hmac;
   }


            

Reported by FlawFinder.

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

Line: 152 Column: 4 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

              bool
kms_request_set_date (kms_request_t *request, const struct tm *tm)
{
   char buf[sizeof AMZ_DT_FORMAT];
   struct tm tmp_tm;

   if (request->failed) {
      return false;
   }

            

Reported by FlawFinder.

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

Line: 585 Column: 13 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

                 bool success = false;
   kms_request_str_t *aws4_plus_secret = NULL;
   kms_request_str_t *aws4_request = NULL;
   unsigned char k_date[32];
   unsigned char k_region[32];
   unsigned char k_service[32];

   if (request->failed) {
      return false;

            

Reported by FlawFinder.

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

Line: 586 Column: 13 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

                 kms_request_str_t *aws4_plus_secret = NULL;
   kms_request_str_t *aws4_request = NULL;
   unsigned char k_date[32];
   unsigned char k_region[32];
   unsigned char k_service[32];

   if (request->failed) {
      return false;
   }

            

Reported by FlawFinder.

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

Line: 587 Column: 13 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

                 kms_request_str_t *aws4_request = NULL;
   unsigned char k_date[32];
   unsigned char k_region[32];
   unsigned char k_service[32];

   if (request->failed) {
      return false;
   }


            

Reported by FlawFinder.

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

Line: 633 Column: 13 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

                 kms_kv_list_t *lst = NULL;
   kms_request_str_t *sig = NULL;
   kms_request_str_t *sts = NULL;
   unsigned char signing_key[32];
   unsigned char signature[32];

   if (request->failed) {
      return NULL;
   }

            

Reported by FlawFinder.

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

Line: 634 Column: 13 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

                 kms_request_str_t *sig = NULL;
   kms_request_str_t *sts = NULL;
   unsigned char signing_key[32];
   unsigned char signature[32];

   if (request->failed) {
      return NULL;
   }


            

Reported by FlawFinder.

src/third_party/wiredtiger/test/suite/test_reconfig04.py
7 issues
Unable to import 'wiredtiger'
Error

Line: 33 Column: 1

              # session_api:reconfigure
# [END_TAGS]

import wiredtiger, wttest

# test_reconfig04.py
#    Test WT_SESSION::reconfigure
class test_reconfig04(wttest.WiredTigerTestCase):
    def test_session_reconfigure(self):

            

Reported by Pylint.

Unused import wiredtiger
Error

Line: 33 Column: 1

              # session_api:reconfigure
# [END_TAGS]

import wiredtiger, wttest

# test_reconfig04.py
#    Test WT_SESSION::reconfigure
class test_reconfig04(wttest.WiredTigerTestCase):
    def test_session_reconfigure(self):

            

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

              # session_api:reconfigure
# [END_TAGS]

import wiredtiger, wttest

# test_reconfig04.py
#    Test WT_SESSION::reconfigure
class test_reconfig04(wttest.WiredTigerTestCase):
    def test_session_reconfigure(self):

            

Reported by Pylint.

Missing class docstring
Error

Line: 37 Column: 1

              
# test_reconfig04.py
#    Test WT_SESSION::reconfigure
class test_reconfig04(wttest.WiredTigerTestCase):
    def test_session_reconfigure(self):
        self.session.reconfigure('ignore_cache_size=false')

        self.session.reconfigure('isolation=snapshot')
        self.session.reconfigure('isolation=read-committed')

            

Reported by Pylint.

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

Line: 37 Column: 1

              
# test_reconfig04.py
#    Test WT_SESSION::reconfigure
class test_reconfig04(wttest.WiredTigerTestCase):
    def test_session_reconfigure(self):
        self.session.reconfigure('ignore_cache_size=false')

        self.session.reconfigure('isolation=snapshot')
        self.session.reconfigure('isolation=read-committed')

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 38 Column: 5

              # test_reconfig04.py
#    Test WT_SESSION::reconfigure
class test_reconfig04(wttest.WiredTigerTestCase):
    def test_session_reconfigure(self):
        self.session.reconfigure('ignore_cache_size=false')

        self.session.reconfigure('isolation=snapshot')
        self.session.reconfigure('isolation=read-committed')
        self.session.reconfigure('isolation=read-uncommitted')

            

Reported by Pylint.

src/third_party/wiredtiger/test/suite/test_debug_mode05.py
7 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

# test_debug_mode05.py
#     As per WT-5046, the debug table logging settings prevent rollback to
#     stable in the presence of prepared transactions.
#

            

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

# test_debug_mode05.py
#     As per WT-5046, the debug table logging settings prevent rollback to
#     stable in the presence of prepared transactions.
#

            

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

# test_debug_mode05.py
#     As per WT-5046, the debug table logging settings prevent rollback to
#     stable in the presence of prepared transactions.
#

            

Reported by Pylint.

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

Line: 36 Column: 1

              #     stable in the presence of prepared transactions.
#
#     This test is to confirm the fix and prevent similar regressions.
class test_debug_mode05(wttest.WiredTigerTestCase):
    conn_config = 'log=(enabled),debug_mode=(table_logging=true)'
    session_config = 'isolation=snapshot'
    uri = 'file:test_debug_mode05'

    def test_table_logging_rollback_to_stable(self):

            

Reported by Pylint.

Missing class docstring
Error

Line: 36 Column: 1

              #     stable in the presence of prepared transactions.
#
#     This test is to confirm the fix and prevent similar regressions.
class test_debug_mode05(wttest.WiredTigerTestCase):
    conn_config = 'log=(enabled),debug_mode=(table_logging=true)'
    session_config = 'isolation=snapshot'
    uri = 'file:test_debug_mode05'

    def test_table_logging_rollback_to_stable(self):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 41 Column: 5

                  session_config = 'isolation=snapshot'
    uri = 'file:test_debug_mode05'

    def test_table_logging_rollback_to_stable(self):
        self.session.create(self.uri, 'key_format=i,value_format=u,log=(enabled=false)')

        self.conn.set_timestamp('stable_timestamp=' + self.timestamp_str(100))
        self.session.checkpoint()


            

Reported by Pylint.

src/mongo/db/ftdc/file_reader.cpp
7 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

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

                      return {ErrorCodes::FileNotOpen, "open() needs to be called first."};
    }

    char buf[sizeof(std::int32_t)];

    _stream.read(buf, sizeof(buf));

    if (sizeof(buf) != _stream.gcount()) {
        // Did we read exactly zero bytes and hit the eof?

            

Reported by FlawFinder.

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

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

                  _buffer.resize(bsonLength);

    // Stuff the length into the front
    memcpy(_buffer.data(), buf, sizeof(std::int32_t));

    // Read the length - 4 bytes from the file
    std::int32_t readSize = bsonLength - sizeof(std::int32_t);

    _stream.read(_buffer.data() + sizeof(std::int32_t), readSize);

            

Reported by FlawFinder.

open - Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents?
Security

Line: 212 Column: 24 CWE codes: 362

                  return {swl.getValue().val};
}

Status FTDCFileReader::open(const boost::filesystem::path& file) {
    _stream.open(file.c_str(), std::ios_base::in | std::ios_base::binary);
    if (!_stream.is_open()) {
        return Status(ErrorCodes::FileStreamFailed, "Failed to open file " + file.generic_string());
    }


            

Reported by FlawFinder.

open - Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents?
Security

Line: 213 Column: 13 CWE codes: 362

              }

Status FTDCFileReader::open(const boost::filesystem::path& file) {
    _stream.open(file.c_str(), std::ios_base::in | std::ios_base::binary);
    if (!_stream.is_open()) {
        return Status(ErrorCodes::FileStreamFailed, "Failed to open file " + file.generic_string());
    }

    boost::system::error_code ec;

            

Reported by FlawFinder.

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

Line: 155 Column: 13 CWE codes: 120 20

              
    char buf[sizeof(std::int32_t)];

    _stream.read(buf, sizeof(buf));

    if (sizeof(buf) != _stream.gcount()) {
        // Did we read exactly zero bytes and hit the eof?
        // Then return an empty document to indicate we are done reading the file.
        if (0 == _stream.gcount() && _stream.eof()) {

            

Reported by FlawFinder.

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

Line: 169 Column: 51 CWE codes: 120 20

                                            << "\""};
    }

    std::uint32_t bsonLength = ConstDataView(buf).read<LittleEndian<std::int32_t>>();

    // Reads past the end of the file will be caught below
    // The interim file sentinel is 8 bytes of zero.
    if (bsonLength == 0) {
        return BSONObj();

            

Reported by FlawFinder.

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

Line: 193 Column: 13 CWE codes: 120 20

                  // Read the length - 4 bytes from the file
    std::int32_t readSize = bsonLength - sizeof(std::int32_t);

    _stream.read(_buffer.data() + sizeof(std::int32_t), readSize);

    if (readSize != _stream.gcount()) {
        return {ErrorCodes::FileStreamFailed,
                str::stream() << "Failed to read " << readSize << " bytes from file \""
                              << _file.generic_string() << "\""};

            

Reported by FlawFinder.