code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
// Copyright (c) 2017 Sagar Gubbi. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package views
import (
"fmt"
"github.com/s-gv/orangeforum/models"
"github.com/s-gv/orangeforum/models/db"
"github.com/s-gv/orangeforum/templates"
"github... | cwe | CWE-601 | Go |
static __forceinline void draw_line(float *output, int x0, int y0, int x1, int y1, int n)
{
int dy = y1 - y0;
int adx = x1 - x0;
int ady = abs(dy);
int base;
int x=x0,y=y0;
int err = 0;
int sy;
#ifdef STB_VORBIS_DIVIDE_TABLE
if (adx < DIVTAB_DENOM && ady < DIVTAB_NUMER) {
if (dy < 0) {
... | cwe | CWE-787 | C/C++ |
static int wrap_nettle_hash_fast(gnutls_digest_algorithm_t algo,
const void *text, size_t text_size,
void *digest)
{
struct nettle_hash_ctx ctx;
int ret;
ret = _ctx_init(algo, &ctx);
if (ret < 0)
return gnutls_assert_val(ret);
ctx.update(&ctx, text_size, text);
ctx.digest(&ctx, ctx.length, digest);
... | cwe | CWE-476 | C/C++ |
private function __pullEvent($eventId, &$successes, &$fails, $eventModel, $server, $user, $jobId)
{
$event = $eventModel->downloadEventFromServer(
$eventId,
$server
);
if (!empty($event)) {
if ($this->__checkIfEventIsBlockedBeforePull($event)) {
... | cwe | CWE-269 | PHP |
static int perf_swevent_init(struct perf_event *event)
{
int event_id = event->attr.config;
if (event->attr.type != PERF_TYPE_SOFTWARE)
return -ENOENT;
/*
* no branch sampling for software events
*/
if (has_branch_stack(event))
return -EOPNOTSUPP;
switch (event_id) {
case PERF_COUNT_SW_CPU_CLOCK:
case... | cwe | CWE-189 | C/C++ |
static void vga_draw_graphic(VGACommonState *s, int full_update)
{
DisplaySurface *surface = qemu_console_surface(s->con);
int y1, y, update, linesize, y_start, double_scan, mask, depth;
int width, height, shift_control, line_offset, bwidth, bits;
ram_addr_t page0, page1;
DirtyBitmapSnapshot *snap =... | cwe | CWE-617 | Unknown |
public function rules()
{
return [
'name' => 'required',
'email' => 'required|email',
'address' => '',
'primary_number' => 'numeric',
'secondary_number' => 'numeric',
'password' => 'sometimes',
'password_confirmation' => 'so... | cwe | CWE-862 | PHP |
package com.ruoyi.common.exception.file;
import java.util.Arrays;
import org.apache.commons.fileupload.FileUploadException;
/**
* 文件上传 误异常类
*
* @author ruoyi
*/
public class InvalidExtensionException extends FileUploadException
{
private static final long serialVersionUID = 1L;
private String[] allowedE... | cwe | CWE-79 | Java |
ast_for_arguments(struct compiling *c, const node *n)
{
/* This function handles both typedargslist (function definition)
and varargslist (lambda definition).
parameters: '(' [typedargslist] ')'
typedargslist: (tfpdef ['=' test] (',' tfpdef ['=' test])* [',' [
'*' [tfpdef] (',' ... | cwe | CWE-125 | C/C++ |
Status SparseCountSparseOutputShapeFn(InferenceContext *c) {
auto rank = c->Dim(c->input(0), 1);
auto nvals = c->UnknownDim();
c->set_output(0, c->Matrix(nvals, rank)); // out.indices
c->set_output(1, c->Vector(nvals)); // out.values
c->set_output(2, c->Vector(rank)); // out.dense_shape
retu... | cwe | CWE-125 | C/C++ |
/*
* Unsquash a squashfs filesystem. This is a highly compressed read only
* filesystem.
*
* Copyright (c) 2021
* Phillip Lougher <phillip@squashfs.org.uk>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free... | cwe | CWE-22 | C/C++ |
package config
import (
"encoding/json"
"io/ioutil"
log "github.com/gophish/gophish/logger"
)
// AdminServer represents the Admin server configuration details
type AdminServer struct {
ListenURL string `json:"listen_url"`
UseTLS bool `json:"use_tls"`
CertPath string `json:"cert_path"`
KeyPath string `... | cwe | CWE-918 | Go |
int equalizer_get_parameter(effect_context_t *context, effect_param_t *p,
uint32_t *size)
{
equalizer_context_t *eq_ctxt = (equalizer_context_t *)context;
int voffset = ((p->psize - 1) / sizeof(int32_t) + 1) * sizeof(int32_t);
int32_t *param_tmp = (int32_t *)p->data;
int32_t param = *param_tmp++;
int32_t param2;
... | cwe | CWE-200 | C/C++ |
apr_byte_t oidc_cache_get(request_rec *r, const char *section, const char *key,
char **value) {
oidc_cfg *cfg = ap_get_module_config(r->server->module_config,
&auth_openidc_module);
int encrypted = oidc_cfg_cache_encrypt(r);
apr_byte_t rc = TRUE;
char *msg = NULL;
oidc_debug(r, "enter: %s (section=%s, decry... | cwe | CWE-330 | Unknown |
static void event_nick_invalid(IRC_SERVER_REC *server, const char *data)
{
if (!server->connected)
server_disconnect((SERVER_REC *) server);
} | cwe | CWE-476 | Unknown |
public function run()
{
if ($this->user->isCurrentUser() || \Yii::$app->user->isGuest) {
return;
}
// Add class for javascript handling
$this->followOptions['class'] .= ' followButton';
$this->unfollowOptions['class'] .= ' unfollowButton';
// Hide inacti... | cwe | CWE-79 | PHP |
/*
* Copyright (C) 2007 Martin Willi
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any ... | cwe | CWE-287 | C/C++ |
public function verifyDOMDocument($document)
{
$signatureNode = $this->locateSignature($document);
/**
* No signature was added, it should not fail as this is not a requirement on redirect bindings
*/
if (!$signatureNode) {
return true;
}
$this... | cwe | CWE-347 | PHP |
switch (type) {
#ifdef ELFCORE
case ET_CORE:
phnum = elf_getu16(swap, elfhdr.e_phnum);
if (phnum > ms->elf_phnum_max)
return toomany(ms, "program", phnum);
flags |= FLAGS_IS_CORE;
if (dophn_core(ms, clazz, swap, fd,
(off_t)elf_getu(swap, elfhdr.e_phoff), phnum,
(size_t)elf_getu16(swap, elfhdr.e_... | cwe | CWE-399 | Unknown |
void linsertCommand(client *c) {
int where;
robj *subject;
listTypeIterator *iter;
listTypeEntry entry;
int inserted = 0;
if (strcasecmp(c->argv[2]->ptr,"after") == 0) {
where = LIST_TAIL;
} else if (strcasecmp(c->argv[2]->ptr,"before") == 0) {
where = LIST_HEAD;
} else ... | cwe | CWE-190 | Unknown |
/************************************************************************
* 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 |
check_symlinks(struct archive_write_disk *a)
{
#if !defined(HAVE_LSTAT)
/* Platform doesn't have lstat, so we can't look for symlinks. */
(void)a; /* UNUSED */
return (ARCHIVE_OK);
#else
char *pn;
char c;
int r;
struct stat st;
/*
* Guard against symlink tricks. Reject any archive entry whose
... | cwe | CWE-19 | C/C++ |
$sanitized_description = $hp->purify($fileinfo->getDescription(), CODENDI_PURIFIER_CONVERT_HTML);
$link_show = '<a href="' . $query_link . '"' .
$this->getVisioningAttributeForLink($fileinfo, $read_only, $lytebox_id) . '
title="' . $sani... | cwe | CWE-79 | PHP |
load_image (const gchar *filename,
GError **error)
{
FILE *ifp;
gint depth, bpp;
gint32 image_ID;
L_XWDFILEHEADER xwdhdr;
L_XWDCOLOR *xwdcolmap = NULL;
ifp = g_fopen (filename, "rb");
if (!ifp)
{
g_set_error (error, G_FILE_ERROR, g_file_e... | cwe | CWE-787 | Unknown |
void diff_change(struct diff_options *options,
unsigned old_mode, unsigned new_mode,
const unsigned char *old_sha1,
const unsigned char *new_sha1,
const char *base, const char *path)
{
char concatpath[PATH_MAX];
struct diff_filespec *one, *two;
if (DIFF_OPT_TST(options, IGNORE_SUBMODULES) && S_ISGITLINK... | cwe | CWE-119 | C/C++ |
@Override
public File provide() throws IOException
{
File f = File.createTempFile(_prefix, _suffix);
f.deleteOnExit();
return f;
} | cwe | CWE-377 | Java |
_pixops_composite_real (guchar *dest_buf,
int render_x0,
int render_y0,
int render_x1,
int render_y1,
int dest_rowstride,
int dest_channels,
gboolean dest_has_alpha,
const guchar *src_buf,
int ... | cwe | CWE-119 | Unknown |
'use strict'
var join = require('path').join
var EventEmitter = require('events')
var pull = require('pull-stream')
var ref = require('ssb-ref')
var ssbKeys = require('ssb-keys')
var createDB = require('./db')
var extras = require('./extras')
var u = require('./util')
function isString (s) {
return typeof s === 's... | cwe | CWE-200 | JavaScript |
/* 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-754 | Python |
static int nr_getname(struct socket *sock, struct sockaddr *uaddr,
int *uaddr_len, int peer)
{
struct full_sockaddr_ax25 *sax = (struct full_sockaddr_ax25 *)uaddr;
struct sock *sk = sock->sk;
struct nr_sock *nr = nr_sk(sk);
lock_sock(sk);
if (peer != 0) {
if (sk->sk_state != TCP_ESTABLISHED) {
release_sock(... | cwe | CWE-200 | C/C++ |
def instantiate variant, mac=nil
# Filenames must end in a hex representation of a mac address but only if mac is not empty
log_halt 403, "Invalid MAC address: #{mac}" unless valid_mac?(mac) || mac.nil?
log_halt 403, "Unrecognized pxeboot config type: #{variant}" unless defined?... | cwe | CWE-284 | Ruby |
static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in,
BIGNUM **kinvp, BIGNUM **rp,
const unsigned char *dgst, int dlen)
{
BN_CTX *ctx = NULL;
BIGNUM *k, *kinv = NULL, *r = *rp;
BIGNUM *l, *m;
int ret = 0;
int q_bits;
if (!dsa->p || !dsa->q || !d... | cwe | CWE-327 | Unknown |
int __cil_build_ast_node_helper(struct cil_tree_node *parse_current, uint32_t *finished, void *extra_args)
{
struct cil_args_build *args = extra_args;
struct cil_db *db = args->db;
struct cil_tree_node *ast_current = args->ast;
struct cil_tree_node *tunif = args->tunif;
struct cil_tree_node *in = args->in;
struct... | cwe | CWE-125 | Unknown |
def render(self, request):
action = "download"
if "action" in request.args:
action = request.args["action"][0]
if "file" in request.args:
filename = request.args["file"][0].decode('utf-8', 'ignore').encode('utf-8')
filename = re.sub("^/+", "/", os.path.realpath(filename))
if not os.path.exists(filen... | cwe | CWE-22 | Python |
void jiffies_to_timeval(const unsigned long jiffies, struct timeval *value)
{
/*
* Convert jiffies to nanoseconds and separate with
* one divide.
*/
u64 nsec = (u64)jiffies * TICK_NSEC;
long tv_usec;
value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &tv_usec);
tv_usec /= NSEC_PER_USEC;
value->tv_usec =... | cwe | CWE-189 | Unknown |
function showallSubcategories() {
// global $db;
expHistory::set('viewable', $this->params);
// $parent = isset($this->params['cat']) ? $this->params['cat'] : expSession::get('catid');
$catid = expSession::get('catid');
$parent = !empty($catid) ? $catid : (!empty($this->params['ca... | cwe | CWE-89 | PHP |
static void* OGRExpatRealloc( void *ptr, size_t size )
{
if( CanAlloc(size) )
return realloc(ptr, size);
free(ptr);
return nullptr;
} | cwe | CWE-415 | C/C++ |
// Copyright 2019 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
/*
This program reads a file containing function prototypes
(like syscall_solaris.go) and generates system call bodies.
The prototypes are ... | cwe | CWE-287 | Go |
function showRenderMsg(msg)
{
prevDiv.style.background = 'transparent';
prevDiv.innerHTML = '';
var status = document.createElement('div');
status.className = 'odPreviewStatus';
mxUtils.write(status, msg);
prevDiv.appendChild(status);
spinner.stop();
} | cwe | CWE-94 | JavaScript |
public function renameRemote($oldName, $newName)
{
$this->run('remote', 'rename', $oldName, $newName);
return $this;
} | cwe | CWE-88 | PHP |
void gf_isom_cenc_get_default_info_internal(GF_TrackBox *trak, u32 sampleDescriptionIndex, u32 *container_type, Bool *default_IsEncrypted, u8 *crypt_byte_block, u8 *skip_byte_block, const u8 **key_info, u32 *key_info_size)
{
GF_ProtectionSchemeInfoBox *sinf;
//setup all default as not encrypted
if (default_IsEncry... | cwe | CWE-476 | C/C++ |
/*
** $Id: ldo.c $
** Stack and Call structure of Lua
** See Copyright Notice in lua.h
*/
#define ldo_c
#define LUA_CORE
#include "lprefix.h"
#include <setjmp.h>
#include <stdlib.h>
#include <string.h>
#include "lua.h"
#include "lapi.h"
#include "ldebug.h"
#include "ldo.h"
#include "lfunc.h"
#include "lgc.h"
#inc... | cwe | CWE-120 | C/C++ |
R_API RBinJavaAttrInfo *r_bin_java_inner_classes_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {
RBinJavaClassesAttribute *icattr;
RBinJavaAttrInfo *attr = NULL;
RBinJavaCPTypeObj *obj;
ut32 i = 0;
ut64 offset = 0, curpos;
attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);
offs... | cwe | CWE-122 | C/C++ |
parse_rockridge(struct archive_read *a, struct file_info *file,
const unsigned char *p, const unsigned char *end)
{
struct iso9660 *iso9660;
iso9660 = (struct iso9660 *)(a->format->data);
while (p + 4 <= end /* Enough space for another entry. */
&& p[0] >= 'A' && p[0] <= 'Z' /* Sanity-check 1st cha... | cwe | CWE-400 | C/C++ |
compute_O_value(std::string const& user_password,
std::string const& owner_password,
QPDF::EncryptionData const& data)
{
// Algorithm 3.3 from the PDF 1.7 Reference Manual
unsigned char O_key[OU_key_bytes_V4];
compute_O_rc4_key(user_password, owner_password, data, O_key);
char upass[key_bytes];
... | cwe | CWE-787 | Unknown |
// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
/* Copyright (c) 2019 Mellanox Technologies. */
#include <linux/mlx5/eswitch.h>
#include "dr_types.h"
#define DR_DOMAIN_SW_STEERING_SUPPORTED(dmn, dmn_type) \
((dmn)->info.caps.dmn_type##_sw_owner || \
((dmn)->info.caps.dmn_type##_sw_owner_v2 && \
(dmn)->info.... | cwe | CWE-476 | C/C++ |
ngx_http_lua_copy_request_headers(ngx_http_request_t *sr, ngx_http_request_t *r)
{
ngx_table_elt_t *header;
ngx_list_part_t *part;
ngx_uint_t i;
if (ngx_list_init(&sr->headers_in.headers, sr->pool, 20,
sizeof(ngx_table_elt_t)) ... | cwe | CWE-444 | C/C++ |
from vyper import ast as vy_ast
from vyper.address_space import CALLDATA, DATA, IMMUTABLES, MEMORY, STORAGE
from vyper.codegen.ir_node import Encoding, IRnode
from vyper.codegen.types import (
DYNAMIC_ARRAY_OVERHEAD,
ArrayLike,
BaseType,
ByteArrayLike,
DArrayType,
MappingType,
SArrayType,
... | cwe | CWE-190 | Python |
CreateForeignServer(CreateForeignServerStmt *stmt)
{
Relation rel;
Datum srvoptions;
Datum values[Natts_pg_foreign_server];
bool nulls[Natts_pg_foreign_server];
HeapTuple tuple;
Oid srvId;
Oid ownerId;
AclResult aclresult;
ObjectAddress myself;
ObjectAddress referenced;
ForeignDataWrapper *fdw;
rel ... | cwe | CWE-94 | Unknown |
static int jas_cmpxformseq_resize(jas_cmpxformseq_t *pxformseq, int n)
{
jas_cmpxform_t **p;
assert(n >= pxformseq->numpxforms);
p = (!pxformseq->pxforms) ? jas_malloc(n * sizeof(jas_cmpxform_t *)) :
jas_realloc(pxformseq->pxforms, n * sizeof(jas_cmpxform_t *));
if (!p) {
return -1;
}
pxformseq->pxforms = p;... | cwe | CWE-189 | Unknown |
int main(int argc, char ** argv)
{
int c;
unsigned long flags = MS_MANDLOCK;
char * orgoptions = NULL;
char * share_name = NULL;
const char * ipaddr = NULL;
char * uuid = NULL;
char * mountpoint = NULL;
char * options = NULL;
char * optionstail;
char * resolved_path = NULL;
char * temp;
char * dev_name;
in... | cwe | CWE-59 | C/C++ |
tt_face_load_kern( TT_Face face,
FT_Stream stream )
{
FT_Error error;
FT_ULong table_size;
FT_Byte* p;
FT_Byte* p_limit;
FT_UInt nn, num_tables;
FT_UInt32 avail = 0, ordered = 0;
/* the kern table is optional; exit silently if it is missing */
err... | cwe | CWE-125 | C/C++ |
static int decode_slice_header(H264Context *h, H264Context *h0)
{
unsigned int first_mb_in_slice;
unsigned int pps_id;
int ret;
unsigned int slice_type, tmp, i, j;
int last_pic_structure, last_pic_droppable;
int must_reinit;
int needs_reinit = 0;
int field_pic_flag, bottom_field_flag;
... | cwe | CWE-787 | Unknown |
PHP_FUNCTION(imageloadfont)
{
char *file;
int file_name, hdr_size = sizeof(gdFont) - sizeof(char *);
int ind, body_size, n = 0, b, i, body_size_check;
gdFontPtr font;
php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &file, &file_name) == FAILURE) {
... | cwe | CWE-200 | C/C++ |
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-125 | C/C++ |
static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
{
uchar *cursor = s->cur;
char *str, *ptr = NULL;
std:
s->tok = cursor;
s->len = 0;
#line 965 "ext/date/lib/parse_date.re"
#line 846 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
static const unsigned char yybm[] = {
0, 0, 0, ... | cwe | CWE-125 | C/C++ |
int pop_open_connection(struct PopAccountData *adata)
{
char buf[1024];
int rc = pop_connect(adata);
if (rc < 0)
return rc;
rc = pop_capabilities(adata, 0);
if (rc == -1)
goto err_conn;
if (rc == -2)
return -2;
#ifdef USE_SSL
/* Attempt STLS if available and desired. */
if (!adata->conn->... | cwe | CWE-94 | Unknown |
void ListenerImpl::listenCallback(evconnlistener*, evutil_socket_t fd, sockaddr* remote_addr,
int remote_addr_len, void* arg) {
ListenerImpl* listener = static_cast<ListenerImpl*>(arg);
// Wrap raw socket fd in IoHandle.
IoHandlePtr io_handle = SocketInterfaceSingleton::get().so... | cwe | CWE-400 | Unknown |
static ssize_t _epoll_readv(
oe_fd_t* desc,
const struct oe_iovec* iov,
int iovcnt)
{
ssize_t ret = -1;
epoll_t* file = _cast_epoll(desc);
void* buf = NULL;
size_t buf_size = 0;
if (!file || (iovcnt && !iov) || iovcnt < 0 || iovcnt > OE_IOV_MAX)
OE_RAISE_ERRNO(OE_EINVAL);
/... | cwe | CWE-200 | Unknown |
/**
* Copyright (c) 2006-2012, JGraph Ltd
*/
/**
* Constructs a new open dialog.
*/
var OpenDialog = function()
{
var iframe = document.createElement('iframe');
iframe.style.backgroundColor = 'transparent';
iframe.allowTransparency = 'true';
iframe.style.borderStyle = 'none';
iframe.style.borderWidth = '0px';
... | cwe | CWE-79 | JavaScript |
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Cliprdr common
*
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2015 Thincast Technologies GmbH
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
* Copyright 2019 Kobi Mizrachi <kmizrachi18@gmail.com>... | cwe | CWE-125 | C/C++ |
# 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, software
# d... | cwe | CWE-79 | Python |
/* quicklist.c - A doubly linked list of ziplists
*
* Copyright (c) 2014, Matt Stancliff <matt@genges.com>
* 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... | cwe | CWE-190 | C/C++ |
function errorHandler (er) {
log.disableProgress()
if (!npm.config || !npm.config.loaded) {
// logging won't work unless we pretend that it's ready
er = er || new Error('Exit prior to config file resolving.')
console.error(er.stack || er.message)
}
if (cbCalled) {
er = er || new Error('Callback... | cwe | CWE-532 | JavaScript |
_nc_find_user_entry(const char *string)
{
const HashData *data = _nc_get_hash_user();
int hashvalue;
struct user_table_entry const *ptr = 0;
struct user_table_entry const *real_table;
hashvalue = data->hash_of(string);
if (data->table_data[hashvalue] >= 0) {
real_table = _nc_get_userdefs_tab... | cwe | CWE-125 | Unknown |
package com.salesmanager.shop.admin.controller.shipping;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.inject.Inject;
import org.apache.commons.lang3.String... | cwe | CWE-639 | Java |
/* 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-190 | C/C++ |
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
TF_LITE_ENSURE_EQ(context, NumInputs(node), 2);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
const TfLiteTensor* params = GetInput(context, node, kParams);
const TfLiteTensor* indices = GetInput(context, node, kIndices);
TfLiteTensor* outpu... | cwe | CWE-787 | C/C++ |
asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid,
compat_long_t addr, compat_long_t data)
{
struct task_struct *child;
long ret;
if (request == PTRACE_TRACEME) {
ret = ptrace_traceme();
goto out;
}
child = ptrace_get_task_struct(pid);
if (IS_ERR(child)) {
ret = PTR_ERR(chil... | cwe | CWE-362 | C/C++ |
BGD_DECLARE(void) gdImagePngCtxEx (gdImagePtr im, gdIOCtx * outfile, int level)
{
int i, j, bit_depth = 0, interlace_type;
int width = im->sx;
int height = im->sy;
int colors = im->colorsTotal;
int *open = im->open;
int mapping[gdMaxColors]; /* mapping[gd_index] == png_index */
png_byte trans_values[256];
png_c... | cwe | CWE-415 | Unknown |
void isis_notif_lsp_error(const struct isis_circuit *circuit,
const uint8_t *lsp_id, const char *raw_pdu,
size_t raw_pdu_len,
__attribute__((unused)) uint32_t offset,
__attribute__((unused)) uint8_t tlv_type)
{
const char *xpath = "/frr-isisd:lsp-error-detected";
struct list *arguments = yang_data... | cwe | CWE-787 | Unknown |
/*
* Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd.
*
* Author: zccrs <zccrs@live.com>
*
* Maintainer: zccrs <zhangjide@deepin.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foun... | cwe | CWE-59 | C/C++ |
/* 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-476 | C/C++ |
NAN_METHOD(XmlDocument::FromHtml)
{
Nan::HandleScope scope;
v8::Local<v8::Object> options = Nan::To<v8::Object>(info[1]).ToLocalChecked();
v8::Local<v8::Value> baseUrlOpt = Nan::Get(options,
Nan::New<v8::String>("baseUrl").ToLocalChecked()).ToLocalChecked();
v8::Local<v8::Value> encodingOpt ... | cwe | CWE-20 | C/C++ |
WandPrivate MagickBooleanType CLIListOperatorImages(MagickCLI *cli_wand,
const char *option,const char *arg1n,const char *arg2n)
{
const char /* percent escaped versions of the args */
*arg1,
*arg2;
Image
*new_images;
MagickStatusType
status;
ssize_t
parse;
#define _image_info (... | cwe | CWE-399 | Unknown |
static char **split_line(const SERVER_REC *server, const char *line,
const char *target, int len)
{
const char *start = settings_get_str("split_line_start");
const char *end = settings_get_str("split_line_end");
gboolean onspace = settings_get_bool("split_line_on_space");
char *recoded_start = recode_out(server... | cwe | CWE-416 | Unknown |
parse_tsquery(char *buf,
PushFunction pushval,
Datum opaque,
bool isplain)
{
struct TSQueryParserStateData state;
int i;
TSQuery query;
int commonlen;
QueryItem *ptr;
ListCell *cell;
/* init state */
state.buffer = buf;
state.buf = buf;
state.state = (isplain) ? WAITSINGLEOPERAND : WAI... | cwe | CWE-189 | C/C++ |
function merge(dst, ...sources) {
for (src of sources) {
for (let key in src) {
let s = src[key], d = dst[key]
if (Object(s) == s && Object(d) === d) {
dst[key] = merge(d, s)
continue
}
dst[key] = src[key]
}
}
return dst
}
module.exports = mer... | cwe | CWE-1321 | JavaScript |
/*
* Timers abstract layer
* Copyright (c) by Jaroslav Kysela <perex@perex.cz>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at you... | cwe | CWE-20 | C/C++ |
find_file (const char *currpath, grub_fshelp_node_t currroot,
grub_fshelp_node_t *currfound,
struct grub_fshelp_find_file_closure *c)
{
#ifndef _MSC_VER
char fpath[grub_strlen (currpath) + 1];
#else
char *fpath = grub_malloc (grub_strlen (currpath) + 1);
#endif
char *name = fpath;
char *next;
enum grub_... | cwe | CWE-119 | C/C++ |
#include <qpdf/qpdf-config.h> // include first for large file support
#include <qpdf/QPDFWriter.hh>
#include <assert.h>
#include <qpdf/Pl_StdioFile.hh>
#include <qpdf/Pl_Count.hh>
#include <qpdf/Pl_Discard.hh>
#include <qpdf/Pl_RC4.hh>
#include <qpdf/Pl_AES_PDF.hh>
#include <qpdf/Pl_Flate.hh>
#include <qpdf/Pl_PNGFil... | cwe | CWE-399 | 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-20 | Python |
async fn(inputs, exits) {
const { currentUser } = this.req;
const { attachment, card, project } = await sails.helpers.attachments
.getProjectPath(inputs.id)
.intercept('pathNotFound', () => Errors.ATTACHMENT_NOT_FOUND);
const isBoardMember = await sails.helpers.users.isBoardMember(currentUser.... | cwe | CWE-22 | JavaScript |
/*
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/lice... | cwe | CWE-20 | C/C++ |
static Image *ReadPCDImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
Image
*image;
MagickBooleanType
status;
MagickOffsetType
offset;
MagickSizeType
number_pixels;
register ssize_t
i,
y;
register PixelPacket
*q;
register unsigned char
*c1,
*c2,
*... | cwe | CWE-120 | C/C++ |
def check_if_this_project_is_in_database(self, project_id):
self.cursor.execute("SELECT count(id) FROM projects where id = %s" % project_id)
return self.cursor.fetchall()[0][0] == 1 | cwe | CWE-89 | Python |
get_git_branch(wchar_t *dst, size_t size)
{
FILE *fp;
char *c;
char pwd[MAXPATHLEN];
char candidate[MAXPATHLEN];
char buf[MAX_BRANCH_LEN];
size_t s;
struct stat bufstat;
int found_repo = -1;
/* start from the working dir */
strlcpy(pwd, getcwd(NULL, MAXPATHLEN), MAXPATHLEN);
do {
snprintf(candidate, MAXP... | cwe | CWE-119 | C/C++ |
func NewConcatKDF(hash crypto.Hash, z, algID, ptyUInfo, ptyVInfo, supPubInfo, supPrivInfo []byte) io.Reader {
buffer := make([]byte, len(algID)+len(ptyUInfo)+len(ptyVInfo)+len(supPubInfo)+len(supPrivInfo))
n := 0
n += copy(buffer, algID)
n += copy(buffer[n:], ptyUInfo)
n += copy(buffer[n:], ptyVInfo)
n += copy(bu... | cwe | CWE-190 | Go |
compile_nested_function(exarg_T *eap, cctx_T *cctx)
{
int is_global = *eap->arg == 'g' && eap->arg[1] == ':';
char_u *name_start = eap->arg;
char_u *name_end = to_name_end(eap->arg, TRUE);
char_u *lambda_name;
ufunc_T *ufunc;
int r = FAIL;
compiletype_T compile_type;
if (eap->forcei... | cwe | CWE-416 | C/C++ |
/* 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 ... | cwe | CWE-190 | C/C++ |
package io.swagger.client.api;
import io.swagger.client.ApiException;
import io.swagger.client.ApiClient;
import io.swagger.client.ApiResponse;
import io.swagger.client.Configuration;
import io.swagger.client.Pair;
import javax.ws.rs.core.GenericType;
import io.swagger.client.model.Order;
import java.util.ArrayList... | cwe | CWE-200 | Java |
/*
Unix SMB/CIFS implementation.
file opening and share modes
Copyright (C) Andrew Tridgell 1992-1998
Copyright (C) Jeremy Allison 2001-2004
Copyright (C) Volker Lendecke 2005
Copyright (C) Ralph Boehme 2017
This program is free software; you can redistribute it and/or modify
it under the terms... | cwe | CWE-61 | C/C++ |
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This 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 2.1 of
* th... | cwe | CWE-863 | Java |
isoclns_print(netdissect_options *ndo,
const uint8_t *p, u_int length, u_int caplen)
{
if (caplen <= 1) { /* enough bytes on the wire ? */
ND_PRINT((ndo, "|OSI"));
return;
}
if (ndo->ndo_eflag)
ND_PRINT((ndo, "OSI NLPID %s (0x%02x): ", tok2str(nlpid_values, "Unknown", *p), *p));
switch (*p... | cwe | CWE-125 | C/C++ |
do_compose_group(pdf14_buf *tos, pdf14_buf *nos, pdf14_buf *maskbuf,
int x0, int x1, int y0, int y1, int n_chan, bool additive,
const pdf14_nonseparable_blending_procs_t * pblend_procs,
bool has_matte, bool overprint, gx_color_index drawn_comps,
gs_memory_t *memor... | cwe | CWE-476 | Unknown |
/*
* 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-269 | Java |
'use strict';
/**
* This callback will be called to transform a script to JavaScript.
*
* @callback compileCallback
* @param {string} code - Script code to transform to JavaScript.
* @param {string} filename - Filename of this script.
* @return {string} JavaScript code that represents the script code.
*/
/**
... | cwe | CWE-74 | JavaScript |
cib_recv_plaintext(int sock)
{
char *buf = NULL;
ssize_t rc = 0;
ssize_t len = 0;
ssize_t chunk_size = 512;
buf = calloc(1, chunk_size);
while (1) {
errno = 0;
rc = read(sock, buf + len, chunk_size);
crm_trace("Got %d more bytes. errno=%d", (int)rc, errno);
... | cwe | CWE-399 | C/C++ |
def status_all(params, request, session, nodes=[], dont_update_config=false)
if nodes == nil
return JSON.generate({"error" => "true"})
end
final_response = {}
threads = []
forbidden_nodes = {}
nodes.each {|node|
threads << Thread.new {
code, response = send_request_with_token(session, node, '... | cwe | CWE-384 | Ruby |
static void sas_discover_domain(struct work_struct *work)
{
struct domain_device *dev;
int error = 0;
struct sas_discovery_event *ev = to_sas_discovery_event(work);
struct asd_sas_port *port = ev->port;
clear_bit(DISCE_DISCOVER_DOMAIN, &port->disc.pending);
if (port->port_dev)
return;
error = sas_get_port_d... | cwe | CWE-284 | Unknown |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.