text stringlengths 79 3.72M |
|---|
<vulnerable_code> 'should throw when not given a node'
)
let processor = remark().use(remarkHtml)
t.equal(
// @ts-expect-error: unknown node.
processor.stringify({type: 'alpha'}),
'<div></div>',
'should stringify unknown nodes'
)
t.equal(
processor.stringify({
// @ts-expect-err... |
<vulnerable_code> unsigned const *const buckets = &hashtab[2];
unsigned const *const chains = &buckets[nbucket];
unsigned const m = elf_hash(name) % nbucket;
if ((unsigned)(file_size - ((char const *)buckets - (char const *)(void const *)file_image))
<= sizeof(unsigned)*nb... |
<vulnerable_code> following PR: https://github.com/apache/incubator-pinot/pull/4110
:param conn_id: The name of the connection to use.
:param cmd_path: The filepath to the pinot-admin.sh executable
:param pinot_admin_system_exit: If true, the result is evaluated based on the status code.
... |
<vulnerable_code> self.conn = conn = mock.MagicMock()
self.conn.host = "host"
self.conn.port = "1000"
self.conn.extra_dejson = {"cmd_path": "./pinot-admin.sh"}
class PinotAdminHookTest(PinotAdminHook):
def get_connection(self, conn_id):
params = ["foo", "bar"... |
<vulnerable_code> throw streamError(streamId, PROTOCOL_ERROR,
"Illegal value specified for the 'TE' header (only 'trailers' is allowed).");
}
if (!isValidHeaderValue(value)) {
throw streamError(streamId, PROTOCOL_ERROR, "Illegal header value given for header '%... |
<vulnerable_code><commit_title>[PATCH] This stops DOS attacks by making the lexer stop early. Added<commit_description><fixed_code>
package graphql.parser;
import com.google.common.base.Strings;
import graphql.ExecutionInput;
import graphql.ExecutionResult;
import graphql.GraphQL;
import graphql.GraphQLError;
import g... |
<vulnerable_code> // won't be extended later.
bool useVftTestHeuristics = true;
TR::PersistentInfo *persistInfo = comp()->getPersistentInfo();
if (persistInfo->getJitState() == STARTUP_STATE)
{
const static bool useVftTestHeuristicsDuringStartup =
... |
<vulnerable_code> */
/*global define,require,document */
define("webodf/editor/widgets/fontPicker", [
"dijit/form/Select"],
function (Select) {
"use strict";
/**
name = documentFonts[i].name;
family = documentFonts[i].family || name;
... |
<vulnerable_code>
define("webodf/editor/widgets/paragraphStyles", [
"dijit/form/Select",
"webodf/editor/EditorSession"],
function (Select, EditorSession) {
"use strict"
/**
for (i = 0; i < availableStyles.length; i += 1) {
selectionList.push({
label... |
<vulnerable_code> axis=(axis - 4)))
self.assertAllClose(fake_quantized, expected)
def testQuantizeDequantizeGrad(self):
shape = (2, 2)
max_threshold = 0<commit_title>[PATCH] Prevent segfault in `quantize_and_dequantize`<commit_description>Fixes #42105.
If `tf.quantization.quantize... |
<vulnerable_code> if (!start)
return true;
/* Reject paths like ".git\" */
if (path[start] == '\\')
return false;
/* Reject paths like '.git ' or '.git.' */<commit_title>[PATCH] Disallow NTFS Alternate Data Stream attacks, even on<commit_description><fixed_code>
if (!start)
return true;
/*
* Reject path... |
<vulnerable_code>#endif
}
/* Trees that contains entries with a tree ".git" that contain
* byte sequences:
* { 0xe2, 0x80, 0x8c }<commit_title>[PATCH] Disallow NTFS Alternate Data Stream attacks, even on<commit_description><fixed_code>
#endif
}
/* A tree that contains an entry ".git::$INDEX_ALLOCATION" because NTFS... |
<vulnerable_code> slave->slave_id == master->slave_id) {
list_move_tail(&slave->open_list, &master->slave_list_head);
spin_lock_irq(&slave_active_lock);
slave->master = master;
slave->timer = master->timer;
if (slave->flags & SNDRV_TIMER_IFLG_RUNNING)
list_add_tail(&slave->active_list,
... |
<vulnerable_code><commit_title>[PATCH] Regression test for<commit_description><fixed_code>
# -*- coding: utf-8 -*-
from system_tests import CaseMeta, path
class MrmImageLargeAllocation(metaclass=CaseMeta):
"""
Regression test for the bug described in:
https://github.com/Exiv2/exiv2/pull/943
"""
u... |
<vulnerable_code> ENGINE_SET_EVENT(p,TCP_OPT_INVALID_LEN);
}
break;
}
pkt += olen;<commit_title>[PATCH] stream/tcp: handle RST with MD5 or AO header<commit_description>Special handling for RST packets if they have an TCP MD5 or AO h... |
<vulnerable_code> if (ostream->flags & STREAMTCP_STREAM_FLAG_RST_RECV) {
if (StreamTcpStateDispatch(tv, p, stt, ssn, &stt->pseudo_queue, ssn->pstate) < 0)
return -1;
}
}
return 0;
static int StreamTcpValidateRst(TcpSession *ssn, Packet *p)
{
uint8_t os_policy;
... |
<vulnerable_code>/* $OpenBSD: ssh-agent.c,v 1.214 2016/09/12 01:22:38 deraadt Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
#include "misc.h"
#include "digest.h"
#include "ssherr.h"
#ifdef ENABLE_PKCS11
#include "ssh-pkcs11.h"
#endif
typedef enum ... |
<vulnerable_code> guint speed;
guint download_size_remaining;
gboolean finished;
gboolean allow_cancel;
gboolean waiting_for_auth;
gboolean emit_eula_required;
PkExitEnum exit_enum,
guint time_ms)
{
g_debug ("emitting finished '%s', %i",
pk_exit_enum_to_string (exit_enum),
ti... |
<vulnerable_code> struct snd_seq_port_info *info = arg;
struct snd_seq_client_port *port;
struct snd_seq_port_callback *callback;
/* it is not allowed to create the port for an another client */
if (info->addr.client != client->number)
return -ENOMEM;
if (client->type == USER_CLIENT && info->kernel) {
snd_se... |
<vulnerable_code>}
/* create a port, port number is returned (-1 on failure) */
struct snd_seq_client_port *snd_seq_create_port(struct snd_seq_client *client,
int port)
{
snd_use_lock_init(&new_port->use_lock);
port_subs_info_init(&new_port->c_src);
port_subs_info_init(&new_port->c_dest);
num = port >= 0 ?... |
<vulnerable_code>#define UNUSED(x) ((void)(x))
/* Glob-style pattern matching. */
int stringmatchlen(const char *pattern, int patternLen,
const char *string, int stringLen, int nocase)
{
while(patternLen && stringLen) {
switch(pattern[0]) {
if (patternLen == 1)
return 1;... |
<vulnerable_code> char month[3];
month[0] = xtoupper(*s);
month[1] = xtolower(*(s + 1));
month[2] = xtolower(*(s + 2));
for (i = 0; i < 12; i++)<commit_title>[PATCH] RFC 1123: Fix date parsing (#1538)<commit_description>The bug was discovered and detailed by Joshua Rogers at
https://megamansec.gith... |
<vulnerable_code>
#include <pwd.h>
#include <grp.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/reboot.h>
#include <crm/msg_xml.h>
#include <crm/common/ipcs.h>
#include <crm/common/mainloop.h>
#include <crm/cluster/internal.h>
#include <crm/cluster.h>
#ifd... |
<vulnerable_code> e_phnum = get_te16(&ehdri.e_phnum);
e_shnum = get_te16(&ehdri.e_shnum);
unsigned const e_phentsize = get_te16(&ehdri.e_phentsize);
if (ehdri.e_ident[Elf32_Ehdr::EI_CLASS]!=Elf32_Ehdr::ELFCLASS32
|| sizeof(Elf32_Phdr) != e_phentsize
|| (Elf32_Ehdr::ELFDATA2MSB == ehdri.e_ident[El... |
<vulnerable_code>static int uas_switch_interface(struct usb_device *udev,
struct usb_interface *intf)
{
int alt;
alt = uas_find_uas_alt_setting(intf);
if (alt < 0)
return alt;
return usb_set_interface(udev,
intf->altsetting[0].desc.bInterfaceNumber, alt);
}
static int uas_configure_endpoints(struct uas_... |
<vulnerable_code> }
if (coap_next_block(&response_packet, &ctx.block) == 0) {
LOG_ERR("Could not get the next");
ctx.code_status = UPDATEHUB_DOWNLOAD_ERROR;
goto cleanup;
}
if (ctx.downloaded_size == ctx.block.total_size) {
if (!install_update_cb_sha256())
ctx.code_status = UPDATEHUB_DOWNLOAD_ERROR;
... |
<vulnerable_code> */
radio_tmr_end_capture();
#if defined(CONFIG_BT_CTLR_SCAN_REQ_RSSI)
radio_rssi_measure();
#endif /* CONFIG_BT_CTLR_SCAN_REQ_RSSI */
#if defined(CONFIG_BT_CTLR_GPIO_LNA_PIN)
radio_gpio_pa_lna_enable(radio_tmr_tifs_base_get() +
conn->apto_reload;
#endif /* CONFIG_BT_CTLR_LE_PING */
... |
<vulnerable_code>
from twisted.web.resource import Resource
from sydent.util.stringutils import is_valid_client_secret
from sydent.util.emailutils import EmailAddressException, EmailSendException
from sydent.validators import (
IncorrectClientSecretException,
'error': 'Invalid client_secret provide... |
<vulnerable_code>from sydent.http.servlets import get_args, send_cors, jsonwrap, MatrixRestError
from sydent.http.auth import authV2
from sydent.util.emailutils import sendEmail
class StoreInviteServlet(Resource):
def __init__(self, syd, require_auth=False):
"error": "Didn't understand medium '%s'"... |
<vulnerable_code>from twisted.internet.abstract import isIPAddress, isIPv6Address
# https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-register-email-requesttoken
client_secret_regex = re.compile(r"^[0-9a-zA-Z\.\=\_\-]+$")
# hostname/domain name
# https://regex101.com/r/OyN1lg/2
r"^(?:[a-z0-9... |
<vulnerable_code> * @author <a href="http://escoffier.me">Clement Escoffier</a>
*/
public class DefaultConnectHandler implements Handler<ServerFrame> {
@Override
public void handle(ServerFrame sf) {
// Server negotiation<commit_title>[PATCH] STOMP server process client frames that would not send<commit_descrip... |
<vulnerable_code> * @param pingHandler the ping handler
*/
void configureHeartbeat(long ping, long pong, Handler<StompServerConnection> pingHandler);
}<commit_title>[PATCH] STOMP server process client frames that would not send<commit_description><fixed_code>
* @param pingHandler the ping handler
*/
void... |
<vulnerable_code> private final Vertx vertx;
private final Context context;
private Handler<ServerFrame> connectHandler = new DefaultConnectHandler();
private Handler<ServerFrame> stompHandler;
this.context = Vertx.currentContext();
this.destinations = vertx.sharedData().getLocalMap("stomp.destination... |
<vulnerable_code>import io.vertx.core.net.NetServer;
import io.vertx.ext.stomp.*;
import java.util.Objects;
/**
* Default implementation of the {@link StompServer}.
"server.");
server
.connectHandler(socket -> {
StompServerConnection connection = new StompServerTCPConnectionImpl(socket,... |
<vulnerable_code>
package io.vertx.ext.stomp.impl;
import io.vertx.core.Vertx;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.net.NetSocket;
import io.vertx.ext.auth.User;
import io.vertx.ext.auth.authentication.AuthenticationProvider;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Tests STO... |
<vulnerable_code> switch (data) {
case SUNKBD_RET_RESET:
schedule_work(&sunkbd->tq);
sunkbd->reset = -1;
break;
}
/*
* sunkbd_reinit() sets leds and beeps to a state the computer remembers they
* were in.
*/
static void sunkbd_reinit(struct work_struct *work)
{
struct sunkbd *sunkbd = container_of(work, ... |
<vulnerable_code> attr->type = (type_and_name >> 16);
attr->name = ((type_and_name << 16) >> 16);
attr->len = geti32(in);
attr->buf = CHECKED_XCALLOC (unsigned char, attr->len);
(void)getbuf(in, attr->buf, attr->len);
checksum = geti16(in);
if (!check_checksum(attr, checksum))<commit_title>... |
<vulnerable_code> s.add("org.apache.ignite.cache.jta.jndi.CacheJndiTmFactory");
s.add("org.quartz.utils.JNDIConnectionProvider");
DEFAULT_NO_DESER_CLASS_NAMES = Collections.unmodifiableSet(s);
}
<commit_title>[PATCH] Block one more gadget type (aries.transaction.jms,<commit_description><fixe... |
<vulnerable_code> self._logger.info("Starting server socket handler.")
# Create a TCP stream socket and configure it for immediate reuse.
self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
while sel... |
<vulnerable_code>
# Test the expected behavior for a normal server/interrupt sequence
s._socket.accept = mock.MagicMock(
side_effect=[('connection', 'address'), expected_error]
)
s.serve()<commit_title>[PATCH] Fix a denial-of-service bug by setting the server socket<commit_d... |
<vulnerable_code> ++*arg;
ret = eval1(arg, rettv, evalarg);
*arg = skipwhite_and_linebreak(*arg, evalarg);
if (**arg == ')')
{
++*arg;
}
else
{
emsg(_(e_missing_closing_paren));
ret = FAIL;
}
}
if (ret != OK)
return FAIL;
else if (**arg != '(')
{
if (verbose)
{<commit_title>[PA... |
<vulnerable_code>
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4773,
/**/<commit_title>[PATCH] patch 8.2.4774: crash when using a number for lambda name<commit_description>Problem: Crash when using a number for lambda name.
Solution: Check the type of the lambda reference... |
<vulnerable_code>templates.path = {testsubject_path}/res
brand.default = is-test
[email]
email.tlsmode = 0
email.invite.subject = %(sender_display_name)s has invited you to chat<commit_title>[PATCH] Add BlacklistingReactor<commit_description>This is a port from the Synapse codebase.<fixed_code>
templates.path = {tests... |
<vulnerable_code><commit_title>[PATCH] Add BlacklistingReactor<commit_description>This is a port from the Synapse codebase.<fixed_code>
# -*- coding: utf-8 -*-
# Copyright 2021 The Matrix.org Foundation C.I.C.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in comp... |
<vulnerable_code>from twisted.internet import defer
from twisted.web.client import FileBodyProducer, Agent, readBody
from twisted.web.http_headers import Headers
from sydent.http.matrixfederationagent import MatrixFederationAgent
from sydent.http.federation_tls_options import ClientTLSOptionsFactory
from sydent.http.h... |
<vulnerable_code>import logging
import logging.handlers
import os
import twisted.internet.reactor
from twisted.internet import task
from sydent.util.hash import sha256_and_url_safe_base64
from sydent.util.tokenutils import generateAlphanumericTokenOfLength
from sydent.sign.ed25519 import SydentEd25519
# Whe... |
<vulnerable_code><commit_title>[PATCH] Add BlacklistingReactor<commit_description>This is a port from the Synapse codebase.<fixed_code>
# Copyright 2021 The Matrix.org Foundation C.I.C.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licen... |
<vulnerable_code><commit_title>[PATCH] Add BlacklistingReactor<commit_description>This is a port from the Synapse codebase.<fixed_code>
# Copyright 2021 The Matrix.org Foundation C.I.C.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licen... |
<vulnerable_code>from io import BytesIO
import logging
import os
import attr
from six import text_type
from twisted.internet import address
import twisted.logger
from twisted.web.http_headers import Headers
# Use an in-memory SQLite database. Note that the database isn't cleaned up between
# tests, so by defau... |
<vulnerable_code>import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
public class XMLPropertyListParser {
private static final DocumentBuilderFactory FACTORY = DocumentBuilderFactory.newInstance()... |
<vulnerable_code> this.port = options.port
this.hideindex = options.hideindex
this.indices = options.indices
this.dir = path.normalize(options.dir)
this.nodot = options.nodot
return this
request.response = res
// prevent traversing directories that are parents of the root
if (request.fullPath.slice(0... |
<vulnerable_code>var http = require('http')
var test = require('tape')
test('fails if path traversal is attempted', function (t) {
t.plan(1)
http.get('http://localhost:1666/../index.js', function (res) {
t.notStrictEqual(res.statusCode, 200)
})
})
<commit_title>[PATCH] Fix path traversal vulnerability<comm... |
<vulnerable_code> EXPECT_EQ(offset, 0);
}
catch (std::bad_alloc& err) {
std::cerr << "[ SKIPPED ] Unable to allocate memory for test testOversizeString\n";
}
}
<commit_title>[PATCH] Improve test error handling<commit_description>Use GTEST_SKIP if available, otherwise print to stderr. Remove test
that's be... |
<vulnerable_code> a._request);
}
// create a request where content fits but the message will overflow and gets truncated
TEST(XmlRpcClient, generateOversizeRequest) {
XmlRpcClientForTest a("localhost", 42);
// Gracefully skip this test if there's not enough memory to run it
try {
XmlRpcValue toola... |
<vulnerable_code>#
# We would appreciate acknowledgement if the software is used.
__version__ = "0.5.1"
from . import local_uuid<commit_title>[PATCH 01/27] Backport<commit_description>References:
https://github.com/Cyber-Domain-Ontology/CDO-Utility-Local-UUID/pull/3
Signed-off-by: Alex Nelson <alexander.nelson@nist.g... |
<vulnerable_code> def is_init_func(self):
return self.name == "__init__"
def validate_return_statement_balance(self):
# Run balanced return statement check.
check_single_exit(self.func_ast_code)<commit_title>[PATCH] remove validate_return_statement_balance method<commit_description>now F... |
<vulnerable_code> sig = FunctionSignature.from_definition(code, sigs=sigs, custom_structs=global_ctx._structs,)
# Validate return statements.
sig.validate_return_statement_balance()
# in order to statically allocate function frames,
# we codegen functions in two passes.<commit_title>[PATCH] remove ... |
<vulnerable_code> }, 0)
}
var QUERIES = [
{
regexp: /^last\s+(\d+)\s+major\s+versions?$/i,
{
regexp: /^last\s+(\d+)\s+electron\s+versions?$/i,
select: function (context, versions) {
return Object.keys(e2c).slice(-versions).map(function (i) {
return 'chrome ' + e2c[i]
})
}
},
... |
<vulnerable_code> sc_apdu_t apdu;
u8 rbuf[SC_MAX_APDU_BUFFER_SIZE];
int r;
const u8 *p = rbuf, *q;
size_t len, tlen = 0, ilen = 0;
sc_format_apdu(card, &apdu, SC_APDU_CASE_2_SHORT, 0xca, 0x01, 0x88);
return 0;
while (len != 0) {
p = sc_asn1_find_tag(card->ctx, p, len, 0xe1, &t... |
<vulnerable_code> hdr->sadb_msg_version = PF_KEY_V2;
hdr->sadb_msg_errno = (uint8_t) 0;
hdr->sadb_msg_len = (sizeof(struct sadb_msg) / sizeof(uint64_t));
pfkey_broadcast(skb, GFP_ATOMIC, BROADCAST_ALL, NULL, c->net);
hdr->sadb_msg_errno = (uint8_t) 0;
hdr->sadb_msg_satype = SADB_SATYPE_UNSPEC;
hdr->sadb_msg_len... |
<vulnerable_code> ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
count=ReadBlob(image,(size_t) (4*image->colors),icon_colormap);
if (count != (ssize_t) (4*image->colors))
ThrowReaderException(CorruptImageError,
"InsufficientImageDataInFile");
... |
<vulnerable_code>
// If not in watch mode, stop the worker farm so we don't keep the process running.
if (!this.watcher && this.options.killWorkers) {
this.stop();
}
}
}<commit_title>[PATCH 02/57] Process inline styles and scripts (#1456)<commit_description><fixed_code>
// If not ... |
<vulnerable_code> subAsset.cacheData = Object.assign(asset.cacheData, subAsset.cacheData);
let processed = await this.processAsset(subAsset);
generated = generated.concat(processed);
asset.hash = md5(asset.hash + subAsset.hash);
} else {<commit_title>[PATCH 02/57] Process inline st... |
<vulnerable_code>
collectDependencies() {
this.ast.root.walkAtRules('import', rule => {
let params = valueParser(rule.params).nodes;
let [name, ...media] = params;
let dep;
if (name.type === 'string') {
dep = name.value;
} else if (
name.type === 'function' &&
... |
<vulnerable_code> ]
};
// Options to be passed to `addURLDependency` for certain tags + attributes
const OPTIONS = {
a: {
}
}
generate() {
return this.isAstDirty ? render(this.ast) : this.contents;
}
}
<commit_title>[PATCH 02/57] Process inline styles and scripts (#1456)<commit_description><fixed_cod... |
<vulnerable_code>module.exports = async function(asset) {
await asset.parseIfNeeded();
let htmlNanoConfig = await asset.getConfig(
['.htmlnanorc', '.htmlnanorc.js'],
{packageKey: 'htmlnano'}
);
let res = await posthtml([htmlnano(htmlNanoConfig)]).process(asset.ast, {
skipParse: true
});<commit_ti... |
<vulnerable_code> return;
}
if (!asset.options.bundleNodeModules) {
const isRelativeImport = /^[/~.]/.test(node.value);
if (!isRelativeImport) return;<commit_title>[PATCH 02/57] Process inline styles and scripts (#1456)<commit_description><fixed_code>
return;
}
// If this came from an inline <s... |
<vulnerable_code>
let html = await fs.readFile(__dirname + '/dist/index.html', 'utf8');
// mergeStyles
assert(
html.includes(
'<style>h1{color:red}div{font-size:20px}</style><style media="print">div{color:blue}</style>'
)
);
// minifyJson
assert(
html.includes('<scrip... |
<vulnerable_code><commit_title>[PATCH 02/57] Process inline styles and scripts (#1456)<commit_description><fixed_code>
console.log('test') |
<vulnerable_code>function errorToJson(error) {
let jsonError = {
message: error.message,
stack: error.stack,
name: error.name
};
// Add all custom codeFrame properties
Object.keys(error).forEach(key => {
jsonError[key] = error[key];
});
return jsonError;
}
function jsonToError(json) {
let... |
<vulnerable_code>const Packager = require('./Packager');
const path = require('path');
const fs = require('fs');
const concat = require('../scope-hoisting/concat');
const urlJoin = require('../utils/urlJoin');
const walk = require('babylon-walk');
const babylon = require('babylon');
const t = require('babel-types');
co... |
<vulnerable_code>const fs = require('fs');
const path = require('path');
const Packager = require('./Packager');
const urlJoin = require('../utils/urlJoin');
const lineCounter = require('../utils/lineCounter');
const objectHash = require('../utils/objectHash');
const prelude = {
source: fs
.readFileSync(path.joi... |
<vulnerable_code><commit_title>[PATCH 02/57] Process inline styles and scripts (#1456)<commit_description><fixed_code>
const fs = require('fs');
/**
* Creates an object that contains both source and minified (using the source as a fallback).
* e.g. builtins.min.js and builtins.js.
*/
module.exports = (minifiedPath, ... |
<vulnerable_code>
async getPackage() {
if (!this._package) {
this._package = await this.getConfig(['package.json']);
}
return this._package;<commit_title>[PATCH 02/57] Process inline styles and scripts (#1456)<commit_description><fixed_code>
async getPackage() {
if (!this._package) {
t... |
<vulnerable_code> this.addedAssets.add(asset);
let {js} = asset.generated;
// If the asset's package has the sideEffects: false flag set, and there are no used
// exports marked, exclude the asset from the bundle.
if (
asset.cacheData.sideEffects === false &&
(!asset.usedExports || asset... |
<vulnerable_code>const matchesPattern = require('../visitors/matches-pattern');
const t = require('babel-types');
const template = require('babel-template');
const rename = require('./renamer');
require: 'function'
};
module.exports = {
Program: {
enter(path, asset) {
asset.cacheData.imports = asset.cach... |
<vulnerable_code> firstName
lastName
}
`.definitions
);
});<commit_title>[PATCH 02/57] Process inline styles and scripts (#1456)<commit_description><fixed_code>
firstName
lastName
}
`.definitions
);
}); |
<vulnerable_code><commit_title>[PATCH 02/57] Process inline styles and scripts (#1456)<commit_description><fixed_code>
import {foo} from 'bar';
output = foo(2); |
<vulnerable_code><commit_title>[PATCH 02/57] Process inline styles and scripts (#1456)<commit_description><fixed_code>
sideEffect('bar');
export default function bar() {
return 2;
} |
<vulnerable_code><commit_title>[PATCH 02/57] Process inline styles and scripts (#1456)<commit_description><fixed_code>
sideEffect('foo');
export default function foo(a) {
return a * a;
} |
<vulnerable_code><commit_title>[PATCH 02/57] Process inline styles and scripts (#1456)<commit_description><fixed_code>
export foo from './foo';
export bar from './bar'; |
<vulnerable_code> assert.deepEqual(output, 'bar');
});
it('missing exports should be replaced with an empty object', async function() {
let b = await bundle(
__dirname + '/integration/scope-hoisting/es6/empty-module/a.js'<commit_title>[PATCH 02/57] Process inline styles and scripts (#1456)<c... |
<vulnerable_code> try {
pkg = await this.readPackage(dir);
// First try loading package.main as a file, then try as a directory.
let main = this.getPackageMain(pkg);
let res =
(await this.loadAsFile(main, extensions, pkg)) ||
(await this.loadDirectory(main, extensions, pkg));... |
<vulnerable_code> assert.equal(resolved.pkg.name, 'package-browser');
});
it('should not resolve a node_modules package.browser main field with --target=node', async function() {
let resolver = new Resolver({
rootDir,<commit_title>[PATCH 02/57] Process inline styles and scripts (#1456)<commi... |
<vulnerable_code> }
if (t.isIdentifier(callee, {name: 'require'})) {
// Ignore require calls that were ignored earlier.
if (!asset.dependencies.has(args[0].value)) {
return;
}
p.isSequenceExpression()
);
if (!parent.isProgram() || bail) {
asset.dependenci... |
<vulnerable_code><commit_title>[PATCH 02/57] Process inline styles and scripts (#1456)<commit_description><fixed_code>
output = require('bar').foo(3) |
<vulnerable_code><commit_title>[PATCH 02/57] Process inline styles and scripts (#1456)<commit_description><fixed_code>
export default function bar() {
return 2;
} |
<vulnerable_code><commit_title>[PATCH 02/57] Process inline styles and scripts (#1456)<commit_description><fixed_code>
export default function foo(a) {
return a * a;
} |
<vulnerable_code> let output = await run(b);
assert.deepEqual(output, 3);
});
});
});<commit_title>[PATCH 02/57] Process inline styles and scripts (#1456)<commit_description><fixed_code>
let output = await run(b);
assert.deepEqual(output, 3);
});
it('should support sideEffects: fal... |
<vulnerable_code> }
addMapping(mapping, lineOffset = 0, columnOffset = 0) {
mapping.generated = {
line: mapping.generated.line + lineOffset,
column: mapping.generated.column + columnOffset
};
this.mappings.push(mapping);
}
addConsumerMapping(mapping, lineOffset = 0, columnOffset = 0) {... |
<vulnerable_code>const terser = require('../transforms/terser');
const SourceMap = require('../SourceMap');
const hoist = require('../scope-hoisting/hoist');
const IMPORT_RE = /\b(?:import\b|export\b|require\s*\()/;
const ENV_RE = /\b(?:process\.env)\b/;
const FS_RE = /\breadFileSync\b/;
const SW_RE = /\bnavigator\s*\... |
<vulnerable_code><commit_title>[PATCH 02/57] Process inline styles and scripts (#1456)<commit_description><fixed_code>
const sum = require('./sum');
module.exports = function() {
return sum(1, 2);
} |
<vulnerable_code><commit_title>[PATCH 02/57] Process inline styles and scripts (#1456)<commit_description><fixed_code>
// Generated by CoffeeScript 1.12.6
(function() {
module.exports = (function(_this) {
return function(a, b) {
return a + b;
};
})(this);
}).call(this);
//# sourceMappingURL=sum.map |
<vulnerable_code><commit_title>[PATCH 02/57] Process inline styles and scripts (#1456)<commit_description><fixed_code>
// Generated by CoffeeScript 2.3.1
(function() {
module.exports = (a, b) => {
return a + b;
};
}).call(this);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3V... |
<vulnerable_code> let map = (await fs.readFile(path.join(sourcemapReference))).toString();
mapValidator(jsOutput, map);
});
});<commit_title>[PATCH 02/57] Process inline styles and scripts (#1456)<commit_description><fixed_code>
let map = (await fs.readFile(path.join(sourcemapReference))).toString();
m... |
<vulnerable_code> }
async ensureDirExists() {
await fs.mkdirp(this.dir);
this.dirExists = true;
}
getCacheFile(filename) {
let hash = md5(this.optionsHash + filename);
return path.join(this.dir, hash + '.json');
}
async getLastModified(filename) {<commit_title>[PATCH 02/57] Process inline ... |
<vulnerable_code> let typescript = await localRequire('typescript', this.name);
let transpilerOptions = {
compilerOptions: {
module: typescript.ModuleKind.CommonJS,
jsx: typescript.JsxEmit.Preserve,
// it brings the generated output from TypeScript closer to that generated by Babel... |
<vulnerable_code> addMapping(mapping, lineOffset = 0, columnOffset = 0) {
this.mappings.push({
source: mapping.source,
original: mapping.original,
generated: {
line: mapping.generated.line + lineOffset,
this.mappings.push({
source: mapping.source,
original: {
line... |
<vulnerable_code>function middleware(bundler) {
const serve = serveStatic(bundler.options.outDir, {
index: false,
setHeaders: setHeaders
});
<commit_title>[PATCH 02/57] Process inline styles and scripts (#1456)<commit_description><fixed_code>
function middleware(bundler) {
const serve = serveStatic(bundle... |
<vulnerable_code> const cert = pki.createCertificate();
cert.publicKey = keys.publicKey;
cert.serialNumber = '01';
cert.validity.notBefore = new Date();
cert.validity.notAfter = new Date();
cert.validity.notAfter.setFullYear(cert.validity.notBefore.getFullYear() + 1);<commit_title>[PATCH 02/57] Process inli... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.