text stringlengths 79 3.72M |
|---|
<vulnerable_code>// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved.
//
// This software, the RabbitMQ Java client library, is triple-licensed under the
// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2
final FrameBuilder frameBuilder;
public SocketCh... |
<vulnerable_code>// Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved.
//
// This software, the RabbitMQ Java client library, is triple-licensed under the
// Mozilla Public License 2.0 ("MPL"), the GNU General Public License version 2
private boolean isUnderflowHandlingEnabled = false;
... |
<vulnerable_code> @Test
public void buildFrameInOneGo() throws IOException {
buffer = ByteBuffer.wrap(new byte[] { 1, 0, 0, 0, 0, 0, 3, 1, 2, 3, end() });
builder = new FrameBuilder(channel, buffer);
Frame frame = builder.readFrame();
assertThat(frame).isNotNull();
assertT... |
<vulnerable_code><commit_title>[PATCH] Add max inbound message size to ConnectionFactory<commit_description>To avoid OOM with a very large message.
The default value is 64 MiB.
Fixes #1062
(cherry picked from commit 9ed45fde52224ec74fc523321efdf9a157d5cfca)
Conflicts:
src/main/java/com/rabbitmq/client/impl/Frame.ja... |
<vulnerable_code>import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
}
public static boolean basicGetBasicConsume(Connection connection, String queue, final CountDownLatch latch, int msgSize)
... |
<vulnerable_code> var $inner_sql = $(this).parent().prev().find('code.sql');
var old_text = $inner_sql.html();
var new_content = "<textarea name=\"sql_query_edit\" id=\"sql_query_edit\">" + sql_query + "</textarea>\n";
new_content += getForeignKeyCheckboxLoader();
new_conten... |
<vulnerable_code> continue;
}
if (i > sizeof(ipv6_addr_t)) {
return NULL;
}
}
#ifdef MODULE_IPV4_ADDR
if (ch == '.' && (i <= sizeof(ipv6_addr_t)) &&
ipv4_addr_from_str((ipv4_addr_t *)(&(result->u8[i])),
... |
<vulnerable_code> {
guint32 canonical_mode;
/* Silently ignore world-writable directories (plus sticky, suid bits,
* etc.) when doing a checkout for bare-user-only repos. This is related
* to the logic in ostree-repo-commit.c for files.
* See also: https://github.com/ostreedev/ostree... |
<vulnerable_code>static gboolean opt_disable_fsync;
static gboolean opt_require_hardlinks;
static gboolean opt_force_copy;
static gboolean
parse_fsync_cb (const char *option_name,
{ "fsync", 0, 0, G_OPTION_ARG_CALLBACK, parse_fsync_cb, "Specify how to invoke fsync()", "POLICY" },
{ "require-hardlinks", 'H', 0, G_... |
<vulnerable_code> couldntClearPackageFromCache: "Couldn't clear package $0 from cache",
clearedPackageFromCache: 'Cleared package $0 from cache',
packWroteTarball: 'Wrote tarball to $0.',
helpExamples: ' Examples:\n$0\n',
helpCommands: ' Commands:\n$0\n',
helpCommandsMore: ' Run `$0` for more information... |
<vulnerable_code>
import {MANIFEST_FIELDS} from '../../constants';
import type {Reporter} from '../../reporters/index.js';
import {isValidLicense} from './util.js';
import {normalizePerson, extractDescription} from './util.js';
import {hostedGitFragmentToGitUrl} from '../../resolvers/index.js';
import inferLicense from... |
<vulnerable_code>
import type {PersonObject} from '../../types.js';
const validateLicense = require('validate-npm-package-license');
export function isValidLicense(license: string): boolean {
return !!license && validateLicense(license).validForNewPackages;
}
export function stringifyPerson(person: mixed): any {
... |
<vulnerable_code> raise TokenError("invalid_grant")
# Validate PKCE parameters.
if self.code_verifier:
if self.authorization_code.code_challenge_method == PKCE_METHOD_S256:
new_code_challenge = (
urlsafe_b64encode(sha256(self.code_verifier.enco... |
<vulnerable_code> },
items: [
"security/policy",
"security/GHSA-rjvp-29xq-f62w",
"security/CVE-2023-39522",
"security/CVE-2023-36456",<commit_title>[PATCH] security: fix CVE-2023-48228<commit_description>Signed-off-by: Jens Langhamme... |
<vulnerable_code> "dojo/dom-construct",
"dojo/_base/NodeList",
"dojo/_base/browser",
'dijit/layout/BorderContainer',
'dijit/layout/ContentPane',
'dojox/layout/ExpandoPane',<commit_title>[PATCH] Add "dojox/html" as dependency<commit_description>"dojox/html/entities" will be used to sanitize the st... |
<vulnerable_code> * -Frank.
*/
int sfgets(void)
{
struct pollfd pfd;
int pollret;
ssize_t readnb;
signed char seen_r = 0;
static size_t scanned;
static size_t readnbd;
if (scanned > (size_t) 0U) { /* support pipelining */
readnbd -= scanned;
addreply_... |
<vulnerable_code> unquoted_file_uri = unquote(__file_uri__).lstrip("/")
segments = unquoted_file_uri.split("/")
if any(segment == ".." or sep in segment for segment in segments):
raise BadRequest("Invalid URL")
file_path = path.join(file_or_directory, unq... |
<vulnerable_code> lazy: true
});
gulp.task('default', ['serve-dev'])
gulp.task('test', ['build'], function () {
return gulp.src('build/**/*Spec.js', {
read: false
})
.pipe($.mocha({
reporter: 'nyan'
}))
})
gulp.task('serve-dev', ['build'], function () {
ser... |
<vulnerable_code>import pg from 'pg';
import Term from './models/Term'
export
default class Database {
constructor(connectionUri) {
this.connectionUri = connectionUri;
};
add(term, callback) {
};
find(id, callback) {
pg.connect(this.connectionUri, function (err, client, done) {
... |
<vulnerable_code><commit_title>[PATCH] Fix XSS on term-detailed web client view. Previous behavior<commit_description><fixed_code>
export default class Sanitize {
constructor() {
}
/**
* This function replaces all instances of lt and gt with their
* HTML entity.
*/
htmlSanitize(html) {
... |
<vulnerable_code><commit_title>[PATCH] Fix XSS on term-detailed web client view. Previous behavior<commit_description><fixed_code>
import assert from 'assert'
import sut from './sanitize'
suite('Sanitize', function() {
suite('#htmlSanitize()', function() {
test('should encode all lt and gt-symbols', functi... |
<vulnerable_code> Add support for all RR types to NSEC type bitmap
Merge pull request #17 from sunds/issue_16
Issue 16: uncaught exceptions leak open sockets
License:
--------
from dnslib.dns import *
version = "0.9.16"
if __name__ == '... |
<vulnerable_code> a_pkt = q.send(address,port,tcp=args.tcp)
a = DNSRecord.parse(a_pkt)
if a.header.tc and args.noretry == False:
# Truncated - retry in TCP mode
a_pkt = q.send(address,port,tcp=True)<commit_title>[PATCH] Validate TXID in client.py (Issue #30 - thanks to @d... |
<vulnerable_code> extent=(size_t) count;
(void) strncpy((char *) q,buffer,extent);
q+=extent;
if ((q-pixels+extent+1) >= sizeof(pixels))
{
*q++='\n';
(void) WriteBlob(image,q-pixels,pixels);
extent=(size_t) count;
... |
<vulnerable_code> * do something before the {@link DecompressionException} is thrown, such as log the
* data that was decompressed so far.
*/
protected void decompressionBufferExhausted(ByteBuf buffer) {}
}<commit_title>[PATCH] Fix Checkstyle issue<commit_description><fixed_code>
* do something ... |
<vulnerable_code> return alloc_limit;
}
static void
alloc_limit_failure (char *fn_name, size_t size)
{
fprintf (stderr,
"%s: Maximum allocation size exceeded "
"(maxsize = %lu; size = %lu).\n",
fn_name,
(unsigned long)alloc_limit,
(unsigned long... |
<vulnerable_code> const entityKey = contentState
.createEntity('LINK', 'MUTABLE', { title: 'title', url: 'url' })
.getLastCreatedEntityKey();
it('should have a div when rendered', () => {
const Link = LinkDecorator.component;
control.setState({ showPopOver: true });
expect(control.childAt(0).chi... |
<vulnerable_code>import React, { Component } from 'react';
import PropTypes from 'prop-types';
import openlink from '../../../images/openlink.svg';
import './styles.css';
openLink: Function = () => {
const { entityKey, contentState } = this.props;
const { url } = contentState.getEntity(entityKey).getDa... |
<vulnerable_code><commit_title>[PATCH] Fix XSS in Link Target<commit_description><fixed_code>
const ATTRIBUTE_WHITESPACES = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g; // eslint-disable-line no-control-regex
const SAFE_URL = /^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i;
/**
* R... |
<vulnerable_code>import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jdom.DocType;
import org.jdom.Element;
import org.jdom.input.DOMBuilder;
currentFormat.setExpandEmptyElements(currentFormatPolicy);
}
}
}
/**<commit_title>[PATCH] XCOMMONS-2568: Impr... |
<vulnerable_code>
defaultProperties.setDeserializeEntities(true);
return defaultProperties;
}
defaultTransformations.addTransformation(tt);
}
String restricted = configuration.getParameters().get(HTMLCleanerConfiguration.RESTRICTED);
if ("true".equalsIgnoreCase... |
<vulnerable_code>import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.xwiki.component.manager.ComponentManager;
+ "</mi></math>");
}
/**
* Verify that passing ... |
<vulnerable_code>import { alias, not, or, readOnly } from "@ember/object/computed";
import Controller, { inject as controller } from "@ember/controller";
import DiscourseURL from "discourse/lib/url";
import EmberObject from "@ember/object";
invitedBy: readOnly("model.invited_by"),
email: alias("model.email"),
... |
<vulnerable_code>}
function getProcessIdOnPort(port) {
return execFileSync('lsof', ['-i:'+port, '-P', '-t', '-sTCP:LISTEN'], execOptions)
.split('\n')[0]
.trim();
}<commit_title>[PATCH] Update getProcessForPort.js<commit_description><fixed_code>
}
function getProcessIdOnPort(port) {
return execFileSync('l... |
<vulnerable_code> }
}
var defaultData = {
namespace: MESSAGE_NAMESPACE
};
function postData(id, data, origin) {
if (!isOriginAllowed(origin)) {
return;
}
var mergedData = XdUtils.extend(data, defaultData);
mergedData.id = id;
parent.postMessage(JSON.stringify(mergedData), ori... |
<vulnerable_code> goto MATLAB_KO; /* unsupported endian */
if (strncmp(MATLAB_HDR.identific, "MATLAB", 6))
MATLAB_KO: ThrowReaderException(CorruptImageError,"ImproperImageHeader");
filepos = TellBlob(image);
while(!EOFBlob(image)) /* object parser loop */<commit_title>[PATCH] https://github.com/ImageMagic... |
<vulnerable_code> be32_to_cpu(agf->agf_flcount) <= xfs_agfl_size(mp)))
return __this_address;
if (be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]) < 1 ||
be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]) < 1 ||
be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]) > XFS_BTREE_MAXLEVELS ||
be32_to_cpu(agf->agf_leve... |
<vulnerable_code> priv->expr_array[i] = dynset_expr;
priv->num_exprs++;
if (set->num_exprs &&
dynset_expr->ops != set->exprs[i]->ops) {
err = -EOPNOTSUPP;
goto err_expr_free;
}
i++;
}<commit_title>[PATCH] netfilter: nf_tables: bail out on mismatching dynset and set<commit_description><fi... |
<vulnerable_code> index_commit_for_bitmap(commit);
}
static void show_object(struct object *obj,
struct strbuf *path, const char *last,
void *data)
{
char *name = path_name(path, last);
add_preferred_base_object(name);
add_object_entry(obj->oid.hash, obj->type, name, 0);
obj->flags |= OBJECT_ADDED;
/*
... |
<vulnerable_code> free_commit_buffer(commit);
}
static void finish_object(struct object *obj,
struct strbuf *path, const char *name,
void *cb_data)
{
struct rev_list_info *info = cb_data;
if (obj->type == OBJ_BLOB && !has_object_file(&obj->oid))
parse_object(obj->oid.hash);
}
static void show_object(str... |
<vulnerable_code> void *cb_data)
{
struct object *obj = &blob->object;
if (!revs->blob_objects)
return;
if (obj->flags & (UNINTERESTING | SEEN))
return;
obj->flags |= SEEN;
show(obj, path, name, cb_data);
}
/*
}
obj->flags |= SEEN;
show(obj, base, name, cb_data);
strbuf_addstr(base, name);
if (base... |
<vulnerable_code> return entry->in_pack_pos;
}
static void show_object(struct object *object, struct strbuf *path,
const char *last, void *data)
{
struct bitmap *base = data;
bitmap_set(base, find_object_pos(object->oid.hash));<commit_title>[PATCH] list-objects: pass full pathname to callbacks<commit_description>... |
<vulnerable_code>static const char *term_bad;
static const char *term_good;
char *path_name(struct strbuf *path, const char *name)
{
struct strbuf ret = STRBUF_INIT;
if (path)
strbuf_addbuf(&ret, path);
strbuf_addstr(&ret, name);
return strbuf_detach(&ret, NULL);
}
void show_object_with_name(FILE *out, struct o... |
<vulnerable_code><commit_title>[PATCH] NMS-15790: Transport bootstrap.jsp args in context<commit_description><fixed_code>
/*******************************************************************************
* This file is part of OpenNMS(R).
*
* Copyright (C) 2023 The OpenNMS Group, Inc.
* OpenNMS(R) is Copyright (C) 1... |
<vulnerable_code> protected void filterResponse(QueryResponse response, List<DocumentReference> usersToCheck)
{
SolrDocumentList results = response.getResults();
long numFound = results.getNumFound();
// Since we are modifying the results collection, we need to iterate over its copy.
... |
<vulnerable_code>
import java.lang.reflect.ParameterizedType;
import java.util.Arrays;
import java.util.Locale;
import org.apache.solr.client.solrj.SolrQuery;
{
private static final String ITERABLE_PARAM_NAME = "multiParam";
private static final String[] ITERABLE_PARAM_EXPECTED = {"value1", "value2"};
pr... |
<vulnerable_code> // Decompress into m_outChunk.
for (int i=0; i<blocksRead; i++)
{
decodeBlock(static_cast<const uint8_t *>(m_inChunk->buffer) + i * m_bytesPerPacket,
static_cast<int16_t *>(m_outChunk->buffer) + i * m_framesPerPacket * m_track->f.channelCount);
framesRead += m_framesPerPacket;
}<commit_titl... |
<vulnerable_code> 768, 614, 512, 409, 307, 230, 230, 230
};
// Compute a linear PCM value from the given differential coded value.
static int16_t decodeSample(ms_adpcm_state &state,
uint8_t code, const int16_t *coefficient)
{
int linearSample = (state.sample1 * coefficient[0] +
state.sample2 * coefficient[1]) >> 8... |
<vulnerable_code>router.get('/alignment', (req, res) => {
const { text } = req.query;
// TODO(twattanavekin): Test Unicode text.
const escapedText = JSON.stringify(text).slice(1, -1);
const { festvoxFile, voiceName, localFolder } = utils.getVoiceSettings();
// Example command:
// ${FESTIVALDIR}/bin/festiv... |
<vulnerable_code>
const utils = require('../utils');
describe('Testing utils getAlignmentData method', () => {
const generateTestData = () => {
let testContent = '()\n'; // Alignment data starts with this.<commit_title>[PATCH] Added function to replace characters with spaces and use it<commit_description><fixed_... |
<vulnerable_code>// See the License for the specific language governing permissions and
// limitations under the License.
/**
* Module containing util methods.
*/
localFolder: MODEL_LOCAL_PATH,
});
module.exports = {
getAlignmentData,
getExecErrorMessage,
getVoiceSettings,
};<commit_title>[PATCH] Added func... |
<vulnerable_code>/*
ImageMagick Macintosh PICT Methods.
*/
#define ReadPixmap(pixmap) \
{ \
pixmap.version=(short) ReadBlobMSBShort(image); \
pixmap.pack_type=(short) ReadBlobMSBShort(image); \
pixmap.pack_size=ReadBlobMSBLong(image); \
pixmap.horizontal_resolution=1UL*ReadBlobMSBShort(image); \
(void) Read... |
<vulnerable_code> * since virtio_gpu doesn't support dma-buf import from other devices.
*/
shmem->pages = drm_gem_shmem_get_sg_table(&bo->base);
if (!shmem->pages) {
drm_gem_shmem_unpin(&bo->base);
return -EINVAL;
}
if (use_dma_api) {<commit_title>[PATCH] drm/virtio: Fix NULL vs IS_ERR checking in<commit_de... |
<vulnerable_code> }
}
if (ReadRectangle(image,&source) == MagickFalse)
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
if (ReadRectangle(image,&destination) == MagickFalse)
ThrowReaderException(CorruptImageError,"ImproperI... |
<vulnerable_code> @property
def sqlalchemy_scheme(self) -> str:
"""Sqlalchemy scheme either from constructor, connection extras or default."""
return (
self._sqlalchemy_scheme
or self.connection_extra_lower.get("sqlalchemy_scheme")
or self.DEFAULT_SQLALCHEMY_SC... |
<vulnerable_code> @property
def sqlalchemy_scheme(self) -> str:
"""SQLAlchemy scheme either from constructor, connection extras or default."""
return (
self._sqlalchemy_scheme
or self.connection_extra_lower.get("sqlalchemy_scheme")
or self.DEFAULT_SQLALCHEMY_SC... |
<vulnerable_code>"""This file and its contents are licensed under the Apache License 2.0. Please see the included NOTICE for copyright information and LICENSE for a copy of the license.
"""
import os
import socket
from django.conf import settings
from django.core.management.utils import get_random_secret_key
from labe... |
<vulnerable_code>
env = environ.Env()
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
environ.Env.read_env(os.path.join(base_dir, '..', '..', '.env'))
def cast_bool_from_str(value):
if isinstance(value, str):<commit_title>[PATCH] use the ls data dir env if specified with a fallback to the<c... |
<vulnerable_code>
import logging
from rdiffweb.controller import Controller, validate_int
from rdiffweb.tools.i18n import ugettext as _
def render_prefs_panel(self, panelid, action=None, **kwargs): # @UnusedVariable
# Process the parameters.
if action == "set_notification_info":
self... |
<vulnerable_code> repo_obj = self.app.store.get_user(self.USERNAME).get_repo(self.REPO)
self.assertEqual(7, repo_obj.maxage)
def test_get_page(self):
self.getPage("/prefs/", method='GET')
self.assertInBody("SSH")<commit_title>[PATCH] Mitigate CSRF on notification #216<commit_descript... |
<vulnerable_code> if (ecma_number_is_nan (converted_number[0]))
{
*date_value_p = converted_number[0];
return ecma_make_number_value (converted_number[0]);
}
<commit_title>[PATCH] Date.prototype.setYear should invalidate cached tza (#4955)<commit_description>This patch fixes #... |
<vulnerable_code>var urlgrey = require('urlgrey')
var jsYaml = require('js-yaml')
var walk = require('ignore-walk')
var execSync = require('child_process').execSync
var detectProvider = require('./detect')
var version = 'v' + require('../package.json').version
var patterns,
more_patterns = ''
var isWindows =
pr... |
<vulnerable_code> char ptr; // this is on the stack
extern void *STACK_BASE;
uint32_t count = (uint32_t)((size_t)STACK_BASE - (size_t)&ptr);
return 1000000 - count; // give it 1 megabyte of stack
#else
// stack depth seems pretty platform-specific :( Default to a value that disables it
return 1000000; // no... |
<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 16/16] [3.12] gh-104496: Use correct Tcl or Tk version... |
<vulnerable_code> emit(ANY_ALL)
else:
emit(ANY)
elif op is POSSESSIVE_REPEAT:
# gh-106052: Possessive quantifiers do not work when the
# subpattern contains backtracking, i.e. "(?:ab?c)*+".
# Implement it as equivalent greedy qualifi... |
<vulnerable_code> self.assertFalse(template_re1.match('nope'))
def test_bug_gh106052(self):
self.assertEqual(re.match("(?>(?:ab?c)+)", "aca").span(), (0, 2))
self.assertEqual(re.match("(?:ab?c)++", "aca").span(), (0, 2))
self.assertEqual(re.match("(?>(?:ab?c)*)", "aca").span(), (0, 2... |
<vulnerable_code> def test_basic_multiple_interpreters_deleted_no_reset(self):
# without resetting; already loaded in a deleted interpreter
# At this point:
# * alive in 0 interpreters
# * module def may or may not be loaded already<commit_title>[PATCH 16/16] [3.12] gh-104496: Use ... |
<vulnerable_code> Do not call them otherwise, they do not initialize the object! */
#ifdef Py_TRACE_REFS
/* Head of circular doubly-linked list of all objects. These are linked
* together via the _ob_prev and _ob_next members of a PyObject, which
* exist only in a Py_TRACE_REFS build.
*/
static PyObject refchain... |
<vulnerable_code> }
if (dump_refs) {
_Py_PrintReferences(stderr);
}
if (dump_refs_fp != NULL) {
_Py_PrintReferences(dump_refs_fp);
}
#endif /* Py_TRACE_REFS */
*/
if (dump_refs) {
_Py_PrintReferenceAddresses(stderr);
}
if (dump_refs_fp != NULL) {
... |
<vulnerable_code> _obmalloc_pools_INIT(interp->obmalloc.pools);
memcpy(&interp->obmalloc.pools.used, temp, sizeof(temp));
}
_PyEval_InitState(interp, pending_lock);
_PyGC_InitState(&interp->gc);<commit_title>[PATCH 16/16] [3.12] gh-104496: Use correct Tcl or Tk version in<commit_desc... |
<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 16/16] [3.12] gh-104496: Use correct Tcl or Tk versi... |
<vulnerable_code>
locale: LPCWSTR
flags: DWORD
src: LPCWSTR
[clinic start generated code]*/
static PyObject *
_winapi_LCMapStringEx_impl(PyObject *module, LPCWSTR locale, DWORD flags,
LPCWSTR src)
/*[clinic end generated code: output=cf4713d80e2b47c9 input=9fe26f95d5ab0001]*/
{
... |
<vulnerable_code> stream=io.StringIO())
def runTests(*cases):
suite = unittest.TestSuite()
for case in cases:
ordering.append('cleanup_good')
else:
ordering.append('cleanup_exc')
raise Exception('CleanUpExc')
class TestCM:
result = unitte... |
<vulnerable_code> supports_root_dir = getattr(func, 'supports_root_dir', False)
save_cwd = None
if root_dir is not None:
if supports_root_dir:
# Support path-like base_name here for backwards-compatibility.
base_name = os.fspath(base_name)<commit_title>[PATCH 16/16] [3.12] gh-... |
<vulnerable_code> formats = [name for name, params in get_archive_formats()]
self.assertNotIn('xxx', formats)
### shutil.unpack_archive
def check_unpack_archive(self, format, **kwargs):<commit_title>[PATCH 16/16] [3.12] gh-104496: Use correct Tcl or Tk version in<commit_description><fixed_code>... |
<vulnerable_code> ...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable.''')
def get_preparation_data(name):<commit_title>[PATCH 16/16] [3.12] gh-104496: Use correct Tcl or Tk version in<commit_description><fixed_code>
... |
<vulnerable_code>}
/*[clinic input]
code.replace
*
co_argcount: int(c_default="self->co_argcount") = -1
co_posonlyargcount: int(c_default="self->co_posonlyargcount") = -1
co_kwonlyargcount: int(c_default="self->co_kwonlyargcount") = -1
co_nlocals: int(c_default="self->co_nlocals") = -1
co_stac... |
<vulnerable_code> self.indent = IndentStack()
self.kind = CALLABLE
self.coexist = False
self.parameter_continuation = ''
self.preserve_output = False
fail("Called @coexist twice!")
self.coexist = True
def parse(self, block: Block) -> None:
self.re... |
<vulnerable_code>import _testinternalcapi
def decode_stderr(err):
return err.decode('utf-8', 'replace').replace('\r', '')
del d.extra
self.assertIsNone(d.extra)
@requires_limited_api
class TestHeapTypeRelative(unittest.TestCase):<commit_title>[PATCH 16/16] [3.12] gh-104496: Use correct Tcl or T... |
<vulnerable_code>// Include definitions from there.
#include "_testcapi/parts.h"
// Forward declarations
static struct PyModuleDef _testcapimodule;
static PyObject *TestError; /* set to exception object in init */
}
static PyObject *test_buildvalue_issue38913(PyObject *, PyObject *);
static PyMethodDef TestMeth... |
<vulnerable_code> except ValueError:
pass
try:
setitem(b, 0, None)
self.fail("Didn't raise TypeError")
except TypeError:
pass<commit_title>[PATCH 16/16] [3.12] gh-104496: Use correct Tcl or Tk version in<commit_descriptio... |
<vulnerable_code><commit_title>[PATCH 16/16] [3.12] gh-104496: Use correct Tcl or Tk version in<commit_description><fixed_code>
import unittest
import sys
from collections import OrderedDict
from test import support
from test.support import import_helper
import _testcapi
NULL = None
class TestObject:
@property
... |
<vulnerable_code><commit_title>[PATCH 16/16] [3.12] gh-104496: Use correct Tcl or Tk version in<commit_description><fixed_code>
import unittest
import sys
from collections import OrderedDict, UserDict
from types import MappingProxyType
from test import support
from test.support import import_helper
import _testcapi
N... |
<vulnerable_code> def test_buildvalue_N(self):
_testcapi.test_buildvalue_N()
def test_mapping_keys_values_items(self):
class Mapping1(dict):
def keys(self):
return list(super().keys())
def values(self):
return list(super().values())
... |
<vulnerable_code> self.attr = 1
a = A()
self.assertEqual(_testcapi.hasattr_string(a, "attr"), True)
self.assertEqual(_testcapi.hasattr_string(a, "noattr"), False)
self.assertIsNone(sys.exception())
def testDel(self):<commit_title>[PATCH 16/16] [3.12] gh-104496: Use c... |
<vulnerable_code><commit_title>[PATCH 16/16] [3.12] gh-104496: Use correct Tcl or Tk version in<commit_description><fixed_code>
#include <stddef.h> // ptrdiff_t
#define PY_SSIZE_T_CLEAN
#include "parts.h"
#define NULLABLE(x) do { if (x == Py_None) x = NULL; } while (0);
#define RETURN_INT(value) do { ... |
<vulnerable_code><commit_title>[PATCH 16/16] [3.12] gh-104496: Use correct Tcl or Tk version in<commit_description><fixed_code>
#include <stddef.h> // ptrdiff_t
#define PY_SSIZE_T_CLEAN
#include "parts.h"
#define NULLABLE(x) do { if (x == Py_None) x = NULL; } while (0);
#define RETURN_INT(value) do { ... |
<vulnerable_code> Py_RETURN_NONE;
}
static PyObject*
getitem_with_error(PyObject *self, PyObject *args)
{
PyObject *map, *key;
#endif
static PyObject *
get_mapping_keys(PyObject* self, PyObject *obj)
{
return PyMapping_Keys(obj);
}
static PyObject *
get_mapping_values(PyObject* self, PyObject *obj)
{
... |
<vulnerable_code> if source_lines is None:
return None
pat = re.compile(r'^\s*class\s*%s\b' %
getattr(obj, '__name__', '-'))
for i, line in enumerate(source_lines):
if pat.match(line):
lineno = i<commit_t... |
<vulnerable_code> self.assertEqual(image['foreground'],
'-foreground {} {} #000000 yellow')
class PhotoImageTest(AbstractTkTest, unittest.TestCase):
image.configure(palette='3/4/2')
self.assertEqual(image['palette'], '3/4/2')
def test_blank(self):
image = ... |
<vulnerable_code> elif kw: cnf = kw
options = ()
for k, v in cnf.items():
if callable(v):
v = self._register(v)
options = options + ('-'+k, v)
self.tk.call(('image', 'create', imgtype, name,) + options)
self.name = name
for k, v in _... |
<vulnerable_code> ('c:func', 'sprintf'),
('c:func', 'stat'),
('c:func', 'system'),
('c:func', 'vsnprintf'),
# Standard C types
('c:type', 'FILE'),<commit_title>[PATCH 16/16] [3.12] gh-104496: Use correct Tcl or Tk version in<commit_description><fixed_code>
('c:func', 'sprintf'),
('c:func'... |
<vulnerable_code>
tcl_version = tuple(map(int, _tkinter.TCL_VERSION.split('.')))
_tk_patchlevel = None
def get_tk_patchlevel():
global _tk_patchlevel
if _tk_patchlevel is None:
tcl = Tcl()
_tk_patchlevel = tcl.info_patchlevel()
return _tk_patchlevel
class TkinterTest(unittest.TestCase):
... |
<vulnerable_code>
import _tkinter
tcl_version = tuple(map(int, _tkinter.TCL_VERSION.split('.')))
def requires_tcl(*version):
if len(version) <= 2:
return unittest.skipUnless(tcl_version >= version,
'requires Tcl version >= ' + '.'.join(map(str, version)))
def deco(test):
@functools... |
<vulnerable_code>import tkinter
from test import support
from test.support import os_helper
from test.test_tkinter.support import AbstractTkTest, AbstractDefaultRootTest, requires_tcl
support.requires('gui')
def test_create_from_gif_data(self):
self.check_create_from_data('gif')
@requires_tcl(8, 6)
... |
<vulnerable_code>import os
from test.support import requires
from test.test_tkinter.support import (requires_tcl,
get_tk_patchlevel, widget_eq,
AbstractDefaultRootTest)
from test.test_tkinter.widget_tests import (
widget = self.create()
... |
<vulnerable_code># Common tests for test_tkinter/test_widgets.py and test_ttk/test_widgets.py
import tkinter
from test.test_tkinter.support import (AbstractTkTest, tcl_version,
pixels_conv, tcl_obj_eq)
import test.support
return self._scaling
def _str(self, value):
... |
<vulnerable_code> newname = f'C.{name}'
self.assertEqual(style.map(newname), {})
style.map(newname, **default)
if theme == 'alt' and name == '.' and get_tk_patchlevel() < (8, 6, 1):
default['embossed'] = [('disabled',... |
<vulnerable_code>import sys
from test.test_ttk_textonly import MockTclObj
from test.test_tkinter.support import (AbstractTkTest, tcl_version, get_tk_patchlevel,
simulate_mouse_click, AbstractDefaultRootTest)
from test.test_tkinter.widget_tests import (add_standard_options,
Abstrac... |
<vulnerable_code>/* Copyright 2018-2020 Google LLC
*
* This is part of the Google Cloud IoT Device SDK for Embedded C.
* It is licensed under the BSD 3-Clause license; you may not use this file
*/
#include "iotc_allocator.h"
#include "iotc_bsp_mem.h"
extern void* memset(void* ptr, int value, size_t num);
void* _... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.