text stringlengths 79 3.72M |
|---|
<vulnerable_code> COUNT_ACCURATE,
/**
* Always include a count in the response, but cache the count so that the count may be slightly out of date (but resource usage will be much lower)
*/
COUNT_CACHED,
/**
* Do not include a count in history responses<commit_title>[PATCH] Resolve test failures<commit_descri... |
<vulnerable_code> return count.intValue();
});
switch (myDaoConfig.getHistoryCountMode()) {
case COUNT_ACCURATE: {
int count = supplier.apply(key);
mySearchEntity.setTotalCount(count);
break;
}
case COUNT_CACHED: {
int count = myMemoryCacheService.get(MemoryCacheService.CacheEnum.HISTORY... |
<vulnerable_code>package ca.uhn.fhir.jpa.dao.dstu2;
import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao;
import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao;
import ca.uhn.fhir.jpa.dao.data.IForcedIdDao;
myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferenc... |
<vulnerable_code>
import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao;
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamString;
import ca.uhn.fhir.jpa.model.entity.TagTypeEnum;
myDaoConfig.setAllowExternalReferences(new ... |
<vulnerable_code>import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import static org.hamcrest.MatcherAssert.assertThat;
import static org... |
<vulnerable_code>
modal_window.find('.modal-body').html('');
modal_window.find('.modal-body').append(modal_content.contents());
modal_window.find('.modal-title').html(__('Interface') + ' ' + String(identifier));
modal_window.modal({'show': true});
modal_window.find('a[rel="popover-modal"]').popover();
type... |
<vulnerable_code>
#include <sys/stat.h>
#ifdef WIN32
#include "strftime.h"
strftime(prline.u_str,
FMT_LEG_LEN, im->gdes[i].format, &tmvdef);
}
} else if (bad_format(im->gdes[i].format)) {
rrd_set_error
... |
<vulnerable_code>import json
import logging
import os
import socket
import time
import webbrowser<commit_title>[PATCH] Added URL Validator and URL escaping of strings<commit_description><fixed_code>
import json
import logging
import os
import re
import socket
import time
import webbrowser |
<vulnerable_code><commit_title>[PATCH] Added URL Validator and URL escaping of strings<commit_description><fixed_code>
#
# Copyright (c) 2012-2023 Snowflake Computing Inc. All rights reserved.
#
from __future__ import annotations
from logging import getLogger
import re
import urllib.parse
logger = getLogger(__name__... |
<vulnerable_code><commit_title>[PATCH] Added URL Validator and URL escaping of strings<commit_description><fixed_code>
#
# Copyright (c) 2012-2023 Snowflake Computing Inc. All rights reserved.
#
from snowflake.connector.url_util import SnowflakeURLUtil
def test_url_validator():
assert SnowflakeURLUtil.is_valid_u... |
<vulnerable_code> size_t regSpill, lengthAndCounterFlag, keysBegin;
};
size_t increment = BLOCKSIZE;
const byte* zeros = (byte *)(Te+256);
byte *space;
do {
// https://msdn.microsoft.com/en-us/library/5471dc8s.aspx
#if (CRYPTOPP_MSC_VERION >= 1400)
space = (byte *)_malloca(255+sizeof(Locals));
sp... |
<vulnerable_code>
add(scope=S.GLOBAL, operation=P.VIEW, description="view any task")
add(scope=S.COLLABORATION, operation=P.VIEW, assign_to_container=True,
assign_to_node=True, description="view tasks of your organization")
add(scope=S.GLOBAL, operation=P.CREATE, description="create a new task")
... |
<vulnerable_code>import numpy as np
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import sparse_tensor
from tensorflow.python.framework import test_util
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import math_ops as mo
from tensorflow.python.ops import strin... |
<vulnerable_code> }
s++;
ptmp = tmp;
while (*s && *s != '\"')
*ptmp++ = *s++;
if (*s != '\"')
return -1;
s += 11;
SKIPWS(s);
ptmp = tmp;
while (isdigit((unsigned char) *s))
*ptmp++ = *s++;
*ptmp = '\0';
if (mutt_str_atol(tmp, &h->c... |
<vulnerable_code> self.assert_length(get_default_streams_for_realm_as_dicts(self.realm.id), 1)
self.check_user_subscribed_only_to_streams("alice", [])
def test_create_multiuse_invite_group_setting(self) -> None:
realm = get_realm("zulip")
full_members_system_group = UserGroup.objects... |
<vulnerable_code> )
streams.append(stream)
invite_link = do_create_multiuse_invite_link(
user_profile, invite_as, invite_expires_in_minutes, streams
)<commit_title>[PATCH] CVE-2024-21630: Check permission to subscribe others using<commit_description><fixed_code>
)
... |
<vulnerable_code> make the path longer, and will not fail. 'size' is the length of
the path, if known. If -1, the first null character will be assumed
to be the end of the path. 'norm_size' is a pointer to a variable
containing the length of the resulting normalized path. */
wchar_t *
_Py_normpathAndSize(wch... |
<vulnerable_code>import org.apache.xml.serialize.HTMLdtd;
import org.apache.xml.serialize.OutputFormat;
import org.owasp.validator.html.InternalPolicy;
import java.io.IOException;
import java.io.Writer;
@SuppressWarnings("deprecation")
public class ASHTMLSerializer extends org.apache.xml.serialize.HTMLSerializer {
p... |
<vulnerable_code> assertThat(as.scan("<p style=\"color: red\">Some Text</p>", policy, AntiSamy.DOM).getCleanHTML(), not(containsString("!important")));
assertThat(as.scan("<p style=\"color: red\">Some Text</p>", policy, AntiSamy.SAX).getCleanHTML(), not(containsString("!important")));
}
}
<commit_tit... |
<vulnerable_code> public void testEmailValidatorWithOkEmail() {
Assert.assertTrue(validator.isValid("my.name@email.com"));
}
}<commit_title>[PATCH] Add test that validator does not halt due bad input<commit_description><fixed_code>
public void testEmailValidatorWithOkEmail() {
Assert.assertTr... |
<vulnerable_code>from asyncio import tasks
from test.test_asyncio import utils as test_utils
from test.test_asyncio.test_tasks import get_innermost_context
from test import support
MOCK_ANY = mock.ANY
class CEagerTaskFactoryLoopTests(EagerTaskFactoryLoopTests, test_utils.TestCase):
Task = getattr(tasks, '_CTask',... |
<vulnerable_code> }
prev_task = Py_None;
}
if (task == Py_None) {
if (_PyDict_DelItem_KnownHash(state->current_tasks, loop, hash) == -1) {
return NULL;
}
} else {
if (_PyDict_SetItem_KnownHash(state->current_tasks, loop, task, hash) == -1) {
re... |
<vulnerable_code> raise ServiceError(ua.StatusCodes.BadSessionNotActivated)
if typeid == ua.NodeId(ua.ObjectIds.ReadRequest_Encoding_DefaultBinary):
self._raise_error_if_session_is_invalid()
_logger.info("Read request (%s)", user)
params = stru... |
<vulnerable_code> ],
styleSrc: [config.serverURL + '/build/', config.serverURL + '/css/', '\'unsafe-inline\'', 'https://github.githubassets.com'], // unsafe-inline is required for some libs, plus used in views
objectSrc: ['*'], // Chrome PDF viewer treats PDFs as objects :/
formAction: ['\'self\'']
}
const cdnD... |
<vulnerable_code>/* $OpenBSD: auth-passwd.c,v 1.44 2014/07/15 15:54:14 millert Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
#define DAY (24L * 60 * 60) /* 1 day in seconds */
#define TWO_WEEKS (2L * 7 * DAY) /* 2 weeks in seconds */
void
disable_... |
<vulnerable_code> }
ReadFile(hFile,pBits,dwSize,&dwSize,NULL);
CloseHandle(hFile);
if (((PAPMHEADER) pBits)->dwKey != 0x9ac6cdd7l)
{
pBits=(BYTE *) DestroyString((char *) pBits);
return((HENHMETAFILE) NULL);<commit_title>[PATCH] Pull request:<commit_description><fixed_code>
}
ReadFile(hFi... |
<vulnerable_code> number_bits=8;
for (bit=0; bit < number_bits; bit++)
{
SetPSDPixel(image,channels,type,packet_size,(((unsigned char) pixel)
& (0x01 << (7-bit))) != 0 ? 0 : QuantumRange,q++,indexes,x++);
}
if (x != (ssize_t) image->columns)
x--;<... |
<vulnerable_code> break;
}
state&=(~InactiveWidgetState);
id=(event.xbutton.y-top_offset)/(int) selection_info.height;
selection_info.id=id;
if ((id < 0) || (id >= (int) number_selections))
if (event.xcrossing.state == 0)
break;
state&=(~Ina... |
<vulnerable_code> if (i == (ssize_t) argc)
ThrowAnimateException(OptionError,"MissingArgument",option);
if (XRemoteCommand(display,resource_info.window_id,argv[i]) != 0)
return(MagickFalse);
i--;
break;
}<commit_title>[PATCH] Pull requ... |
<vulnerable_code> if (i == (ssize_t) argc)
ThrowDisplayException(OptionError,"MissingArgument",option);
if (XRemoteCommand(display,resource_info.window_id,argv[i]) != 0)
return(MagickFalse);
i--;
break;
}<commit_title>[PATCH] Pull requ... |
<vulnerable_code> char *http_proxy; ///< holds the address of the HTTP proxy server
AVDictionary *avio_opts;
int strict_std_compliance;
} HLSContext;
static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
return AVERROR_INVALIDDATA;
// only http(s) & file are allow... |
<vulnerable_code> * No restrictions so for a user client we can clear
* the whole fifo
*/
if (client->type == USER_CLIENT)
snd_seq_fifo_clear(client->data.user.fifo);
}
<commit_title>[PATCH] ALSA: seq: Fix missing NULL check at remove_events ioctl<commit_description>snd_seq_ioctl_remove_events() calls snd... |
<vulnerable_code>#include "intset.h"
#include "zmalloc.h"
#include "endianconv.h"
/* Note that these encodings are ordered, so:
* INTSET_ENC_INT16 < INTSET_ENC_INT32 < INTSET_ENC_INT64. */
/* Resize the intset */
static intset *intsetResize(intset *is, uint32_t len) {
uint32_t size = len*intrev32ifbe(is->encodin... |
<vulnerable_code> if ((len = rdbLoadLen(rdb,NULL)) == RDB_LENERR) return NULL;
/* Use a regular set when there are too many entries. */
if (len > server.set_max_intset_entries) {
o = createSetObject();
/* It's faster to expand the dict to the right size asap in order
... |
<vulnerable_code> if (success) {
/* Convert to regular set when the intset contains
* too many entries. */
if (intsetLen(subject->ptr) > server.set_max_intset_entries)
setTypeConvert(subject,OBJ_ENCODING_HT);
return 1;
... |
<vulnerable_code> None.
"""
# Retrieve the latest, remote root.json.
latest_root_metadata_file = self._get_metadata_file(
'root', 'root.json', DEFAULT_ROOT_UPPERLENGTH, None)
latest_root_metadata = securesystemslib.util.load_json_string(
latest_root_metadata_file.read().decode('ut... |
<vulnerable_code> self.assertEqual('admin', session.get(SESSION_KEY))
self.assertIsNotNone(session.get(LOGIN_TIME))
def test_cookie_http_only(self):
# Given a request made to rdiffweb
# When receiving the response<commit_title>[PATCH] Make username case-insensitive<commit_description... |
<vulnerable_code> self.assertStatus(303)
self.getPage(self.PREFS)
self.assertInBody("Profile updated successfully.")
# Then database is updated with fullname
user = UserObject.query.filter(UserObject.username == self.USERNAME).first()
self.assertIsNotNone(user)
sel... |
<vulnerable_code> """
Only verify the user's credentials using the database store.
"""
user = UserObject.query.filter_by(username=username).first()
if user and user.validate_password(password):
return username, {}
return False
fullname = extra_attrs.get... |
<vulnerable_code># You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import cherrypy
from sqlalchemy import event
from ._repo import RepoObject # noqa
from ._session import DbSession, SessionObject # noqa
from ._sshkey import Ss... |
<vulnerable_code>import string
import cherrypy
from sqlalchemy import Column, Integer, SmallInteger, String, and_, event, inspect, or_
from sqlalchemy.exc import IntegrityError
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.orm import deferred, relationship, validates
PATTERN_USERNAME = r"[a-zA-... |
<vulnerable_code> # Check if listener called
self.listener.user_added.assert_not_called()
def test_add_user_with_password(self):
"""Add user to database with password."""
userobj = UserObject.add_user('jo', 'password')
self.assertEqual('testcases', obj.repo_objs[1].name)
... |
<vulnerable_code>class UrlForTest(WebCase):
@property
def repo_obj(self):
user = UserObject.query.filter(UserObject.username == 'admin').first()
return RepoObject.query.filter(RepoObject.user == user, RepoObject.repopath == self.REPO).first()
def test_url_for_absolute_path(self):<commit_tit... |
<vulnerable_code> * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
(function() {
/**
* @class OCA.Circles.FileList
},
formatResult: function (circle) {
return circle.name;
},
formatSelection: function (circle) {
return circle.name;
//return OC.SystemTags... |
<vulnerable_code> if (c->argc > 4 || (c->argc == 4 && strcasecmp(c->argv[3]->ptr,"withvalues"))) {
addReplyErrorObject(c,shared.syntaxerr);
return;
} else if (c->argc == 4)
withvalues = 1;
hrandfieldWithCountCommand(c, l, withvalues);
return;
}<comm... |
<vulnerable_code> if (c->argc > 4 || (c->argc == 4 && strcasecmp(c->argv[3]->ptr,"withscores"))) {
addReplyErrorObject(c,shared.syntaxerr);
return;
} else if (c->argc == 4)
withscores = 1;
zrandmemberWithCountCommand(c, l, withscores);
return;
}<com... |
<vulnerable_code> return OC.linkTo('files', 'index.php')+"?dir="+ encodeURIComponent(dir).replace(/%2F/g, '/');
},
_isValidPath: function(path) {
var sections = path.split('/');
for (var i = 0; i < sections.length; i++) {
return false;
}
}
return true;
},
/**<commit_title>[PATCH] Filter... |
<vulnerable_code> '/abc/..',
'/abc/../',
'/../abc/',
'/another\\subdir/../foo\\../bar\\..\\file/..\\folder/../'
], function(path) {
fileList.changeDirectory(path);
expect(fileList.getCurrentDirectory()).toEqual('/');
});
});<commit_title>[PATCH] Filter out %0A from paths<commit_descriptio... |
<vulnerable_code> image[height - 1, 0:width, 0:depth] = color
return image
def _testDrawBoundingBoxColorCycling(self, img, colors=None):
"""Tests if cycling works appropriately.
Args:
img: 3-D numpy image on which to draw.
"""
color_table = colors
if colors is None:
bboxes = m... |
<vulnerable_code> EXPECT_THAT(send_command({"shell", petenv_name()}), Eq(mp::ReturnCode::Ok));
}
TEST_F(Client, shell_cmd_skips_automount_when_disabled)
{
std::stringstream cout_stream;
const grpc::Status ok{}, notfound{grpc::StatusCode::NOT_FOUND, "msg"};
EXPECT_THAT(send_command({"start", petenv_name(... |
<vulnerable_code> "local.bridged-network=<name>` to correct. See `multipass networks` for valid names."));
}
TEST_F(Daemon, refuses_disabled_mount)
{
mp::Daemon daemon{config_builder.build()};
<commit_title>[PATCH] [tests] use camelCase test names<commit_description><fixed_code>
... |
<vulnerable_code> uriFreeUriMembersA(&uri); // second time
}
TEST(MakeOwnerSuite, MakeOwner) {
const char * const uriString = "scheme://user:pass@[v7.X]:55555/path/../path/?query#fragment";
UriUriA uri;<commit_title>[PATCH] tests: Cover fixed uriFreeUriMembers* behavior (#121)<commit_description><fixed_code>
uriFr... |
<vulnerable_code> if (query == null) {
throw new InternalErrorException("query attributes is required");
}
query = query.replaceAll("\\?", searchString);
String base = getAttributes().get("base");
if (base == null) {
if (query == null) {
throw new InternalErrorException("loginQuery attributes is requi... |
<vulnerable_code>
return new Pair<>(amount, field);
}
}<commit_title>[PATCH] Fix vulnerability in communication with LDAP connector<commit_description>- we need to properly escape some characters to prevent LDAP query
injection
- new method for escaping character was added
- method was used for every input from... |
<vulnerable_code> gf_bs_read_data(bs, data, size);
for (i=0; i<size-8; i++) {
if (GF_4CC((u32)data[i+4], (u8)data[i+5], (u8)data[i+6], (u8)data[i+7]) == GF_ISOM_BOX_TYPE_ESDS) {
GF_BitStream *mybs = gf_bs_new(data + i, size - i, GF_BITSTREAM_READ);
if (ptr->esd) {
gf_isom_box_del((GF_Box *)ptr->esd);
p... |
<vulnerable_code> if (buf == curbuf)
return OK;
if (text_locked())
{
text_locked_msg();
return FAIL;
}
if (curbuf_locked())
return FAIL;
// altfpos may be changed by getfile(), get it now<commit_title>[PATCH] patch 8.2.5043: can open a cmdline window from a substitute<commit_description><fi... |
<vulnerable_code> return e_not_allowed_to_change_text_or_change_window;
}
/*
* Check if "curbuf_lock" or "allbuf_lock" is set and return TRUE when it is
* and give an error message.
int save_KeyTyped;
#endif
// Can't do this recursively. Can't do it when typing a password.
if (cmdwin_type != 0
# i... |
<vulnerable_code>
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
5042,
/**/<commit_title>[PATCH] patch 8.2.5043: can open a cmdline window from a substitute<commit_description><fixed_code>
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
5... |
<vulnerable_code> return;
}
#endif
if (text_locked())
{
beep_flush();
text_locked_msg();
return;
}
if (curbuf_locked())
return;
if (wp->w_buffer != curbuf)
reset_VIsual_and_resel();<commit_title>[PATCH] patch 8.2.5043: can open a cmdline window from a substitute<commit_description><fixed_c... |
<vulnerable_code> Literal,
NamedTuple,
NoReturn,
TypeGuard,
overload,
)
ClassDict = dict[str, "Class"]
DestinationDict = dict[str, Destination]
ModuleDict = dict[str, "Module"]
ParserDict = dict[str, "DSLParser"]
clinic = None
class Clinic:
) -> None:
# maps strings to Parser objects.
... |
<vulnerable_code> assert not effect.cond, "Array effects cannot have a condition"
return 0, effect.size
elif effect.cond:
return 0, f"{maybe_parenthesize(effect.cond)} ? 1 : 0"
else:
return 1, ""
self.emit(f"STACK_GROW({osym});")
def declare(self, dst: StackEffect... |
<vulnerable_code>
__all__ = ["cmp_op", "hasarg", "hasconst", "hasname", "hasjrel", "hasjabs",
"haslocal", "hascompare", "hasfree", "hasexc", "opname", "opmap",
"HAVE_ARGUMENT", "EXTENDED_ARG"]
# It's a chicken-and-egg I'm afraid:
# We're imported before _opcode's made.
# With exception unheeded
#... |
<vulnerable_code> f'_sysconfigdata_{sys.abiflags}_{sys.platform}_{multiarch}',
)
def _generate_posix_vars():
"""Generate the Python module containing build-time variables."""
import pprint
vars = {}
# load the installed Makefile:
makefile = get_makefile_filename()
f.write('# sys... |
<vulnerable_code>
def _text_accumulator() -> _TextAccumulator:
text: list[str] = []
def output():
s = ''.join(text)
text.clear()
return s
the counts dict would now look like
{'a': 2, 'b': 1, 'c': 1}
"""
def __init__(self):
self.counts = collections.Count... |
<vulnerable_code> ssl.OP_NO_TLSv1_2
self.assertEqual(ssl.PROTOCOL_TLS, ssl.PROTOCOL_SSLv23)
def test_ssl_types(self):
ssl_types = [
_ssl._SSLContext,
)
def test_options(self):
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
# OP_ALL | OP_NO_SSLv2 | OP_N... |
<vulnerable_code>/*[clinic end generated code: output=2cf0d7a0741b6bd1 input=8d58a805b95fc534]*/
{
PySSLContext *self;
long options;
const SSL_METHOD *method = NULL;
SSL_CTX *ctx = NULL;
X509_VERIFY_PARAM *params;
static PyObject *
get_options(PySSLContext *self, void *c)
{
return PyLong_FromLon... |
<vulnerable_code> uops = {opname for opname, _ in ex}
self.assertIn("_POP_JUMP_IF_FALSE", uops)
def test_pop_jump_if_true(self):
def testfunc(n):
i = 0<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-10679... |
<vulnerable_code>
switch (opcode) {
case POP_JUMP_IF_FALSE:
case POP_JUMP_IF_TRUE:
{
// Assume jump unlikely (TODO: handle jump likely case)
RESERVE(1, 2);
_Py_CODEUNIT *target_instr =<commit_title>[PATCH 016/395] Small fixes t... |
<vulnerable_code> }
inst(KW_NAMES, (--)) {
assert(kwnames == NULL);
assert(oparg < PyTuple_GET_SIZE(FRAME_CO_CONSTS));
kwnames = GETITEM(FRAME_CO_CONSTS, oparg);
}
}
inst(CALL_PY_EXACT_ARGS, (unused/1, func_version/2, method, callable, args[op... |
<vulnerable_code>
///////////////////// Experimental UOp Interpreter /////////////////////
#undef DEOPT_IF
#define DEOPT_IF(COND, INSTNAME) \
if ((COND)) { \
int opcode;
uint64_t operand;
int oparg;
for (;;) {
opcode = self->trace[pc].opcode;
operand = self->trace[pc]... |
<vulnerable_code>
def is_viable_uop(self) -> bool:
"""Whether this instruction is viable as a uop."""
if self.name == "EXIT_TRACE":
return True # This has 'return frame' but it's okay
if self.always_exits:
# print(f"Skipping {self.name} because it always exits")
... |
<vulnerable_code>
threading_helper.requires_working_threading(module=True)
class Something:
def method_1(self):
waitable_mock.wait_until_called()
waitable_mock.wait_until_any_call_with("works")
def test_wait_success(self):
waitable_mock = self._make_mock(spec=Something)
with ... |
<vulnerable_code>
ex = get_first_executor(testfunc)
self.assertIsNotNone(ex)
uops = {opname for opname, _ in ex}
self.assertIn("SAVE_IP", uops)
self.assertIn("LOAD_FAST", uops)
ex = get_first_executor(many_vars)
self.assertIsNotNone(ex)
self.assertIn(("L... |
<vulnerable_code> STORE_SUBSCR_LIST_INT,
};
inst(STORE_SUBSCR, (counter/1, v, container, sub -- )) {
#if ENABLE_SPECIALIZATION
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
next_instr--;
_Py_Specialize_StoreSubscr(container, sub, next_instr)... |
<vulnerable_code> _Py_CODEUNIT *ip_offset = (_Py_CODEUNIT *)_PyFrame_GetCode(frame)->co_code_adaptive;
int pc = 0;
int opcode;
uint64_t operand;
int oparg;
for (;;) {
opcode = self->trace[pc].opcode;
operand = self->trace[pc].operand;
oparg = (int)operand;
DPRINTF... |
<vulnerable_code> if (oname == NULL) {
return NULL;
}
PyObject *operand = PyLong_FromUnsignedLongLong(self->trace[index].operand);
if (operand == NULL) {
Py_DECREF(oname);
return NULL;
}
PyObject *args[2] = { oname, operand };
return _PyTuple_FromArraySteal(args, 2);
}... |
<vulnerable_code> if self.always_exits:
dprint(f"Skipping {self.name} because it always exits")
return False
if self.instr_flags.HAS_ARG_FLAG:
# If the instruction uses oparg, it cannot use any caches
if self.active_caches:
dprint(f"Skipping... |
<vulnerable_code> /* get length */
slen = i2d_SSL_SESSION(session, NULL);
if (slen == 0 || slen > 0xFF00) {
PyErr_SetString(PyExc_ValueError, "i2d() failed.");
goto error;
}
if ((senc = PyMem_Malloc(slen)) == NULL) {
}
p = senc;
if (!i2d_SSL_SESSION(session, &p)) {
... |
<vulnerable_code>/*[clinic end generated code: output=13af7670aac51b12 input=6657ab31d74c29fc]*/
#endif
/*[clinic input]
dump buffer
output pop
#endif /* !defined(CONDITION_A) && !(CONDITION_B) */
#ifndef TEST_PREPROCESSOR_GUARDED_CONDITION_A_METHODDEF
#define TEST_PREPROCESSOR_GUARDED_CONDITION_A_METHODDEF
#end... |
<vulnerable_code> """).lstrip() # Note, lstrip() because of the newline
self.assertEqual(out, expected)
class ClinicGroupPermuterTest(TestCase):
def _test(self, l, m, r, output):<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR... |
<vulnerable_code> self.parameter_continuation = line[:-1]
return
line = line.lstrip()
if line in ('*', '/', '[', ']'):
self.parse_special_symbol(line)
return
match self.parameter_state:
case ParamState.START | ParamState.REQUIRED:
... |
<vulnerable_code> return 0, effect.size
elif effect.cond:
if effect.cond in ("0", "1"):
return 0, effect.cond
return 0, f"{maybe_parenthesize(effect.cond)} ? 1 : 0"
else:
return 1, ""
def check_families(self) -> None:
"""Check each family:
- Must h... |
<vulnerable_code> }
}
if (compiler_add_const(c->c_const_cache, c->u, docstring ? docstring : Py_None) < 0) {
compiler_exit_scope(c);
return ERROR;
}
}
Py_DECREF(doc);
return PyUnicode_FromStringAndSize(buff, w - buff);
}
<commit_title>[PATCH 016/395] Small fixes to code ... |
<vulnerable_code>module_get_annotations(PyModuleObject *m, void *Py_UNUSED(ignored))
{
PyObject *dict = PyObject_GetAttr((PyObject *)m, &_Py_ID(__dict__));
if ((dict == NULL) || !PyDict_Check(dict)) {
PyErr_Format(PyExc_TypeError, "<module>.__dict__ is not a dictionary");
Py_XDECREF(dict);
... |
<vulnerable_code> }
PyObject *annotations;
/* there's no _PyDict_GetItemId without WithError, so let's LBYL. */
PyObject *dict = lookup_tp_dict(type);
if (PyDict_Contains(dict, &_Py_ID(__annotations__))) {
annotations = PyDict_GetItemWithError(dict, &_Py_ID(__annotations__));
/*
... |
<vulnerable_code> state->PyCursesError = PyErr_NewException(
"_curses_panel.error", NULL, NULL);
if (PyModule_AddObject(mod, "error", Py_NewRef(state->PyCursesError)) < 0) {
Py_DECREF(state->PyCursesError);
return -1;
}
<commit_title>[PATCH 016/395] Small fixes to code generator (#10... |
<vulnerable_code> Py_DECREF(base);
/* add to module */
CHECK_INT(PyModule_AddObject(m, cm->name, Py_NewRef(cm->ex)));
/* add to signal tuple */
PyTuple_SET_ITEM(state->SignalTuple, i, Py_NewRef(cm->ex));
ASSIGN_PTR(cm->ex, PyErr_NewException(cm->fqname, base, NULL));
... |
<vulnerable_code> if (setup_confname_tables(m))
return -1;
PyModule_AddObject(m, "error", Py_NewRef(PyExc_OSError));
#if defined(HAVE_WAITID) && !defined(__APPLE__)
waitid_result_desc.name = MODNAME ".waitid_result";
PyObject *WaitidResultType = (PyObject *)PyStructSequence_NewType(&waitid_resu... |
<vulnerable_code> if (PyType_Ready(&spamdict_type) < 0)
return -1;
if (PyModule_AddObject(m, "spamlist",
Py_NewRef(&spamlist_type)) < 0)
return -1;
if (PyModule_AddObject(m, "spamdict",
Py_NewRef(&spamdict_type)) < 0)
return -1;
... |
<vulnerable_code> "PyMethodDescr_Type",
"PyModuleDef_Init",
"PyModuleDef_Type",
"PyModule_AddFunctions",
"PyModule_AddIntConstant",
"PyModule_AddObject",<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_description>These repair nits I found in PR gh-106798 (issue gh-106... |
<vulnerable_code>EXPORT_FUNC(PyMemoryView_FromMemory)
EXPORT_FUNC(PyMemoryView_FromObject)
EXPORT_FUNC(PyMemoryView_GetContiguous)
EXPORT_FUNC(PyModule_AddFunctions)
EXPORT_FUNC(PyModule_AddIntConstant)
EXPORT_FUNC(PyModule_AddObject)<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_descripti... |
<vulnerable_code> PyModule_GetName(mod));
return -1;
}
if (PyDict_SetItemString(dict, name, value)) {
return -1;
}
return 0;
}
int
PyModule_AddObject(PyObject *mod, const char *name, PyObject *value)
int
PyModule_AddIntConstant(PyObject *m, const char *name, long v... |
<vulnerable_code> */
libver = OpenSSL_version_num();
r = PyLong_FromUnsignedLong(libver);
if (r == NULL || PyModule_AddObject(m, "OPENSSL_VERSION_NUMBER", r))
return -1;
parse_openssl_version(libver, &major, &minor, &fix, &patch, &status);
r = Py_BuildValue("IIIII", major, minor, fix, pa... |
<vulnerable_code> ADD_INT_MACRO(module, FILE_ATTRIBUTE_TEMPORARY);
ADD_INT_MACRO(module, FILE_ATTRIBUTE_VIRTUAL);
if (PyModule_AddObject(module, "IO_REPARSE_TAG_SYMLINK",
PyLong_FromUnsignedLong(IO_REPARSE_TAG_SYMLINK)) < 0) {
return -1;
}
if (PyModule_AddObjec... |
<vulnerable_code>static int
module_exec(PyObject *module)
{
if (PyModule_AddObject(module, "SIZEOF_PYGC_HEAD",
PyLong_FromSsize_t(sizeof(PyGC_Head))) < 0) {
return 1;
}
if (PyModule_AddObject(module, "SIZEOF_TIME_T",
PyLong_FromSsize_t(sizeof(ti... |
<vulnerable_code> // Round towards minus infinity
timeout_max = floor(timeout_max);
if (PyModule_AddObject(module, "TIMEOUT_MAX",
PyFloat_FromDouble(timeout_max)) < 0) {
return -1;
}
<commit_title>[PATCH 016/395] Small fixes to code generator (#106845)<commit_descripti... |
<vulnerable_code>static int
cmath_exec(PyObject *mod)
{
if (PyModule_AddObject(mod, "pi", PyFloat_FromDouble(Py_MATH_PI)) < 0) {
return -1;
}
if (PyModule_AddObject(mod, "e", PyFloat_FromDouble(Py_MATH_E)) < 0) {
return -1;
}
// 2pi
if (PyModule_AddObject(mod, "tau", PyFloat_From... |
<vulnerable_code> if (state->str___trunc__ == NULL) {
return -1;
}
if (PyModule_AddObject(module, "pi", PyFloat_FromDouble(Py_MATH_PI)) < 0) {
return -1;
}
if (PyModule_AddObject(module, "e", PyFloat_FromDouble(Py_MATH_E)) < 0) {
return -1;
}
// 2pi
if (PyModule_Ad... |
<vulnerable_code> }
Py_DECREF(o);
}
return PyModule_AddObject(module, tablename, d);
}
/* Return -1 on failure, 0 on success. */
#endif
/* Initialize environ dictionary */
PyObject *v = convertenviron();
Py_XINCREF(v);
if (v == NULL || PyModule_AddObject(m, "environ", v) != 0)
... |
<vulnerable_code> return -1;
}
#endif // MS_WINDOWS
PyObject *tzname_obj = Py_BuildValue("(NN)", otz0, otz1);
if (tzname_obj == NULL) {
return -1;
}
PyModule_AddObject(m, "tzname", tzname_obj);
#else // !HAVE_DECL_TZNAME
static const time_t YEAR = (365 * 24 + 6) * 3600;
time_t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.