text stringlengths 79 3.72M |
|---|
<vulnerable_code>
url = "/_synapse/admin/v1/media/%s/%s" % (self.server_name, "12345")
channel = self.make_request("DELETE", url, access_token=self.other_user_token,)
self.assertEqual(403, int(channel.result["code"]), msg=channel.result["body"])
self.assertEqual(Codes.FORBIDDEN, channe... |
<vulnerable_code> self._assert_peek(room_id, expect_code=403)
def _assert_peek(self, room_id, expect_code):
"""Assert that the admin user can (or cannot) peek into the room.
"""
url = "rooms/%s/initialSync" % (room_id,)
channel = self.make_request(
"""
chann... |
<vulnerable_code> If the user is not a server admin, an error 403 is returned.
"""
channel = self.make_request(
"GET", self.url, json.dumps({}), access_token=self.other_user_tok,
)
self.assertEqual(403, int(channel.result["code"]), msg=channel.result["body"])
... |
<vulnerable_code> search_field: Field which is to request: `name` or `user_id`
expected_http_code: The expected http code for the request
"""
url = self.url + "?%s=%s" % (search_field, search_term,)
channel = self.make_request(
"GET", ur... |
<vulnerable_code>
# Mod the mod
room_power_levels = self.helper.get_state(
self.room_id, "m.room.power_levels", tok=self.admin_access_token,
)
# Update existing power levels with mod at PL50<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code>
... |
<vulnerable_code> )
def test_redact_event_as_moderator_ratelimit(self):
"""Tests that the correct ratelimiting is applied to redactions
"""
message_ids = []
# as a regular user, send messages to redact<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code... |
<vulnerable_code> mock_federation_client = Mock(spec=["backfill"])
self.hs = self.setup_test_homeserver(
config=config, federation_client=mock_federation_client,
)
return self.hs
<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code>
mock_federati... |
<vulnerable_code> message_handler = self.hs.get_message_handler()
event = self.get_success(
message_handler.get_room_data(
self.banned_user_id, room_id, "m.room.member", self.banned_user_id,
)
)
self.assertEqual(
message_handler = self.hs.ge... |
<vulnerable_code> event_id = resp["event_id"]
channel = self.make_request(
"GET", "/events/" + event_id, access_token=self.token,
)
self.assertEquals(channel.code, 200, msg=channel.result)<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code>
even... |
<vulnerable_code> # matrix access token, mxid, and device id.
login_token = params[2][1]
chan = self.make_request(
"POST", "/login", content={"type": "m.login.token", "token": login_token},
)
self.assertEqual(chan.code, 200, chan.result)
self.assertEqual(chan.j... |
<vulnerable_code> def make_homeserver(self, reactor, clock):
self.hs = self.setup_test_homeserver(
"red", federation_http_client=None, federation_client=Mock(),
)
self.hs.get_federation_handler = Mock()
results = channel.json_body["search_categories"]["room_events"]["res... |
<vulnerable_code> def make_homeserver(self, reactor, clock):
hs = self.setup_test_homeserver(
"red", federation_http_client=None, federation_client=Mock(),
)
self.event_source = hs.get_event_sources().sources["typing"]<commit_title>[PATCH 01/14] Fix some typos.<commit_descriptio... |
<vulnerable_code> json.dumps(data).encode("utf8"),
)
assert int(channel.result["code"]) == expect_code, (
"Expected: %d, got: %d, resp: %r"
% (expect_code, int(channel.result["code"]), channel.result["body"])
)
self.auth_user_id = temp_id
... |
<vulnerable_code> self.submit_token_resource = PasswordResetSubmitTokenResource(hs)
def test_basic_password_reset(self):
"""Test basic password reset flow
"""
old_password = "monkey"
new_password = "kangeroo"
@override_config({"rc_3pid_validation": {"burst_count": 3}})
... |
<vulnerable_code> """Ensure that fallback auth via a captcha works."""
# Returns a 401 as per the spec
channel = self.register(
401, {"username": "user", "type": "m.login.password", "password": "bar"},
)
# Grab the session
) -> FakeChannel:
"""Delete an in... |
<vulnerable_code>
self.assertEqual(channel.code, 400, channel.result)
self.assertEqual(
channel.json_body["errcode"], Codes.PASSWORD_TOO_SHORT, channel.result,
)
def test_password_no_digit(self):
self.assertEqual(channel.code, 400, channel.result)
self.assertEqu... |
<vulnerable_code> )
def test_deny_membership(self):
"""Test that we deny relations on membership events
"""
channel = self._send_relation(RelationTypes.ANNOTATION, EventTypes.Member)
self.assertEquals(400, channel.code, channel.json_body)
def test_deny_double_react(self)... |
<vulnerable_code>
# Check that room name changes increase the unread counter.
self.helper.send_state(
self.room_id, "m.room.name", {"name": "my super room"}, tok=self.tok2,
)
self._check_unread_count(1)
# Check that room topic changes increase the unread counter.
... |
<vulnerable_code>
# Increase the power levels so that this user can upgrade.
power_levels = self.helper.get_state(
self.room_id, "m.room.power_levels", tok=self.creator_token,
)
power_levels["users"][self.other] = 100
self.helper.send_state(
# Increase the po... |
<vulnerable_code> async def post_json(destination, path, data):
self.assertEqual(destination, self.hs.hostname)
self.assertEqual(
path, "/_matrix/key/v2/query",
)
channel = FakeChannel(self.site, self.reactor)
req.content = BytesIO(enco... |
<vulnerable_code> ),
),
# an empty file
(_TestImage(b"", b"image/gif", b".gif", None, None, False,),),
],
)
class MediaRepoTests(unittest.HomeserverTestCase):
return config
def test_upload_innocent(self):
"""Attempt to upload some innocent data that should be ... |
<vulnerable_code> self._tcp_callbacks[(host, port)] = callback
def connectTCP(self, host, port, factory, timeout=30, bindAddress=None):
"""Fake L{IReactorTCP.connectTCP}.
"""
conn = super().connectTCP(
host, port, factory, timeout=timeout, bindAddress=None<commit_title>[... |
<vulnerable_code> tok = self.login(localpart, "password")
# Sync with the user's token to mark the user as active.
channel = self.make_request("GET", "/sync?timeout=0", access_token=tok,)
# Also retrieves the list of invites for this user. We don't care about that
... |
<vulnerable_code> self.do_check(events, edges, expected_state_ids)
def test_mainline_sort(self):
"""Tests that the mainline ordering works correctly.
"""
events = [
FakeEvent(
# C -|-> B -> A
a = FakeEvent(
id="A", sender=ALICE, typ... |
<vulnerable_code> # No ignored_users key.
self.get_success(
self.store.add_account_data_for_user(
self.user, AccountDataTypes.IGNORED_USER_LIST, {},
)
)
<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code>
# No ignored_users k... |
<vulnerable_code> async def update(progress, count):
self.assertEqual(progress, {"my_key": 2})
self.assertAlmostEqual(
count, target_background_update_duration_ms / duration_ms, places=0,
)
await self.updates._end_background_update("test_update")
... |
<vulnerable_code> self.room_id = info["room_id"]
def run_background_update(self):
"""Re run the background update to clean up the extremities.
"""
# Make sure we don't clash with in progress updates.
self.assertTrue(
self.store.db_pool.updates._all_done, "Backgrou... |
<vulnerable_code> device_id = "MY_DEVICE"
# Insert a user IP
self.get_success(self.store.store_device(user_id, device_id, "display name",))
self.get_success(
self.store.insert_client_ip(
user_id, "access_token", "ip", "user_agent", device_id
device_id ... |
<vulnerable_code> "content": {"tag": "power"},
},
).build(
prev_event_ids=[], auth_event_ids=[create.event_id, bob_join.event_id],
)
)
self.assertFalse(
link_map.exists_path_from(
chain_m... |
<vulnerable_code> ],
)
self.get_success(self.store.db_pool.runInteraction("insert", insert_event,))
# Now actually test that various combinations give the right result:
)
self.hs.datastores.persist_events._persist_event_auth_chain_txn(
... |
<vulnerable_code>
yield defer.ensureDeferred(
self.store.add_push_actions_to_staging(
event.event_id, {user_id: action}, False,
)
)
yield defer.ensureDeferred(<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_cod... |
<vulnerable_code> self.assert_extremities([self.remote_event_1.event_id])
def persist_event(self, event, state=None):
"""Persist the event, with optional state
"""
context = self.get_success(
self.state.compute_event_context(event, old_state=state)
)
self.... |
<vulnerable_code>
def _insert(txn):
txn.execute(
"INSERT INTO foobar VALUES (?, ?)", (stream_id, instance_name,),
)
txn.execute("SELECT setval('foobar_seq', ?)", (stream_id,))
txn.execute(
self.assertEqual(id_gen.get_current_token_for_write... |
<vulnerable_code> # value, although it gets stored on the config object as mau_limits.
@override_config({"max_mau_value": 5, "mau_limit_reserved_threepids": gen_3pids(5)})
def test_reap_monthly_active_users_reserved_users(self):
""" Tests that reaping correctly handles reaping where reserved users ar... |
<vulnerable_code> )
def test_redact_censor(self):
"""Test that a redacted event gets censored in the DB after a month
"""
self.get_success(
self.inject_room_member(self.room1, self.u_alice, Membership.JOIN)
self.assert_dict({"content": {}}, json.loads(event_json)... |
<vulnerable_code> try:
yield defer.ensureDeferred(
self.store.validate_threepid_session(
"fake_sid", "fake_client_secret", "fake_token", 0,
)
)
except ThreepidValidationError as e:
try:
yield defer.ensureDefer... |
<vulnerable_code>
# king should be able to send state
event_auth.check(
RoomVersions.V1, _random_state_event(king), auth_events, do_sig_check=False,
)
def test_alias_event(self):
# creator should be able to send aliases
event_auth.check(
RoomVersions... |
<vulnerable_code> )
channel = self.make_request(
"POST", "/register", request_data, access_token=token,
)
if channel.code != 200:<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code>
)
channel = self.make_request(
"POST",
... |
<vulnerable_code>
def get_sample_labels_value(sample):
""" Extract the labels and values of a sample.
prometheus_client 0.5 changed the sample type to a named tuple with more
members than the plain tuple had in 0.4 and earlier. This function can<commit_title>[PATCH 01/14] Fix some typos.<commit_descriptio... |
<vulnerable_code>
res = JsonResource(self.homeserver)
res.register_paths(
"GET", [re.compile("^/_matrix/foo$")], _callback, "test_servlet",
)
# The path was registered as GET, but this is a HEAD request.<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_co... |
<vulnerable_code> # We need a valid token ID to satisfy foreign key constraints.
token_id = self.get_success(
self.hs.get_datastore().add_access_token_to_user(
self.helper.auth_user_id, "some_fake_token", None, None,
)
... |
<vulnerable_code>
def test_eviction_iterable(self):
cache = DeferredCache(
"test", max_entries=3, apply_cache_factor_from_config=False, iterable=True,
)
cache.prefill(1, ["one", "two"])<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code>
def test_evic... |
<vulnerable_code> obj.mock.assert_not_called()
def test_cache_with_sync_exception(self):
"""If the wrapped function throws synchronously, things should continue to work
"""
class Cls:
@cached()
self.failureResultOf(d, SynapseError)
def test_cache_with_async_... |
<vulnerable_code> parts = chunk_seq("123", 8)
self.assertEqual(
list(parts), ["123"],
)
def test_long_seq(self):
parts = chunk_seq("abcdefghijklmnop", 8)
self.assertEqual(
list(parts), ["abcdefgh", "ijklmnop"],
)
def test_uneven_parts(se... |
<vulnerable_code> self.assertTrue("user@foo.com" not in cache._entity_to_key)
self.assertEqual(
cache.get_all_entities_changed(2), ["bar@baz.net", "user@elsewhere.org"],
)
self.assertIsNone(cache.get_all_entities_changed(1))
{"bar@baz.net", "user@elsewhere.org"},... |
<vulnerable_code> db_conn.close()
hs = homeserver_to_use(
name, config=config, version_string="Synapse/tests", reactor=reactor,
)
# Install @cache_in_self attributes
def trigger(
self, http_method, path, content, mock_request, federation_auth_origin=None
):
""" Fire ... |
<vulnerable_code> return await self._provider_metadata.get()
async def _load_metadata(self) -> OpenIDProviderMetadata:
# init the metadata from our config
metadata = OpenIDProviderMetadata(
issuer=self._config.issuer,
authorization_endpoint=self._config.authorization_... |
<vulnerable_code>
logger = logging.getLogger(__name__)
SESSION_COOKIE_NAME = b"oidc_session"
#: A token exchanged from the token endpoint, as per RFC6749 sec 5.1. and
#: OpenID.Core sec 3.1.3.3.
# otherwise, it is presumably a successful response. see:
# https://tools.ietf.org/html/rfc6749#section-4... |
<vulnerable_code># WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import logging
from synapse.http.server import DirectServeHtmlResource
logger = logging.getLogger(__name__)
class OIDCCal... |
<vulnerable_code>
def test_redirect_request(self):
"""The redirect request has the right arguments & generates a valid session cookie."""
req = Mock(spec=["addCookie"])
url = self.get_success(
self.provider.handle_redirect_request(req, b"http://client/redirect")
)
... |
<vulnerable_code> gpointer user_data)
{
struct tcmur_handler *handler = find_handler_by_subtype(subtype);
struct dbus_info *info = handler->opaque;
if (!handler) {
g_dbus_method_invocation_return_value(invocation,<commit_title>[PATCH] fixed local DoS when UnregisterHandler was called for a not<commit_descr... |
<vulnerable_code> int c;
bool ignore_driver_version_mismatch = false;
DBusError error;
DBusConnection* connection;
dbus_error_init(&error);
if (gRet == ERRORCODE_QUIT)
gRet = 0;
return gRet;
}<commit_title>[PATCH] [wpanctl] free dbus connection and error on exit.<commit_description><fixed_code>
int c;
bool... |
<vulnerable_code> if (trans == NULL)
return NULL;
trans->msg_type = msg_type;
trans->ctx = *ctx;
<commit_title>[PATCH] netfilter: nf_tables: fix null deref due to zeroed list head<commit_description>In nf_tables_updtable, if nf_tables_table_enable returns an error,
nft_trans_destroy is called to free the transacti... |
<vulnerable_code>from .default_data import DEFAULT_DATA
from .utils import (
Constants, SHOWANSWER, DummyTranslationService, FeedbackMessage,
FeedbackMessages, ItemStats, StateMigration, _clean_data, _
)
# Globals ###########################################################
item['expandedIma... |
<vulnerable_code> _fn.build.$el.zonesPreview.append(
_fn.tpl.zoneElement({
uid: zoneObj.uid,
title: gettext(zoneObj.title),
descripti... |
<vulnerable_code>import re
from collections import namedtuple
from bleach.sanitizer import Cleaner
def _(text):
def _clean_data(data):
""" Remove html tags and extra white spaces e.g newline, tabs etc from provided data """
cleaner = Cleaner(tags=[], strip=True)
cleaned_text = " ".join(re.split(r"\s+", ... |
<vulnerable_code>
setup(
name='xblock-drag-and-drop-v2',
version='2.7.0',
description='XBlock - Drag-and-Drop v2',
packages=['drag_and_drop_v2'],
install_requires=[<commit_title>[PATCH] feat!: sanitize HTML tags to prevent XSS vulnerabilities<commit_description>This allows rendering only a pre-defin... |
<vulnerable_code> }
, cb => {
console.log("> Created README.md");
myRepo.exec("add .", cb);
}
, cb => {
console.log("> Added the files.");<commit_title>[PATCH] fix command injection vulnerability<commit_description><fixed_code>
}
, cb => {
console.log("> Created README.m... |
<vulnerable_code> * @return {Gry} The `Gry` instance.
*/
exec (command, args, callback) {
var eargs = [];
if (typeof args === "function") {
callback = args;
args = null;
}
// Handle spawn
if (Array.isArray(args)) {
eargs.push("gi... |
<vulnerable_code> case (12<<8)+24:
LogError( _("FontForge does not support type2 multiple master fonts\n") );
info->bad_cff = true;
td->nMasters = stack[0];
td->nAxes = sp-4;
memcpy(td->weightvector,stack+1,(sp-4)*sizeof(real));<commit_title>[PATCH] readcfftopdict: Prevent stack underflow con... |
<vulnerable_code> return 0;
}
bool tcmur_unregister_handler(struct tcmur_handler *handler)
{
int i;
return false;
}
static int is_handler(const struct dirent *dirent)
{
if (strncmp(dirent->d_name, "handler_", 8))
if (info->register_invocation) {
info->connection = connection;
tcmur_register_handler(handler);... |
<vulnerable_code> // Read the rest of the segment.
DataBuf buf(size);
if (size > 0) {
assert(size >= 2); // enforced above
readOrThrow(*io_, buf.pData_ + 2, size - 2, kerFailedToReadImageData);
memcpy(buf.pData_, sizebuf, 2);
... |
<vulnerable_code> m_keyLength = length / 8;
m_EncryptMetadata = encryptMetadata;
auto oValueData = oValue.GetRawData();
if (oValueData.size() < 32)
PODOFO_RAISE_ERROR_INFO(PdfErrorCode::InvalidEncryptionDict, "/O value is invalid");
auto uValueData = uValue.GetRawData();
if (uValueData.... |
<vulnerable_code>/*! For license information please see end_to_end_encryption-filedrop.js.LICENSE.txt */
(()=>{var e={4820:(e,t,n)=>{"use strict";n(9070),t.Z=void 0,n(9601);var r,o,i=(r=n(9669))&&r.__esModule?r:{default:r},a=n(4332);var s=i.default.create({headers:{requesttoken:null!==(o=(0,a.getRequestToken)())&&void ... |
<vulnerable_code><commit_title>[PATCH] Prevent filedrop entry name conflict<commit_description>Signed-off-by: Louis Chemineau <louis@chmn.me><fixed_code>
import axios from '@nextcloud/axios'
import { generateOcsUrl } from '@nextcloud/router'
import { EncryptedFile, encryptStringAsymmetric } from './crypto.js'
/**
* @... |
<vulnerable_code>// SPDX-FileCopyrightText: 2022 Carl Schwan <carl@carlschwan.eu>
// SPDX-License-Identifier: AGPL-3.0-or-later
import { generateOcsUrl } from '@nextcloud/router'
import axios from '@nextcloud/axios'
import { EncryptedFile, encryptStringAsymmetric } from './crypto.js'
/**
* @typedef {object} Encrypte... |
<vulnerable_code> }
gf_log("fuse", GF_LOG_DEBUG, "got event %d on graph %d", event,
((graph && event_graph) ? graph->id : 0));
return ret;
}
<commit_title>[PATCH] fuse: Resolve reviewer comment<commit_description>Fixes: #3954
Change-Id: I6b2869256b26d22163879737dcf163510d1cd8bf
Signed-off-by: Moh... |
<vulnerable_code>{
int len, diff;
len = gethuff(huff);
if (len == 16 && (!dng_version || dng_version >= 0x1010000))
return -32768;
{
int len, diff;
len = bits._gethuff_lj(buf,*huff,huff+1);
if (len == 16 && (!dng_version || dng_version >= 0x1010000))
return -32768;
}
#endif
if (!ljpeg_start ... |
<vulnerable_code>{
int len, diff;
len = gethuff(huff);
if (len == 16 && (!dng_version || dng_version >= 0x1010000))
return -32768;
{
int len, diff;
len = bits._gethuff_lj(buf,*huff,huff+1);
if (len == 16 && (!dng_version || dng_version >= 0x1010000))
return -32768;
}
#endif
if (!ljpeg_start ... |
<vulnerable_code> for more information
*/
#line 3948 "dcraw/dcraw.c"
#include <math.h>
#define CLASS LibRaw::
#include "libraw/libraw_types.h"
#include "libraw/libraw.h"
#include "internal/defines.h"
#include "internal/var_defines.h"
#line 3959 "dcraw/dcraw.c"
/*
Seach from the current directory up to the root lo... |
<vulnerable_code>
LibRaw_byte_buffer *LibRaw_abstract_datastream::make_byte_buffer(unsigned int sz)
{
LibRaw_byte_buffer *ret = new LibRaw_byte_buffer(sz);
read(ret->get_buffer(),sz,1);
return ret;
}
LibRaw_byte_buffer *LibRaw_buffer_datastream::make_byte_buffer(unsigned int sz)
{
LibRaw_byte_buffer *r... |
<vulnerable_code>
/* remove capability of path traversal */
/* discoverd by David Byrne of X-Force Red */
exparg = explode(arg, "/");
szof = sizeof(exparg);
if (szof > 1) {<commit_title>[PATCH] Update help.c<commit_description><fixed_code>
/* remove capability of path traversal */
/* discove... |
<vulnerable_code>import * as fixturesWindows from "../fixtures/win.js";
import common from "../_constants.cjs";
/**
* Returns the shells officially supported by Shescape for the current platform.
*
* @yields {string} Supported shells for the current platform.
*/
export function* platformShells() {
if (common.isW... |
<vulnerable_code> */
import { testProp } from "@fast-check/ava";
import test from "ava";
import * as fc from "fast-check";
import { arbitrary, generate } from "../_.js";
import { quote, quoteAll as quoteAll } from "shescape";
for (const shell of generate.platformShells()) {
test(`inputs are quoted for ${shell}`, ... |
<vulnerable_code> p+=strlen(network_line);
} else if ( !strncmp(network_line, "GET_DN ", strlen("GET_DN ")) && msg_id != UINT32_MAX && network_client_get_version(fd) > 0) {
univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_ALL, "RECV: GET_DN");
<commit_title>[PATCH] Bug #48427 UDN: Forbid vulnerable GET_DN for VE... |
<vulnerable_code> }
$("#mainContent legend").html(PMA_messages.strEndStep);
$("#mainContent h4").html(
"<h3>" + PMA_sprintf(PMA_messages.strFinishMsg, PMA_commonParams.get('table')) + "</h3>"
);
$("#mainContent p").html('');
$("#mainContent #extra").html('');<commit_title>[PATCH] Fix XSS ... |
<vulnerable_code> buf[buf_out_len++] = ';';
offset += len;
/* ssh.server_host_key_algorithms [None] */
len = ntohl(*(u_int32_t*)&packet->payload[offset]);
offset += 4 + len;
/* ssh.encryption_algorithms_client_to_server [C] */
len = ntohl(*(u_int32_t*)&packet->payload[offset]);
} else
offset += 4 ... |
<vulnerable_code> target = {};
}
if (path.length > 1) {
target[key] = setByPath(target[key], path.slice(1), value);
}
}
/**
* Push deeply nested value into target object. If nested properties are not an
* objects or not exists creates them.
*
* @param {*} target Parent object.
target = {};
}
... |
<vulnerable_code>const keyget = require('..');
describe('keyget', function () {
describe('Select values', function () {
it('Select "a" from {a: 1}', function () {
const result = keyget.select({a: 1}, ['a']);
.which.is.equal(1);
});
it('Should push value', function () {
const obj = {};... |
<vulnerable_code>
i=0;
while ( (od_tk = (GF_TrackBox*)gf_list_enum(file->moov->trackList, &i))) {
if (od_tk->Media->handler->handlerType != GF_ISOM_MEDIA_OD) continue;
for (j=0; j<od_tk->Media->information->sampleTable->SampleSize->sampleCount; j++) {<commit_title>[PATCH] add null guards on gf_isom_find_od_id_fo... |
<vulnerable_code> rc = RPMERR_UNKNOWN_FILETYPE;
}
setmeta:
if (!rc && fp->setmeta) {
rc = fsmSetmeta(fd, di.dirfd, fp->fpath,<commit_title>[PATCH] Set file metadata via fd-based ops for everything but<commit_description><fixed_code>
rc = RPMERR_UNKNOWN_FILETYPE... |
<vulnerable_code> );
});
it('works with short EIP2098 format', async function () {
const version = '1b'; // 27 = 1b.
const signature = signatureWithoutVersion + version;
expect(await this.ecdsa.recover(TEST_MESSAGE, to2098Format(signature))).to.equal(signer);
expect(a... |
<vulnerable_code>var expect = require('expect');
var isWin32 = require('os').platform() === 'win32';
describe('glob-parent', function () {
it('should strip glob magic to return parent path', function (done) {
expect(gp('.')).toEqual('.');
done();
});
});
if (isWin32) {<commit_title>[PATCH] test: Add a te... |
<vulnerable_code>
assert out["layout"] == {
"nonreentrant.foo": {"type": "nonreentrant lock", "location": "storage", "slot": 0},
"nonreentrant.bar": {"type": "nonreentrant lock", "location": "storage", "slot": 2},
"foo": {
"type": "HashMap[address, uint256][address, uint256]",
... |
<vulnerable_code>
for node in vyper_module.get_children(vy_ast.FunctionDef):
type_ = node._metadata["type"]
if type_.nonreentrant is not None:
type_.set_reentrancy_key_position(StorageSlot(storage_slot))
# TODO this could have better typing but leave it untyped until
... |
<vulnerable_code> /* Create a symlink pointing to the target directory */
assert((ae = archive_entry_new()) != NULL);
archive_entry_copy_pathname(ae, "sym");
archive_entry_set_mode(ae, S_IFREG | 0777);
archive_entry_copy_symlink(ae, "../target");
assert(0 == archive_write_header(a, ae));
archive_entry_free(ae);
... |
<vulnerable_code> /* Attempt to hardlink to the target directory. */
assert((ae = archive_entry_new()) != NULL);
archive_entry_copy_pathname(ae, "bar");
archive_entry_set_mode(ae, S_IFREG | 0777);
archive_entry_set_size(ae, 8);
archive_entry_copy_hardlink(ae, "../target/foo");
assertEqualInt(ARCHIVE_FAILED, archi... |
<vulnerable_code> if (!thumbprint || strcmp(thumbprint, target) != 0) {
continue;
}
if (jwk_valid_for_deriving_keys(jwk)) {
return json_incref(jwk);
} else if (jwk_valid_for_signing(jwk)) {
json_auto_t* sign = json_deep_copy... |
<vulnerable_code>var map=null,doPoll=!0,statuses={"Email Sent":{color:"#1abc9c",label:"label-success",icon:"fa-envelope",point:"ct-point-sent"},"Emails Sent":{color:"#1abc9c",label:"label-success",icon:"fa-envelope",point:"ct-point-sent"},"In progress":{label:"label-primary"},Queued:{label:"label-info"},Completed:{labe... |
<vulnerable_code>if(function(p,_){function e(t,e){return e.toUpperCase()}function i(t){(g.addEventListener||"load"===t.type||"complete"===g.readyState)&&(L(),xt.ready())}var r,n,v=typeof _,t=p.location,g=p.document,o=g.documentElement,a=p.jQuery,s=p.$,l={},h=[],u="1.10.2",m=h.concat,c=h.push,d=h.slice,f=h.indexOf,y=l.t... |
<vulnerable_code> return
}
$("#exportButton").html('<i class="fa fa-spinner fa-spin"></i>')
var csvString = Papa.unparse(csvScope, {})
var csvData = new Blob([csvString], {
type: 'text/csv;charset=utf-8;'
});<commit_title>[PATCH] Updated PapaParse config to prevent CSV injection.<comm... |
<vulnerable_code>/*!
Papa Parse
v4.3.6
https://github.com/mholt/PapaParse
License: MIT
*/
!function(a,b){"function"==typeof define&&define.amd?define([],b):"object"==typeof module&&"undefined"!=typeof exports?module.exports=b():a.Papa=b()}(this,function(){"use strict";function a(a,b){b=b||{};var c=b.dynamicTyping||... |
<vulnerable_code> if status != CONTINUE:
break
# skip the header from the 100 response
while True:
skip = self.fp.readline(_MAXLINE + 1)
if len(skip) > _MAXLINE:
raise LineTooLong("header line")
skip =... |
<vulnerable_code> resp = client.HTTPResponse(FakeSocket(body))
self.assertRaises(client.LineTooLong, resp.begin)
def test_overflowing_chunked_line(self):
body = (
'HTTP/1.1 200 OK\r\n'<commit_title>[PATCH] bpo-44022: Fix httplib client deny of service with total<commit_descriptio... |
<vulnerable_code> if (metadata == NULL)
return NULL;
gpg_data = extra_gpg_data ? extra_gpg_data : included_gpg_data;
deploy_data = flatpak_dir_get_deploy_data (self, ref, FLATPAK_DEPLOY_VERSION_ANY, cancellable, NULL);<commit_title>[PATCH] Ensure that bundles have metadata on install<commit_description>If we... |
<vulnerable_code> {
ldblk=(ssize_t) ((bpp*image->columns+7)/8);
BImgBuff=(unsigned char *) AcquireQuantumMemory((size_t)
ldblk,sizeof(*BImgBuff));
if (BImgBuff == (unsigned char *) NULL)
goto NoMemor... |
<vulnerable_code> ValueError: If the scalar values in `pylist` have inconsistent nesting
depth; or if ragged_rank or inner_shape are incompatible with `pylist`.
"""
if ragged_tensor.is_ragged(pylist):
raise TypeError("pylist may not be a RaggedTensor or RaggedTensorValue.")
# np.ndim builds an array,... |
<vulnerable_code> } else if (chunkType == "iCCP") {
// The ICC profile name can vary from 1-79 characters.
uint32_t iccOffset = 0;
while (iccOffset < 80 && iccOffset < chunkLength) {
if (chunkData.pData_[iccOffset++] == ... |
<vulnerable_code>#include "log.h"
/* This protects:
* 'secure.*' settings from being set
* some mapgen settings from being set
* (not security-criticial, just to avoid messing up user configs)
*/
#define CHECK_SETTING_SECURITY(L, name) \
static inline int checkSettingSecurity(lua_State* L, const std::string &na... |
<vulnerable_code> ptr->entries[i].sampleCount = gf_bs_read_u32(bs);
if (ptr->version)
ptr->entries[i].decodingOffset = gf_bs_read_int(bs, 32);
else
ptr->entries[i].decodingOffset = (s32) gf_bs_read_u32(bs);
if (ptr->max_cts_delta <= ABS(ptr->entries[i].decodingOffset)) {
ptr->max_cts_delta = ABS(ptr->e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.