text stringlengths 79 3.72M |
|---|
<vulnerable_code>
bytes_type = type(bytes()) # Works the same in Python 2.X and 3.X
string_type = getattr(builtins, "unicode", str)
int_types = (int, long) if sys.version_info[0] < 3 else (int,)
# Make basic type tests more consistent
tok = stream.read(16)
if not tok:
# stream has truncate... |
<vulnerable_code> for desc in self.rdfRoot.getElementsByTagNameNS(RDF_NAMESPACE, "Description"):
if desc.getAttributeNS(RDF_NAMESPACE, "about") == aboutUri:
attr = desc.getAttributeNodeNS(namespace, name)
if attr != None:
yield attr
... |
<vulnerable_code>__version__ = "1.27.3"<commit_title>[PATCH 01/11] STY: Fix various style issues (#742)<commit_description><fixed_code>
__version__ = "1.27.4" |
<vulnerable_code>from .pagerange import PageRange, parse_filename_page_ranges
from ._version import __version__
__all__ = ["pdf", "PdfFileMerger"]<commit_title>[PATCH 01/11] STY: Fix various style issues (#742)<commit_description><fixed_code>
from .pagerange import PageRange, parse_filename_page_ranges
from ._version ... |
<vulnerable_code> # Unable to import zlib. Attempt to use the System.IO.Compression
# library from the .NET framework. (IronPython only)
import System
from System import IO, Collections, Array
def _string_to_bytearr(buf):
retval = Array.CreateInstance(System.Byte, len(buf))
x = ... |
<vulnerable_code> # break occurs. If it's a multi-char EOL, consume the
# second character:
tok = stream.read(1)
if not tok in b_("\n\r"):
stream.seek(-1, 1)
# Then don't add anything to the actua... |
<vulnerable_code> page set.
"""
new_dests = []
prev_header_added = True
for k, o in list(dests.items()):
for j in range(*pages):
if pdf.getPage(j).getObject() == o['/Page'].getObject():
if p.id == v['/Page']:
... |
<vulnerable_code> @staticmethod
def valid(input):
""" True if input is a valid initializer for a PageRange. """
return isinstance(input, slice) or \
isinstance(input, PageRange) or \
(isString(input)
and bool(re.match(PAGE_RANGE_RE, input)))
for... |
<vulnerable_code>__maintainer__ = "Phaseit, Inc."
__maintainer_email = "PyPDF2@phaseit.net"
import string
import math
import struct
import sys
else:
from io import BytesIO
from . import filters
from . import utils
import warnings
import codecs
if debug: print((data, "TYPE", data.__class__.__name__))
... |
<vulnerable_code> # Mainly for debugging
RADIUS = 5000
stream.seek(-RADIUS, 1)
outputDoc = open('PyPDF2_pdfLocation.txt', 'wb')
outputDoc.write(stream.read(RADIUS))
outputDoc.write(b'HERE')
outputDoc.write(stream.read(RADIUS))
outputDoc.close()
stream.seek(-RADIUS, 1)
... |
<vulnerable_code>import datetime
import decimal
from .generic import PdfObject
from xml.dom import getDOMImplementation
from xml.dom.minidom import parseString
from .utils import u_
<commit_title>[PATCH 01/11] STY: Fix various style issues (#742)<commit_description><fixed_code>
import datetime
import decimal
from .gene... |
<vulnerable_code> print("usage: python 2-up.py input_file output_file")
sys.exit(1)
print("2-up input " + sys.argv[1])
reader = PdfFileReader(open(sys.argv[1], "rb"))
writer = PdfFileWriter()
for iter in range(0, reader.getNumPages() - 1, 2):
lhs = reader.getPage(iter)<commit_titl... |
<vulnerable_code>#!/usr/bin/env python
"""
Layout the pages from a PDF file to print a booklet or brochure.
The resulting media size is twice the size of the first page
of the source document. If you print the resulting PDF in duplex
(short edge), you get a center fold brochure that you can staple
... |
<vulnerable_code>
def main(pdf: str):
reader = PyPDF2.PdfFileReader(open(pdf, "rb"))
page = reader.pages[30]
if "/XObject" in page["/Resources"]:<commit_title>[PATCH 01/11] STY: Fix various style issues (#742)<commit_description><fixed_code>
def main(pdf: str):
reader = PyPDF2.PdfFileReader(pdf)
... |
<vulnerable_code>def test_basic_features():
output = PdfFileWriter()
document1 = os.path.join(RESOURCE_ROOT, "crazyones.pdf")
input1 = PdfFileReader(open(document1, "rb"))
# print how many pages input1 has:
print("document1.pdf has %d pages." % input1.getNumPages())
# add page 4 from input1, bu... |
<vulnerable_code>import os
import binascii
import sys
import PyPDF2
# file_merger.append(reader)
# File handle
fh = open(pdf_path, "rb")
file_merger.append(fh)
file_merger.addBookmark("A bookmark", 0)
<commit_title>[PATCH 01/11] STY: Fix various style issues (#742)<commit_description><fixed_code>... |
<vulnerable_code> output is as expected.
"""
pdf_path = os.path.join(RESOURCE_ROOT, "crazyones.pdf")
reader = PdfFileReader(open(pdf_path, "rb"))
page = reader.pages[0]
page.mergeRotatedScaledPage(page, 90, 1, 1)
page.mergeScaledTranslatedPage(page, 1, 1, 1)<commit_title>[PATCH 01/11] STY: Fi... |
<vulnerable_code>import os
import pytest
import PyPDF2.utils
from PyPDF2.filters import decodeStreamData, _xobj_to_image
TESTS_ROOT = os.path.abspath(os.path.dirname(__file__))
PROJECT_ROOT = os.path.dirname(TESTS_ROOT)
],
)
def test_get_annotations(src):
reader = PyPDF2.PdfFileReader(open(src, "rb"))
for... |
<vulnerable_code>
from PyPDF2 import PdfFileReader, PdfFileWriter
from PyPDF2.utils import PageSizeNotDefinedError
from PyPDF2.generic import IndirectObject, RectangleObject
TESTS_ROOT = os.path.abspath(os.path.dirname(__file__))
PROJECT_ROOT = os.path.dirname(TESTS_ROOT)
pdf_path = os.path.join(RESOURCE_ROOT, "cr... |
<vulnerable_code>
VERSIONFILE = "PyPDF2/_version.py"
verstrline = open(VERSIONFILE, "rt").read()
VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
mo = re.search(VSRE, verstrline, re.M)
if mo:<commit_title>[PATCH 01/11] STY: Fix various style issues (#742)<commit_description><fixed_code>
VERSIONFILE = "PyPDF2/_version.py... |
<vulnerable_code><commit_title>[PATCH 01/11] STY: Fix various style issues (#742)<commit_description><fixed_code>
import os
import pytest
from PyPDF2 import PdfFileReader, PdfFileWriter
# Configure path environment
TESTS_ROOT = os.path.abspath(os.path.dirname(__file__))
PROJECT_ROOT = os.path.dirname(TESTS_ROOT)
RESO... |
<vulnerable_code>import os
import sys
import unittest
import binascii
from PyPDF2 import PdfFileReader, PdfFileWriter
# Configure path environment
TESTS_ROOT = os.path.abspath(os.path.dirname(__file__))
PROJECT_ROOT = os.path.dirname(TESTS_ROOT)
RESOURCE_ROOT = os.path.join(PROJECT_ROOT, "Resources")
sys.path.appen... |
<vulnerable_code> fileobj = StreamIO(filecontent)
my_file = True
elif isinstance(fileobj, PdfFileReader):
orig_tell = fileobj.stream.tell()
fileobj.stream.seek(0)
filecontent = StreamIO(fileobj.stream.read())
fileobj.stream.seek(orig_tell) #... |
<vulnerable_code># vim: sw=4:expandtab:foldmethod=marker
#
# Copyright (c) 2006, Mathieu Fenniak
# All rights reserved.
#
from cStringIO import StringIO
else:
from io import StringIO
import struct
try:
import zlib
class CCITTFaxDecode(object):
def decode(data, decodeParms=None, height=0):
i... |
<vulnerable_code>import decimal
import codecs
ObjectPrefix = b_('/<[tf(n%')
NumberSigns = b_('+-')
IndirectPattern = re.compile(b_(r"[+-]?(\d+)\s+(\d+)\s+R[^a-zA-Z]"))
while True:
tok = stream.read(1)
if not tok:
# stream has truncated prematurely
raise P... |
<vulnerable_code># vim: sw=4:expandtab:foldmethod=marker
#
# Copyright (c) 2006, Mathieu Fenniak
# All rights reserved.
#<commit_title>[PATCH 01/11] STY: Fix various style issues (#742)<commit_description><fixed_code>
# Copyright (c) 2006, Mathieu Fenniak
# All rights reserved.
# |
<vulnerable_code># -*- coding: utf-8 -*-
#
# vim: sw=4:expandtab:foldmethod=marker
#
# Copyright (c) 2006, Mathieu Fenniak
# Copyright (c) 2007, Ashish Kulkarni <kulkarni.ashish@gmail.com>
#
streamData.seek(0, 0)
lines = streamData.readlines()
for i in range(0, len(lines)... |
<vulnerable_code>except ImportError: # Py3
import builtins
xrange_fn = getattr(builtins, "xrange", range)
_basestring = getattr(builtins, "basestring", str)
def readUntilRegex(stream, regex, ignore_eof=False):
"""
Reads until the regular expression pattern matched (ignore the match)
Raise PdfStreamE... |
<vulnerable_code>
import pytest
from PyPDF2 import PdfFileWriter, PdfFileReader
from PyPDF2.utils import PdfReadError
from PyPDF2.pdf import convertToInt
TESTS_ROOT = os.path.abspath(os.path.dirname(__file__))
PROJECT_ROOT = os.path.dirname(TESTS_ROOT)
def test_basic_features():
output = PdfFileWriter()
doc... |
<vulnerable_code>import os
import pytest
from PyPDF2 import PdfFileReader, PdfFileWriter
PROJECT_ROOT = os.path.dirname(TESTS_ROOT)
RESOURCE_ROOT = os.path.join(PROJECT_ROOT, "Resources")
@pytest.fixture
def pdf_file_writer():
ipdf = PdfFileReader(os.path.join(RESOURCE_ROOT, "crazyones.pdf"))
pdf_file_writer ... |
<vulnerable_code> pdf_path = os.path.join(RESOURCE_ROOT, "crazyones.pdf")
outline = os.path.join(RESOURCE_ROOT, "pdflatex-outline.pdf")
pdf_forms = os.path.join(RESOURCE_ROOT, "pdflatex-forms.pdf")
file_merger = PyPDF2.PdfFileMerger()
file_merger.append(pdf_path, pages=PyPDF2.pagerange.PageRange(sl... |
<vulnerable_code>import os
from PyPDF2 import PdfFileReader
TESTS_ROOT = os.path.abspath(os.path.dirname(__file__))
RESOURCE_ROOT = os.path.join(PROJECT_ROOT, "Resources")
def test_page_operations():
"""
This test just checks if the operation throws an exception.
This should be done way more thoroughly... |
<vulnerable_code>from PyPDF2.pagerange import PageRange, ParseError, parse_filename_page_ranges
def test_idempotency():
pr = PageRange(slice(0, 5))
pr2 = PageRange(pr)<commit_title>[PATCH 01/11] STY: Fix various style issues (#742)<commit_description><fixed_code>
from PyPDF2.pagerange import PageRange, ParseE... |
<vulnerable_code>import io
import os
import pytest
import PyPDF2.utils
from PyPDF2.filters import _xobj_to_image
TESTS_ROOT = os.path.abspath(os.path.dirname(__file__))
RESOURCE_ROOT = os.path.join(PROJECT_ROOT, "Resources")
def test_read_metadata():
with open(os.path.join(RESOURCE_ROOT, "crazyones.pdf"), "rb") ... |
<vulnerable_code>import pytest
import PyPDF2.utils
import io
@pytest.mark.parametrize(
assert PyPDF2.utils.isInt(value) == expected
@pytest.mark.parametrize(
"stream,expected",
[
def test_markLocation():
stream = io.BytesIO(b"abde" * 6000)
PyPDF2.utils.markLocation(stream)<commit_title>[PATCH 01... |
<vulnerable_code># -*- coding: utf-8 -*-
import os
import binascii
import sys
import pytest
from PyPDF2 import PdfFileReader<commit_title>[PATCH 01/11] STY: Fix various style issues (#742)<commit_description><fixed_code>
# -*- coding: utf-8 -*-
import binascii
import os
import sys
import pytest
from PyPDF2 import ... |
<vulnerable_code>import os
import pytest
from PyPDF2 import PdfFileReader, PdfFileWriter
from PyPDF2.utils import PageSizeNotDefinedError
from PyPDF2.generic import RectangleObject
TESTS_ROOT = os.path.abspath(os.path.dirname(__file__))
PROJECT_ROOT = os.path.dirname(TESTS_ROOT)
# Cleanup
os.remove(tmp_filen... |
<vulnerable_code>import os
import pytest
import PyPDF2
TESTS_ROOT = os.path.abspath(os.path.dirname(__file__))
PROJECT_ROOT = os.path.dirname(TESTS_ROOT)
],
)
def test_read_xmp(src, has_xmp):
with open(src, "rb") as inputfile:
ipdf = PyPDF2.PdfFileReader(inputfile)
xmp = ipdf.getXmpMetadata()
... |
<vulnerable_code> return retval
return None
title = property(lambda self: self.getText("/Title"))
"""Read-only property accessing the document's **title**.
Returns a unicode string (``TextStringObject``) or ``None``
if the title is not specified."""<commit_title>[PATCH 01/11] STY: Fi... |
<vulnerable_code>"""
Interface to Bill Hart's Quadratic Sieve
"""
import os
import subprocess as sp
import sage.rings.integer
from sage.cpython.string import bytes_to_str
from sage.misc.temporary_file import tmp_dir
def qsieve(n, block=True, time=False, verbose=False):
r"""
Run Hart's quadratic sieve and r... |
<vulnerable_code> this._handleLocalStreamChangedBound = this._handleLocalStreamChanged.bind(this)
this._handleLocalTrackEnabledChangedBound = this._handleLocalTrackEnabledChanged.bind(this)
this._handleLocalStreamStoppedBound = this._handleLocalStreamStopped.bind(this)
this._handleVolumeChangeBound = this._handleVol... |
<vulnerable_code> });
delete that.staticCSSResources[field.hash];
};
}]);<commit_title>[PATCH] CSRF For personal theme<commit_description><fixed_code>
});
delete that.staticCSSResources[field.hash];
};
this.initVariables = function () {
if (window.PersonalTheme.staticResourc... |
<vulnerable_code>
static int omninet_open(struct tty_struct *tty, struct usb_serial_port *port)
{
struct usb_serial *serial = port->serial;
struct usb_serial_port *wport;
wport = serial->port[1];
tty_port_tty_set(&wport->port, tty);
return usb_serial_generic_open(tty, port);
}
<commit_title>[PATCH] USB: serial: ... |
<vulnerable_code> status=SetImageExtent(image,image->columns,image->rows);
if (status == MagickFalse)
{
InheritException(exception,&image->exception);
return(DestroyImageList(image));
}<commit_title>[PATCH] https://github.com/ImageMagick/ImageMagick/issues/596<commit_description><fixed_code>
st... |
<vulnerable_code> expect(obj.polluted).toBe(undefined)
})
test("#648 assigning object to itself should not change patches", () => {
const input = {
obj: {<commit_title>[PATCH] fix(security): Follow up on CVE-2020-28477 where `path:<commit_description><fixed_code>
expect(obj.polluted).toBe(undefined)
})
test("CVE-... |
<vulnerable_code>// html escaping functions - special case when sending js string to html (see codebase for examples)
// jsText (equivalent to text() )
// jsAttr (equivalent to attr() )
const htmlEscapesText = {
'&': '&',
'<': '<',
'>': '>'
};
const htmlEscapesAttr = {
'&': '&',
'<... |
<vulnerable_code>/* Edge cases - SIZE_MAX
Note: FreeRTOS heap size isn't large enough for SIZE_MAX allocations.
*/
#ifndef IOTC_PLATFORM_IS_FREERTOS
IOTC_TT_TESTCASE(
utest__iotc_memory_calloc__num_1__size_max_minus_1,
{<commit_title>[PATCH] added IOTC_TARGET_FREERTOS definition to builds<commit_description... |
<vulnerable_code>import os
import pexpect
import re
from tempfile import gettempdir
from uuid import uuid4
try:
from collections.abc import Mapping
# setup initial environment
if private_data_dir:
self.private_data_dir = os.path.abspath(private_data_dir)
else:
self.p... |
<vulnerable_code> /* Number of characters read into yy_ch_buf, not including EOB
* characters.
*/
yy_size_t yy_n_chars;
/* Whether we "own" the buffer - i.e., we know we created it,
* and can realloc() it to grow it, and should free() it to
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* Lex... |
<vulnerable_code> String host = url.getHost();
if(presentationDownloadSupportedProtocols.stream().noneMatch(p -> p.equalsIgnoreCase(protocol))) {
log.error("Invalid protocol [{}]", protocol);
return false;
}
if(presentationDownloadBlockedH... |
<vulnerable_code> }
size_change = S_ISREG(inode->i_mode) && attr->ia_valid & ATTR_SIZE;
if (size_change) {
status = ocfs2_rw_lock(inode, 1);
if (status < 0) {
mlog_errno(status);
if (status)
goto bail_unlock;
inode_dio_wait(inode);
if (i_size_read(inode) >= attr->ia_size) {
if (ocfs2_should_order... |
<vulnerable_code>
now = sched_clock_cpu(smp_processor_id());
cfs_b->runtime = cfs_b->quota;
cfs_b->runtime_expires = now + ktime_to_ns(cfs_b->period);
cfs_b->expires_seq++;
}
static inline struct cfs_bandwidth *tg_cfs_bandwidth(struct task_group *tg)
{
struct task_group *tg = cfs_rq->tg;
struct cfs_bandwidth *cf... |
<vulnerable_code><commit_title>[PATCH] [testsuite] Add reproducers for #263<commit_description>This issue got resolved by #180 and #461.<fixed_code>
# -*- coding: utf-8 -*-
import system_tests
class OutOfBoundsReadInPrintStructure(metaclass=system_tests.CaseMeta):
url = "https://github.com/Exiv2/exiv2/issues/26... |
<vulnerable_code> .description("Initializes CodeQL")
.requiredOption("--repository <repository>", "Repository name. (Required)")
.requiredOption("--github-url <url>", "URL of GitHub instance. (Required)")
.requiredOption("--github-auth <auth>", "GitHub Apps token or personal access token. (Required)")
... |
<vulnerable_code> return undefined;
}
exports.apiVersionInRange = apiVersionInRange;
//# sourceMappingURL=util.js.map<commit_title>[PATCH] Add capability to specify auth from env var or stdin<commit_description>This commit adds two new ways of specifying GitHub auth:
1. from the GITHUB_TOKEN environment variable
2.... |
<vulnerable_code>Object.defineProperty(exports, "__esModule", { value: true });
const fs = __importStar(require("fs"));
const os = __importStar(require("os"));
const github = __importStar(require("@actions/github"));
const ava_1 = __importDefault(require("ava"));
const sinon_1 = __importDefault(require("sinon"));
}... |
<vulnerable_code> if (player == "")
return;
cmdline.append(player);
cmdline.append(" \"");
cmdline.append(utils::replace_all(file,"\"", "\\\""));
cmdline.append("\"");
stfl::reset();
utils::run_interactively(cmdline, "pb_controller::play_file");
}<commit_title>[PATCH] Work around shell code in podcast names (#5... |
<vulnerable_code> strftime(lbuf, sizeof(lbuf), "%Y-%b-%d-%H%M%S.unknown", localtime(&t));
fn.append(lbuf);
} else {
fn.append(base);
}
return fn;
}<commit_title>[PATCH] Work around shell code in podcast names (#598)<commit_description><fixed_code>
strftime(lbuf, sizeof(lbuf), "%Y-%b-%d-%H%M%S.unknown", localt... |
<vulnerable_code>
s = &adtkt.cname;
r = adtkt.crealm;
}
_krb5_principalname2krb5_principal(context, &sp, *s, r);<commit_title>[PATCH] kdc: validate sname in TGS-REQ<commit_description>In tgs_build_reply(), validate the server name in the TGS-REQ is present before
dereferencing.<fixed_code>
s = &adtkt.cname... |
<vulnerable_code> item->subtype = subtype;
item->space = space;
free (item->str);
item->str = str ? strdup (str) : NULL;
if (str && !item->str) {
if (!node) { // If we just created this
free (item);
}
return false;
}
R_DIRTY (a);
if (!node) {<commit_title>[PATCH] Fix ANSI Escape Sequence Injection vulns... |
<vulnerable_code> int i = 0;
size_t count;
const ut8 *tmp_buf = NULL;
if (mode == R_MODE_PRINT) {
print (" The Directory Table:\n");
for (i = 0; i < 2; i++) {
while (buf + 1 < buf_end) {
const char *filename = (const char *)buf;
size_t maxlen = R_MIN ((size_t) (buf_end - buf - 1), 0xfff);
ut64 id_idx... |
<vulnerable_code>/* radare - LGPL - Copyright 2008-2021 - pancake */
#include <r_cons.h>
#include <ctype.h>
R_API char *r_cons_hud_file(const char *f) {
char *s = r_file_slurp (f, NULL);
if (s) {
char *ret = r_cons_hud_string (s);
free (s);
return ret;
}
r_str_replace_ch (o, '\r', 0, true);
r_str_replace_ch... |
<vulnerable_code> break;
case '!':
{
char *out;
const char *comment = r_meta_get_string (core->anal, R_META_TYPE_COMMENT, addr);
out = r_core_editor (core, NULL, comment);
if (out) {
//r_meta_set (core->anal->meta, R_META_TYPE_COMMENT, addr, 0, out);
r_core_cmdf (core, "CC-@0x%08"PFMT64x, addr);... |
<vulnerable_code>/* radare - LGPL - Copyright 2009-2022 - pancake */
#include <r_core.h>
#include <limits.h><commit_title>[PATCH] Fix ANSI Escape Sequence Injection vulns via DWARF ##vuln<commit_description>* Reported by @solid-snail via huntrdev
* BountyID: 583133af-7ae6-4a21-beef-a4b0182cf82e
* Reproducer: dwarf_tes... |
<vulnerable_code>}
// remove ansi escape codes from string, decolorizing it
R_API size_t r_str_ansi_strip(char *str) {
size_t i = 0;
while (str[i]) {
size_t chlen = __str_ansi_length (str + i);
if (chlen > 1) {
r_str_cpy (str + i + 1, str + i + chlen);
}
i++;
}
return i;
}<commit_title>[PATCH] Fix ANSI ... |
<vulnerable_code>from marshmallow.validate import Length, Range, OneOf
from vantage6.common.task_status import TaskStatus
class _OnlyIdSchema(Schema):
class RoleInputSchema(Schema):
""" Schema for validating input for creating a role. """
# TODO add check that name cannot be one of default roles
name = ... |
<vulnerable_code> return {'msg': 'Request body is incorrect', 'errors': errors}, \
HTTPStatus.BAD_REQUEST
# check if role name is allowed (i.e. not a default role name)
if 'name' in data and data['name'] in [role for role in DefaultRole]:
return {
... |
<vulnerable_code> flag_2: 1,
},
userId: 12345,
apiURL: given.config.api_host,
...given.toolbarParamsOverrides,
}))
}))
given.subject()
expect(given.toolbar.loadToolbar).toHaveBeenCalledWith({ ...given.toolbarPar... |
<vulnerable_code><commit_title>[PATCH] Add regression test for #790<commit_description><fixed_code>
import system_tests
# Due to an integer overflow bug (#790), this test triggers an 8GB
# memory allocation. So the test will fail with a std::bad_alloc
# exception if less than 8GB is available. On Linux, you can use
... |
<vulnerable_code> '`': '`'
};
var unescapeMap = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
''': "'",
'`': '`'
};
// Functions for escaping and unescaping strings to/from HTML interpolation.
var createEscaper = function (map) {
var escaper = functio... |
<vulnerable_code>int fmt_mtm_load_song(song_t *song, slurp_t *fp, unsigned int lflags)
{
uint8_t b[192];
uint16_t ntrk, nchan, nord, npat, nsmp;
uint16_t comment_len;
int n, pat, chan, smp, rows, todo = 0;
song_note_t *note;
rows = slurp_getc(fp); /* beats per track (translation: number of rows in every pattern) ... |
<vulnerable_code> if (!found) {
encryptedFile.encryptionKey = EncryptionHelper::generateRandom(16);
encryptedFile.encryptedFilename = EncryptionHelper::generateRandomFilename();
encryptedFile.initializationVector = EncryptionHelper::generateRandom(16);
encryptedFile.fileVersion = 1;
encry... |
<vulnerable_code> return idx;
}
/*
* Handle the count before a normal command and set cap->count0.
*/
goto normal_end;
}
if (text_locked() && (nv_cmds[idx].cmd_flags & NV_NCW))
{
// This command is not allowed while editing a cmdline: beep.
clearopbeep(oap);
text_locked_msg();
goto normal_end;
... |
<vulnerable_code> int above = FALSE;
int did_undo = TRUE;
// First make sure the current undoable change is synced.
if (curbuf->b_u_synced == FALSE)
u_sync(TRUE);<commit_title>[PATCH] patch 8.2.5023: substitute overwrites allocated buffer<commit_description>Problem: Substitute overwrites a... |
<vulnerable_code>
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
5022,
/**/<commit_title>[PATCH] patch 8.2.5023: substitute overwrites allocated buffer<commit_description>Problem: Substitute overwrites allocated buffer.
Solution: Disallow undo when in a substitute command.<... |
<vulnerable_code> const attachment = this._getAttachment(placement)
this.addAttachmentClass(attachment)
const container = this.config.container === false ? document.body : $(this.config.container)
$(tip).data(this.constructor.DATA_KEY, this)
<commit_title>[PATCH] fix(tooltip): xss in co... |
<vulnerable_code> prism2_pkthdr hdr;
/* get the fields */
hdr.host_time = EXTRACT_LE_32BITS(pc+32);
hdr.mac_time = EXTRACT_LE_32BITS(pc+44);
hdr.channel = EXTRACT_LE_32BITS(pc+56);
hdr.rssi = EXTRACT_LE_32BITS(pc+68);
hdr.sq = EXTRACT_LE_32BITS(pc+80);
hdr.signal = EXTRACT_LE_32... |
<vulnerable_code> @Override
public void onActivityPaused(@NonNull Activity activity) {
Log_OC.d(activity.getClass().getSimpleName(), "onPause() ending");
passCodeManager.onActivityPaused(activity);
}
@Override<commit_title>[PATCH] PassCodeM... |
<vulnerable_code>import com.nextcloud.client.preferences.AppPreferences;
import com.nextcloud.client.preferences.AppPreferencesImpl;
import com.owncloud.android.MainApp;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.activity.PassCodeActivity;
import com.owncloud.android.ui.activity... |
<vulnerable_code> private final CounterStatistic loggedInUsers = new CounterStatistic();
private long _idTokenExpiry = 10000;
public static void main(String[] args) throws Exception
{
String clientId = "CLIENT_ID123";<commit_title>[PATCH] fix checkstyle error<commit_description>Signed-off-by: L... |
<vulnerable_code>static void validate_dex_header(const dex_header* dh,
size_t dexsize,
int support_dex_version) {
bool supported = false;
switch (support_dex_version) {
case 38:
"Reported size in header (%zu) does not match file size (%u)\n",
... |
<vulnerable_code> {
_af_error(AF_BAD_NOT_IMPLEMENTED,
"IMA ADPCM compression supports only 4 bits per sample");
}
int bytesPerBlock = (samplesPerBlock + 14) / 8 * 4 * channelCount;
{
_af_error(AF_BAD_CODEC_CONFIG,
"Invalid samples per block for IMA ADPCM compression");
}
track->f.sa... |
<vulnerable_code> {
if (LOG.isDebugEnabled())
LOG.debug("auth revoked {}", authentication);
synchronized (session)
{
session.removeAttribute(SessionAuthentication.__J_AUTHENTICATED);
... |
<vulnerable_code>import java.io.File;
import java.io.IOException;
import java.security.Principal;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.... |
<vulnerable_code> offset = offset_in_page(uaddr);
for (j = cur_page; j < page_limit; j++) {
unsigned int bytes = PAGE_SIZE - offset;
if (len <= 0)
break;
bytes)
break;
len -= bytes;
offset = 0;
}<commit_title>[PATCH] fix unbalanced page refcounting in bio_map_user_iov<commit_descript... |
<vulnerable_code>// make executable the runnable extensions
$(".navigrid-item-buttonset[run='1'],.navigrid-item-buttonset[run='true']").parent().on("dblclick", function()
{
// is this extension enabled?
if($(this).find(".navigrid-item-buttonset").attr("enabled")=="0")
return;
var extension = $(this... |
<vulnerable_code> e.stopPropagation();
e.preventDefault();
$("#theme-upload-button").parent().find("form").remove();
$("#theme-upload-button").after('<form action="?fid=themes&act=theme_upload" enctype="multipart/form-data" method="post"><input type="file" name="theme-upload" style=" disp... |
<vulnerable_code>
import pytest
from PIL import Image, ImageFile, TiffImagePlugin
from PIL.TiffImagePlugin import RESOLUTION_UNIT, X_RESOLUTION, Y_RESOLUTION
from .helper import (
im.load()
ImageFile.LOAD_TRUNCATED_IMAGES = False
@pytest.mark.skipif(not is_win32(), reason="Windows only")
cla... |
<vulnerable_code> (MM, 8, (1,), 1, (8, 8, 8), ()): ("LAB", "LAB"),
}
PREFIXES = [
b"MM\x00\x2A", # Valid TIFF header with big-endian byte order
b"II\x2A\x00", # Valid TIFF header with little-endian byte order
SAMPLESPERPIXEL,
3 if self._compression == "tiff_jpeg" and photo in (2, 6... |
<vulnerable_code> while (c)
{
len++;
if (len > maxlen)
return 0;
b += 2;
c = (b[0] << 8) + b[1];
# endif
{
BITCODE_TU c = wstr;
while (*c++)
{
len++;
if (len > maxlen)
return 0;
}
return len;
}
#endi... |
<vulnerable_code> "description": "Tooltip which is shown for this element",
"translate": true
},
"align": {
"name": "Align",
"type": "string",
if (_value && _value != '')
{
this.egw().tooltipBind(elem, _value);
this._tooltipElem = elem;
}
}<commit_title>[PATCH] Set statustext value as... |
<vulnerable_code> * Creates the tooltip_div with the given text.
*
* @param {string} _html
*/
function prepare(_html)
{
// Free and null the old tooltip_div
hide();
//Generate the tooltip div, set it's text and append it to the body tag
tooltip_div = jQuery(_wnd.document.createElement('div'));
toolti... |
<vulnerable_code> // Tooltip
if(!event._tooltipElem)
{
event.set_statustext(event._tooltip());
return event.div.trigger('mouseenter');
}
{
parent._out_of_view();
}
// This should now cease to exist, as new events have been created
this.free();
return;
'<span class="ca... |
<vulnerable_code>/* ====== PUBLIC FUNCTION DEFINITIONS ====== */
void gnrc_sixlowpan_frag_sfr_init(void)
{
if (gnrc_sixlowpan_frag_sfr_congure_snd_has_inter_frame_gap()) {
for (unsigned i = 0; i < FRAME_QUEUE_POOL_SIZE; i++) {
clist_rpush(&_frame_queue_free, &_frame_queue_pool[i].super);
... |
<vulnerable_code> algorithms.Hash(hash_alg),
ima_keyrings,
mb_measurement_list,
agent['mb_refstate'])
failure.merge(quote_validation_failure)
if not failure:<commit_title>[PATCH] tpm: do not compress quote with zlib by default<commit_description>Pythons zlib decompression has no ... |
<vulnerable_code> logger.warning("AIK not found in registrar, quote not validated")
return False
failure = self.tpm_instance.check_quote(AgentAttestState(self.agent_uuid), self.nonce, public_key, quote, self.registrar_data['aik_tpm'], hash_alg=hash_alg)
if failure:
if... |
<vulnerable_code>
# tpm_quote
@abstractmethod
def create_quote(self, nonce, data=None, pcrmask=EMPTYMASK, hash_alg=None):
pass
@abstractmethod
def check_quote(self, agentAttestState, nonce, data, quote, aikTpmFromRegistrar, tpm_policy={}, ima_measurement_list=None, allowlist={}, hash_alg=No... |
<vulnerable_code> pcr_list.append(str(pcr))
return ",".join(pcr_list)
def create_quote(self, nonce, data=None, pcrmask=tpm_abstract.AbstractTPM.EMPTYMASK, hash_alg=None):
if hash_alg is None:
hash_alg = self.defaults['hash']
command = ["tpm2_quote", "... |
<vulnerable_code> throw new TypeError('option secretLength must be finite number > 1')
}
var validity = opts.validity !== undefined
? opts.validity
: 0
<commit_title>[PATCH 1/3] Update index.js<commit_description>Co-authored-by: James Sumners <james@sumners.email><fixed_code>
throw new TypeError('op... |
<vulnerable_code>
if (this.userInfo) {
if (typeof userInfo !== 'string') {
throw new TypeError('argument userInfo is required')
}
}
<commit_title>[PATCH 1/3] Update index.js<commit_description>Co-authored-by: James Sumners <james@sumners.email><fixed_code>
if (this.userInfo) {
if (typeof userIn... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.