text
stringlengths
79
3.72M
<vulnerable_code> # Non-defaults following defaults. with self.assertRaisesRegex(TypeError, "non-default argument 'y' follows " "default argument"): @dataclass class C: x: int = 0 # A d...
<vulnerable_code> # Class creation from C with warnings_helper.check_warnings( ('.*custom tp_new.*in Python 3.14.*', DeprecationWarning), ): sub = _testcapi.make_type_with_base(Base) self.assertTrue(issubclass(sub, Base))<commit_title>[PATCH 016/395] S...
<vulnerable_code> if (_allow_tp_new) { if (PyErr_WarnFormat( PyExc_DeprecationWarning, 1, "Using PyType_Spec with metaclasses that have custom " "tp_new is deprecated and will no longer be allowed in " "Python 3.14.") < 0...
<vulnerable_code> x |= buf[1] << 8 x |= buf[2] << 16 x |= buf[3] << 24 x |= buf[1] << 32 x |= buf[1] << 40 x |= buf[1] << 48 x |= buf[1] << 56 x |= -(x & (1<<63)) # Sign-extend return x <commit_title>[PATCH 016/395] Small fixes to code generator (#...
<vulnerable_code>import _pickle import pickle import shutil import sys import types import tempfile import textwrap import unittest.mock import warnings try: from concurrent.futures import ThreadPoolExecutor except ImportError: yield return 'spam' class TestPredicates(IsTestBase): def test_excluding_...
<vulnerable_code>import os import sys import contextlib import stat import tempfile import test.support import types import typing import unittest self.assertEqual(self._get_summary_line(os.stat), "stat(path, *, dir_fd=None, follow_symlinks=True)") @requires_docstrings def test_staticmethod...
<vulnerable_code> ['str.{}('.format(x) for x in dir(str) if x.startswith('s')]) self.assertEqual(self.stdcompleter.attr_matches('tuple.foospamegg'), []) expected = sorted({'None.%s%s' % (x, '(' if x != '__doc__' else '') for x ...
<vulnerable_code> static PyMethodDef test_methods[] = { {"docstring_empty", (PyCFunction)test_with_docstring, METH_NOARGS, docstring_empty}, {"docstring_no_signature", (PyCFunction)test_with_docstring, METH_NOARGS, docstring_no_signature}, {"docstring_with_invalid_signature",...
<vulnerable_code>static PyObject * method_get_text_signature(PyMethodDescrObject *descr, void *closure) { return _PyType_GetTextSignatureFromInternalDoc(descr->d_method->ml_name, descr->d_method->ml_doc); } static PyObject * static PyObject * wrapperdescr_get_text_signature(PyWrapperDescrObject *descr, void *closu...
<vulnerable_code>static PyObject * meth_get__text_signature__(PyCFunctionObject *m, void *closure) { return _PyType_GetTextSignatureFromInternalDoc(m->m_ml->ml_name, m->m_ml->ml_doc); } static PyObject *<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I fou...
<vulnerable_code> return PyUnicode_FromString(doc); } PyObject * _PyType_GetTextSignatureFromInternalDoc(const char *name, const char *internal_doc) { const char *start = find_signature(name, internal_doc); const char *end; else end = NULL; if (!end) { Py_RETURN_NONE; } static P...
<vulnerable_code>from itertools import count, groupby, repeat from bisect import bisect_left, bisect_right from math import hypot, sqrt, fabs, exp, erf, tau, log, fsum, sumprod from functools import reduce from operator import itemgetter from collections import Counter, namedtuple, defaultdict return float(xbar...
<vulnerable_code> # === Helper functions and class === def sign(x): """Return -1.0 for negatives, including -0.0, otherwise +1.0.""" return math.copysign(1, x) self.assertAlmostEqual(statistics.correlation(x, y), 1) self.assertAlmostEqual(statistics.covariance(x, y), 0.1) def test_correla...
<vulnerable_code>SCRIPT_NAME = "Tools/build/generate_opcode_h.py" PYTHON_OPCODE = "Lib/opcode.py" header = f""" // Auto-generated by {SCRIPT_NAME} from {PYTHON_OPCODE} #ifndef Py_OPCODE_H extern "C" {{ #endif /* Instruction opcodes for compiled code */ """.lstrip() footer = """ #ifdef __cplusplus } #endif /* !Py_...
<vulnerable_code> kind, result = c.recv() if kind == '#RETURN': return result raise convert_to_error(kind, result) def convert_to_error(kind, result): if kind == '#ERROR': conn = self._Client(token.address, authkey=self._authkey) dispatch(conn, None, 'decref', (token.id,)...
<vulnerable_code> if hasattr(manager, "shutdown"): self.addCleanup(manager.shutdown) # # #<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-106798 (issue gh-106797) and in PR gh-106716 (issue gh-106706).<fixed_code> ...
<vulnerable_code> return lines[0], '\n'.join(lines[2:]) return '', '\n'.join(lines) def classname(object, modname): """Get a class name and qualify it with a module name if necessary.""" name = object.__name__ title = title + '(%s)' % ', '.join(parents) decl = '' try: ...
<vulnerable_code> self.assertEqual(self._get_summary_line(dict.__class_getitem__), "__class_getitem__(object, /) method of builtins.type instance") @requires_docstrings def test_staticmethod(self): class X:<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_d...
<vulnerable_code> self._check_function(self.path.normcase) if sys.platform == 'win32': self.assertEqual(ntpath.normcase('\u03a9\u2126'), 'ωΩ') def test_path_isabs(self): self._check_function(self.path.isabs)<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<com...
<vulnerable_code> C2.hmm = "baz" self.assert_events([C1, [C2]]) def test_watch_non_type(self): with self.watcher() as wid: with self.assertRaisesRegex(ValueError, r"Cannot watch non-type"):<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commi...
<vulnerable_code> assert(dictptr != NULL); dict = *dictptr; if (dict == NULL) { dictkeys_incref(cached); if (_PyType_HasFeature(tp, Py_TPFLAGS_MANAGED_DICT)) { OBJECT_STAT_INC(dict_materialized_on_request); } dict = new_dict_with_sha...
<vulnerable_code> goto error_check; } dictptr = &dorv_ptr->dict; } else { dictptr = _PyObject_ComputedDictPointer(obj);<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-106798 (is...
<vulnerable_code> with self.assertRaises(TypeError): C[()] def test_init(self): T = TypeVar('T') S = TypeVar('S')<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-106798 (issue gh-106797) and in PR gh-10671...
<vulnerable_code> return -1; } /* Probably never reached anymore. */ return recursive_issubclass(derived, cls); } <commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-106798 (issue gh-106797) and in PR gh-106716 (issue gh-106706)...
<vulnerable_code> static const char* const attr_exceptions[] = { "__class__", "__origin__", "__args__", "__unpacked__",<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-106798 (issue gh-106797) and in PR gh-106716 (issue gh-106706...
<vulnerable_code>#define Py_LIMITED_API 0x030c0000 // 3.12 #include "parts.h" #ifdef LIMITED_API_AVAILABLE /* Test Vectorcall in the limited API */ static PyObject * LimitedVectorCallClass_tpcall(PyObject *self, PyObject *args, PyObject *kwargs) { return PyUnicode_FromString("tp_call called"); return self; ...
<vulnerable_code> for eff in self.deep: if eff.size: terms.append(("-", maybe_parenthesize(eff.size))) elif eff.cond and eff.cond != "1": terms.append(("-", f"({parenthesize_cond(eff.cond)} ? 1 : 0)")) elif eff.cond != "0": num -...
<vulnerable_code> with self.subTest(block=block): self.expect_failure(block, err) def test_depr_star_invalid_format_1(self): block = """ module foo<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR ...
<vulnerable_code> @functools.cached_property def fulldisplayname(self) -> str: if isinstance(self.module, Module): return f"{self.module.name}.{self.displayname}" return self.displayname @property def render_parameters(self) -> list[Parameter]:<commit_title>[PATCH 016/395] S...
<vulnerable_code>}; PyDoc_STRVAR(typing_doc, "Accelerators for the typing module.\n"); static int _typing_exec(PyObject *m)<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-106798 (issue gh-106797) and in PR gh-106716 (issue gh-106706).<fixed_c...
<vulnerable_code> ac_tester.DeprStarNew(None) self.assertEqual(cm.filename, __file__) def test_depr_star_init(self): regex = re.escape( "Passing positional arguments to _testclinic.DeprStarInit() is " ac_tester.DeprStarInit(None) self.assertEqual(cm.filena...
<vulnerable_code> return type->tp_alloc(type, 0); } static PyTypeObject DeprStarNew = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "_testclinic.DeprStarNew", .tp_basicsize = sizeof(PyObject), .tp_new = depr_star_new, .tp_flags = Py_TPFLAGS_DEFAULT, }; return 0; } static PyTypeObject DeprSt...
<vulnerable_code> function_name = fields.pop() module, cls = self.clinic._module_and_class(fields) if not (existing_function.kind is self.kind and existing_function.coexist == self.coexist): fail("'kind' of function and cloned function don't match! " ...
<vulnerable_code> def test_mro_disagreement(self): # Testing error messages for MRO disagreement... mro_err_msg = """Cannot create a consistent method resolution order (MRO) for bases """ def raises(exc, expected, callable, *args): try:<commit_title>[PATCH 016/395] Small fixes t...
<vulnerable_code> n = PyDict_GET_SIZE(set); off = PyOS_snprintf(buf, sizeof(buf), "Cannot create a \ consistent method resolution\norder (MRO) for bases"); i = 0; while (PyDict_Next(set, &i, &k, &v) && (size_t)off < sizeof(buf)) { PyObject *name = class_name(k);<commit_title>[PATCH 016/395] Smal...
<vulnerable_code>#include "pycore_namespace.h" #include "pycore_object.h" #include "pycore_opcode.h" #include "pycore_pyerrors.h" #include "pycore_pystate.h" // _PyInterpreterState_GET() static bool valid_opcode(int opcode) { if (opcode > 0 && opcode != RESERVED && opcode < 255 && _Py...
<vulnerable_code>[python start generated code]*/ /*[python end generated code: output=da39a3ee5e6b4b0d input=dff8760fb1eba6a1]*/ // NB: This needs to be in sync with the sqlite3.connect docstring /*[clinic input] _sqlite3.Connection.__init__ as pysqlite_connection_init return -1; } #define VISIT_CALLBACK_CONTEXT...
<vulnerable_code>[clinic start generated code]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=81e330492d57488e]*/ // NB: This needs to be in sync with the Connection.__init__ docstring. PyDoc_STRVAR(module_connect_doc, "connect($module, /, database, timeout=5.0, detect_types=0,\n" " isolation_lev...
<vulnerable_code>""" import argparse import os import posixpath import sys typing.assert_never(thing) return instr, popped, pushed def write_stack_effect_functions(self) -> None: popped_data: list[tuple[AnyInstruction, str]] = [] pushed_data: list[tuple[AnyInstruction, str]...
<vulnerable_code> output_stream: BinaryIO, max_size: Optional[int] = None, headers: Optional[RawHeaders] = None, is_allowed_content_type: Optional[Callable[[bytes], bool]] = None, ) -> Tuple[int, Dict[bytes, List[bytes]], str, int]: """GETs a file from a given URL Args...
<vulnerable_code> return content_type.lower().startswith("application/json") def _is_previewable(content_type: bytes) -> bool: """Returns True for content types for which we will perform URL preview and False otherwise.""" content_type = content_type.lower() return ( content_type.startswit...
<vulnerable_code> if (deflateInit(&stream,level) != Z_OK) { quantum_info=DestroyQuantumInfo(quantum_info); return(0); } }<commit_title>[PATCH] https://github.com/ImageMagick/ImageMagick/issues/1451<commit_description><fixed_code> if (deflateInit(&stream,level) != Z_OK)...
<vulnerable_code>import unittest import unittest.mock from test.support import requires, swap_attr import tkinter as tk from idlelib.idle_test.tkinter_testing_utils import run_in_tk_mainloop @run_in_tk_mainloop() def test_very_long_wrapped_line(self): with swap_attr(self.shell, 'squeezer', None): ...
<vulnerable_code> time.sleep(delay) delay = min(delay * 2, max_delay)<commit_title>[PATCH] gh-95778: CVE-2020-10735: Prevent DoS by very large int()<commit_description><fixed_code> time.sleep(delay) delay = min(delay * 2, max_delay) @contextlib.contextmanager def adjust_int_max_str_di...
<vulnerable_code> self.assertRaises(ValueError, ast.literal_eval, '+True') self.assertRaises(ValueError, ast.literal_eval, '2+3') def test_literal_eval_complex(self): # Issue #4907 self.assertEqual(ast.literal_eval('6j'), 6j)<commit_title>[PATCH] gh-95778: CVE-2020-10735: Prevent DoS...
<vulnerable_code> self.assertTrue(proc.stderr.startswith(err_msg), proc.stderr) self.assertNotEqual(proc.returncode, 0) @unittest.skipIf(interpreter_requires_environment(), 'Cannot run -I tests when PYTHON env vars are required.')<commit_title>[PATCH] gh-95778: CVE-2020-10735: Prevent ...
<vulnerable_code> self.assertEqual(eval("0o777"), 511) self.assertEqual(eval("-0o0000010"), -8) def test_unary_minus(self): # Verify treatment of unary minus on negative numbers SF bug #660455 if sys.maxsize == 2147483647:<commit_title>[PATCH] gh-95778: CVE-2020-10735: Prevent DoS by...
<vulnerable_code>class PyUsabilityTest(UsabilityTest): decimal = P class PythonAPItests(unittest.TestCase): def test_abc(self): class PyCoverage(Coverage): decimal = P class PyFunctionality(unittest.TestCase): """Extra functionality in decimal.py""" <commit_title>[PATCH] gh-95778: CVE-2020-10735: Pre...
<vulnerable_code> self.assertEqual(int('1_2_3_4_5_6_7', 32), 1144132807) if __name__ == "__main__": unittest.main()<commit_title>[PATCH] gh-95778: CVE-2020-10735: Prevent DoS by very large int()<commit_description><fixed_code> self.assertEqual(int('1_2_3_4_5_6_7', 32), 1144132807) class IntStrDig...
<vulnerable_code>from io import StringIO from collections import OrderedDict from test.test_json import PyTest, CTest class TestDecode: d = self.json.JSONDecoder() self.assertRaises(ValueError, d.raw_decode, 'a'*42, -50000) class TestPyDecode(TestDecode, PyTest): pass class TestCDecode(TestDecode, CT...
<vulnerable_code> self.assertIsInstance(sys.executable, str) self.assertEqual(len(sys.float_info), 11) self.assertEqual(sys.float_info.radix, 2) self.assertEqual(len(sys.int_info), 2) self.assertTrue(sys.int_info.bits_per_digit % 5 == 0) self.assertTrue(sys.int_info.sizeof...
<vulnerable_code> check('<bigdecimal>9876543210.0123456789</bigdecimal>', decimal.Decimal('9876543210.0123456789')) def test_get_host_info(self): # see bug #3613, this raised a TypeError transp = xmlrpc.client.Transport()<commit_title>[PATCH] gh-95778: CVE-2020-10735: Prevent D...
<vulnerable_code>#define IS_SMALL_INT(ival) (-_PY_NSMALLNEGINTS <= (ival) && (ival) < _PY_NSMALLPOSINTS) #define IS_SMALL_UINT(ival) ((ival) < _PY_NSMALLPOSINTS) static inline void _Py_DECREF_INT(PyLongObject *op) { tenpow *= 10; strlen++; } if (writer) { if (_PyUnicodeWriter_Prepare(wr...
<vulnerable_code>#include <Python.h> #include "pycore_ast.h" // _PyAST_Validate(), #include <errcode.h> #include "tokenizer.h" if (c == NULL) { p->error_indicator = 1; return NULL; } <commit_title>[PATCH] gh-95778: CVE-2020-10735: Prevent DoS by very large int()<commit_description><f...
<vulnerable_code>#include "pycore_getopt.h" // _PyOS_GetOpt() #include "pycore_initconfig.h" // _PyStatus_OK() #include "pycore_interp.h" // _PyInterpreterState.runtime #include "pycore_pathconfig.h" // _Py_path_config #include "pycore_pyerrors.h" // _PyErr_Fetch() #include "pycore_pylifecycle....
<vulnerable_code>#include "pycore_code.h" // _Py_QuickenedCount #include "pycore_frame.h" // _PyInterpreterFrame #include "pycore_initconfig.h" // _PyStatus_EXCEPTION() #include "pycore_namespace.h" // _PyNamespace_New() #include "pycore_object.h" // _PyObject_IS_GC() #include "pycore_pat...
<vulnerable_code> switch (priv->size) { case 8: { u64 src64; switch (priv->op) { case NFT_BYTEORDER_NTOH: for (i = 0; i < priv->len / 8; i++) { src64 = nft_reg_load64(&src[i]); nft_reg_store64(&dst[i], be64_to_cpu((__force __be64)src64)); } break; for (i = 0; i < priv->len / 8; i++) {...
<vulnerable_code>{ switch (key) { case NFT_META_TIME_NS: nft_reg_store64(dest, ktime_get_real_ns()); break; case NFT_META_TIME_DAY: nft_reg_store8(dest, nft_meta_weekday());<commit_title>[PATCH] netfilter: nf_tables: fix pointer math issue in<commit_description><fixed_code> { switch (key) { case NFT_META_TIM...
<vulnerable_code><commit_title>[PATCH] Safe allocation wrappers (#754)<commit_description>Create allocation wrappers with a configurable OOM handler (defaults to abort()). See #752, #747<fixed_code> /* * Copyright (c) 2020, Michael Grunder <michael dot grunder at gmail dot com> * * All rights reserved. * * Redist...
<vulnerable_code> */ #include "fmacros.h" #include <stdlib.h> #include <string.h> #include <strings.h> static void *callbackValDup(void *privdata, const void *src) { ((void) privdata); redisCallback *dup = malloc(sizeof(*dup)); memcpy(dup,src,sizeof(*dup)); return dup; }<commit_title>[PATCH] Safe allo...
<vulnerable_code> */ #include "fmacros.h" #include <stdlib.h> #include <assert.h> #include <limits.h> /* Create a new hash table */ static dict *dictCreate(dictType *type, void *privDataPtr) { dict *ht = malloc(sizeof(*ht)); _dictInit(ht,type,privDataPtr); return ht; } return DICT_ERR; /* All...
<vulnerable_code> if (c->tcp.host != addr) { free(c->tcp.host); c->tcp.host = strdup(addr); } if (timeout) { if (c->timeout != timeout) { if (c->timeout == NULL) c->timeout = malloc(sizeof(struct timeval)); memcpy(c->timeout, timeout, sizeof(...
<vulnerable_code> return ids1.equals(ids2); } @SuppressWarnings("unchecked") private void reset() { // Cache helper component before removal } private void validateSelectionEnabledState(PropertyChangeEvent event) { // we need to compare old value with new value to see if any...
<vulnerable_code> public EvaluatedDlsFlsConfig getDlsFls(User user, boolean dfmEmptyOverwritesAll, IndexNameExpressionResolver resolver, ClusterService cs, NamedXContentRegistry namedXContentRegistry) { if (!containsDlsFlsConfig()) { if(log.isDebugEnabled()) { ...
<vulnerable_code> verifyNoMoreInteractions(ip); } /** Verify concreteIndexNames on exact name matches */ @Test public void testExactName() {<commit_title>[PATCH] Keep existing behavoir when there are no matches found to<commit_description><fixed_code> verifyNoMoreInteractions(ip); } ...
<vulnerable_code> self._assertResizeCheckShape(x, x_shape, [320, 320], [320, 320, 3]) class ResizeImagesTest(test_util.TensorFlowTestCase, parameterized.TestCase):<commit_title>[PATCH] Fix crash with tf.image.resize if size is large<commit_description>This PR tries to address the issue rais...
<vulnerable_code> throw new Error('expecting string but got '+typeof data); } } var result = {}; var currentSection = undefined; var lines = data.split(this.options.lineEnding); var newSection = line.match(sectionRegExp); if(newSection !== null){ currentSec...
<vulnerable_code> expect(result.Section.foo).to.equal("bar"); }); it('valueTrim should trim custom chars', function () { var config = new Config(); expect(config.valueTrim('"Te"s"t"', '"')).to.equal('Te"s"t');<commit_title>[PATCH] fix: prevent prototype pollution attack<commit_descriptio...
<vulnerable_code># along with SiCKRAGE. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## import functools import time import traceback import types from typing import Optional, Awaitable from urllib.parse import urlparse, urljoin from jose i...
<vulnerable_code> } } // extend the compressed data buffer size if (compressed == null || chunkSize > compressed.length) { compressed = new byte[chunkSize]; } readBytes = 0; while (readBytes < chunkSize) {<commit_title>[PATCH] Merge pull request fr...
<vulnerable_code> import static org.junit.Assert.*; import java.io.IOException; import java.nio.ByteBuffer; } } /* Tests happy cases for BitShuffle.shuffle method - double: 0, 10 - int: 0, 10 - long: 0, 10 - short: 0, 10 */ @Test public void isValidArrayInputLengthFor...
<vulnerable_code> */ var createError = require('http-errors') var normalize = require('path').normalize var pathIsAbsolute = require('path-is-absolute') var resolve = require('path').resolve throw createError(403) } // resolve & normalize the root path root = normalize(resolve(root) + sep) // resolve the...
<vulnerable_code> normalize(join(process.cwd(), 'index.js'))) }) it('should accept empty string', function () { assert.equal(normalize(resolvePath('')), normalize(process.cwd())) normalize(resolve(__dirname, 'index.js'))) }) it('should accept relative path'...
<vulnerable_code> def read_config(self, config, **kwargs): consent_config = config.get("user_consent") if consent_config is None: return self.user_consent_version = str(consent_config["version"])<commit_title>[PATCH] Convert terms to a Jinja template.<commit_description><fixed_co...
<vulnerable_code>logger = logging.getLogger(__name__) TERMS_TEMPLATE = """ <html> <head> <title>Authentication</title> <meta name='viewport' content='width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0'> <link rel="stylesheet" href="/_matrix/static/client/register/style.css...
<vulnerable_code>user_upn_p12 = os.path.join(certs, 'user-upn.p12') user_upn2_p12 = os.path.join(certs, 'user-upn2.p12') user_upn3_p12 = os.path.join(certs, 'user-upn3.p12') path = os.path.join(os.getcwd(), 'testdir', 'tmp-pkinit-certs') path_enc = os.path.join(os.getcwd(), 'testdir', 'tmp-pkinit-certs-enc') p12_upn_i...
<vulnerable_code> if (err < 0) return err; if (!tb[NFTA_EXPR_DATA]) return -EINVAL; type = __nft_expr_type_get(ctx->family, tb[NFTA_EXPR_NAME]);<commit_title>[PATCH] nf_tables: fix NULL pointer dereference in<commit_description><fixed_code> if (err < 0) return err; if (!tb[NFTA_EXPR_DATA] || !tb[NFTA_EXPR_...
<vulnerable_code> return -1; } if (len) { stream_get(str, s, len); str[len] = '\0'; XFREE(MTYPE_BGP_SOFT_VERSION, peer->soft_version);<commit_title>[PATCH] bgpd: Check the length of the rcv software version<commit_description>Make sure we don't exceed the maximum of BGP_MAX_SOFT_VERSION. The Capability Leng...
<vulnerable_code> { if (!(bitmapData->flags & NO_BITMAP_COMPRESSION_HDR)) { Stream_Read_UINT16(s, bitmapData->cbCompFirstRowSize); /* cbCompFirstRowSize (2 bytes) */ Stream_Read_UINT16(s,<commit_title>[PATCH] Fixed #6005: Bounds checks in update_read_bitmap_data<commit_description><fixed...
<vulnerable_code> """Contains constants from the specification.""" class Membership(object): <commit_title>[PATCH] Apply some limits to depth to counter abuse<commit_description>* When creating a new event, cap its depth to 2^63 - 1 * When receiving events, reject any without a sensible depth As per https://docs.goo...
<vulnerable_code># limitations under the License. import logging from synapse.api.errors import SynapseError from synapse.crypto.event_signing import check_event_content_hash from synapse.events import FrozenEvent from synapse.events.utils import prune_event FrozenEvent Raises: SynapseError: if th...
<vulnerable_code>from twisted.internet import defer, reactor from twisted.python.failure import Failure from synapse.api.constants import EventTypes, Membership from synapse.api.errors import AuthError, Codes, SynapseError from synapse.crypto.event_signing import add_hashes_and_signatures from synapse.events.utils imp...
<vulnerable_code> import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; import java.nio.file.StandardCopyOption; import java.util.UUID; default File getTempFileFromInputStream(InputStream inputStream, String prefix, String suffix) throws IOException { File tmp = Files.createTe...
<vulnerable_code> var banned_options = ["SBD_OPTS", "SBD_WATCHDOG_DEV", "SBD_PACEMAKER"]; $.each(this.get("sbd_config"), function(opt, val) { if (banned_options.indexOf(opt) == -1) { out += '<tr><td>' + opt + '</td><td>' + val + '</td></tr>\n'; } }); return out + '</table>'; }.prope...
<vulnerable_code> dialog_obj.find('#auth_nodes_list').empty(); unauth_nodes.forEach(function(node) { dialog_obj.find('#auth_nodes_list').append("\t\t\t<tr><td>" + node + '</td><td><input type="password" name="' + node + '-pass"></td></tr>\n'); }); }<commit_title>[PATCH] web UI: fixed XSS vulnerability<commit...
<vulnerable_code> } } conn->c_trans = trans; ret = trans->conn_alloc(conn, gfp);<commit_title>[PATCH] RDS: verify the underlying transport exists before creating a<commit_description><fixed_code> } } if (trans == NULL) { kmem_cache_free(rds_conn_slab, conn); conn = ERR_PTR(-ENODEV); goto out; } conn...
<vulnerable_code> def loseConnection(self): self.lost = True class TestVNCServerAuthenticator(unittest.TestCase): def setUp(self): def test_check_version(self): self.t.buf = "" self.p.check_version("RFB 003.008\n") self.assertEqual(self.t.buf, "\x02\x01\x02") def test_c...
<vulnerable_code> if version == self.VERSION: log.msg("Client version %s is valid" % version.strip()) # Hardcoded: 2 security types: None and VNC Auth. self.transport.write("\x02\x01\x02") return self.select_security_type, 1 else: log.err("Can'...
<vulnerable_code> int save_do_all; // remember user specified 'g' flag int save_do_ask; // remember user specified 'c' flag char_u *pat = NULL, *sub = NULL; // init for GCC char_u *sub_copy = NULL; int delimiter; int sublen; int got_quit = FALSE; int got_match = FALSE; int wh...
<vulnerable_code> 'color': /^(#[0-9a-f]{3}|#[0-9a-f]{6}|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow)$/i, 'style': /^(?:\s*-?[_A-Z]+[_A-Z0-9-]*:[^\n\r\f;]+;)*\s*-?[_A-Z]+[_A-Z0-9-]*:[^\n\r\f;]+;?\s*$/i, 'phone': /^(?:(?:\(?(?:00|\+)(?:[1-4]\d\d|[1-9]\d?)\)?)?...
<vulnerable_code>% M M A A P % % % % % % Read/Write Image Colormaps As An Image File....
<vulnerable_code> image->rows=(size_t) (draw_info->affine.sy*image->rows); status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) return(DestroyImageList(image)); if (SetImageBackgroundColor(image,exception) == MagickFalse) { image=DestroyImageList(image); ...
<vulnerable_code>def test_add_transformation_on_page_without_contents(): page = PageObject() page.add_transformation(Transformation())<commit_title>[PATCH] Extend testing<commit_description><fixed_code> def test_add_transformation_on_page_without_contents(): page = PageObject() page.add_transformation(T...
<vulnerable_code> # 6 instead of 5: as there is an issue in page 5 (missing objects) # and too complex to handle the warning without hiding real regressions (True, "https://arxiv.org/pdf/1601.03642.pdf", [0, 1, 5, 7]), ], ) def test_extract_textbench(enable, url, pages, print_result=False):<c...
<vulnerable_code> rr_class = DNS_RR_CLASS(aptr); rr_len = DNS_RR_LEN(aptr); aptr += RRFIXEDSZ; if (rr_class == C_IN && rr_type == T_A && rr_len == sizeof(struct in_addr)<commit_title>[PATCH] ares: Prevent buffer overlow in ares_parse_a_reply<commit_description><fixed_code> rr_class = DN...
<vulnerable_code>import itertools import random from typing import Union import aiohttp import discord import inflection from redbot.core import Config, checks, commands from redbot.core.i18n import get_locale from redbot.core.utils.chat_formatting import italics from .helpers import * class Act(commands.Cog): ...
<vulnerable_code> // do not proceed, throw an exception and quit. This prevents the core from falling // back to a plaintext-only core when they should be expecting SSL/TLS only. if (Quassel::isOptionSet("require-ssl")) { throw ExitException{EXIT_FAILURE, tr("--require-ssl is set, but...
<vulnerable_code> return; timer = &pit->pit_state.timer; if (hrtimer_cancel(timer)) hrtimer_start_expires(timer, HRTIMER_MODE_ABS); } static void destroy_pit_timer(struct kvm_pit *pit)<commit_title>[PATCH] KVM: x86: Improve thread safety in pit<commit_description>There's a race condition in the PIT emulation cod...
<vulnerable_code>var logger = require('morgan'); var cookieParser = require('cookie-parser'); var bodyParser = require('body-parser'); var routes = require('./routes/index'); var challenge = require('./routes/challenge'); app.use(bodyParser.urlencoded({ extended: false })); app.use(cookieParser()); app.use(express.sta...
<vulnerable_code>var express = require('express'); var router = express.Router(); var mysql = require('mysql'); var conn_params = { host : "ec2-52-1-159-248.compute-1.amazonaws.com", user : "root", database: "picture_this", }; /* GET home page. */ router.get('/', function(req, res, next) { res.js...