code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
/* Copyright 2015 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-20 | Python |
def index
valid_http_methods :get, :post, :put
# for permission check
if params[:package] and not ["_repository", "_jobhistory"].include?(params[:package])
pkg = DbPackage.get_by_project_and_name( params[:project], params[:package], use_source=false )
else
prj = DbProject.get_by_name params... | cwe | CWE-284 | Ruby |
static int oidc_handle_discovery_response(request_rec *r, oidc_cfg *c) {
/* variables to hold the values returned in the response */
char *issuer = NULL, *target_link_uri = NULL, *login_hint = NULL,
*auth_request_params = NULL, *csrf_cookie, *csrf_query = NULL,
*user = NULL, *path_scopes;
oidc_provider_t *pro... | cwe | CWE-601 | C/C++ |
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ignore
// +build aix
/*
Input to cgo -godefs. See also mkerrors.sh and mkall.sh
*/
// +godefs map struct_in_addr [4]byte /* in_addr */
// +godefs m... | cwe | CWE-287 | Go |
htmlGetText(tree_t *t) /* I - Tree to pick */
{
uchar *s, // String
*s2, // New string
*tdata = NULL, // Temporary string data
*talloc = NULL; // Allocated string data
size_t slen, // Length of string
tlen; // Length of node string
// Loop through all of the nodes in the tree and collect text...
... | cwe | CWE-787 | C/C++ |
async getFileData(filename: string) {
const bucket = await this._getBucket();
const stream = bucket.openDownloadStreamByName(filename);
stream.read();
return new Promise((resolve, reject) => {
const chunks = [];
stream.on('data', data => {
chunks.push(data);
});
stream.on... | cwe | CWE-1321 | JavaScript |
// 1. notebook change
// notebook一改变, 当前的肯定要保存, ajax是异步的. 此时先清空所有note信息. -> 得到该notebook的notes, 显示出来, 并选中第一个!
// 在这期间定时器还会保存, curNoteId还没换, 所以会清空curNoteId的content!!!
// 2. note change, save cur, 立即curNoteId = ""!!
// 3. 什么时候设置curNoteId? 是ajax得到内容之后设置
// note
Note.curNoteId = "";
Note.interval = ""; // 定时器
Note.note... | cwe | CWE-79 | JavaScript |
static int kvm_vm_ioctl_set_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps)
{
int start = 0;
u32 prev_legacy, cur_legacy;
mutex_lock(&kvm->arch.vpit->pit_state.lock);
prev_legacy = kvm->arch.vpit->pit_state.flags & KVM_PIT_FLAGS_HPET_LEGACY;
cur_legacy = ps->flags & KVM_PIT_FLAGS_HPET_LEGACY;
if (!prev_lega... | cwe | CWE-369 | C/C++ |
static unsigned long convert_eip_to_linear(struct task_struct *child, struct pt_regs *regs)
{
unsigned long addr, seg;
addr = regs->eip;
seg = regs->xcs & 0xffff;
if (regs->eflags & VM_MASK) {
addr = (addr & 0xffff) + (seg << 4);
return addr;
}
/*
* We'll assume that the code segments in the GDT
* are a... | cwe | CWE-20 | Unknown |
static int __init pcd_init(void)
{
struct pcd_unit *cd;
int unit;
if (disable)
return -EINVAL;
pcd_init_units();
if (pcd_detect())
return -ENODEV;
/* get the atapi capabilities page */
pcd_probe_capabilities();
if (register_blkdev(major, name)) {
for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd+... | cwe | CWE-476 | C/C++ |
int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
{
int i,n=0,len,nid, first, use_bn;
BIGNUM *bl;
unsigned long l;
const unsigned char *p;
char tbuf[DECIMAL_SIZE(i)+DECIMAL_SIZE(l)+2];
if ((a == NULL) || (a->data == NULL)) {
buf[0]='\0';
... | cwe | CWE-200 | Unknown |
/*
*
* Copyright 2019 Asylo 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 agree... | cwe | CWE-119 | C/C++ |
function readKey() {
let length = src[position++]
if (length >= 0xa0 && length < 0xc0) {
// fixstr, potentially use key cache
length = length - 0xa0
if (srcStringEnd >= position) // if it has been extracted, must use it (and faster anyway)
return srcString.slice(position - srcStringStart, (position += length... | cwe | CWE-674 | JavaScript |
/*
* Copyright (c) 2004-2021, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
* list of cond... | cwe | CWE-918 | Java |
static int vp8dx_decode_bool(BOOL_DECODER *br, int probability) {
unsigned int bit = 0;
VP8_BD_VALUE value;
unsigned int split;
VP8_BD_VALUE bigsplit;
int count;
unsigned int range;
split = 1 + (((br->range - 1) * probability) >> 8);
if (br->count < 0) vp8dx_bool_decoder_fill(br);
value = br->value... | cwe | CWE-125 | Unknown |
struct dump_dir *dd_opendir(const char *dir, int flags)
{
struct dump_dir *dd = dd_init();
dir = dd->dd_dirname = rm_trailing_slashes(dir);
struct stat stat_buf;
if (stat(dir, &stat_buf) != 0)
goto cant_access;
/* & 0666 should remove the executable bit */
dd->mode = (stat_buf.st_mode ... | cwe | CWE-20 | Unknown |
/*
* Copyright (c) 2019-2021 GeyserMC. http://geysermc.org
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy,... | cwe | CWE-287 | Java |
static int check_options(int argc, char **argv, char *operation)
{
int i= 0; // loop counter
int num_found= 0; // number of options found (shortcut loop)
char config_file[FN_REFLEN]; // configuration file name
char plugin_name[FN_REFLEN]; // plugin name
/* Form prefix strings ... | cwe | CWE-200 | Unknown |
int tls1_change_cipher_state(SSL *s, int which)
{
static const unsigned char empty[]="";
unsigned char *p,*mac_secret;
unsigned char *exp_label;
unsigned char tmp1[EVP_MAX_KEY_LENGTH];
unsigned char tmp2[EVP_MAX_KEY_LENGTH];
unsigned char iv1[EVP_MAX_IV_LENGTH*2];
unsigned char iv2[EVP_MAX_IV_LENGTH*2];
unsign... | cwe | CWE-310 | Unknown |
void Curl_detach_connnection(struct Curl_easy *data)
{
struct connectdata *conn = data->conn;
if(conn)
Curl_llist_remove(&conn->easyq, &data->conn_queue, NULL);
data->conn = NULL;
} | cwe | CWE-416 | Unknown |
/* 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-697 | Python |
spell_suggest(int count)
{
char_u *line;
pos_T prev_cursor = curwin->w_cursor;
char_u wcopy[MAXWLEN + 2];
char_u *p;
int i;
int c;
suginfo_T sug;
suggest_T *stp;
int mouse_used;
int need_cap;
int limit;
int selected = count;
int badlen = 0;
int msg_scroll_... | cwe | CWE-787 | C/C++ |
static bool TryParse(const char* inp, int length,
TypedValue* buf, Variant& out,
JSONContainerType container_type, bool is_tsimplejson) {
SimpleParser parser(inp, length, buf, container_type, is_tsimplejson);
bool ok = parser.parseValue();
parser.skipSpace();
... | cwe | CWE-125 | C/C++ |
def config_restore(params, request, session)
if params[:name]
code, response = send_request_with_token(
session, params[:name], 'config_restore', true,
{:tarball => params[:tarball]}
)
else
if not allowed_for_local_cluster(session, Permissions::FULL)
return 403, 'Permission denied'
... | cwe | CWE-384 | Ruby |
/* Copyright 2018 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-617 | Python |
/*
Copyright 2023 The Fluid 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, softw... | cwe | CWE-863 | Go |
static int efi_capsule_release(struct inode *inode, struct file *file)
{
struct capsule_info *cap_info = file->private_data;
kfree(cap_info->pages);
kfree(cap_info->phys);
kfree(file->private_data);
file->private_data = NULL;
return 0;
} | cwe | CWE-200 | Unknown |
bool AXARIAGridCell::isAriaRowHeader() const {
const AtomicString& role = getAttribute(HTMLNames::roleAttr);
return equalIgnoringCase(role, "rowheader");
} | cwe | CWE-254 | C/C++ |
function B(ia,ra,aa,ca,na){na||(ea.innerHTML="",M(),S=ia,Y=ca);var la=null;if(aa){la=document.createElement("table");
la.className="geTempDlgDiagramsListGrid";var qa=document.createElement("tr"),ta=document.createElement("th");ta.style.width="50%";ta.innerHTML=mxUtils.htmlEntities(mxResources.get("diagram"));qa.appendC... | cwe | CWE-94 | JavaScript |
static int bond_ipsec_add_sa(struct xfrm_state *xs)
{
struct net_device *bond_dev = xs->xso.dev;
struct bonding *bond;
struct slave *slave;
int err;
if (!bond_dev)
return -EINVAL;
rcu_read_lock();
bond = netdev_priv(bond_dev);
slave = rcu_dereference(bond->curr_active_slave);
xs->xso.real_dev = slave->dev;... | cwe | CWE-703 | C/C++ |
int kvm_iommu_map_guest(struct kvm *kvm)
{
int r;
if (!iommu_present(&pci_bus_type)) {
printk(KERN_ERR "%s: iommu not found\n", __func__);
return -ENODEV;
}
kvm->arch.iommu_domain = iommu_domain_alloc(&pci_bus_type);
if (!kvm->arch.iommu_domain)
return -ENOMEM;
if (!allow_unsafe_assigned_interrupts &&
... | cwe | CWE-264 | Unknown |
switch (yych) {
case 'a': goto yy25;
default: goto yy24;
} | cwe | CWE-787 | Unknown |
GF_Err infe_box_read(GF_Box *s, GF_BitStream *bs)
{
char *buf;
u32 buf_len, i, string_len, string_start;
GF_ItemInfoEntryBox *ptr = (GF_ItemInfoEntryBox *)s;
ISOM_DECREASE_SIZE(ptr, 4);
ptr->item_ID = gf_bs_read_u16(bs);
ptr->item_protection_index = gf_bs_read_u16(bs);
if (ptr->version == 2) {
ISOM_DECREASE_... | cwe | CWE-787 | Unknown |
var mxClient={VERSION:"19.0.1",IS_IE:null!=navigator.userAgent&&0<=navigator.userAgent.indexOf("MSIE"),IS_IE11:null!=navigator.userAgent&&!!navigator.userAgent.match(/Trident\/7\./),IS_EDGE:null!=navigator.userAgent&&!!navigator.userAgent.match(/Edge\//),IS_EM:"spellcheck"in document.createElement("textarea")&&8==docum... | cwe | CWE-94 | JavaScript |
static const struct usb_cdc_union_desc *
ims_pcu_get_cdc_union_desc(struct usb_interface *intf)
{
const void *buf = intf->altsetting->extra;
size_t buflen = intf->altsetting->extralen;
struct usb_cdc_union_desc *union_desc;
if (!buf) {
dev_err(&intf->dev, "Missing descriptor data\n");
return NULL;
}
if (!bu... | cwe | CWE-125 | Unknown |
static Image *ReadWEBPImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
Image
*image;
int
webp_status;
MagickBooleanType
status;
register unsigned char
*p;
size_t
length;
ssize_t
count,
y;
unsigned char
header[12],
*stream;
WebPDecoderConfig
... | cwe | CWE-119 | Unknown |
static int bmp_getint32(jas_stream_t *in, int_fast32_t *val)
{
int n;
uint_fast32_t v;
int c;
for (n = 4, v = 0;;) {
if ((c = jas_stream_getc(in)) == EOF) {
return -1;
}
v |= (c << 24);
if (--n <= 0) {
break;
}
v >>= 8;
}
if (val) {
*val = v;
}
return 0;
} | cwe | CWE-125 | Unknown |
/*
* Copyright (C) 2004-2018 ZNC, see the NOTICE file for details.
*
* 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 requi... | cwe | CWE-264 | C/C++ |
resolve_list_keys(struct lys_node_list *list, const char *keys_str)
{
int i, len, rc;
const char *value;
char *s = NULL;
struct ly_ctx *ctx = list->module->ctx;
for (i = 0; i < list->keys_size; ++i) {
assert(keys_str);
if (!list->child) {
/* no child, possible forward r... | cwe | CWE-119 | Unknown |
@app.route('/movies/search', methods=['GET', 'POST'])
def search_films():
form = SearchForm()
if not form.validate_on_submit():
return render_template('search.html', title='Search for films', form=form)
search_terms = form.data['term'].split(' ')
search_string = ' & '.join(search_terms)
cur.... | cwe | CWE-89 | Python |
static ssize_t k90_show_current_profile(struct device *dev,
struct device_attribute *attr,
char *buf)
{
int ret;
struct usb_interface *usbif = to_usb_interface(dev->parent);
struct usb_device *usbdev = interface_to_usbdev(usbif);
int current_profile;
char data[8];
ret = usb_control_msg(usbdev, usb_rcvc... | cwe | CWE-399 | Unknown |
asn1_oid_decode(struct asn1_ctx *ctx,
unsigned char *eoc, unsigned long **oid, unsigned int *len)
{
unsigned long subid;
unsigned int size;
unsigned long *optr;
size = eoc - ctx->pointer + 1;
*oid = kmalloc(size * sizeof(unsigned long), GFP_ATOMIC);
if (*oid == NULL)
return 0;
optr = *oid;
if (!asn1_subi... | cwe | CWE-119 | Unknown |
static int rawv6_recvmsg(struct kiocb *iocb, struct sock *sk,
struct msghdr *msg, size_t len,
int noblock, int flags, int *addr_len)
{
struct ipv6_pinfo *np = inet6_sk(sk);
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)msg->msg_name;
struct sk_buff *skb;
size_t copied;
int err;
if (flags & MSG_OOB)
... | cwe | CWE-20 | Unknown |
ALGnew(PyObject *self, PyObject *args, PyObject *kwdict)
{
unsigned char *key, *IV;
ALGobject * new=NULL;
int keylen, IVlen=0, mode=MODE_ECB, segment_size=0;
PyObject *counter = NULL;
int counter_shortcut = 0;
#ifdef PCT_ARC2_MODULE
int effective_keylen = 1024; /* this is a weird default, but it's compa... | cwe | CWE-787 | C/C++ |
int
http_message_needs_eof (const http_parser *parser)
{
if (parser->type == HTTP_REQUEST) {
return 0;
}
/* See RFC 2616 section 4.4 */
if (parser->status_code / 100 == 1 || /* 1xx e.g. Continue */
parser->status_code == 204 || /* No Content */
parser->status_code == 304 || /* Not Modif... | cwe | CWE-444 | Unknown |
get_next_reel (int tape_des)
{
static int reel_number = 1;
FILE *tty_in; /* File for interacting with user. */
FILE *tty_out; /* File for interacting with user. */
int old_tape_des;
char *next_archive_name;
dynamic_string new_name;
char *str_res;
ds_init (&new_name, 128);
/* Open files for inte... | cwe | CWE-190 | Unknown |
int TLSOutStream::writeTLS(const U8* data, int length)
{
int n;
n = gnutls_record_send(session, data, length);
if (n == GNUTLS_E_INTERRUPTED || n == GNUTLS_E_AGAIN)
return 0;
if (n < 0)
throw TLSException("writeTLS", n);
return n;
} | cwe | CWE-122 | C/C++ |
"""
HTTP basic auth downloader middleware
See documentation in docs/topics/downloader-middleware.rst
"""
from w3lib.http import basic_auth_header
from scrapy import signals
class HttpAuthMiddleware(object):
"""Set Basic HTTP Authorization header
(http_user and http_pass spider class attributes)"""
@cl... | cwe | CWE-200 | Python |
MG_INTERNAL int parse_mqtt(struct mbuf *io, struct mg_mqtt_message *mm) {
uint8_t header;
size_t len = 0, len_len = 0;
const char *p, *end;
unsigned char lc = 0;
int cmd;
if (io->len < 2) return MG_MQTT_ERROR_INCOMPLETE_MSG;
header = io->buf[0];
cmd = header >> 4;
/* decode mqtt variable length */
... | cwe | CWE-284 | Unknown |
static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
const struct dp_upcall_info *upcall_info)
{
struct ovs_header *upcall;
struct sk_buff *nskb = NULL;
struct sk_buff *user_skb; /* to be queued to userspace */
struct nlattr *nla;
struct genl_info info = {
.dst_sk = ovs_dp_get_net(dp... | cwe | CWE-416 | Unknown |
"""Domain related views."""
from functools import reduce
from reversion import revisions as reversion
from django.contrib.auth import mixins as auth_mixins
from django.contrib.auth.decorators import (
login_required, permission_required, user_passes_test
)
from django.db.models import Q, Sum
from django.http imp... | cwe | CWE-352 | Python |
static void nfs4_xdr_enc_getacl(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_getaclargs *args)
{
struct compound_hdr hdr = {
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
};
uint32_t replen;
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh... | cwe | CWE-703 | Unknown |
/* global host, bridge, data, context */
'use strict';
const {
Object: localObject,
Array: localArray,
Error: LocalError,
Reflect: localReflect,
Proxy: LocalProxy,
WeakMap: LocalWeakMap,
Function: localFunction,
Promise: localPromise,
eval: localEval
} = global;
const {
freeze: localObjectFreeze
} = localO... | cwe | CWE-74 | JavaScript |
static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid,
unsigned int epid, unsigned int streamid)
{
XHCIEPContext *epctx;
assert(slotid >= 1 && slotid <= xhci->numslots);
assert(epid >= 1 && epid <= 31);
if (!xhci->slots[slotid-1].enabled) {
DPRINTF("xhci: xhci_... | cwe | CWE-835 | Unknown |
import os
from typing import List, Tuple
from paste import request
from paste.fileapp import FileApp
from paste.httpheaders import ETAG
from paste.urlparser import StaticURLParser
class CacheableStaticURLParser(StaticURLParser):
def __init__(self, directory, cache_seconds=None, directory_per_host=None):
... | cwe | CWE-22 | Python |
function Ut(e){if(!Ht(e)||rt(e)!=b)return!1;var t=pe(e);if(null===t)return!0;var n=ae.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&oe.call(n)==le} | cwe | CWE-79 | JavaScript |
/* nbdkit
* Copyright (C) 2013-2019 Red Hat Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the f... | cwe | CWE-617 | C/C++ |
public function get($id)
{
if (!is_numeric($id)) {
$this->errors[] = _T("ID must be an integer!");
return false;
}
try {
$select = $this->zdb->select($this->table);
$select->where($this->fpk . '=' . $id);
$results = $this->zdb->ex... | cwe | CWE-89 | PHP |
bool f_libxml_disable_entity_loader(bool disable /* = true */) {
xmlParserInputBufferCreateFilenameFunc old;
if (disable) {
old = xmlParserInputBufferCreateFilenameDefault(hphp_libxml_input_buffer_noload);
} else {
old = xmlParserInputBufferCreateFilenameDefault(nullptr);
}
return (old == hphp_libxml... | cwe | CWE-94 | Unknown |
QPDF::calculateHSharedObject(
std::map<int, QPDFXRefEntry> const& xref,
std::map<int, qpdf_offset_t> const& lengths,
std::map<int, int> const& obj_renumber)
{
CHSharedObject& cso = this->m->c_shared_object_data;
std::vector<CHSharedObjectEntry>& csoe = cso.entries;
HSharedObject& so = this->m->s... | cwe | CWE-787 | Unknown |
int sock_setsockopt(struct socket *sock, int level, int optname,
char __user *optval, unsigned int optlen)
{
struct sock *sk = sock->sk;
int val;
int valbool;
struct linger ling;
int ret = 0;
/*
* Options without arguments
*/
if (optname == SO_BINDTODEVICE)
return sock_bindtodevice(sk, optval, optl... | cwe | CWE-264 | C/C++ |
CursorImpl::IDBThreadHelper::~IDBThreadHelper() {
cursor_->RemoveCursorFromTransaction();
} | cwe | CWE-416 | C/C++ |
rndr_quote(struct buf *ob, const struct buf *text, void *opaque)
{
if (!text || !text->size)
return 0;
BUFPUTSL(ob, "<q>");
bufput(ob, text->data, text->size);
BUFPUTSL(ob, "</q>");
return 1;
} | cwe | CWE-79 | C/C++ |
MagickExport void ScaleResampleFilter(ResampleFilter *resample_filter,
const double dux,const double duy,const double dvx,const double dvy)
{
double A,B,C,F;
assert(resample_filter != (ResampleFilter *) NULL);
assert(resample_filter->signature == MagickCoreSignature);
resample_filter->limit_reached = Magick... | cwe | CWE-369 | C/C++ |
Response ServiceWorkerHandler::DeliverPushMessage(
const std::string& origin,
const std::string& registration_id,
const std::string& data) {
if (!enabled_)
return CreateDomainNotEnabledErrorResponse();
if (!process_)
return CreateContextErrorResponse();
int64_t id = 0;
if (!base::Strin... | cwe | CWE-20 | C/C++ |
function(c,l,x){return tb(c,["width"],l,function(p,v,A,B,ha){ha=c.shape.getEdgeWidth()*c.view.scale+x;return new mxPoint(B.x+v*p/4+A*ha/2,B.y+A*p/4-v*ha/2)},function(p,v,A,B,ha,K){p=Math.sqrt(mxUtils.ptSegDistSq(B.x,B.y,ha.x,ha.y,K.x,K.y));c.style.width=Math.round(2*p)/c.view.scale-x})},tb=function(c,l,x,p,v){return fb... | cwe | CWE-20 | JavaScript |
fileprivate func asByteBufferBounds(withMaxSize size: Int) -> (offset: Int64, byteCount: Int) {
switch self {
case .start(let value):
return (offset: numericCast(value), byteCount: size - value)
case .tail(let value):
return (offset: numericCast(size - val... | cwe | CWE-190 | Swift |
int main(int argc, char **argv) {
FILE *infile = NULL;
vpx_codec_ctx_t codec = {0};
vpx_codec_enc_cfg_t cfg = {0};
int frame_count = 0;
vpx_image_t raw = {0};
vpx_codec_err_t res;
VpxVideoInfo info = {0};
VpxVideoWriter *writer = NULL;
const VpxInterface *encoder = NULL;
const int fps = 2; ... | cwe | CWE-119 | C/C++ |
PHP_FUNCTION(imagetruecolortopalette)
{
zval *IM;
zend_bool dither;
zend_long ncolors;
gdImagePtr im;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rbl", &IM, &dither, &ncolors) == FAILURE) {
return;
}
if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
RETURN_FALSE;
}
if (... | cwe | CWE-787 | C/C++ |
@endpoints.route("/h2h")
def h2h():
if db == None:
init()
player1 = request.args.get('tag1', default="christmasmike")
player2 = request.args.get('tag2', default="christmasmike")
sql = "SELECT * FROM matches WHERE (player1 = '"+str(player1)+"' OR "\
+"player2 = '"+str(player1)+"') AN... | cwe | CWE-89 | Python |
ngx_mail_core_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
{
ngx_mail_core_srv_conf_t *prev = parent;
ngx_mail_core_srv_conf_t *conf = child;
ngx_conf_merge_msec_value(conf->timeout, prev->timeout, 60000);
ngx_conf_merge_msec_value(conf->resolver_timeout, prev->resolver_timeout,
... | cwe | CWE-295 | Unknown |
MagickPrivate MagickBooleanType OpenModule(const char *module,
ExceptionInfo *exception)
{
char
module_name[MagickPathExtent],
name[MagickPathExtent],
path[MagickPathExtent];
MagickBooleanType
status;
ModuleHandle
handle;
ModuleInfo
*module_info;
PolicyRights
rights;
const... | cwe | CWE-668 | C/C++ |
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
const TfLiteTensor* input = GetInput(context, node, kInputTensor);
TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
TF_LITE_ENSURE_EQ(context, NumInputs(node), 1);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
TF_LITE_ENSURE_TY... | cwe | CWE-787 | C/C++ |
static int __key_instantiate_and_link(struct key *key,
struct key_preparsed_payload *prep,
struct key *keyring,
struct key *authkey,
struct assoc_array_edit **_edit)
{
int ret, awaken;
key_check(key);
key_check(keyring);
awaken = 0;
ret = -EBUSY;
mutex_lock(&key_construc... | cwe | CWE-20 | C/C++ |
#include "Note.hpp"
#include "prf.h"
#include "crypto/sha256.h"
#include "random.h"
#include "version.h"
#include "streams.h"
#include "zcash/util.h"
#include "librustzcash.h"
using namespace libzcash;
SproutNote::SproutNote() {
a_pk = random_uint256();
rho = random_uint256();
r = random_uint256();
}
u... | cwe | CWE-755 | C/C++ |
static MagickBooleanType IsWEBPImageLossless(const unsigned char *stream,
const size_t length)
{
#define VP8_CHUNK_INDEX 15
#define LOSSLESS_FLAG 'L'
#define EXTENDED_HEADER 'X'
#define VP8_CHUNK_HEADER "VP8"
#define VP8_CHUNK_HEADER_SIZE 3
#define RIFF_HEADER_SIZE 12
#define VP8X_CHUNK_SIZE 10
#define TAG_SIZ... | cwe | CWE-125 | Unknown |
/*
* Copyright (C) 2016 Southern Storm Software, Pty Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, ... | cwe | CWE-119 | Java |
// Copyright 2019 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License... | cwe | CWE-400 | Go |
void Polygon::Insert( sal_uInt16 nPos, const Point& rPt )
{
ImplMakeUnique();
if( nPos >= mpImplPolygon->mnPoints )
nPos = mpImplPolygon->mnPoints;
mpImplPolygon->ImplSplit( nPos, 1 );
mpImplPolygon->mpPointAry[ nPos ] = rPt;
} | cwe | CWE-787 | C/C++ |
Menus.prototype.addInsertTableItem = function(menu, insertFn, parent, showOptions)
{
showOptions = (showOptions != null) ? showOptions : true;
insertFn = (insertFn != null) ? insertFn : mxUtils.bind(this, function(evt, rows, cols)
{
var graph = this.editorUi.editor.graph;
var td = graph.getParentByName(mxEvent.... | cwe | CWE-94 | JavaScript |
urnParseReply(const char *inbuf, const HttpRequestMethod& m)
{
char *buf = xstrdup(inbuf);
char *token;
url_entry *list;
url_entry *old;
int n = 32;
int i = 0;
debugs(52, 3, "urnParseReply");
list = (url_entry *)xcalloc(n + 1, sizeof(*list));
for (token = strtok(buf, crlf); token; t... | cwe | CWE-401 | C/C++ |
TfLiteStatus GreaterEval(TfLiteContext* context, TfLiteNode* node) {
const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1);
const TfLiteTensor* input2 = GetInput(context, node, kInputTensor2);
TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
bool requires_broadcast = !HaveSameShapes... | cwe | CWE-125 | C/C++ |
// SPDX-License-Identifier: GPL-2.0-only
#include <crypto/hash.h>
#include <linux/export.h>
#include <linux/bvec.h>
#include <linux/fault-inject-usercopy.h>
#include <linux/uio.h>
#include <linux/pagemap.h>
#include <linux/highmem.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/splice.h>
#include ... | cwe | CWE-665 | C/C++ |
int perf_event_task_enable(void)
{
struct perf_event *event;
mutex_lock(¤t->perf_event_mutex);
list_for_each_entry(event, ¤t->perf_event_list, owner_entry)
perf_event_for_each_child(event, perf_event_enable);
mutex_unlock(¤t->perf_event_mutex);
return 0;
} | cwe | CWE-264 | C/C++ |
void VaapiVideoDecodeAccelerator::VaapiH264Accelerator::FillVAPicture(
VAPictureH264* va_pic,
scoped_refptr<H264Picture> pic) {
VASurfaceID va_surface_id = VA_INVALID_SURFACE;
if (!pic->nonexisting) {
scoped_refptr<VaapiDecodeSurface> dec_surface =
H264PictureToVaapiDecodeSurface(pic);
... | cwe | CWE-362 | C/C++ |
Header readHeader(BasicIo& io)
{
byte header[2];
io.read(header, 2);
ByteOrder byteOrder = invalidByteOrder;
if (header[0] == 'I' && header[1] == 'I')
byteOrder = littleEndian;
else if (header[0] == 'M' && header[1] == 'M')
... | cwe | CWE-617 | C/C++ |
static int DoPamAuth(struct pam_handle* pamh,
const char* username,
std::string& authenticated_username)
{
int err = pam_set_item(pamh, PAM_RUSER, username);
if (err != PAM_SUCCESS) {
Dmsg1(debuglevel, "PAM set_item failed: %s\n", pam_strerror(pamh, err));
return er... | cwe | CWE-284 | Unknown |
static __inline__ int cbq_dump_ovl(struct sk_buff *skb, struct cbq_class *cl)
{
unsigned char *b = skb->tail;
struct tc_cbq_ovl opt;
opt.strategy = cl->ovl_strategy;
opt.priority2 = cl->priority2+1;
opt.penalty = (cl->penalty*1000)/HZ;
RTA_PUT(skb, TCA_CBQ_OVL_STRATEGY, sizeof(opt), &opt);
return skb->len;
rt... | cwe | CWE-200 | Unknown |
connection.query("SELECT * FROM Skills WHERE soc = '" + soc + "'", function(err, rows, fields) {
if (err === null && rows.length == 1) {
successNext(rows[0]);
} else {
successNext(null);
}
}); | cwe | CWE-89 | JavaScript |
TfLiteStatus EvalQuantized(TfLiteContext* context, TfLiteNode* node,
OpData* data, const RuntimeShape& lhs_shape,
const TfLiteTensor* lhs,
const RuntimeShape& rhs_shape,
const TfLiteTensor* rhs, TfLiteTensor* out... | cwe | CWE-787 | C/C++ |
/*
* EJS Embedded JavaScript templates
* Copyright 2112 Matthew Eernisse (mde@fleegix.org)
*
* 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/L... | cwe | CWE-79 | JavaScript |
/*
* card-muscle.c: Support for MuscleCard Applet from musclecard.com
*
* Copyright (C) 2006, Identity Alliance, Thomas Harning <support@identityalliance.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by t... | cwe | CWE-119 | C/C++ |
func (m *wrappedMAC) VerifyMAC(mac, data []byte) error {
// This also rejects raw MAC with size of 4 bytes or fewer. Those MACs are
// clearly insecure, thus should be discouraged.
prefixSize := cryptofmt.NonRawPrefixSize
if len(mac) <= prefixSize {
return errInvalidMAC
}
// try non raw keys
prefix := mac[:pr... | cwe | CWE-681 | Go |
int main(int argc, char *argv[]) {
struct mschm_decompressor *chmd;
struct mschmd_header *chm;
struct mschmd_file *file, **f;
unsigned int numf, i;
setbuf(stdout, NULL);
setbuf(stderr, NULL);
user_umask = umask(0); umask(user_umask);
MSPACK_SYS_SELFTEST(i);
if (i) return 0;
if ((chmd = mspack_cre... | cwe | CWE-22 | Unknown |
static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
{
VirtIONet *n = opaque;
VirtIODevice *vdev = VIRTIO_DEVICE(n);
int ret, i, link_down;
if (version_id < 2 || version_id > VIRTIO_NET_VM_VERSION)
return -EINVAL;
ret = virtio_load(vdev, f);
if (ret) {
return r... | cwe | CWE-119 | Unknown |
static int wc_ecc_make_pub_ex(ecc_key* key, ecc_curve_spec* curveIn,
ecc_point* pubOut)
{
int err = MP_OKAY;
#ifndef WOLFSSL_ATECC508A
#ifndef WOLFSSL_SP_MATH
ecc_point* base = NULL;
#endif
ecc_point* pub;
DECLARE_CURVE_SPECS(curve, ECC_CURVE_FIELD_COUNT);
#endif /* !WOLFSSL_ATECC508A */
if... | cwe | CWE-203 | C/C++ |
/*
* The MIT License (MIT)
*
* Copyright (c) 2016 Ferenc Karsany
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* us... | cwe | CWE-89 | Java |
"""Fork of urllib2.
When reading this, don't assume that all code in here is reachable. Code in
the rest of mechanize may be used instead.
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Python
Software Foundation; All Rights Reserved
Copyright 2002-2009 John J Lee <jjl@pobox.com>
This code is f... | cwe | CWE-1333 | Python |
int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
{
flush_fp_to_thread(src);
flush_altivec_to_thread(src);
flush_vsx_to_thread(src);
flush_spe_to_thread(src);
*dst = *src;
clear_task_ebb(dst);
return 0;
} | cwe | CWE-20 | C/C++ |
static int snd_ctl_tlv_ioctl(struct snd_ctl_file *file,
struct snd_ctl_tlv __user *_tlv,
int op_flag)
{
struct snd_card *card = file->card;
struct snd_ctl_tlv tlv;
struct snd_kcontrol *kctl;
struct snd_kcontrol_volatile *vd;
unsigned int len;
int err = 0;
... | cwe | CWE-416 | C/C++ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.