text
stringlengths
79
3.72M
<vulnerable_code> import pytest from airflow.models import DAG, RenderedTaskInstanceFields from airflow.operators.bash import BashOperator from airflow.serialization.serialized_objects import SerializedDAG from airflow.utils import timezone ) @pytest.fixture(scope="module", autouse=True) def init_blank_db(): ...
<vulnerable_code> assert.strictEqual(output, "\\~foo~bar"); }); it("escapes a tilde after '=' at the end", function () { const input = "foobar=~"; const output = escapeShellArg(input, shell, interpolation); assert.strictEqual(output, "foobar=\\~"); ...
<vulnerable_code> st = field[n].start + 1; len = field[n].end - field[n].start; switch (*s) { case 'u': if (len == 1 || (len == 4<commit_title>[PATCH] Skip 0-length ACL fields<commit_description>Currently, it is possible to create an archive that crashes bsdtar with a malformed ACL: Program received si...
<vulnerable_code> hideDuration: 1000, timeOut: 10000, extendedTimeOut: 1000, }); }, warning(message, title) { hideDuration: 1000, timeOut: 7000, extendedTimeOut: 1000, }); }, success(message, title) { hideDuration: 1000, timeOut: 7000, extendedTimeOut...
<vulnerable_code> outputCanvasContext.fillStyle = 'black' outputCanvasContext.fillRect(0, 0, outputCanvasElement.width, outputCanvasElement.height) this._setOutputTrack('default', this._outputStream.getVideoTracks()[0]) this._disableOrRemoveOutputTrackTimeout = setTimeout(() => { clearTimeout(this._disableO...
<vulnerable_code> afterEach(() => { clearTimeout(blackVideoEnforcer._disableOrRemoveOutputTrackTimeout) }) afterAll(() => { jest.restoreAllMocks() }) const DISABLE_OR_REMOVE_TIMEOUT = 1000 const STOPPED = true <commit_title>[PATCH] Render canvas several times<commit_description><fixed_code> afterEach(() ...
<vulnerable_code> while(*s && d < e) { if(unlikely(*s == '%')) { if(likely(s[1] && s[2])) { *d++ = from_hex(s[1]) << 4 | from_hex(s[2]); s += 2; } }<commit_title>[PATCH] fixed vulnerabilities identified by red4sec.com (#4521)<commit_description>...
<vulnerable_code> return web_client_api_request_single_chart(host, w, url, rrd_stats_api_v1_chart); } // returns the HTTP code inline int web_client_api_request_v1_data(RRDHOST *host, struct web_client *w, char *url) { debug(D_WEB_CLIENT, "%llu: API v1 data with URL '%s'", w->id, url); } } if(!...
<vulnerable_code> if (file) { char buffer[1024]; int len; while ((len = zzip_fread (buffer, 1, 1024, file))) { fwrite (buffer, 1, len, out); }<commit_title>[PATCH] #68 return value of zzip_fread is signed<commit_description><fixed_code> if (file) { char buffer[1024]; int len; while (0 < (le...
<vulnerable_code> } else { CXBMCTinyXML xmlDoc; stream >> xmlDoc; if (xmlDoc.Error()) { TiXmlElement *pRootElement = xmlDoc.RootElement(); // lowercase every element TiXmlNode *pNode = pRootElement; TiXmlNode *pChild = NULL;<commit_title>[PATCH] [Playlist] dont use istream direct...
<vulnerable_code> @Override public void authorizeRequest(Operation op) { op.complete(); } @Override<commit_title>[PATCH] Add auth to UtilityService<commit_description>Extend auth check to UtiliyService endpoints: stats, config, subscription Issue: VRXEN-5 Change-Id: I52a4b4a42731c244a97f97610...
<vulnerable_code> .setBody(state)); assertEquals(Operation.STATUS_CODE_UNAUTHORIZED, failureResponse.op.getStatusCode()); Map<String, ServiceStats.ServiceStat> stat = this.host.getServiceStats( UriUtils.buildUri(this.host, ServiceUriPaths.CORE_MANAGEMENT)); ...
<vulnerable_code> * isn't created immediately, so this polls. */ private String loginUser(URI hostUri) throws Throwable { URI usersLink = UriUtils.buildUri(hostUri, UserService.FACTORY_LINK); // wait for factory availability this.host.waitForReplicatedFactoryServiceAvailable(usersLi...
<vulnerable_code> ri.limit = limit; ri.options = EnumSet.of(RequestRateInfo.Option.PAUSE_PROCESSING); this.host.setRequestRateLimit(userPath, ri); this.host.assumeIdentity(userPath); ServiceStat rateLimitStatBefore = getRateLimitOpCountStat(); if (rateLimitStatBefore == n...
<vulnerable_code> } }; Operation subscribe = Operation.createPost(UriUtils.buildUri(hostWithAuth, minimalServiceUUID)); subscribe.setReferer(hostWithAuth.getReferer()); ServiceSubscriber subscriber = new ServiceSubscriber(); subscriber.replaySt...
<vulnerable_code>package com.vmware.xenon.common; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.net.URI; import java.util.ArrayList; import java.util.EnumSet; import com.vmware.xenon.common.ServiceStats.TimeSeriesStats; import com.vmware.xenon.common.ServiceStats....
<vulnerable_code>import com.vmware.xenon.common.ServiceHost; import com.vmware.xenon.common.UriUtils; import com.vmware.xenon.common.Utils; import com.vmware.xenon.services.common.ExampleService.ExampleServiceState; import com.vmware.xenon.services.common.QueryTask; import com.vmware.xenon.services.common.QueryTask.Que...
<vulnerable_code>import com.vmware.xenon.common.Operation; import com.vmware.xenon.common.Operation.AuthorizationContext; import com.vmware.xenon.common.Operation.CompletionHandler; import com.vmware.xenon.common.Service; import com.vmware.xenon.common.Service.Action; import com.vmware.xenon.common.Service.ServiceOptio...
<vulnerable_code> VerificationHost groupHost = this.host.getPeerHost(); // wait for auth related services to be stabilized groupHost.waitForReplicatedFactoryServiceAvailable( UriUtils.buildUri(groupHost, UserService.FACTORY_LINK)); String bazUserLink = UriUtils.buildUriP...
<vulnerable_code> if (i > 1) { selectSQL.append(", "); } selectSQL.append(pgmd.getBaseColumnName(i)); } selectSQL.append(" from ").append(onlyTable).append(tableName).append(" where "); for (int i = 0; i < numKeys; i++) { PrimaryKey primaryKey = primaryKeys.get(i); sel...
<vulnerable_code><commit_title>[PATCH] Merge pull request from GHSA-r38f-c4h4-hqq2<commit_description>Fixes SQL generated in PgResultSet.refresh() to escape column identifiers so as to prevent SQL injection. Previously, the column names for both key and data columns in the table were copied as-is into the generated SQ...
<vulnerable_code>} /* * Checks if the dnode contains any uncommitted dirty records. */ boolean_t dnode_is_dirty(dnode_t *dn) mutex_enter(&dn->dn_mtx); for (int i = 0; i < TXG_SIZE; i++) { if (multilist_link_active(&dn->dn_dirty_link[i])) { mutex_exit(&dn->dn_mtx); return (B_TRUE); }<commit_title>[PATCH]...
<vulnerable_code> len = pSetup->wLength; } if (len) { const struct flash_area *fa; <commit_title>[PATCH] usb: dfu: check requested length (wLength) during DFU_UPLOAD<commit_description>During DFU_UPLOAD, the host could requests more data as stated in wTransferSize. Limit upload length to the size of the r...
<vulnerable_code> else if (reply == 0x02) *cold = 0; else return -EIO; deb_info("Identify state cold = %d\n", *cold); err: kfree(buf);<commit_title>[PATCH] media: usb: fix memory leak in af9005_identify_state<commit_description>In af9005_identify_state when returning -EIO the allocated buffer should be released...
<vulnerable_code>{ Gif_Colormap *gfcm = gfs->global; int index; if (gfi && gfi->local) gfcm = gfi->local; if (color->haspixel == 2) { /* have pixel value, not color */ if (color->pixel < (uint32_t)gfcm->ncol) return color->pixel; else { if (color_context) } } index = Gif_FindColo...
<vulnerable_code> npy_intp idx = PyArray_NDIM(input) > 0 ? 2 * PyArray_NDIM(input) * ii : ii; if (regions[idx] >= 0) { PyObject *tuple = PyTuple_New(PyArray_NDIM(input)); if (!tuple) { PyErr_NoMemory(); goto exit; ...
<vulnerable_code> parser_line_counter_t start_line, /**< start line */ parser_line_counter_t start_column) /**< start column */ { context_p->source_p = context_p->token.lit_location.char_p; context_p->line = start_line; context_p->column = s...
<vulnerable_code><commit_title>[PATCH] Fix PropertyDefinition parsing in ObjectInitializer<commit_description>This patch fixes #3822 and fixes #3823 and fixes #3824 and fixes #3825. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu<fixed_code> // Copyright JS Foundation and other contributors, ...
<vulnerable_code><commit_title>[PATCH] Fix PropertyDefinition parsing in ObjectInitializer<commit_description>This patch fixes #3822 and fixes #3823 and fixes #3824 and fixes #3825. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu<fixed_code> // Copyright JS Foundation and other contributors, ...
<vulnerable_code> if (interp->isSafe) return Jsi_LogError("line edit not available in safe mode"); if (Jsi_ValueIsNull(interp, v)) { jsi_RlGetLine(interp, NULL); return JSI_OK; } cp = Jsi_ValueString(interp, v, NULL); if (cp) { p = ...
<vulnerable_code> if (strncmp(MATLAB_HDR.identific, "MATLAB", 6)) { MATLAB_KO: if (clone_info != (ImageInfo *) NULL) clone_info=DestroyImageInfo(clone_info); ThrowReaderException(CorruptImageError,"ImproperImageHeader");<commit_title>[PATCH] https://github.com/ImageMagick/ImageMagick/issues/617...
<vulnerable_code>import java.util.stream.Collectors; import java.util.stream.Stream; import org.slf4j.LoggerFactory; import com.vaadin.flow.component.ClientCallable; invokeMethod(compositeContent, compositeContent.getClass(), methodName, args, promiseId, inert); } else { ...
<vulnerable_code> let errored = false; if (match) { // Turn matched uri parameters into an object of parameters const params = {}; for (let i = 1; i < match.length; i += 1) {<commit_title>[PATCH] fix: remove trailer header if present when proxying<...
<vulnerable_code>'use strict'; const { test } = require('tap'); const { destinationObjectStream, HttpServer, t.end(); });<commit_title>[PATCH] fix: remove trailer header if present when proxying<commit_description><fixed_code> 'use strict'; const { test } = require('tap'); const { exec } = require('child...
<vulnerable_code> host = conf.serv[key]; } } var nowTemp = host.frondend + (request.url.replace('/', '') || host.baseTemp); var httpHead = header(nowTemp); conf.app = conf.getApp(host.backend); if(!host) {<commit_title>[PATCH] [FIX] Path traversal sanitizing request path<commit_des...
<vulnerable_code> request.set_time_zone(QTimeZone::systemTimeZoneId().toStdString()); auto ret = request_launch(parser); if (ret == ReturnCode::Ok && request.instance_name() == petenv_name.toStdString()) { QString mount_source{}; try<commit_title>[PATCH] [cli] skip automount on petenv wh...
<vulnerable_code> EXPECT_CALL(mock_settings, get(_)).Times(AnyNumber()); /* Admit get calls beyond explicitly expected in tests. This allows general actions to consult settings (e.g...
<vulnerable_code> private static final VariantInfo VARIANT_OBJECT_XML = new VariantInfo( MediaType.APPLICATION_JAVA_OBJECT_XML); /** Indicates whether the JavaBeans XML deserialization is supported or not. */ private static final boolean VARIANT_OBJECT_XML_SUPPORTED = Boolean .getBoo...
<vulnerable_code> package org.restlet.representation; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; * representations of JavaBeans using the {@link XMLEncoder} and * {@link XMLDecoder} classes. In this case, it handles representations having * the following media type: {@...
<vulnerable_code> if (primitive_info->text == (char *) NULL) break; clone_info=CloneImageInfo(draw_info->image_info); composite_images=(Image *) NULL; if (LocaleNCompare(primitive_info->text,"data:",5) == 0) composite_images=ReadInlineImage(clone_info,primitive_info->text,<commit...
<vulnerable_code>} CUTPalHeader; static void InsertRow(ssize_t depth,unsigned char *p,ssize_t y,Image *image) { ExceptionInfo *exception; size_t bit; ssize_t x; register PixelPacket *q; IndexPacket index; register IndexPacket *indexes; index=(IndexPacket) 0; exception=(&image->exception); switc...
<vulnerable_code>function load_activity(feedurl, divid) { var feed = new google.feeds.Feed(feedurl); var container = document.getElementById(divid); var loaded = 0; var nb_display = 8; feed.setNumEntries(30); feed.load(function(result) { if (result.error) { return; } ...
<vulnerable_code> #define VALIDATION_WORD 0x31305341 #define MAX_IMAGE_SIZE (60 * 1024 - 4) static int add_barebox_header; uint8_t validation_word[4]; uint8_t version; uint8_t flags; uint8_t program_length[2]; uint8_t spare[2]; uint8_t checksum[2]; }; static uint32_t bb_header[] = { 0x00000000, /* socfpga he...
<vulnerable_code><commit_title>[PATCH] Squashed commit of the following:<commit_description><fixed_code> # Copyright (C) 2010-2013 Thomas Petazzoni <thomas.petazzoni@free-electrons.com> import sys import subprocess # Execute the "make <pkg>-show-version" command to get the version of a given # list of packages, and r...
<vulnerable_code>#endif }; struct unsafe_opt_s { const char *arg; size_t len; }; /* Unsafe options are options that specify a potentialy unsafe path, * that will be checked by check_unsafe_path(), below. * * sizeof() on a string literal includes the terminating \0. */ #define UNSAFE_OPT(o) { #o, sizeof(#o)-...
<vulnerable_code> expires: ms('5 minutes') / 1000, }, }, debug: true, logClientVersion: true, periodicPingUrls: [], streamingUpload: false,<commit_title>[PATCH] replace debug<commit_description>remove debug flag instead add allowLocalUrls (COMPANION_ALLOW_LOCAL_URLS) which defaults to false this fixe...
<vulnerable_code> * Validates that the download URL is secure * * @param {string} url the url to validate * @param {boolean} debug whether the server is running in debug mode */ const validateURL = (url, debug) => { if (!url) { return false } const validURLOpts = { protocols: ['http', 'https'], re...
<vulnerable_code> * @param {string=} traceId a unique id to easily trace logs tied to a request */ exports.debug = (msg, tag, traceId) => { // @todo: this function should depend on companion's debug option instead if (process.env.NODE_ENV !== 'production') { // @ts-ignore log(msg, tag, 'debug', traceId, ch...
<vulnerable_code> return done(err) } getURLMeta(this._getMediaUrl(body)) .then(({ size }) => done(null, size)) .catch((err2) => { logger.error(err2, 'provider.facebook.size.error')<commit_title>[PATCH] replace debug<commit_description>remove debug flag instead a...
<vulnerable_code> return done(err) } getURLMeta(body.media_url) .then(({ size }) => done(null, size)) .catch((err2) => { logger.error(err2, 'provider.instagram.size.error')<commit_title>[PATCH] replace debug<commit_description>remove debug flag instead add allow...
<vulnerable_code> return } getURLMeta(body.links.download) .then(({ size }) => done(null, size)) .catch((err2) => { logger.error(err2, 'provider.unsplash.size.error')<commit_title>[PATCH] replace debug<commit_description>remove debug flag instead add allowLocalUrls (COMPANI...
<vulnerable_code> uploadUrls: uploadUrls ? uploadUrls.split(',') : null, secret: getSecret('COMPANION_SECRET') || generateSecret(), preAuthSecret: getSecret('COMPANION_PREAUTH_SECRET') || generateSecret(), debug: process.env.NODE_ENV && process.env.NODE_ENV !== 'production', // cookieDomain is kind o...
<vulnerable_code> }) }, 1000) afterAll(() => { nock.cleanAll() nock.restore()<commit_title>[PATCH] replace debug<commit_description>remove debug flag instead add allowLocalUrls (COMPANION_ALLOW_LOCAL_URLS) which defaults to false this fixes https://huntr.dev/bounties/8b060cc3-2420-468e-8293-b9216620175b/ also do...
<vulnerable_code> COMPANION_HIDE_WELCOME: 'false', COMPANION_STREAMING_UPLOAD: 'true', COMPANION_PROTOCOL: 'http', COMPANION_DATADIR: './test/output',<commit_title>[PATCH] replace debug<commit_description>remove debug flag instead add allowLocalUrls (COMPANION_ALLOW_LOCAL_URLS) which defaults to false this fix...
<vulnerable_code> private FileData file; @Override public OutputStream receiveUpload(String fileName, String MIMEType) { FileOutputStream outputBuffer = createFileOutputStream(fileName); file = new FileData(fileName, MIMEType, outputBuffer); return outputBuffer; }<commit_title>...
<vulnerable_code>package com.vaadin.flow.component.upload.receivers; import java.io.ByteArrayInputStream; import java.io.FileDescriptor; import java.io.FileInputStream; import java.io.FileOutputStream; private Map<String, FileData> files = new HashMap<>(); @Override public OutputStream receiveUpload(Stri...
<vulnerable_code>package com.vaadin.flow.component.charts.demo.examples.dynamic; import com.vaadin.flow.component.ClickEvent; import com.vaadin.flow.component.ComponentEventListener; import com.vaadin.flow.component.ComponentUtil; import com.vaadin.flow.component.charts.Chart; import com.vaadin.flow.component.charts.d...
<vulnerable_code>import com.vaadin.flow.component.charts.testbench.ChartElement; import org.junit.Test; import org.openqa.selenium.By; import static org.junit.Assert.assertNotEquals; public class DynamicExtremesIT extends AbstractTBTest { @Test public void axisFunction_toggleExtremesPoint_pointHidden() { ...
<vulnerable_code> public void axisRescaled(AxisRescaledEvent event) { chart.getElement().callJsFunction("__callAxisFunction", "setExtremes", event.getAxis(), event.getAxisIndex(), event.getMinimum().doubleValue(), event.getMaximum().doubleValue(), event.isRedra...
<vulnerable_code> import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.Map; import com.google.common.base.Ascii; import com.google.common.collect.ImmutableMap; import io.netty.util.AsciiString; // - Sec-Fetch-User // - Sec-Metadata // Pseudo-headers /** ma...
<vulnerable_code> */ package com.linecorp.armeria.common; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkState; import static com.linecorp.armeria.internal.ArmeriaHttpUtil.isAbsoluteUri; import static io.netty.handler.codec.http2.Http2Headers.P...
<vulnerable_code> final CharSequenceMap result = new CharSequenceMap(arraySizeHint); while (valuesIter.hasNext()) { final AsciiString lowerCased = HttpHeaderNames.of(valuesIter.next()).toLowerCase(); try { int index = lowerCased.forEachByte(FIND_COMMA); ...
<vulnerable_code>package com.linecorp.armeria.common; import static org.assertj.core.api.Assertions.assertThat; import org.junit.Test; import io.netty.util.AsciiString; public class HttpHeaderNamesTest { @Test public void testOfAsciiString() { // Should produce a lower-cased AsciiString. fi...
<vulnerable_code> import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.fail; import java.net.URI; import java.util.Iterator; import java.util.Map; import java.util.NoSuchElementException; import org.junit.Test; impo...
<vulnerable_code><commit_title>[PATCH] Merge pull request from GHSA-35fr-h7jr-hh86<commit_description>Motivation: An `HttpService` can produce a malformed HTTP response when a user specified a malformed HTTP header values, such as: ResponseHeaders.of(HttpStatus.OK "my-header", "foo\r\nbad-h...
<vulnerable_code>!function(){var t={7452:function(){Craft.AdminTable=Garnish.Base.extend({settings:null,totalItems:null,sorter:null,$noItems:null,$table:null,$tbody:null,$deleteBtns:null,init:function(t){this.setSettings(t,Craft.AdminTable.defaults),this.settings.allowDeleteAll||(this.settings.minItems=1),this.$noItems...
<vulnerable_code> createNewElement: function (elementInfo) { var $element = elementInfo.$element.clone(); var removeText = Craft.t('app', 'Remove {label}', { label: elementInfo.label, }); // Make a couple tweaks Craft.setElementSize(<commit_title>[PATCH] Fixed an XSS vulnerabili...
<vulnerable_code><commit_title>[PATCH] XWIKI-20524: Improve icon rendering<commit_description>* Require script right for icon set authors. * Record the icon set's source document reference in the icon theme. * Refactor XWiki syntax escaping into its own component. Currently, this component is internal as this is not ...
<vulnerable_code><commit_title>[PATCH] XWIKI-20524: Improve icon rendering<commit_description>* Require script right for icon set authors. * Record the icon set's source document reference in the icon theme. * Refactor XWiki syntax escaping into its own component. Currently, this component is internal as this is not ...
<vulnerable_code><commit_title>[PATCH] XWIKI-20524: Improve icon rendering<commit_description>* Require script right for icon set authors. * Record the icon set's source document reference in the icon theme. * Refactor XWiki syntax escaping into its own component. Currently, this component is internal as this is not ...
<vulnerable_code> { super(message, source); } }<commit_title>[PATCH] XWIKI-20524: Improve icon rendering<commit_description>* Require script right for icon set authors. * Record the icon set's source document reference in the icon theme. * Refactor XWiki syntax escaping into its own component. Currently,...
<vulnerable_code>import java.util.List; import java.util.Map; /** * A collection of icons, with some properties to display them. * private IconType type; /** * Constructor. * { return this.iconMap.containsKey(iconName); } }<commit_title>[PATCH] XWIKI-20524: Improve icon rendering<...
<vulnerable_code> contentToParse.write("\")\n"); contentToParse.write(renderer); return velocityRenderer.render(contentToParse.toString()); } @Override public void use(IconSet iconSet) throws IconException { if (iconSet == null) { throw new IconException("The...
<vulnerable_code>import java.util.Properties; import javax.inject.Inject; import javax.inject.Singleton; import org.xwiki.bridge.DocumentAccessBridge; import org.xwiki.icon.IconSetLoader; import org.xwiki.icon.IconType; import org.xwiki.model.reference.DocumentReference; import org.xwiki.wiki.descriptor.WikiDescripto...
<vulnerable_code> import java.io.IOException; import java.io.InputStreamReader; import java.util.List; import javax.inject.Inject; import javax.inject.Singleton; import org.apache.commons.lang3.StringUtils; import org.xwiki.bridge.DocumentAccessBridge; import org.xwiki.component.annotation.Component; import org.xwiki...
<vulnerable_code>package org.xwiki.icon.internal; import java.io.StringWriter; import javax.inject.Inject; import javax.inject.Singleton; import org.apache.velocity.VelocityContext; import org.xwiki.component.annotation.Component; import org.xwiki.icon.IconException; import org.xwiki.logging.LoggerConfiguration; imp...
<vulnerable_code> IconSet iconSet = new IconSet("default"); iconSet.setRenderWiki("image:$icon.png"); iconSet.addIcon("test", new Icon("blabla")); when(velocityRenderer.render("#set($icon = \"blabla\")\nimage:$icon.png")).thenReturn("image:blabla.png"); // Test String res...
<vulnerable_code>import org.xwiki.icon.IconException; import org.xwiki.icon.IconSet; import org.xwiki.icon.IconType; import org.xwiki.model.reference.DocumentReference; import org.xwiki.test.junit5.mockito.ComponentTest; import org.xwiki.test.junit5.mockito.InjectMockComponents; import org.xwiki.test.junit5.mockito.Moc...
<vulnerable_code> import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mock; import org.xwiki.bridge.DocumentAccessBridge; import org.xwiki.configuration.ConfigurationSource; import org.xwiki.query.Query; import org.xwiki.query.QueryException; import org.xwiki.query.QueryManage...
<vulnerable_code>package org.xwiki.icon.internal; import java.io.Writer; import org.apache.velocity.VelocityContext; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import org.xwiki.icon.IconException; import or...
<vulnerable_code> @Test void getIconsIconManagerException() throws Exception { IconException iconException = new IconException("icon error", null); when(this.iconManager.hasIcon(any(), any())).thenThrow(iconException); when(this.iconSetManager.getCurrentIconSet()).thenReturn(new Icon...
<vulnerable_code><commit_title>[PATCH] XWIKI-20524: Improve icon rendering<commit_description>* Require script right for icon set authors. * Record the icon set's source document reference in the icon theme. * Refactor XWiki syntax escaping into its own component. Currently, this component is internal as this is not ...
<vulnerable_code>import org.xwiki.rendering.block.XDOM; import org.xwiki.rendering.configuration.ExtendedRenderingConfiguration; import org.xwiki.rendering.configuration.RenderingConfiguration; import org.xwiki.rendering.macro.MacroCategoryManager; import org.xwiki.rendering.macro.MacroId; import org.xwiki.rendering.ma...
<vulnerable_code>import org.xwiki.rendering.block.XDOM; import org.xwiki.rendering.configuration.ExtendedRenderingConfiguration; import org.xwiki.rendering.configuration.RenderingConfiguration; import org.xwiki.rendering.macro.Macro; import org.xwiki.rendering.macro.MacroCategoryManager; import org.xwiki.rendering.macr...
<vulnerable_code> Local<Value> args[1]; args[0] = anArray; Local<Value> result = func->Call(GET_CURRENT_CONTEXT, OBJECT_FROM_PERSISTENT(mObject), 1, args).ToLocalChecked(); if(result.IsEmpty()) { THROW_EXCEPTION("wrong return value. it's empty. return the number of written characters"); r...
<vulnerable_code>var muhammara = require('../muhammara'); describe('BasicModificationWithStreams', function() { it('should complete without error', function() { color:0x00 }); pageModifier.endContext().writePage(); pdfWriter.end(); outStream.close(); inStream.close(); }); });<commit_title>[PATCH] Fix c...
<vulnerable_code> /* Does not support long mode */ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt, u16 selector, int seg, u8 cpl, bool in_task_switch) { struct desc_struct seg_desc, old_desc; u8 dpl, rpl; } load: ctxt->ops->set_segment(ctxt, selector, &seg_desc, base3, seg); return X86...
<vulnerable_code>import moment from "moment"; export default CardFieldsService; CardFieldsService.$inject = ["$sce", "$filter"]; function CardFieldsService($sce, $filter) { const highlight = $filter("tuleapHighlight"); return { cardFieldIsSimpleValue, cardFieldIsList, cardFieldIsPerm...
<vulnerable_code> * @license MIT */ import { isNumber } from "angular"; import { Classifier } from "./highlight/Classifier"; import { HighlightedText } from "./highlight/HighlightedText"; export default TuleapHighlightFilter; * @returns HTML-encoded string */ function TuleapHighlightFilter() { function isText...
<vulnerable_code>import angular from "angular"; import ngSanitize from "angular-sanitize"; import "../themes/main.scss"; import HighlightFilter from "./highlight-filter.js"; import cardTextFieldDirective from "./card-text-field/card-text-field-directive.js"; export default angular .module("card-fields", [ngSaniti...
<vulnerable_code>var Buffer = require('safe-buffer').Buffer; var RegExpClone = require('regexp-clone'); /** * Clones objects * var k; for (k in obj) { val = clone(obj[k], options); if (!minimize || ('undefined' !== typeof val)) { while (i--) { key = keys[i]; if ('undefined' === typeof to[key...
<vulnerable_code> done(); }); }); });<commit_title>[PATCH] fix(utils): avoid copying special properties like `__proto__`<commit_description><fixed_code> done(); }); it('skips __proto__', function() { var payload = JSON.parse('{"__proto__": {"polluted": "vulnerable"}}'); var res =...
<vulnerable_code> if (!node) return -ENOMEM; for (i = 2; i <= file_de->file_num_ext; i++) { ret = exfat_de_iter_get(iter, i, &dentry); if (ret || dentry->type != EXFAT_NAME) { if (i > 2 && repair_file_ask(iter, NULL, ER_DE_NAME,<commit_title>[PATCH] fsck: fix out-of-bounds write in read_file_dentry_set<commi...
<vulnerable_code>function preprocessRFC2822(s) { // Remove comments and folding whitespace and replace multiple-spaces with a single space return s .replace(/\([^)]*\)|[\n\t]/g, ' ') .replace(/(\s\s+)/g, ' ') .replace(/^\s\s*/, '') .replace(/\s\s*$/, '');<commit_title>[PATCH] [bu...
<vulnerable_code> } if (nb_lead) { val = gf_bs_read_int(bs, nb_lead); val += (1 << nb_lead) - 1; bits += nb_lead; } if (si->slice_type > 9) return -1; pps_id = gf_bs_read_ue_log(bs, "pps_id"); if (pps_id > 255) return -1; si->pps = &avc->pps[pps_id]; if (!si->pps->slice_group_count) return -2; si->sps ...
<vulnerable_code> return tensor def create_test_model(self) -> str: constant_node = onnx.helper.make_node( 'Constant', inputs=[], model_file_path = self.get_temp_model_filename() external_data_file = str(uuid.uuid4()) convert_model_to_external_data(s...
<vulnerable_code>if getattr(C, 'DEFAULT_LOG_PATH'): path = C.DEFAULT_LOG_PATH if path and (os.path.exists(path) and os.access(path, os.W_OK)) or os.access(os.path.dirname(path), os.W_OK): logging.basicConfig(filename=path, level=logging.DEBUG, format='%(asctime)s %(name)s %(message)s') mypid = s...
<vulnerable_code>#ifndef LLONG_MIN #define LLONG_MIN (-LLONG_MAX - 1LL) #endif static const char *ep; const char *cJSON_GetErrorPtr( void ) { return ep; } static int cJSON_strcasecmp( const char *s1, const char *s2 ) { if ( ! s1 ) return ( s1 == s2 ) ? 0 : 1; if ( ! s2 ) return 1; for ( ; tolower(*s1) == t...
<vulnerable_code> cJSON_AddStringToObject(test->json_start, "cookie", test->cookie); if (test->protocol->id == SOCK_STREAM) { if (test->settings->mss) cJSON_AddIntToObject(test->json_start, "tcp_mss", test->settings->mss); else { len = sizeof(opt); getsockopt(test->ctrl_sck, IPPROTO_TCP, TCP_MAX...
<vulnerable_code> j = cJSON_CreateBool(va_arg(argp, int)); break; case 'd': j = cJSON_CreateInt(va_arg(argp, int64_t)); break; case 'f': j = cJSON_CreateFloat(va_arg(argp, double)); break; case 's': j = cJSON_CreateString(va_arg(argp, char *));<commit_title>[PATCH] Fix a buffer overflow / heap corrup...