code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
private int
mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
size_t nbytes, size_t o, unsigned int cont_level, int mode, int text,
int flip, int recursion_level, int *printed_something,
int *need_separator, int *returnval)
{
uint32_t soffset, offset = ms->offset;
uint32_t count = m->str... | vuln | Vulnerable | C/C++ |
cvt_whole_image( TIFF *in, TIFF *out )
{
uint32* raster; /* retrieve RGBA image */
uint32 width, height; /* image width & height */
uint32 row;
size_t pixel_count;
TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &width);
TIFFGetField(in, TIFFTAG_IMAGELENGTH, &height);
pixel_count = width... | cwe | CWE-119 | Unknown |
function o(){var b,c,d,e;return b=vc,c=vc,58===a.charCodeAt(vc)?(d=na,vc++):(d=X,0===Bc&&g(oa)),d!==X?(e=v(),e!==X?(wc=c,d=pa(e),c=d):(vc=c,c=aa)):(vc=c,c=aa),c===X&&(c=ba),c!==X&&(wc=b,c=qa(c)),b=c} | cwe | CWE-1321 | JavaScript |
int parse_arguments(int *argc_p, const char ***argv_p)
{
static poptContext pc;
char *ref = lp_refuse_options(module_id);
const char *arg, **argv = *argv_p;
int argc = *argc_p;
int opt;
int orig_protect_args = protect_args;
if (ref && *ref)
set_refuse_options(ref);
if (am_daemon) {
set_refuse_options("log-... | vuln | Safe | Unknown |
# Copyright 2022, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | vuln | Safe | Python |
int git_pkt_parse_line(
git_pkt **head, const char *line, const char **out, size_t bufflen)
{
int ret;
int32_t len;
/* Not even enough for the length */
if (bufflen > 0 && bufflen < PKT_LEN_SIZE)
return GIT_EBUFS;
len = parse_len(line);
if (len < 0) {
/*
* If we fail to parse the length, it might be bec... | vuln | Vulnerable | Unknown |
/*
Copyright 2015 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | cwe | CWE-863 | Go |
static SSL_CTX *init_tls_ctx(EAP_TLS_CONF *conf)
{
SSL_METHOD *meth;
SSL_CTX *ctx;
X509_STORE *certstore;
int verify_mode = SSL_VERIFY_NONE;
int ctx_options = 0;
int type;
/*
* Bug fix
* http://old.nabble.com/Backward-compatibility-of-private-key-files--td27937046.html
*/
OpenSSL_add_all_algorithms();
... | cwe | CWE-295 | Unknown |
xmlBufferAdd(xmlBufferPtr buf, const xmlChar *str, int len) {
unsigned int needSize;
if ((str == NULL) || (buf == NULL)) {
return -1;
}
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1;
if (len < -1) {
#ifdef DEBUG_BUFFER
xmlGenericError(xmlGenericErrorContext,
"xmlBufferAdd: len ... | cwe | CWE-190 | Unknown |
viewController.getData = function (request, cb) {
async.parallel(
[
function (callback) {
if (global.env === 'development') {
require('../../sass/buildsass').build(callback)
} else {
return callback()
}
},
function (callback) {
async.parallel(
... | cwe | CWE-521 | JavaScript |
/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | cwe | CWE-369 | Python |
(function()
{
Sidebar.prototype.addInfographicPalette = function()
{
var w = 100;
var h = 100;
var s = 'whiteSpace=wrap;html=1;shape=mxgraph.infographic.';
var s2 = mxConstants.STYLE_VERTICAL_LABEL_POSITION + '=bottom;' + mxConstants.STYLE_VERTICAL_ALIGN + '=top;html=1;shape=mxgraph.infographic.';
var s3 = ... | cwe | CWE-284 | Java |
package server
import (
"context"
"encoding/json"
"fmt"
"time"
"github.com/pkg/errors"
"github.com/usememos/memos/api"
metric "github.com/usememos/memos/plugin/metrics"
"github.com/usememos/memos/server/profile"
"github.com/usememos/memos/store"
"github.com/usememos/memos/store/db"
"github.com/gorilla/ses... | vuln | Vulnerable | Go |
def shame_ask(name):
db = db_connect()
cursor = db.cursor()
try:
cursor.execute('''
SELECT shame FROM people WHERE name='{}'
'''.format(name))
shame = cursor.fetchone()
db.close()
if shame is None:
logger.debug('No shame found for name {}'.... | vuln | Vulnerable | Python |
@app.route('/quiz')
def quiz():
varga = request.args.get('varga')
try:
rows =[]
with sql.connect('amara.db') as con:
con.row_factory = sql.Row
cur = con.cursor()
cur.execute("select * from pada inner join mula on pada.sloka_line = mula.sloka_line where pada... | cwe | CWE-89 | Python |
static int decode_pce(AVCodecContext *avctx, MPEG4AudioConfig *m4ac,
enum ChannelPosition new_che_pos[4][MAX_ELEM_ID],
GetBitContext *gb)
{
int num_front, num_side, num_back, num_lfe, num_assoc_data, num_cc, sampling_index;
int comment_len;
skip_bits(gb, 2);
... | vuln | Vulnerable | C/C++ |
Prism.languages.hcl={comment:/(?:\/\/|#).*|\/\*[\s\S]*?(?:\*\/|$)/,heredoc:{pattern:/<<-?(\w+)[\s\S]*?^\s*\1/m,greedy:!0,alias:"string"},keyword:[{pattern:/(?:resource|data)\s+(?:"(?:\\[\s\S]|[^\\"])*")(?=\s+"[\w-]+"\s+{)/i,inside:{type:{pattern:/(resource|data|\s+)(?:"(?:\\[\s\S]|[^\\"])*")/i,lookbehind:!0,alias:"vari... | vuln | Safe | JavaScript |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.website.website_generator import WebsiteGenerator
from frappe.website.render import clear_cache
from frappe.utils import today, cin... | vuln | Safe | Python |
static MagickBooleanType WriteBMPImage(const ImageInfo *image_info,Image *image,
ExceptionInfo *exception)
{
BMPInfo
bmp_info;
BMPSubtype
bmp_subtype;
const char
*option;
const StringInfo
*profile;
MagickBooleanType
have_color_info,
status;
MagickOffsetType
scene;
Memor... | cwe | CWE-190 | Unknown |
jpc_mqdec_t *jpc_mqdec_create(int maxctxs, jas_stream_t *in)
{
jpc_mqdec_t *mqdec;
/* There must be at least one context. */
assert(maxctxs > 0);
/* Allocate memory for the MQ decoder. */
if (!(mqdec = jas_malloc(sizeof(jpc_mqdec_t)))) {
goto error;
}
mqdec->in = in;
mqdec->maxctxs = maxctxs;
/* Allocate m... | vuln | Safe | Unknown |
private void postLogin(User user) {
// At the end of this method execution new session and identity objects
// should properly create and initialized
// Destroy current session and session objects
externalContext.invalidateSession();
// Force to create new session
externalConte... | vuln | Safe | Java |
function peg$parsebodies() {
var s0, s1, s2, s3, s4, s5, s6, s7;
peg$silentFails++;
s0 = peg$currPos;
s1 = [];
s2 = peg$currPos;
s3 = peg$parseld();
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s4 = peg$c16;
peg$currPos++;
... | vuln | Vulnerable | JavaScript |
inline static void RENAME(hcscale)(uint16_t *dst, int dstWidth,
uint8_t *src1, uint8_t *src2, int srcW, int xInc)
{
#ifdef HAVE_MMX
if(sws_flags != SWS_FAST_BILINEAR || (!canMMX2BeUsed))
#else
if(sws_flags != SWS_FAST_BILINEAR)
#endif
{
RENAME(hScale)(dst , dstWidth, src1, srcW, xInc, hChrFil... | vuln | Vulnerable | C/C++ |
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | vuln | Safe | Python |
HexOutStream::writeBuffer() {
U8* pos = start;
while (pos != ptr) {
out_stream.check(2);
U8* optr = out_stream.getptr();
U8* oend = out_stream.getend();
size_t length = min(ptr-pos, (oend-optr)/2);
for (size_t i=0; i<length; i++) {
optr[i*2] = intToHex((pos[i] >> 4) & 0xf);
optr[i*2... | vuln | Safe | C/C++ |
void BrowserEventRouter::ExtensionActionExecuted(
Profile* profile,
const ExtensionAction& extension_action,
WebContents* web_contents) {
const char* event_name = NULL;
switch (extension_action.action_type()) {
case Extension::ActionInfo::TYPE_BROWSER:
event_name = "browserAction.onClicked";
... | cwe | CWE-264 | C/C++ |
/*
* wildmidi_lib.c -- Midi Wavetable Processing library
*
* Copyright (C) WildMIDI Developers 2001-2016
*
* This file is part of WildMIDI.
*
* WildMIDI is free software: you can redistribute and/or modify the player
* under the terms of the GNU General Public License and you can redistribute
* and/or modify t... | cwe | CWE-119 | C/C++ |
private void commitTransactions() {
LOG.debug("Committing batch transactions");
dataSourceMap.values().forEach(TransactionalDataSource::commit);
} | vuln | Safe | Java |
return { kind: 'redirect', to: `/signin?from=${encodeURIComponent(req!.url!)}` };
}
}; | cwe | CWE-79 | JavaScript |
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_home: { //Main view
showMenuHome();
break;
}
case R.id.menu_log: {
showDetailedLog();
bre... | vuln | Vulnerable | Java |
static ExitStatus gen_mtpr(DisasContext *ctx, TCGv vb, int regno)
{
int data;
switch (regno) {
case 255:
gen_helper_tbia(cpu_env);
break;
case 254:
gen_helper_tbis(cpu_env, vb);
break;
case 253:
{
TCGv_i32 tmp = tcg_const... | vuln | Safe | C/C++ |
static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env,
struct bpf_insn *insn,
const struct bpf_reg_state *ptr_reg,
const struct bpf_reg_state *off_reg)
{
struct bpf_reg_state *regs = cur_regs(env), *dst_reg;
bool known = tnum_is_const(off_reg->var_off);
s64 smin_val = off_reg->smin_val... | vuln | Vulnerable | C/C++ |
void *colo_process_incoming_thread(void *opaque)
{
MigrationIncomingState *mis = opaque;
QEMUFile *fb = NULL;
QIOChannelBuffer *bioc = NULL;
uint64_t total_size;
uint64_t value;
Error *local_err = NULL;
migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE,
MIGRATION_... | vuln | Vulnerable | C/C++ |
int dtls1_enc(SSL *s, int send)
{
SSL3_RECORD *rec;
EVP_CIPHER_CTX *ds;
unsigned long l;
int bs,i,j,k,mac_size=0;
const EVP_CIPHER *enc;
if (send)
{
if (EVP_MD_CTX_md(s->write_hash))
{
mac_size=EVP_MD_CTX_size(s->write_hash);
if (mac_size < 0)
return -1;
}
ds=s->enc_write_ctx;
rec= &(s->... | cwe | CWE-310 | Unknown |
static ssize_t acpi_table_aml_write(struct config_item *cfg,
const void *data, size_t size)
{
const struct acpi_table_header *header = data;
struct acpi_table *table;
int ret;
table = container_of(cfg, struct acpi_table, cfg);
if (table->header) {
pr_err("table already loaded\n");
return -EBUSY;
}
... | vuln | Vulnerable | C/C++ |
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2019 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
* Website: https://www.espocrm.com
*
* EspoCRM is free software: you can redistribute i... | cwe | CWE-79 | JavaScript |
function handleRequest(req, res) {
// express puts content after first slash into 0 index element
const path = req.params.path + req.params[0];
const attributeIds = sql.getColumn("SELECT attributeId FROM attributes WHERE isDeleted = 0 AND type = 'label' AND name IN ('customRequestHandler', 'customResource... | cwe | CWE-79 | JavaScript |
ldns_rr_new_frm_str_internal(ldns_rr **newrr, const char *str,
uint32_t default_ttl, const ldns_rdf *origin,
ldns_rdf **prev, bool question)
{
ldns_rr *new;
const ldns_rr_descriptor *desc;
ldns_rr_type rr_type;
ldns_buffer *rr_buf = NULL;
ldns_buffer *rd_buf = NULL;
uint32_t ttl_val;
char *owner... | cwe | CWE-125 | C/C++ |
PHP_FUNCTION(bcpowmod)
{
char *left, *right, *modulous;
int left_len, right_len, modulous_len;
bc_num first, second, mod, result;
long scale = BCG(bc_precision);
int scale_int;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|l", &left, &left_len, &right, &right_len, &modulous, &modulous_len, &scale) ==... | cwe | CWE-20 | Unknown |
static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
MXFContext *mxf = s->priv_data;
KLVPacket klv;
int64_t essence_offset = 0;
mxf->last_forward_tell = INT64_MAX;
if (!mxf_read_sync(s->pb, mxf_header_partition_pack_key, 14)) {
av_log(s, AV_LOG_ERROR, "could not find head... | vuln | Vulnerable | C/C++ |
int ssl_parse_serverhello_tlsext(SSL *s, unsigned char **p, unsigned char *d,
int n, int *al)
{
unsigned short length;
unsigned short type;
unsigned short size;
unsigned char *data = *p;
int tlsext_servername = 0;
int renegotiate_seen = 0;
# ifndef OPENSSL_NO_NE... | cwe | CWE-190 | Unknown |
Try<JWT, JWTError> JWT::parse(const string& token, const string& secret)
{
const vector<string> components = strings::split(token, ".");
if (components.size() != 3) {
return JWTError(
"Expected 3 components in token, got " + stringify(components.size()),
JWTError::Type::INVALID_TOKEN);
}
T... | cwe | CWE-200 | C/C++ |
package eu.hinsch.spring.boot.actuator.logview;
import freemarker.template.Configuration;
import freemarker.template.TemplateException;
import org.apache.commons.io.IOUtils;
import org.springframework.boot.actuate.endpoint.Endpoint;
import org.springframework.boot.actuate.endpoint.mvc.MvcEndpoint;
import org.springfra... | cwe | CWE-22 | Java |
copy_rrset(const struct ub_packed_rrset_key* key, struct regional* region)
{
struct ub_packed_rrset_key* ck = regional_alloc(region,
sizeof(struct ub_packed_rrset_key));
struct packed_rrset_data* d;
struct packed_rrset_data* data = key->entry.data;
size_t dsize, i;
uint8_t* nextrdata;
/* derived from packed_rr... | vuln | Safe | Unknown |
package com.salesmanager.core.business.services.common.generic;
import java.io.Serializable;
import java.util.List;
import com.salesmanager.core.business.exception.ServiceException;
/**
* <p>Service racine pour la gestion des entités.</p>
*
* @param <T> type d'entité
*/
public interface SalesManagerEntityServic... | cwe | CWE-639 | Java |
static int hns_gmac_get_sset_count(int stringset)
{
if (stringset == ETH_SS_STATS)
return ARRAY_SIZE(g_gmac_stats_string);
return 0;
} | vuln | Vulnerable | Unknown |
def __call__(self, env, start_response):
try:
# Validate the method
method = env["REQUEST_METHOD"].upper()
if method != "POST":
raise HTTPException(405, "Method not allowed (%s)." % method)
# Parse the request
try:
leng... | cwe | CWE-20 | Python |
vlv_copy_down_controls(TALLOC_CTX *mem_ctx, struct ldb_control **controls)
{
struct ldb_control **new_controls;
unsigned int i, j, num_ctrls;
if (controls == NULL) {
return NULL;
}
for (num_ctrls = 0; controls[num_ctrls]; num_ctrls++);
new_controls = talloc_array(mem_ctx, struct ldb_control *, num_ctrls);
i... | cwe | CWE-416 | Unknown |
void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,
const char *name,
uint64_t ram_size)
{
uint64_t addr = 0;
int i;
if (nb_numa_nodes == 0 || !have_memdevs) {
allocate_system_memory_nonnuma(mr... | vuln | Safe | C/C++ |
public function scopeSearch(Builder $query, array $search = [])
{
if (empty($search)) {
return $query;
}
if (!array_intersect(array_keys($search), $this->searchable)) {
return $query;
}
return $query->where($search);
} | cwe | CWE-287 | PHP |
'use strict';
const Mailer = require('./mailer');
const shared = require('./shared');
const SMTPPool = require('./smtp-pool');
const SMTPTransport = require('./smtp-transport');
const SendmailTransport = require('./sendmail-transport');
const StreamTransport = require('./stream-transport');
const JSONTransport = requi... | cwe | CWE-74 | Java |
gst_h264_slice_parse_dec_ref_pic_marking (GstH264SliceHdr * slice,
GstH264NalUnit * nalu, NalReader * nr)
{
GstH264DecRefPicMarking *dec_ref_pic_m;
guint start_pos;
GST_DEBUG ("parsing \"Decoded reference picture marking\"");
start_pos = nal_reader_get_pos (nr);
dec_ref_pic_m = &slice->dec_ref_pic_mark... | vuln | Vulnerable | C/C++ |
// Copyright 2014 The Gogs Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package form
import (
"net/url"
"strings"
"github.com/go-macaron/binding"
"github.com/unknwon/com"
"gopkg.in/macaron.v1"
"gogs.io/gogs/internal/conf"... | cwe | CWE-918 | Go |
multi_process_incoming_link(struct multi_context *m, struct multi_instance *instance, const unsigned int mpp_flags)
{
struct gc_arena gc = gc_new();
struct context *c;
struct mroute_addr src, dest;
unsigned int mroute_flags;
struct multi_instance *mi;
bool ret = true;
bool floated = false;
... | cwe | CWE-476 | C/C++ |
static int tty_open(struct inode *inode, struct file *filp)
{
struct tty_struct *tty = NULL;
int noctty, retval;
struct tty_driver *driver;
int index;
dev_t device = inode->i_rdev;
unsigned saved_flags = filp->f_flags;
nonseekable_open(inode, filp);
retry_open:
noctty = filp->f_flags & O_NOCTTY;
index = -1;... | cwe | CWE-703 | C/C++ |
static target_ulong compute_tlbie_rb(target_ulong v, target_ulong r,
target_ulong pte_index)
{
target_ulong rb, va_low;
rb = (v & ~0x7fULL) << 16;
va_low = pte_index >> 3;
if (v & HPTE64_V_SECONDARY) {
va_low = ~va_low;
}
if (!(v & HPTE64_V_1TB_... | vuln | Vulnerable | C/C++ |
static void handle_PORT(ctrl_t *ctrl, char *str)
{
int a, b, c, d, e, f;
char addr[INET_ADDRSTRLEN];
struct sockaddr_in sin;
if (ctrl->data_sd > 0) {
uev_io_stop(&ctrl->data_watcher);
close(ctrl->data_sd);
ctrl->data_sd = -1;
}
/* Convert PORT command's argument to IP address + port */
sscanf(str, "%d,%d... | cwe | CWE-787 | C/C++ |
void WorkerProcessLauncher::Core::StopWorker() {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
if (launch_success_timer_->IsRunning()) {
launch_success_timer_->Stop();
launch_backoff_.InformOfRequest(false);
}
self_ = this;
ipc_enabled_ = false;
if (process_watcher_.GetWatchedO... | vuln | Vulnerable | C/C++ |
/*
* The Python Imaging Library.
* $Id: //modules/pil/libImaging/TiffDecode.c#1 $
*
* LibTiff-based Group3 and Group4 decoder
*
*
* started modding to use non-private tiff functions to port to libtiff 4.x
* eds 3/12/12
*
*/
#include "Imaging.h"
#ifdef HAVE_LIBTIFF
#ifndef uint
#define uint uint32
#endif
#... | cwe | CWE-125 | Python |
void Compute(OpKernelContext* context) override {
const auto& input = context->input(0);
auto flat_in = input.flat<tstring>();
int fixed_length;
const auto& length_input = context->input(1);
OP_REQUIRES(context, TensorShapeUtils::IsScalar(length_input.shape()),
errors::InvalidArgume... | cwe | CWE-665 | C/C++ |
TfLiteStatus ReluPrepare(TfLiteContext* context, TfLiteNode* node) {
ReluOpData* data = reinterpret_cast<ReluOpData*>(node->user_data);
TF_LITE_ENSURE_EQ(context, NumInputs(node), 1);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
const TfLiteTensor* input = GetInput(context, node, 0);
TfLiteTensor* output ... | cwe | CWE-787 | C/C++ |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may n... | cwe | CWE-668 | Java |
VirtIODevice *virtio_blk_init(DeviceState *dev, BlockConf *conf)
{
VirtIOBlock *s;
int cylinders, heads, secs;
static int virtio_blk_id;
DriveInfo *dinfo;
if (!conf->bs) {
error_report("virtio-blk-pci: drive property not set");
return NULL;
}
if (!bdrv_is_inserted(conf->bs)) ... | vuln | Safe | C/C++ |
def login():
data = request.get_json()
if not data:
data = request.values
if "user" in data and "pass" in data:
username = data["user"]
password = data["pass"]
if "remember" in data and data["remember"] in valid_boolean_trues:
remember = True
else:
... | vuln | Safe | Python |
private List<User> getFollowers(List<String> followerIds) {
return followerIds.stream()
.map(userId -> userRepository.findOneByUserId(userId.trim()))
.filter(Objects::nonNull)
.collect(toList());
} | vuln | Vulnerable | Java |
HexInStream::HexInStream(InStream& is, int bufSize_)
: bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_LEN), offset(0), in_stream(is)
{
ptr = end = start = new U8[bufSize];
} | vuln | Vulnerable | C/C++ |
protected void updateAlpha() {
int alpha = calculateAlpha();
getDrawable().setAlpha(alpha);
// this is necessary so that touches won't be intercepted if udfps is paused:
if (mPauseAuth && alpha == 0 && getParent() != null) {
((ViewGroup) getParent()).setVisibility(View.INVIS... | vuln | Safe | Java |
void Compute(OpKernelContext* ctx) override {
const Tensor& input_0 = ctx->input(0);
const Tensor& input_1 = ctx->input(1);
const Device& eigen_device = ctx->eigen_device<Device>();
bool error = false;
bool* const error_ptr = Functor::has_errors ? &error : nullptr;
// NOTE: Handle three simple ... | vuln | Vulnerable | C/C++ |
public void loadProfiles() {
if (!Files.exists(STORE_FILE)) {
return;
}
try {
// Get the profile data from the json file.
AccountStore store = JsonUtils.parse(GSON, STORE_FILE, AccountStore.class);
// TODO: create a migration system if this ever ... | vuln | Safe | Java |
function template(state, options) {
function tpl(expression, ...args) {
let last;
tpl.lines.push(
expression
.replace(/%i/g, () => 'i')
.replace(/\$(\d)/g, (match, index) => `${args[index - 1]}`)
.replace(/(%[sd])/g, () => {
if (args.length) {
last = args.s... | vuln | Vulnerable | JavaScript |
static int decode_frame(AVCodecContext *avctx,
void *data, int *got_frame,
AVPacket *avpkt)
{
SheerVideoContext *s = avctx->priv_data;
ThreadFrame frame = { .f = data };
AVFrame *p = data;
GetBitContext gb;
unsigned format;
int ret;
if (avpkt->... | vuln | Vulnerable | C/C++ |
/* jshint unused: false */
// eslint-disable-next-line no-unused-vars
/* global window, $, Backbone, document, d3, ReactDOM, React */
/* global arangoHelper, btoa, atob, _, frontendConfig */
(function () {
'use strict';
let isCurrentCoordinator = false;
window.Router = Backbone.Router.extend({
toUpdate: [],... | cwe | CWE-918 | C/C++ |
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | cwe | CWE-131 | Python |
private void registerApi1PhoneStateListener() {
Timber.d("Registering API 1 phone state listener");
boolean collectNeighboringCells = MyApplication.getPreferencesProvider().getCollectNeighboringCells();
measurementParser = new MeasurementParserFactory().CreateApi1Parser(transportMode.getAccuracy... | vuln | Safe | Java |
function checkPassword($username, $password)
{
$doUser = OA_Dal::factoryDO('users');
$doUser->username = strtolower($username);
$doUser->password = md5($password);
$doUser->find();
if ($doUser->fetch()) {
return $doUser;
} else {
return false;... | cwe | CWE-287 | PHP |
bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table,
bool *error_reported, vcol_init_mode mode)
{
CHARSET_INFO *save_character_set_client= thd->variables.character_set_client;
CHARSET_INFO *save_collation= thd->variables.collation_connection;
Query_arena *backup_stmt_arena_ptr= t... | cwe | CWE-416 | Unknown |
static unsigned long get_ctl_id_hash(const struct snd_ctl_elem_id *id)
{
int i;
unsigned long h;
h = id->iface;
h = MULTIPLIER * h + id->device;
h = MULTIPLIER * h + id->subdevice;
for (i = 0; id->name[i] && i < SNDRV_CTL_ELEM_ID_NAME_MAXLEN; i++)
h = MULTIPLIER * h + id->name[i];
h = MULTIPLIER * h + id->ind... | cwe | CWE-125 | C/C++ |
package com.salesmanager.shop.admin.controller.orders;
import com.salesmanager.core.business.services.catalog.product.PricingService;
import com.salesmanager.core.business.services.customer.CustomerService;
import com.salesmanager.core.business.services.order.OrderService;
import com.salesmanager.core.business.service... | vuln | Vulnerable | Java |
/*
* hmi.c -- Midi Wavetable Processing library
*
* Copyright (C) WildMIDI Developers 2001-2016
*
* This file is part of WildMIDI.
*
* WildMIDI is free software: you can redistribute and/or modify the player
* under the terms of the GNU General Public License and you can redistribute
* and/or modify the librar... | cwe | CWE-125 | C/C++ |
write_header( FT_Error error_code )
{
FT_Face face;
const char* basename;
const char* format;
error = FTC_Manager_LookupFace( handle->cache_manager,
handle->scaler.face_id, &face );
if ( error )
Fatal( "can't access font file" );
if ( !status... | cwe | CWE-120 | C/C++ |
void SoftAAC2::onQueueFilled(OMX_U32 /* portIndex */) {
if (mSignalledError || mOutputPortSettingsChange != NONE) {
return;
}
UCHAR* inBuffer[FILEREAD_MAX_LAYERS];
UINT inBufferLength[FILEREAD_MAX_LAYERS] = {0};
UINT bytesValid[FILEREAD_MAX_LAYERS] = {0};
List<BufferInfo *> &inQueue = getPortQueue(0);... | vuln | Vulnerable | Unknown |
@EventHandler(ignoreCancelled = true)
public void onPistonExtend(BlockPistonExtendEvent event) {
boolean undone = false;
// Immediately undo or commit any blocks involved
List<Block> blocks = new ArrayList<>(event.getBlocks());
// Look one past the line of moved blocks, in case it h... | vuln | Safe | Java |
static int svq1_motion_inter_4v_block(DSPContext *dsp, GetBitContext *bitbuf,
uint8_t *current, uint8_t *previous,
int pitch, svq1_pmv *motion, int x, int y)
{
uint8_t *src;
uint8_t *dst;
svq1_pmv mv;
svq1_pmv *pmv[4];
int i... | vuln | Vulnerable | C/C++ |
evbuffer_add_vprintf(struct evbuffer *buf, const char *fmt, va_list ap)
{
char *buffer;
size_t space;
int sz, result = -1;
va_list aq;
struct evbuffer_chain *chain;
EVBUFFER_LOCK(buf);
if (buf->freeze_end) {
goto done;
}
/* make sure that at least some space is available */
if ((chain = evbuffer_expand_... | cwe | CWE-189 | Unknown |
static int vhdx_open(BlockDriverState *bs, QDict *options, int flags,
Error **errp)
{
BDRVVHDXState *s = bs->opaque;
int ret = 0;
uint32_t i;
uint64_t signature;
s->bat = NULL;
s->first_visible_write = true;
qemu_co_mutex_init(&s->lock);
QLIST_INIT(&s->regions);
... | vuln | Safe | C/C++ |
static int __init acpi_custom_method_init(void)
{
if (!acpi_debugfs_dir)
return -ENOENT;
cm_dentry = debugfs_create_file("custom_method", S_IWUSR,
acpi_debugfs_dir, NULL, &cm_fops);
if (!cm_dentry)
return -ENODEV;
return 0;
} | cwe | CWE-264 | C/C++ |
static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
int closing, int tx_ring)
{
struct pgv *pg_vec = NULL;
struct packet_sock *po = pkt_sk(sk);
int was_running, order = 0;
struct packet_ring_buffer *rb;
struct sk_buff_head *rb_queue;
__be16 num;
int err = -EINVAL;
/* Added to avoid minimal... | vuln | Vulnerable | C/C++ |
static void tcx_init(target_phys_addr_t addr, int vram_size, int width,
int height, int depth)
{
DeviceState *dev;
SysBusDevice *s;
dev = qdev_create(NULL, "SUNW,tcx");
qdev_prop_set_taddr(dev, "addr", addr);
qdev_prop_set_uint32(dev, "vram_size", vram_size);
qdev_prop_set_u... | vuln | Safe | C/C++ |
public void overthrowLeader() {
if (isPlayer()) {
//session().status().loseOverthrown();
return;
}
leader = new Leader(this);
for (EmpireView view: empireViews()) {
if (view != null)
view.breakAllTreaties();
}
... | vuln | Safe | Java |
TfLiteStatus SimpleOpEval(TfLiteContext* context, TfLiteNode* node) {
const TfLiteTensor* input1 = tflite::GetInput(context, node, /*index=*/0);
const TfLiteTensor* input2 = tflite::GetInput(context, node, /*index=*/1);
TfLiteTensor* output = GetOutput(context, node, /*index=*/0);
int32_t* output_data = outpu... | cwe | CWE-125 | C/C++ |
function validateBaseUrl(url: string) {
// from this MIT-licensed gist: https://gist.github.com/dperini/729294
return /^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-... | vuln | Vulnerable | JavaScript |
def send_request(session, node, request, post=false, data={}, remote=true, raw_data=nil, timeout=30, cookies_data=nil)
cookies_data = {} if not cookies_data
begin
request = "/#{request}" if not request.start_with?("/")
# fix ipv6 address for URI.parse
node6 = node
if (node.include?(":") and ! node.... | cwe | CWE-384 | Ruby |
#
# Copyright (C) 2009-2020 the sqlparse authors and contributors
# <see AUTHORS file>
#
# This module is part of python-sqlparse and is released under
# the BSD License: https://opensource.org/licenses/BSD-3-Clause
from sqlparse import tokens
# object() only supports "is" and is useful as a marker
# use this marker ... | cwe | CWE-1333 | Python |
void InputConnectionImpl::CommitText(const base::string16& text,
int new_cursor_pos) {
StartStateUpdateTimer();
std::string error;
if (!ime_engine_->ClearComposition(input_context_id_, &error))
LOG(ERROR) << "ClearComposition failed: error=\"" << error << "\"";
if (IsC... | cwe | CWE-119 | Unknown |
static int
i915_gem_do_execbuffer(struct drm_device *dev, void *data,
struct drm_file *file,
struct drm_i915_gem_execbuffer2 *args,
struct drm_i915_gem_exec_object2 *exec)
{
drm_i915_private_t *dev_priv = dev->dev_private;
struct list_head objects;
struct eb_objects *eb;
struct drm_i915_g... | vuln | Vulnerable | C/C++ |
/**
* File: TGA Input
*
* Read TGA images.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include "gd_tga.h"
#include "gd.h"
#include "gd_errors.h"
#include "gdhelpers.h"
/*
Function: gdImageCreateFromTga
... | cwe | CWE-125 | C/C++ |
void CoordinatorImpl::PerformNextQueuedGlobalMemoryDump() {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
QueuedRequest* request = GetCurrentRequest();
if (request == nullptr)
return;
std::vector<QueuedRequestDispatcher::ClientInfo> clients;
for (const auto& kv : clients_) {
auto client_identity =... | vuln | Vulnerable | C/C++ |
package com.salesmanager.shop.admin.controller.products;
import com.salesmanager.core.business.services.catalog.category.CategoryService;
import com.salesmanager.core.business.services.catalog.product.ProductService;
import com.salesmanager.core.business.services.catalog.product.relationship.ProductRelationshipService... | cwe | CWE-639 | Java |
SYSCALL_DEFINE1(timer_getoverrun, timer_t, timer_id)
{
struct k_itimer *timr;
int overrun;
unsigned long flags;
timr = lock_timer(timer_id, &flags);
if (!timr)
return -EINVAL;
overrun = timr->it_overrun_last;
unlock_timer(timr, flags);
return overrun;
} | cwe | CWE-190 | Unknown |
static void xen_irq_init(unsigned irq)
{
struct irq_info *info;
#ifdef CONFIG_SMP
/* By default all event channels notify CPU#0. */
cpumask_copy(irq_get_affinity_mask(irq), cpumask_of(0));
#endif
info = kzalloc(sizeof(*info), GFP_KERNEL);
if (info == NULL)
panic("Unable to allocate metadata for IRQ%d\n", irq);
... | cwe | CWE-400 | Unknown |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.