text stringlengths 79 3.72M |
|---|
<vulnerable_code>from keystone import exception
from keystone import policy
from keystone import token
from keystone.common import manager
from keystone.common import wsgi
CONF = config.CONF
class Manager(manager.Manager):
"""Default pivot point for the Identity backend.
return self.update_user(context,... |
<vulnerable_code> return self.db.delete('token-%s' % token_id)
except KeyError:
raise exception.TokenNotFound(token_id=token_id)<commit_title>[PATCH] Invalidate user tokens when password is changed<commit_description>Fixes bug 996595
This commit will cause all valid tokens to be deleted ... |
<vulnerable_code> with session.begin():
session.delete(token_ref)
session.flush()<commit_title>[PATCH] Invalidate user tokens when password is changed<commit_description>Fixes bug 996595
This commit will cause all valid tokens to be deleted for a user
who's password is changed (implement... |
<vulnerable_code> """
raise exception.NotImplemented()
def _get_default_expire_time(self):
"""Determine when a token should expire based on the config.
<commit_title>[PATCH] Invalidate user tokens when password is changed<commit_description>Fixes bug 996595
This commit will cause all valid ... |
<vulnerable_code> username='blah',
password='blah')
def test_user_create_update_delete(self):
from keystoneclient import exceptions as client_exceptions
<commit_title>[PATCH] Invalidate user tokens when password is changed<commit_description>Fixes bug 9965... |
<vulnerable_code> zip_error_set(error, ZIP_ER_SEEK, EFBIG);
return NULL;
}
if ((flags & ZIP_CHECKCONS) && offset+size != eocd_offset) {
zip_error_set(error, ZIP_ER_INCONS, 0);
return NULL;
}<commit_title>[PATCH] Make eocd checks more consistent between zip and zip64 cases.<commit_descriptio... |
<vulnerable_code> 'az',
'az.completion.sh',
'az.bat',
],
packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests", "azure", "azure.cli"]),
install_requires=DEPENDENCIES,<commit_title>[PATCH] ps1<commit_description><fixed_code>
'az',
'az.completion.sh'... |
<vulnerable_code> is_torch_available,
logging,
requires_backends,
torch_only_method,
)
vocab_dict = None
if pretrained_vocab_file is not None:
# Priority on pickle files (support PyTorch and TF)
with open(pretrained_vocab_file, "rb") as f:
... |
<vulnerable_code>
from ...tokenization_utils import PreTrainedTokenizer
from ...tokenization_utils_base import BatchEncoding
from ...utils import cached_file, is_datasets_available, is_faiss_available, logging, requires_backends
from .configuration_rag import RagConfig
from .tokenization_rag import RagTokenizer
de... |
<vulnerable_code>
import json
import os
import pickle
import shutil
import tempfile
from unittest import TestCase
)
return retriever
def get_dummy_legacy_index_retriever(self):
dataset = Dataset.from_dict(
{
"id": ["0", "1"],
"text": ["foo", "... |
<vulnerable_code>/* radare - LGPL - Copyright 2019 - GustavoLCR */
#include "ne.h"
RList *segments = r_list_newf (free);
for (i = 0; i < bin->ne_header->SegCount; i++) {
RBinSection *bs = R_NEW0 (RBinSection);
NE_image_segment_entry *se = &bin->segment_entries[i];
if (!bs) {
return segments;
}
bs->size... |
<vulnerable_code> bmp_info.bits_per_pixel<<=1;
bytes_per_line=4*((image->columns*bmp_info.bits_per_pixel+31)/32);
length=(size_t) bytes_per_line*image->rows;
pixel_info=AcquireVirtualMemory((size_t) image->rows,
MagickMax(bytes_per_line,image->columns+256UL)*sizeof(*pixels));
if (pixel_info =... |
<vulnerable_code> Reinst *y;
};
static int count(struct cstate *g, Renode *node)
{
int min, max, n;
if (!node) return 0;
switch (node->type) {
default: return 1;
case P_CAT: return count(g, node->x) + count(g, node->y);
case P_ALT: return count(g, node->x) + count(g, node->y) + 2;
case P_REP:
min = node->m;
... |
<vulnerable_code>var assert = require("assert");
var debug = require("./debug");
// Create handlers that pass events from native requests
var events = ["abort", "aborted", "connect", "error", "socket", "timeout"];
var eventHandlers = Object.create(null);
};
});
var InvalidUrlError = createErrorType(
"ERR_INVALID_... |
<vulnerable_code> switch (error.cause.code) {
// Node 17+
case "ERR_INVALID_URL":
assert.equal(error.message, "Redirected request failed: Invalid URL");
break;
// Older Node versions
case "ERR_UNESCAPED_CHARACTERS":
});
});
it("emits an error when ur... |
<vulnerable_code>
@author: Patrik Dufresne
"""
import rdiffweb.test
# Given an https request made to rdiffweb
self.getPage('/', headers=[('X-Forwarded-Proto', 'https')])
# When receiving the response
# Then the header contains Set-Cookie with Secure
cookie = self.assertHeader('... |
<vulnerable_code>import logging
import cherrypy
from cherrypy._cptools import HandlerTool
# Define the logger
logger = logging.getLogger(__name__)
http.cookies.Morsel._reserved['samesite'] = 'SameSite'
class SecureHeaders(HandlerTool):
"""
This tool provide CSRF mitigation.
https://cheatsheetseries... |
<vulnerable_code> output_grad = gradient_checker_v2.compute_gradient(f, [input_tensor])
self.assertAllClose(output_grad[0], np.zeros([1, 4, 4]))
@test_util.run_all_in_graph_and_eager_modes
class SortedSearchTest(test_util.TensorFlowTestCase):<commit_title>[PATCH] Fix Integer overflow error in Dequantize op... |
<vulnerable_code> byte[] ciphertext, int ciphertextOffset, int length)
throws ShortBufferException {
int space;
if (ciphertextOffset > ciphertext.length)
space = 0;
else
space = ciphertext.length - ciphertextOffset;
if (!haskey) {
// The key is not set yet - return the plaintext as-is.
if (leng... |
<vulnerable_code> *
* @throws IllegalStateException The nonce has wrapped around.
*
* The plaintext and ciphertext buffers can be the same for in-place
* encryption. In that case, plaintextOffset must be identical to
* ciphertextOffset.
*
* @throws IllegalStateException The nonce has wrapped around.
... |
<vulnerable_code> return true;
}
static bool
wasm_loader_push_frame_csp(WASMLoaderContext *ctx, uint8 label_type,
BlockType block_type, uint8 *start_addr,<commit_title>[PATCH] Fix classic-interp build error<commit_description><fixed_code>
return true;
}
#if WASM_ENABLE_FAST_INTERP ==... |
<vulnerable_code>static inline int z_vrfy_gpio_enable_callback(struct device *port,
gpio_pin_t pin)
{
return z_impl_gpio_enable_callback((struct device *)port, pin);
}
#include <syscalls/gpio_enable_callback_mrsh.c>
static inline int z_vrfy_gpio_disable_callback(struct device *port,
gpio_pin_t pin... |
<vulnerable_code> normalize=True,
expected_output=expected_output)
if __name__ == "__main__":
test.main()<commit_title>[PATCH] Fix tf.raw_ops.EditDistance vulnerability with negative<commit_description><fixed_code>
normalize=True,
expected_output=expected_output)
def testEditDistan... |
<vulnerable_code>typedef size_t __wasi_size_t;
static inline
void copy_iov_to_host(void* _mem, __wasi_iovec_t* host_iov, __wasi_iovec_t* wasi_iov, int32_t iovs_len)
{
// Convert wasi memory offsets to host addresses
for (int i = 0; i < iovs_len; i++) {
host_iov[i].buf = m3ApiOffsetToPtr(wasi_iov[i].buf... |
<vulnerable_code> for (uvwasi_size_t i = 0; i < iovs_len; ++i) {
iovs[i].buf = m3ApiOffsetToPtr(m3ApiReadMem32(&wasi_iovs[i].buf));
iovs[i].buf_len = m3ApiReadMem32(&wasi_iovs[i].buf_len);
//fprintf(stderr, "> fd_pread fd:%d iov%d.len:%d\n", fd, i, iovs[i].buf_len);
}
for (uvwasi_si... |
<vulnerable_code>#if defined(HAS_IOVEC)
static inline
void copy_iov_to_host(void* _mem, struct iovec* host_iov, wasi_iovec_t* wasi_iov, int32_t iovs_len)
{
// Convert wasi memory offsets to host addresses
for (int i = 0; i < iovs_len; i++) {
host_iov[i].iov_base = m3ApiOffsetToPtr(m3ApiReadMem32(&wasi_... |
<vulnerable_code> }
if ( !foundExifData
&& marker == app1_ && size >= 8 && memcmp(buf.pData_ + 2, exifId_, 6) == 0) {
ByteOrder bo = ExifParser::decode(exifData_, buf.pData_ + 8, size - 8);
setByteOrder(bo);
if (size > 8 && byteOr... |
<vulnerable_code> Double index;
Bool importer;
Bool deps, notime, temporal_delim;
u32 bsdbg;
//only one input pid declared
if (!ctx->opid)
return GF_NON_COMPLIANT_BITSTREAM;
gf_bs_get_content_no_truncate(ctx->state.bs, &ctx->state.frame_obus, &pck_size, &ctx->state.frame_obus_alloc);
if (!pck_size) {
... |
<vulnerable_code>from html import escape as html_escape
import re
from typing import Union
from six import ensure_str
text = _UNESCAPER_TEXT.sub(r'<\1\2>', text)
for a_href in _A_HREF.finditer(text):
href = a_href.group(1)
target = a_href.group(2)
if target:<commit_title>[PATCH] Preve... |
<vulnerable_code> "<a href=\"xyz\">abc</a><script>alert(1)</script><a href=\"xyz\">abc</a>",
),
(" ", None),
# At the moment also javascript URLs are accepted. This will be refused in the next step
("<a href=\"javascript:alert(1)\">abc</a>", None),
])
def ... |
<vulnerable_code> register ssize_t
i;
if ((p+length) < q)
while (p < q)
{
for (i=0; i < (ssize_t) length; i++)
if (p[i] != target[i])
break;
if (i == (ssize_t) length)
return((unsigned char *) p);
p++;
}
return((unsigned char *) NULL);
}
<commit_title>[P... |
<vulnerable_code> c = bytesToNumber(bytearray(s))
return c
def _rawPublicKeyOp(self, c):
b = numberToByteArray(c, numBytes(self.n))
s = m2.rsa_public_decrypt(self.rsa, bytes(b), m2.no_padding)
m = bytesToNumber(bytearray(s))
return m
... |
<vulnerable_code>
return (val_a^((val_a^val_b)|(((val_a-val_b)&0xffffffff)^val_b)))>>31
def ct_gt_u32(val_a, val_b):
"""
Return 1 if val_a > val_b, 0 otherwise. Constant time.
"""
return ct_lt_u32(val_b, val_a)
def ct_le_u32(val_a, val_b):
"""
Return 1 if val_a <= val_b, 0 otherwise. Const... |
<vulnerable_code>
from tlslite.utils.constanttime import ct_lt_u32, ct_gt_u32, ct_le_u32, \
ct_lsb_prop_u8, ct_isnonzero_u32, ct_neq_u32, ct_eq_u32, \
ct_check_cbc_mac_and_pad, ct_compare_digest
from hypothesis import given, example
import hypothesis.strategies as st
self.assertEqual(((i & 0x1)... |
<vulnerable_code>
def _parseKeyHelper(key, private, public):
if private:
if not key.hasPrivateKey():
raise SyntaxError("Not a private key!")
if public:
return _createPublicKey(key)
if private:
if hasattr(key, "d"):
return _createPrivateKey(key)
else... |
<vulnerable_code>from .rsakey import *
from .python_rsakey import Python_RSAKey
from .compat import compatAscii2Bytes
#copied from M2Crypto.util.py, so when we load the local copy of m2
#we can still use it
key._hasPrivateKey = False
else:
raise Synta... |
<vulnerable_code> // [databind#2032]: more 3rd party; data exfiltration via xml parsed ext entities
s.add("org.apache.ibatis.parsing.XPathParser");
DEFAULT_NO_DESER_CLASS_NAMES = Collections.unmodifiableSet(s);
}
<commit_title>[PATCH] Backport #2052, #2058 fixes for 2.7.9.4<commit_descriptio... |
<vulnerable_code> // magic number that identifies the stream as a compressed stream
int flagCount = 0;
int flags = 0;
dst = calloc(comp_Prebuf.size + uncompressedSize, 1);
ALLOCCHECK(dst);
memcpy(dst, comp_Prebuf.data, comp_Prebuf.size);<commit_title>[PATCH] prevent 32 bit system int overflow<com... |
<vulnerable_code> if (pcd_table[i] == (PCDTable *) NULL)
{
buffer=(unsigned char *) RelinquishMagickMemory(buffer);
ThrowBinaryImageException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
}
if (r->length > 16)
{
buffer=(unsigned char *) R... |
<vulnerable_code> char **details;
sd_bus_message *request, *reply;
sd_bus_message_handler_t callback;
void *userdata;
sd_bus_slot *slot;
Hashmap *registry;
} AsyncPolkitQuery;
static void async_polkit_query_free(AsyncPolkitQuery *q) {
if (!q)
ret... |
<vulnerable_code>#include <pj/file_io.h>
#include <pj/assert.h>
#include <pj/errno.h>
#include <stdio.h>
#include <errno.h>
{
int mode;
switch (whence) {
case PJ_SEEK_SET:
mode = SEEK_SET; break;<commit_title>[PATCH] Merge pull request from GHSA-rwgw-vwxg-q799<commit_description>* Prevent potentia... |
<vulnerable_code> /* Read the headers of each stream. */
for (i = 0; i < avi_hdr.avih_hdr.num_streams; i++) {
pj_size_t elem = 0;
pj_ssize_t size_to_read;
/* Read strl header */
status = file_read(fport[0]->fd, &avi_hdr.strl_hdr[i],
do {
pjmedia_avi_subchunk ch;
... |
<vulnerable_code> pjmedia_port **p_port )
{
pjmedia_wave_hdr wave_hdr;
pj_ssize_t size_to_read, size_read;
struct file_reader_port *fport;
pjmedia_audio_format_detail *ad;
pj_off_t pos;
return status;
/* Read the file header plus fmt header only. */
size_read = size_to_read = siz... |
<vulnerable_code> for (index=file_count-1; index>=0; index--) {
pjmedia_wave_hdr wavehdr;
pj_ssize_t size_to_read, size_read;
/* we end with the last one so we are good to go if still in function*/
pj_memcpy(filename, file_list[index].ptr, file_list[index].slen);
goto on_error;
/* Read the file header ... |
<vulnerable_code>import contextlib
import logging
from datetime import datetime, timedelta, timezone
from typing import Optional, Tuple, Union
import discord
from redbot.core import commands, i18n, checks, modlog
await show_results()
return
for user_id in user_ids:
user = g... |
<vulnerable_code> ),
"NETWORK_DRIVERS": ConstanceConfigItem(
default={},
help_text=mark_safe(
"Extend or override default Platform.network_driver translations provided by "
'<a href="https://netutils.readthedocs.io/en/latest/user/lib_use_cases_lib_mapper/">netutils</a>. '
... |
<vulnerable_code>
@property
def header(self):
return mark_safe('<input type="checkbox" class="toggle" title="Toggle all" />')
class BooleanColumn(django_tables2.Column):<commit_title>[PATCH] Add ruff for linting, add S308 disables to audited code<commit_description><fixed_code>
@property
def ... |
<vulnerable_code> "help_text": cf_form_field.help_text,
}
if cf.type == CustomFieldTypeChoices.TYPE_BOOLEAN:
field_info["format"] = mark_safe("<code>true</code> or <code>false</code>")
elif cf.type == CustomFieldTypeChoices.TYPE_DATE... |
<vulnerable_code> VRFPrefixAssignment,
)
AVAILABLE_LABEL = mark_safe('<span class="label label-success">Available</span>')
UTILIZATION_GRAPH = """
{% load helpers %}<commit_title>[PATCH] Add ruff for linting, add S308 disables to audited code<commit_description><fixed_code>
VRFPrefixAssignment,
)
AVAILABLE_LA... |
<vulnerable_code> run_command(context, command)
@task
def yamllint(context):
"""Run yamllint to validate formatting applies to YAML standards."""
hadolint(context)
markdownlint(context)
yamllint(context)
pylint(context)
check_migrations(context)
check_schema(context)<commit_title>[P... |
<vulnerable_code> "Flask-Assets>=2.0,<3",
"Flask-Babel>=2.0,<3",
"Flask-Login>=0.6,<0.7", # breaking changes can happen on minor version increases
"flask>=2.2,<2.3", # breaking changes can happen on minor version increases (with deprecation warnings)
"frozendict>=2.0,<3",
"future>=0.18.2,<1", ... |
<vulnerable_code>
assets = None
babel = None
debug = False
safe_mode = False
timer.start()
def _setup_app(self, app):
from octoprint.server.util.flask import (
OctoPrintFlaskRequest,
OctoPrintFlaskResponse,
MarkdownFilter(app)
def _setup_i18n(self, app):
... |
<vulnerable_code>
@api.route("/login", methods=["POST"])
def login():
data = request.get_json()
if not data:<commit_title>[PATCH] =?UTF-8?q?=F0=9F=94=92=EF=B8=8F=20Rate=20limit=20failed?=<commit_description><fixed_code>
@api.route("/login", methods=["POST"])
@octoprint.server.limiter.limit(
"3/minute;5/1... |
<vulnerable_code> };
var overlayElement = $("#login-overlay");
var errorElement = $("#login-error");
var offlineElement = $("#login-offline");
var buttonElement = $("#login-button");
var reconnectElement = $("#login-reconnect");
var remember = rememberElement.prop("checked");
ov... |
<vulnerable_code>/*
* Copyright 2004-2019 H2 Group. Multiple-Licensed under the MPL 2.0,
* and the EPL 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package org.h2.jdbc;
import java.io.Writer;
import java.sql.SQLException;
import java.sql.SQLXML;
import javax.xml.parsers.DocumentB... |
<vulnerable_code> byte[] digest = md.digest();
// check digest
return (TypeUtil.toString(digest, 16).equalsIgnoreCase(response));
}
catch (Exception e)
{
{
return username + "," + response;
}
}
}<commit_... |
<vulnerable_code> return new Password(credential);
}
/**
* Unix Crypt Credentials
*/
credentials=new String((char[])credentials);
if (!(credentials instanceof String) && !(credentials instanceof Password))
LOG.warn("Can't check " + credentials.getCl... |
<vulnerable_code>
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Locale;
import org.eclipse.jetty.util.log.Log;
@Override
public boolean check(Object credentials)
{
if (this == credentials) return true;
if (credentials instan... |
<vulnerable_code>
Start replacing each field one by one.
TODO: Optimize this so it's done all in one update.
FIXME: Possible security issue due to embedding an unsanitized
string directly into the statement.
"""
with Transaction(self.conn) as tx:
q = "UPDATE u... |
<vulnerable_code>#endif
/* MARK: v NAME & IP FUNCTIONS */
#define dns_name_foreach_label_safe(label, name, next, maxlen) \
for ((label) = (name), (next) = (char *)((name) + *(unsigned char*)(name) + 1); \
(*(label) != '\0') && ((uint16_t)((label) - (name)) < (maxlen)); \
(label) = (next), (next) ... |
<vulnerable_code> /* Decompress single DNS question */
qname_original = pico_dns_question_decompress(question, packet);
mdns_dbg("Question RCVD for '%s'\n", question->qname);
/* Find currently active query cookie */
if ((cookie = pico_mdns_ctree_find_cookie(question->qname,
... |
<vulnerable_code> if (file)
{
char buffer[1024]; int len;
while ((len = zzip_file_read (file, buffer, 1024)))
{
fwrite (buffer, 1, len, out);
}<commit_title>[PATCH] #68 ssize_t return value of zzip_file_read is a signed value<commit_description><fixed_code>
if (file)
{
char buffer[1024]; int... |
<vulnerable_code> self.assertIsNone(iso2time(test),
"iso2time(%r)" % test)
class HeaderTests(unittest.TestCase):
<commit_title>[PATCH] Test for ISO_DATE_RE sub-quadratic performance<commit_description><fixed_code>
self.assertIsNone(iso2time(test),
... |
<vulnerable_code>/*******************************************************************************
* Copyright (c) 2014, 2015 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* http://www.eclipse.org/org/document... |
<vulnerable_code> */
editormd.filterHTMLTags = function(html, filters) {
if (typeof html !== "string") {
html = new String(html);
}
if (typeof filters !== "string") {
// If no filters set use "script|on*" by default to avoid XSS
... |
<vulnerable_code> },
});
areaSlider.noUiSlider.on("change", changeAreaSlider);
areaSlider.noUiSlider.on("end", update_filter);
function changedtgSlider(str, h, values) {
currentfilter.mindtg = values[0];
}
});
dtgSlider.noUiSlider.on("change", changedtgSlider);
dtgSlider.noUiSlider.on("end", update_filter);
func... |
<vulnerable_code> if (quantum_info != (QuantumInfo *) NULL)
quantum_info=DestroyQuantumInfo(quantum_info);
END_OF_READING:
clone_info=DestroyImageInfo(clone_info);
CloseBlob(image);
<commit_title>[PATCH] https://github.com/ImageMagick/ImageMagick/issues/547<commit_description><fixed_code>
if (quantum_info !... |
<vulnerable_code>
if (jsonstring !== '')
{
jsonobj = eval('(' + jsonstring + ')');
display = '<table width="100%" class="question uploadedfiles"><thead><tr><td width="20%"> </td>';
if (show_title != 0)
display += '<th>'+uploadLang.headTitle+'</th>';<commit_title>[PATCH] ... |
<vulnerable_code> if (filecount > 0)
{
var jsontext = window.parent.window.$('#' + fieldname).val();
var json = eval('(' + jsontext + ')');
if ($('#field' + fieldname + '_listfiles').length == 0)
{
$("<ul id='field" + fieldname + "_listfiles' class='files-list' />").in... |
<vulnerable_code> severityName: message.severity === 1 ? 'Warning' : 'Error',
lineNumber: message.line,
column: message.column,
message: message.message,
ruleId: message.ruleId,
ruleLink: getRuleLink(message.ruleId)
});
});
}
/**
* Formats the source code before adding it to the HTML
* @param {string} s... |
<vulnerable_code> i = (buf >> (DIGIT_BIT - 1)) & 1;
buf <<= 1;
if (mode == 0) {
mode = i;
/* timing resistant - dummy operations */
if (err == MP_OKAY)
err = ecc_projective_add_point(M[1], M[2], M[2], a, modulus,
... |
<vulnerable_code>from typing import Dict, Optional, Tuple
from django.utils.translation import ugettext as _
from django.conf import settings
MAX_EMOJI_GIF_SIZE = 128
MAX_EMOJI_GIF_FILE_SIZE_BYTES = 128 * 1024 * 1024 # 128 kb
# Performance Note:
#
# For writing files to S3, the file could either be stored in RAM
... |
<vulnerable_code>
from zerver.lib.response import json_success, json_error
from zerver.lib.upload import upload_message_image_from_request, get_local_file_path, \
get_signed_upload_url, check_upload_within_quota
from zerver.models import UserProfile, validate_attachment_request
from django.conf import settings
from... |
<vulnerable_code>from datetime import datetime
import os
import webbrowser
# Qt translation handling
)
try:
result = os.system("asciidoctor {} -o {}".format(reportraw, reporthtml))
if str(result) == "32512":
msg = "asciidoctor not found. html cannot be gene... |
<vulnerable_code> X509CRL.setDefaultStr(getDefaultCRL());
}
// FIXME:
// Need to shutdown the connection cleanly
// FIXME?
// add a finalizer method that calls shutdown
public boolean processMsg(CConnection cc) {
is = (FdInStream)cc.getInStream();
os = (FdOutStream)cc.getOutStream();
{
Col... |
<vulnerable_code> return len;
}
public byte[] getCalculatedAuthenticationBytes() {
return mac.doFinal();
}
}<commit_title>[PATCH] #485 Calculate AES mac with cache and push back functionality<commit_description><fixed_code>
return len;
}
public byte[] getCalculatedAuthenticationBytes(int numberOf... |
<vulnerable_code>
package net.lingala.zip4j.crypto.PBKDF2;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
/*
* Source referred from Matthias Gartner's PKCS#5 implementation -
* see http://rtner.de/software/PBK... |
<vulnerable_code> }
@Override
protected void endOfEntryReached(InputStream inputStream) throws IOException {
verifyContent(readStoredMac(inputStream));
}
private void verifyContent(byte[] storedMac) throws IOException {
byte[] calculatedMac = getDecrypter().getCalculatedAuthenticationBytes();
byt... |
<vulnerable_code> return decrypter;
}
protected void endOfEntryReached(InputStream inputStream) throws IOException {
// is optional but useful for AES
}
<commit_title>[PATCH] #485 Calculate AES mac with cache and push back functionality<commit_description><fixed_code>
return decrypter;
}
protecte... |
<vulnerable_code> cipherInputStream.close();
}
public void endOfEntryReached(InputStream inputStream) throws IOException {
cipherInputStream.endOfEntryReached(inputStream);
}
public void pushBackInputStreamIfNecessary(PushbackInputStream pushbackInputStream) throws IOException {
// Do nothing by de... |
<vulnerable_code> }
@Override
public void endOfEntryReached(InputStream inputStream) throws IOException {
if (inflater != null) {
inflater.end();
inflater = null;
}
super.endOfEntryReached(inputStream);
}
@Override
public void pushBackInputStreamIfNecessary(PushbackInputStream pushb... |
<vulnerable_code> private void endOfCompressedDataReached() throws IOException {
//With inflater, without knowing the compressed or uncompressed size, we over read necessary data
//In such cases, we have to push back the inputstream to the end of data
decompressedInputStream.pushBackInputStreamIfNecessary(... |
<vulnerable_code> verifyLastModifiedFileTime(zipFile, fileToTestWith, expectedLastModifiedTimeInMillis);
}
private void testAddAndExtractWithPasswordUtf8Encoding(boolean useUtf8ForPassword) throws IOException {
char[] password = "hun 焰".toCharArray();
ZipFile zipFile = new ZipFile(generatedZipFile, pass... |
<vulnerable_code>import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.security.SecureRandom;
import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
}
}
pr... |
<vulnerable_code>import java.io.OutputStream;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
}
}
private void testZipOutputStream(CompressionMethod compressionMethod, boolean encrypt,
EncryptionMe... |
<vulnerable_code> "use strict";
var f, sorted, xs, ps, i, j, l, xx;
if (Array.isArray(data) && (data.length>0)){
sorted = data.slice().sort(function(a,b){ return +a-b; });
xs = [];
ps = [];<commit_title>[PATCH] throw TypeError on invalid data array or elements<commit_description><fixed_code>
"use stri... |
<vulnerable_code> apiLogger.info("RESPONSE, " + req.params.func + ", " + response);
//is this a jsonp call, if yes, add the function call
if(req.query.jsonp)
response = req.query.jsonp + "(" + response + ")";
res._____send(response);<commit_title>[PATCH] better sanitize jsonp<commit_description><... |
<vulnerable_code> m_SequenceParameters.EnsureCapacity(num_seq_params);
unsigned int cursor = 6;
for (unsigned int i=0; i<num_seq_params; i++) {
m_SequenceParameters.Append(AP4_DataBuffer());
AP4_UI16 param_length = AP4_BytesToInt16BE(&payload[cursor]);
m_SequenceParameters[i].SetData(... |
<vulnerable_code>{
// make a copy of our configuration bytes
unsigned int payload_size = size-AP4_ATOM_HEADER_SIZE;
m_RawBytes.SetData(payload, payload_size);
// parse the payload<commit_title>[PATCH] fix for #188<commit_description><fixed_code>
{
// make a copy of our configuration bytes
unsig... |
<vulnerable_code> return P.identity ? P : ECP::Point(mr.ConvertOut(P.x), mr.ConvertOut(P.y));
}
template <typename T>
inline Integer ToInteger(const T& val)
{
return !!val ? Integer::One() : Integer::Zero();
}
ANONYMOUS_NAMESPACE_END
// Gyrations attempt to maintain constant-timeness
// We need either (P.x, P.y... |
<vulnerable_code> assert self.blocks
# Don't proxy a URL unless it's a URL specifically loaded by the user using
# gr.load() to prevent SSRF or harvesting of HF tokens by malicious Spaces.
is_safe_url = any(url.host.endswith(root) for root in self.blocks.root_urls)
if not is_safe_... |
<vulnerable_code> "init_xframe_protection",
"init_airflow_session_interface",
"init_appbuilder",
]
@functools.wraps(f)<commit_title>[PATCH] Fix tests<commit_description><fixed_code>
"init_xframe_protection",
"init_airflow_session_interface",
... |
<vulnerable_code> "init_jinja_globals",
"init_plugins",
"init_airflow_session_interface",
]
)
def factory():<commit_title>[PATCH] Fix tests<commit_description><fixed_code>
"init_jinja_globals",
"init_plugins",
"init_airflow_session_i... |
<vulnerable_code>from tests.test_utils.www import check_content_in_response, check_content_not_in_response
def test_index(admin_client):
with assert_queries_count(16):
resp = admin_client.get('/', follow_redirects=True)
check_content_in_response('DAGs', resp)
<commit_title>[PATCH] Fix tests<commit_de... |
<vulnerable_code>
dst_len = ieee802154_get_dst(mhr, dst, &_pan_tmp);
src_len = ieee802154_get_src(mhr, src, &_pan_tmp);
if ((dst_len < 0) || (src_len < 0)) {
DEBUG("_make_netif_hdr: unable to get addresses\n");
return NULL;
}<commit_title>[PATCH] gnrc_netif_ieee802154: Ignore packets wit... |
<vulnerable_code> return email.replace(/[^a-zA-Z0-9_\-@.+]/g,'');
};
pimcore.helpers.registerKeyBindings = function (bindEl, ExtJS) {
if (!ExtJS) {<commit_title>[PATCH] optimized urlslug input (#14669)<commit_description><fixed_code>
return email.replace(/[^a-zA-Z0-9_\-@.+]/g,'');
};
pimcore.helpers.sanit... |
<vulnerable_code> process.env.NODE_ENV = "production";
}
log.info("server", "Node Env: " + process.env.NODE_ENV);
log.info("server", "Inside Container: " + (process.env.UPTIME_KUMA_IS_CONTAINER === "1"));
log.info("server", "Importing Node libraries");
const fs = require("fs");<commit_title>[PATCH] Merge pull requ... |
<vulnerable_code>const http = require("http");
const { Server } = require("socket.io");
const { R } = require("redbean-node");
const { log } = require("../src/util");
const Database = require("./database");
const util = require("util");
const { CacheableDnsHttpAgent } = require("./cacheable-dns-http-agent");
Up... |
<vulnerable_code> *******************************************************************************/
package org.eclipse.core.internal.runtime;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.TransformerFactory;
import org... |
<vulnerable_code>
AllPreferenceTests.class,
/*
* Intentional the LAST TEST in the list to let JobEventTest.testNoTimeoutOccured() verify the other
* tests:<commit_title>[PATCH] Add XmlProcessorFactoryTest<commit_description>And createDocumentBuilderIgnoringDOCTYPE() does not load remote DTDs.
see https://gi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.