text
stringlengths
79
3.72M
<vulnerable_code> import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import org.postgresql.test.TestUtil; import org.postgresql.test.jdbc2.BaseTest4; import org.junit.Before; import org.junit.Test; import java.io.Writer; import java.s...
<vulnerable_code> new TextEncoder().encode(btoa(JSON.stringify(encryptedPayload))) ) const encryptedKey = await encryptStringAsymmetric( publicKey, new TextEncoder().encode(bufferToBase64(await window.crypto.subtle.exportKey('raw', encryptedEncryptionParams.key))), ) return {<commit_title>[PATCH] Add logs<co...
<vulnerable_code> afi = packet->afi; safi = packet->safi; if (packet->length >= FLOWSPEC_NLRI_SIZELIMIT_EXTENDED) { flog_err(EC_BGP_FLOWSPEC_PACKET, "BGP flowspec nlri length maximum reached (%u)",<commit_title>[PATCH] bgpd: Limit flowspec to no attribute means a implicit<commit_description><fixed_code> afi =...
<vulnerable_code> DEFAULT_PREFIX = "http://example.org/kb/" # Shortcut syntax for defining an immutable named tuple is noted here: # https://docs.python.org/3/library/typing.html#typing.NamedTuple # via the "See also" box here: https://docs.python.org/3/library/collections.html#collections.namedtuple<commit_title>[PAT...
<vulnerable_code>util.setProperty = function setProperty(dst, path, value) { function setProp(dst, path, value) { var part = path.shift(); if (path.length > 0) { dst[part] = setProp(dst[part] || {}, path, value); } else {<commit_title>[PATCH] fix: do not let setProperty change th...
<vulnerable_code> return 0; found: op->tas.type_attrs = op1->tas.type_attrs; op->value.bytes = ptr; r_set_size(op, size); push(2); op[-1] = *op1; r_set_size(op - 1, ptr - op[-1].value.bytes); op1->value.bytes = ptr + size; r_set_size(op1, count + (!forward ? (size - 1) : 0)); make...
<vulnerable_code>from posthog.api.shared import OrganizationBasicSerializer, TeamBasicSerializer from posthog.api.utils import raise_if_user_provided_url_unsafe from posthog.auth import authenticate_secondarily from posthog.cloud_utils import is_cloud from posthog.email import is_email_available from posthog.event_usag...
<vulnerable_code><commit_title>[PATCH] Add sanitize template option for tooltip/popover plugins.<commit_description><fixed_code> /** * -------------------------------------------------------------------------- * Bootstrap (v4.3.0): tools/sanitizer.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/maste...
<vulnerable_code> * -------------------------------------------------------------------------- */ import $ from 'jquery' import Popper from 'popper.js' import Util from './util' * ------------------------------------------------------------------------ */ const NAME = 'tooltip' const VERSION ...
<vulnerable_code> assert.strictEqual(offset.offset, myOffset) assert.ok(typeof offset.fn === 'undefined') }) })<commit_title>[PATCH] Add sanitize template option for tooltip/popover plugins.<commit_description><fixed_code> assert.strictEqual(offset.offset, myOffset) assert.ok(typeof offset.fn === 'unde...
<vulnerable_code>import java.util.logging.SimpleFormatter; import java.util.regex.Pattern; import org.apache.commons.lang.StringUtils; /** * Utility functions used in views. return c.getValue(); } /** * Gets the suffix to use for YUI JavaScript. */<commit_title>[PATCH] [FIXED SECURITY-77] X...
<vulnerable_code> { StaplerRequest req = Stapler.getCurrentRequest(); iconSize = req != null ? Functions.getCookie(req, "iconSize", "32x32") : "32x32"; } @Override protected void compute() throws Exception {<commit_title>[PATCH] [FIXED SECURITY-77] XSS in iconSize cookie...
<vulnerable_code>import static java.util.logging.Level.SEVERE; import java.util.logging.LogRecord; import java.util.logging.Logger; import java.util.regex.Pattern; import javax.annotation.CheckForNull; import javax.annotation.Nonnull; import javax.annotation.Nullable; */ public void doIconSize( StaplerRequest ...
<vulnerable_code> return DLT_RETURN_WRONG_PARAMETER; /* check if message is in range */ if (index >= file->counter) { dlt_vlog(LOG_WARNING, "Message %d out of range!\r\n", index); return DLT_RETURN_WRONG_PARAMETER; }<commit_title>[PATCH] Check for negative index in dlt_file_message<c...
<vulnerable_code> } } static size_t read_entry( git_index_entry **out, git_index *index, const void *buffer, size_t buffer_size, char *tmp_path = NULL; if (INDEX_FOOTER_SIZE + minimal_entry_size > buffer_size) return 0; /* buffer is not guaranteed to be aligned */ memcpy(&source, buffer, sizeof(struct entr...
<vulnerable_code> struct branch *b = insnbuf; unsigned long delta = (unsigned long)target - (addr+5); if (tgt_clobbers & ~site_clobbers) return len; /* target would clobber too much for this site */ if (len < 5) return len; /* call too long for patch site */ b->opcode = 0xe8; /* call */ b->delta = delta; st...
<vulnerable_code> stderr=subprocess.STDOUT, ) if checkout is not None: subprocess.check_output( # nosec [repo_type, 'checkout', checkout], cwd=repo_dir, stderr=subprocess.STDOUT, ) ...
<vulnerable_code> mock_subprocess.assert_any_call( [repo_type, 'clone', repo_url], cwd=str(clone_dir), stderr=subprocess.STDOUT ) mock_subprocess.assert_any_call( [repo_type, 'checkout', branch], cwd=expected_repo_dir, stderr=subprocess.STDOUT ) vcs.clone(repository_url, clone_t...
<vulnerable_code> branch_info.insert(0, "--") mock_subprocess.assert_any_call( [repo_type, 'checkout', *branch_info], cwd=expected_repo_dir, stderr=subprocess.STDOUT ) <commit_title>[PATCH 1/2] Sanitize Mercurial branch information before checkout.<commit_description><fixed_code> branch...
<vulnerable_code> if (!baud) { /* pick a default, any default... */ baud = 9600; } else tty_encode_baud_rate(tty, baud, baud); edge_port->baud_rate = baud; config->wBaudRate = (__u16)((461550L + baud/2) / baud);<commit_title>[PATCH] USB: serial: io_ti: fix div-by-zero in set_termios<commit_description>Fix a d...
<vulnerable_code> VALID_URL_PATTERN = "^https:\/\/[0-9A-z.]+.[0-9A-z.]+.[a-z]+\/.*\.json$" class JSONLoader(BaseLoader): @staticmethod def load_data(content): """Load a json file. Each data point is a key value pair.""" JSONLoader._check_content(content) loader = JSONReader() <commit...
<vulnerable_code>static inline uint32_t zigzag32(int32_t v) { // Note: the right-shift must be arithmetic // Note: left shift must be unsigned because of overflow return ((uint32_t)(v) << 1) ^ (uint32_t)(v >> 31); } /** static inline uint64_t zigzag64(int64_t v) { // Note: the right-shift must be arithmetic //...
<vulnerable_code> 'src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc', 'src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc', 'src/core/ext/filters/client_channel/retry_filter.cc', 'src/core/ext/filters/client_channel/retry_service_config.cc', 'src/core/ext/filte...
<vulnerable_code>// TODO: fold this into bootstrap static void setup_private_mount(const char *snap_name) { uid_t uid = getuid(); gid_t gid = getgid(); char tmpdir[MAX_BUF] = { 0 }; // Create a 0700 base directory, this is the base dir that is // MS_PRIVATE needs linux > 2.6.11 sc_do_mount("none", "/tmp", NULL, ...
<vulnerable_code> data.data = JSON.stringify(draft); } ajax("/chat/drafts", { type: "POST", data, ignoreUnsent: false }) .then(() => { this.markNetworkAsReliable(); }) .catch((error) => { if (!error.jqXHR?.responseJSON?.errors?.length) { this.markNetworkAsUnreli...
<vulnerable_code>import logging import cherrypy from . import Controller, BaseController, Endpoint, ENDPOINT_MAP, \ allow_empty_body from .. import mgr from ..tools import str_to_bool def api_all_json(self): return self._gen_spec(True, "/") def _swagger_ui_page(self, all_endpoints=False, token=No...
<vulnerable_code> }); it('does log on invalid APNS notification', async () => { let args = { cert: new Buffer('testCert'), key: new Buffer('testKey'), production: true,<commit_title>[PATCH] refactor<commit_description><fixed_code> }); it('does log on invalid APNS notification', async () =...
<vulnerable_code> it('does log on invalid APNS notification', async () => { const log = require('npmlog'); const spy = spyOn(log, 'warn'); var args = { apiKey: 'apiKey' }; const gcm = new GCM(args); gcm.send(); expect(spy).toHaveBeenCalled(); });<commit_title>[PATCH] refactor<commit...
<vulnerable_code> factory.setValidating(false); factory.setNamespaceAware(true); final CapturingErrorHandler errorHandler = new CapturingErrorHandler(); try { final DocumentBuilder builder = factory.newDocumentBuilder();<commit_title>[PATCH] NMS-15704: Securing Xml parser fac...
<vulnerable_code> return ext; default: return file[$1] || ''; } }); });<commit_title>[PATCH] fixed another case of html entities not being encoded<commit_description><fixed_code> return ext; default: return plupload.xmlEncode(file[$1] || ''); } }); });
<vulnerable_code>!function(e,t,i,s,n){function l(e){return i.translate(e)||e}function o(e){e.id=e.attr("id"),e.html('<div class="plupload_wrapper"><div class="ui-widget-content plupload_container"><div class="ui-state-default ui-widget-header plupload_header"><div class="plupload_header_content"><div class="plupload_lo...
<vulnerable_code>o.files=[],n.each(e,function(e){o.files.push(new t(a.uid,e))})},999),a.shimExec.call(this,"FileInput","init",r(e.accept),e.multiple),this.trigger("ready")},setOption:function(e,t){"accept"==e&&(t=r(t)),this.getRuntime().shimExec.call(this,"FileInput","setOption",e,t)}};return e.FileInput=o}),n("moxie/r...
<vulnerable_code> ThrowReaderException(CorruptImageError,"FileFormatVersionMismatch"); if (header.header_size < sz_XWDheader) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); switch (header.visual_class) { case StaticGray: entry->encoder=(EncodeImageHandler *) WriteXWDImage; #endif en...
<vulnerable_code> else if (ds->codec_id == GF_CODECID_AVC || ds->codec_id == GF_CODECID_SVC || ds->codec_id == GF_CODECID_MVC) { AVCState avc; GF_AVCConfig* avccfg = gf_odf_avc_cfg_read(dsi->value.data.ptr, dsi->value.data.size); GF_NALUFFParam *sl = (GF_NALUFFParam *)gf_list_get(avccfg->sequenceParameter...
<vulnerable_code><commit_title>[PATCH] Fix the issue that uploaded file can be stored anywhere<commit_description><fixed_code> package io.onedev.server.util; public class FilenameUtils extends org.apache.commons.io.FilenameUtils { public static String sanitizeFilename(String fileName) { return fileName.replace(".....
<vulnerable_code>import io.onedev.server.git.BlobIdentFilter; import io.onedev.server.git.exception.GitException; import io.onedev.server.model.Project; import io.onedev.server.util.UrlUtils; import io.onedev.server.web.ajaxlistener.ConfirmClickListener; import io.onedev.server.web.behavior.ReferenceInputBehavior; ...
<vulnerable_code>import io.onedev.server.model.Project; import io.onedev.server.model.PullRequest; import io.onedev.server.model.User; import io.onedev.server.util.markdown.MarkdownManager; import io.onedev.server.util.validation.ProjectNameValidator; import io.onedev.server.web.avatar.AvatarManager; HttpServletReq...
<vulnerable_code>import io.onedev.server.search.code.query.BlobQuery; import io.onedev.server.search.code.query.TextQuery; import io.onedev.server.security.SecurityUtils; import io.onedev.server.util.script.identity.JobIdentity; import io.onedev.server.util.script.identity.ScriptIdentity; import io.onedev.server.util.s...
<vulnerable_code> if (LIKELY(needByteCodeGeneration)) { try { #if defined(ENABLE_CODE_CACHE) // Store cache if (cacheable) { codeCache->prepareCacheWriting(srcHash);<commit_title>[PATCH] Fix bug with top-level-await with class variable init<commit_description>* Prevent...
<vulnerable_code>{ } class ExecutionPauserExecutionStateParentBinder { public: ExecutionPauserExecutionStateParentBinder(ExecutionState& state, ExecutionState* originalState) : m_originalState(originalState) { m_oldParent = m_originalState->parent(); ExecutionState* pstate = m_origina...
<vulnerable_code> auto env = state->lexicalEnvironment(); auto record = env->record(); if (record->isGlobalEnvironmentRecord() || record->isModuleEnvironmentRecord()) { return state->hasRareData() && state->rareData()->m_pauseSource; } else if (record->isDe...
<vulnerable_code>from __future__ import with_statement __author__ = 'Marcel Hellkamp' __version__ = '0.12.10' __license__ = 'MIT' # The gevent server adapter needs to patch some modules before they are imported<commit_title>[PATCH] Release of 0.12.11<commit_description>* fix #913: redirect() doesn't filter "\r\n" lea...
<vulnerable_code>'use strict'; module.exports = function(grunt) { // Project configuration. grunt.initConfig({ eslint: {<commit_title>[PATCH] v6.4.16<commit_description><fixed_code> 'use strict'; module.exports = function (grunt) { // Project configuration. grunt.initConfig({ eslint: {
<vulnerable_code> return lines .filter(line => line.trim()) .map(line => ({ key: line .substr(0, line.indexOf(':')) .trim() .toLowerCase(), line })); }<commit_title>[PATCH] v6.4.16<...
<vulnerable_code> .split(';') .forEach(cookiePart => { let valueParts = cookiePart.split('='); let key = valueParts .shift() .trim() .toLowerCase(); let value = valueParts.join('=').trim();...
<vulnerable_code> const MAX_REDIRECTS = 5; module.exports = function(url, options) { return fetch(url, options); }; let fetchRes = options.fetchRes; let parsed = urllib.parse(url); let method = (options.method || '') .toString() .trim() .toUpperCase() || 'G...
<vulnerable_code> if (this.data.attachments && this.data.attachments.length) { this.data.attachments.forEach((attachment, i) => { if (!attachment.filename) { attachment.filename = (attachment.path || attachment.href || '') ...
<vulnerable_code> } let parsed = path.parse(filename); let extension = (parsed.ext.substr(1) || parsed.name || '') .split('?') .shift() .trim() .toLowerCase(); let value = defaultMimeType; if (extensions.has(extension)) { i...
<vulnerable_code> const ETHEREAL_API = (process.env.ETHEREAL_API || 'https://api.nodemailer.com').replace(/\/+$/, ''); const ETHEREAL_WEB = (process.env.ETHEREAL_WEB || 'https://ethereal.email').replace(/\/+$/, ''); const ETHEREAL_CACHE = ['true', 'yes', 'y', '1'].includes( (process.env.ETHEREAL_CACHE || 'yes') ...
<vulnerable_code> let returned; let transform; if (this.args) { // force -i to keep single dots args = ['-i'].concat(this.args).concat(envelope.to);<commit_title>[PATCH] v6.4.16<commit_description><fixed_code> let returned; let transform; const ha...
<vulnerable_code> * @param {Function} reject Function to run if callback ends with an error */ module.exports.callbackPromise = (resolve, reject) => function() { let args = Array.from(arguments); let err = args.shift(); if (err) { /** * Copies properties from source objects to target objec...
<vulnerable_code> // Error harness for initial connection. Once connection is established, the responsibility // to handle errors is passed to whoever uses this socket let finished = false; let tempSocketErr = function(err) { if (finished) { return; }<commit_title>[PATCH] v6.4...
<vulnerable_code> constructor(options) { super(options); this.id = crypto .randomBytes(8) .toString('base64') .replace(/\W/g, ''); this.stage = 'init'; this.options = options || {}; this.customAuth = new Map(); Object.keys(this.op...
<vulnerable_code> * @param {String} key [description] * @returns {Object} SMTP config or false if not found */ module.exports = function(key) { key = normalizeKey(key.split('@').pop()); return normalized[key] || false; };<commit_title>[PATCH] v6.4.16<commit_description><fixed_code> * @param {String} key [des...
<vulnerable_code> if (data.error) { // Error Response : https://tools.ietf.org/html/rfc6749#section-5.2 let errorMessage = data.error; if(data.error_description) { errorMessage += ': ' + data.error_description; } ...
<vulnerable_code> chai.config.includeStack = true; describe('Base64 Tests', function() { let encodeFixtures = [ ['abcd= ÕÄÖÜ', 'YWJjZD0gw5XDhMOWw5w='], ['foo bar ', 'Zm9vIGJhciAg'], 'MTIzNDU2N\r\nzg5MDEyMz\r\nQ1Njc4ICA\r\n5MA0Kw7XD\r\npMO2w7zDt\r\ncOkw7bDvM\r\nO1w6TDtsO\r\n8w7XDpMO2\r\nw7z...
<vulnerable_code>-----END PUBLIC KEY-----`; */ describe('DKIM Tests', function() { this.timeout(100 * 1000); // eslint-disable-line it('should sign message', function(done) { let message = `From: saatja aadress To: Saaja aadress Subject: pealkiri writeNext(); }); it('should sign large...
<vulnerable_code> chai.config.includeStack = true; describe('DKIM MessageParser Tests', function() { it('should extract header and body', function(done) { let parser = new MessageParser(); let message = `From: saatja aadress To: Saaja aadress<commit_title>[PATCH] v6.4.16<commit_description><fixed_c...
<vulnerable_code> chai.config.includeStack = true; describe('DKIM RelaxedBody Tests', function() { it('Should calculate body hash byte by byte', function(done) { fs.readFile(__dirname + '/fixtures/message1.eml', 'utf-8', (err, message) => { expect(err).to.not.exist; }); }); it...
<vulnerable_code>-----END PUBLIC KEY-----`; */ describe('DKIM Sign Tests', function() { it('should create relaxed headers', function() { let headerLines = [ { key: 'a', }); }); it('should skip specific headers', function() { let headerLines = [ ...
<vulnerable_code>const expect = chai.expect; chai.config.includeStack = true; describe('Ethereal Tests', function() { this.timeout(50 * 1000); // eslint-disable-line no-invalid-this it('should create an account and send a message', function(done) { // Generate SMTP service account from ethereal.email ...
<vulnerable_code> chai.config.includeStack = true; describe('Cookie Tests', function() { let biskviit; beforeEach(function() { biskviit = new Cookies(); }); describe('#getPath', function() { it('should return root path', function() { expect(biskviit.getPath('/')).to.equal(...
<vulnerable_code> '-----END CERTIFICATE-----' }; describe('Fetch Tests', function() { let httpServer, httpsServer; beforeEach(function(done) { httpServer = http.createServer(function(req, res) { switch (req.url) { case '/redirect6': res.writeHead(...
<vulnerable_code>const expect = chai.expect; chai.config.includeStack = true; describe('JSON Transport Tests', function() { it('should return an JSON string', function(done) { let transport = nodemailer.createTransport({ jsonTransport: true }); }); }); it('should return...
<vulnerable_code> chai.config.includeStack = true; describe('Quoted-Printable Tests', function() { let encodeFixtures = [ ['abcd= ÕÄÖÜ', 'abcd=3D =C3=95=C3=84=C3=96=C3=9C'], ['foo bar ', 'foo bar =20'], '12345678=\r\n90123456=\r\n78=20=20=\r\n90\r\n=C3=B5=\r\n=C3=A4=\r\n=C3=B6=\r\n=C3=BC=\...
<vulnerable_code> chai.config.includeStack = true; describe('Sendmail Unix Newlines', function() { it('should rewrite all linebreaks (byte by byte)', function(done) { let source = 'tere tere\nteine rida\nkolmas rida\r\nneljas rida\r\nviies rida\n kuues rida'; let chunks = []; setImmediate(...
<vulnerable_code> } } describe('Sendmail Transport Tests', function() { it('Should expose version number', function() { let client = new SendmailTransport(); expect(client.name).to.exist; expect(client.version).to.exist; }); it('Should send message', function(done) { let...
<vulnerable_code>TweUw+zMVdSXjO+FCPcYNi6CP1t1KoESzGKBVoqA/g== -----END RSA PRIVATE KEY-----`; describe('SES Transport Tests', function() { this.timeout(50 * 1000); // eslint-disable-line no-invalid-this it('should return MessageId', function(done) { let transport = nodemailer.createTransport({ ...
<vulnerable_code> chai.config.includeStack = true; describe('Shared Funcs Tests', function() { describe('Logger tests', function() { it('Should create a logger', function() { expect( typeof shared.getLogger({ logger: false }); }); describe('C...
<vulnerable_code>const PROXY_PORT = 3128; const TARGET_PORT = 3129; describe('HTTP Proxy Client Tests', function() { it('should connect to a socket through proxy', function(done) { let smtpServer = new SMTPServer({ logger: false }); }); }); }); it('should con...
<vulnerable_code>let LMTP_PORT_NUMBER = 8396; let XOAUTH_PORT = 8497; describe('SMTP-Connection Tests', function() { describe('Version test', function() { it('Should expose version number', function() { let client = new SMTPConnection(); expect(client.version).to.equal(packageData.v...
<vulnerable_code>const crypto = require('crypto'); const querystring = require('querystring'); module.exports = function(options) { return new OAuthServer(options); }; this.options.expiresIn = Number(this.options.expiresIn) || 3600; } OAuthServer.prototype.addUser = function(username, refreshToken) { let...
<vulnerable_code> } } describe('SMTP Pool Tests', function() { this.timeout(100 * 1000); //eslint-disable-line no-invalid-this let server; beforeEach(function(done) { server = new SMTPServer({ authMethods: ['PLAIN', 'XOAUTH2'], disabledCommands: ['STARTTLS'], ...
<vulnerable_code> } } describe('SMTP Transport Tests', function() { this.timeout(10000); // eslint-disable-line no-invalid-this describe('Anonymous sender tests', function() { let server, failingServer; beforeEach(function(done) { server = new SMTPServer({ disab...
<vulnerable_code> } } describe('Stream Transport Tests', function() { this.timeout(10000); // eslint-disable-line no-invalid-this it('Should expose version number', function() { let client = new StreamTransport(); expect(client.name).to.exist; expect(client.version).to.exist; })...
<vulnerable_code> chai.config.includeStack = true; describe('Well-Known Services Tests', function() { describe('#wellKnown', function() { it('Should find by key', function() { expect(wellKnown('Gmail')).to.deep.equal({ host: 'smtp.gmail.com', port: 465, ...
<vulnerable_code> chai.config.includeStack = true; describe('XOAuth2 tests', function() { this.timeout(10000); let server; let users = {}; let XOAUTH_PORT = 8993; beforeEach(function(done) { server = mockServer({ port: XOAUTH_PORT, onUpdate: function(username, acce...
<vulnerable_code> std::ostringstream os; // #1114 - show negative values for SByte if (md.typeId() == Exiv2::signedByte) { for ( int c = 0 ; c < md.value().count() ; c++ ) { int value = md.value().toLong(c); os << (c?" ":"") << s...
<vulnerable_code> // find $right findDiff = false; blockIndex = nBlocks - 1; blockSize = p_->blocksMap_[blockIndex].getSize(); while ((blockIndex + 1 > 0) && right < src.size() && !findDiff) { if(src.seek(-1 * (blockSize + right), BasicIo::end)) { ...
<vulnerable_code> Exiv2::ExifData::iterator pos = exifData_->findKey(ExifKey(from)); if (pos == exifData_->end()) return; if (!prepareXmpTarget(to)) return; for (int i = 0; i < pos->count(); ++i) { std::string value = pos->toString(i); if (!pos->value().ok()) { #if...
<vulnerable_code> long sumToLong(const Exiv2::Exifdatum& md) { long sum = 0; for (int i = 0; i < md.count(); ++i) { sum += md.toLong(i); } return sum;<commit_title>[PATCH] Defensive coding changes to avoid integer overflow in loop<commit_description><fixed_code> lo...
<vulnerable_code> std::string parseEscapes(const std::string& input) { std::string result = ""; for (unsigned int i = 0; i < input.length(); ++i) { char ch = input[i]; if (ch != '\\') { result.push_back(ch); result.push_back('\t'); ...
<vulnerable_code>#include "iptc.hpp" #include "types.hpp" #include "error.hpp" #include "value.hpp" #include "datasets.hpp" #include "jpgimage.hpp" void IptcData::printStructure(std::ostream& out, const Slice<byte*>& bytes, uint32_t depth) { uint32_t i = 0; while (i < bytes.size() - 3 && bytes....
<vulnerable_code> enforce(size_ <= static_cast<uint32_t>(io.size()), kerCorruptedMetadata); DataBuf buf(size_); uint32_t idxBuf = 0; for (int i = 0; i < sizes.count(); i++) { uint32_t offset = dataValue.toLong(i); ...
<vulnerable_code> #include "convert.hpp" #include "error.hpp" #include "i18n.h" // NLS support. #include "canonmn_int.hpp" { uint16_t bit = 0; uint16_t comma = 0; for (uint16_t i = 0; i < value.count(); i++ ) { // for each element in value array ...
<vulnerable_code> return; } uint32_t size = 0; for (int i = 0; i < pSize->count(); ++i) { size += static_cast<uint32_t>(pSize->toLong(i)); } uint32_t offset = static_cast<uint32_t>(pValue()->toLong(0)); #endif return; } for (int ...
<vulnerable_code> // create vector of signedShorts from unsignedShorts in Exif.Canon.AFInfo std::vector<int16_t> ints; std::vector<uint16_t> uint; for (int i = 0; i < object->pValue()->count(); i++) { ints.push_back((int16_t) object->pValue()->toLong(i)); uint.pus...
<vulnerable_code> bool stringTo<bool>(const std::string& s, bool& ok) { std::string lcs(s); /* lowercase string */ for(unsigned i = 0; i < lcs.length(); i++) { lcs[i] = std::tolower(s[i]); } /* handle the same values as xmp sdk */<commit_title>[PATCH] Defensive coding ...
<vulnerable_code> || i->typeId() == xmpAlt) { printNode(ns, i->tagName(), "", options); meta.SetProperty(ns.c_str(), i->tagName().c_str(), 0, options); for (int idx = 0; idx < i->count(); ++idx) { const std::string item = i->tagName() + ...
<vulnerable_code> std::string head(reinterpret_cast<const char*>(buf + start), len - start); if (head.substr(0, 5) == "<?xml") { // Forward to the next tag for (unsigned i = 5; i < head.size(); ++i) { if (head[i] == '<') { head = head.substr(i)...
<vulnerable_code> } public void downloadBundle(String filename, OutputStream outputStream) throws IOException { ensureFileWithinBundleDir(filename); try { final Path filePath = bundleDir.resolve(filename); } } private void ensureFileWithinBundleDir(String filename) ...
<vulnerable_code>import org.graylog2.shared.bindings.providers.ObjectMapperProvider; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import java.nio.file.Path; import java.t...
<vulnerable_code> // MARK: Huffman decoding static void ok_jpg_generate_huffman_table(ok_jpg_huffman_table *huff, const uint8_t *bits) { // JPEG spec: "Generate_size_table" int k = 0; for (uint8_t i = 1; i <= 16; i++) { for (int j = 1; j <= bits[i]; j++) { huff->size[k++] = i; }...
<vulnerable_code>#include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h" #include "mlir/IR/BuiltinOps.h" #include "mlir/Transforms/DialectConversion.h" using namespace mlir; SmallVector<Type, 8> returnTypes; for (auto result : ifOp.getResults()) { auto convertedType = typeConverter.convertType(result.getTy...
<vulnerable_code> SQL_NODE_INIT (delete_node_t, del, delete_node_input, del_free); if (tb && !sec_tb_check (tb, SC_G_ID (sc), SC_U_ID (sc), GR_DELETE)) sqlc_new_error (sc->sc_cc, "43000", "SQ108:SECURITY", "Permission denied for delete from %.300s (user ID = %lu)", tb->tb_name, SC_U_ID (sc)); del->de...
<vulnerable_code> test.strictSame(error.constructor.name === 'TypeError', true); } sheet.cells['A1'] = '=Object.constructor.constructor("console.log(\\"Hello, World!\\")")();'; try {<commit_title>[PATCH] fixup! Improve tests for security<commit_description><fixed_code> test.strictSame(error.constructo...
<vulnerable_code> ) { obj = []; obj[index] = leaf; } else { obj[cleanRoot] = leaf; } }<commit_title>[PATCH] [Fix] `parse`: ignore `__proto__` keys<commit_description><fixed_code> ) { obj = []; ...
<vulnerable_code> st.end(); }); t.test('can return null objects', { skip: !Object.create }, function (st) { var expected = Object.create(null); expected.a = Object.create(null);<commit_title>[PATCH] [Fix] `parse`: ignore `__proto__` keys<commit_description><fixed_code> st.end(); ...
<vulnerable_code> tar_info.mtime = 0 return tar_info if custom_filter is None else custom_filter(tar_info) unzipped_filename = tempfile.mktemp() try: with tarfile.open(unzipped_filename, "w") as tar: tar.add(source_dir, arcname=archive_name, filter=_filter_timestamps) ...
<vulnerable_code> throw new TypeError('option secretLength must be finite number > 1') } var validity = opts.validity || 0 if (typeof validity !== 'number' || !isFinite(validity) || validity < 0) { throw new TypeError('option validity must be finite number > 0') } this.validity = validity this.sal...