code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
void Compute(OpKernelContext* ctx) override {
const Tensor& gradient = ctx->input(0);
const Tensor& input = ctx->input(1);
Tensor* input_backprop = nullptr;
OP_REQUIRES_OK(ctx,
ctx->allocate_output(0, input.shape(), &input_backprop));
OP_REQUIRES(
ctx, input.IsSameSize(gr... | cwe | CWE-754 | Unknown |
# -*- coding: utf-8 -*-
import codecs
import io
import mimetypes
import os
from itertools import chain
from logging import getLogger
from urllib.parse import quote, urlencode
import pycurl
from pyload import APPID
from ...utils.convert import to_bytes, to_str
from ..exceptions import Abort
from .exceptions import Ba... | cwe | CWE-295 | Python |
identify_system_timezone(void)
{
int i;
char tzname[128];
char localtzname[256];
time_t t = time(NULL);
struct tm *tm = localtime(&t);
HKEY rootKey;
int idx;
if (!tm)
{
#ifdef DEBUG_IDENTIFY_TIMEZONE
fprintf(stderr, "could not identify system time zone: localtime() failed\n");
#endif
return NULL;... | cwe | CWE-119 | Unknown |
static PixelChannels **AcquirePixelThreadSet(const Image *images)
{
const Image
*next;
PixelChannels
**pixels;
register ssize_t
i;
size_t
columns,
number_threads;
number_threads=(size_t) GetMagickResourceLimit(ThreadResource);
pixels=(PixelChannels **) AcquireQuantumMemory(number... | cwe | CWE-787 | C/C++ |
def span(self, key):
path = os.path.join(self.namespace, key)
try:
self.etcd.write(path, None, dir=True, prevExist=False)
except etcd.EtcdAlreadyExist as err:
raise CSStoreExists(str(err))
except etcd.EtcdException as err:
log_error("Error storing key ... | cwe | CWE-22 | Python |
/*
* 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 |
int lock_flags) __releases(RCU)
{
struct inode *inode = VFS_I(ip);
struct xfs_mount *mp = ip->i_mount;
int error;
/*
* check for re-use of an inode within an RCU grace period due to the
* radix tree nodes not being updated yet. We monitor for this by
* setting the inode number to zero before freeing the... | cwe | CWE-476 | C/C++ |
add_mtab(char *devname, char *mountpoint, unsigned long flags)
{
int rc = 0;
char *mount_user;
struct mntent mountent;
FILE *pmntfile;
atexit(unlock_mtab);
rc = lock_mtab();
if (rc) {
fprintf(stderr, "cannot lock mtab");
rc = EX_FILEIO;
goto add_mtab_exit;
}
pmntfile = setmntent(MOUNTED, "a+");
if (!p... | cwe | CWE-362 | Unknown |
protected function getBodyTagAttributes()
{
$formEngineParameters = [];
$parameters = parent::getBodyTagAttributes();
$formEngineParameters['fieldChangeFunc'] = $this->parameters['fieldChangeFunc'];
$formEngineParameters['fieldChangeFuncHash'] = GeneralUtility::hmac(serialize($this-... | cwe | CWE-20 | PHP |
static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
{
zval *id;
xmlDoc *docp;
dom_object *intern;
char *source = NULL, *valid_file = NULL;
int source_len = 0;
xmlRelaxNGParserCtxtPtr parser;
xmlRelaxNGPtr sptr;
xmlRelaxNGValidCtxtPtr vptr;
int ... | cwe | CWE-20 | Unknown |
static ssize_t _hostfs_writev(
oe_fd_t* desc,
const struct oe_iovec* iov,
int iovcnt)
{
ssize_t ret = -1;
file_t* file = _cast_file(desc);
void* buf = NULL;
size_t buf_size = 0;
if (!file || !iov || iovcnt < 0 || iovcnt > OE_IOV_MAX)
OE_RAISE_ERRNO(OE_EINVAL);
/* Flatten th... | cwe | CWE-200 | Unknown |
$item = trim( $item );
if ( strpos( $item, '|-' ) === 0 ) {
$item = explode( '|-', $item, 2 );
if ( count( $item ) == 2 ) {
$item = $item[1];
} else {
$rowsKey[$index] = $item;
continue;
}
}
if ( strlen( $item ) > 0 ) {
$word = explode( "\n|", $item );
if ( is... | cwe | CWE-400 | PHP |
make_weights (PixopsFilter *filter,
PixopsInterpType interp_type,
double scale_x,
double scale_y)
{
switch (interp_type)
{
case PIXOPS_INTERP_NEAREST:
g_assert_not_reached ();
break;
case PIXOPS_INTERP_TILES:
tile_make_weights (&fil... | cwe | CWE-119 | Unknown |
static MagickBooleanType GetEXIFProperty(const Image *image,
const char *property,ExceptionInfo *exception)
{
#define MaxDirectoryStack 16
#define EXIF_DELIMITER "\n"
#define EXIF_NUM_FORMATS 12
#define EXIF_FMT_BYTE 1
#define EXIF_FMT_STRING 2
#define EXIF_FMT_USHORT 3
#define EXIF_FMT_ULONG 4
#define EXIF_FM... | cwe | CWE-703 | C/C++ |
float AudioParam::finalValue()
{
float value;
calculateFinalValues(&value, 1, false);
return value;
} | cwe | CWE-119 | C/C++ |
static int async_polkit_callback(sd_bus_message *reply, void *userdata, sd_bus_error *error) {
_cleanup_(sd_bus_error_free) sd_bus_error error_buffer = SD_BUS_ERROR_NULL;
AsyncPolkitQuery *q = userdata;
int r;
assert(reply);
assert(q);
q->slot = sd_bus_slot_unref(q->slo... | cwe | CWE-416 | C/C++ |
public void addViolation(String msg) {
violationOccurred = true;
context.buildConstraintViolationWithTemplate(msg)
.addConstraintViolation();
} | cwe | CWE-74 | Java |
package org.bouncycastle.crypto.engines;
import org.bouncycastle.crypto.BlockCipher;
import org.bouncycastle.crypto.CipherParameters;
import org.bouncycastle.crypto.DataLengthException;
import org.bouncycastle.crypto.OutputLengthException;
import org.bouncycastle.crypto.params.KeyParameter;
import org.bouncycastle.uti... | cwe | CWE-310 | Java |
/*
* gd_gd2.c
*
* Implements the I/O and support for the GD2 format.
*
* Changing the definition of GD2_DBG (below) will cause copious messages
* to be displayed while it processes requests.
*
* Designed, Written & Copyright 1999, Philip Warner.
*
*/
/**
* File: GD2 IO
*
* Read and write... | cwe | CWE-415 | C/C++ |
/*
* 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 |
export function parse(formula: string): [a: number, b: number] {
formula = formula.trim().toLowerCase();
if (formula === "even") {
return [2, 0];
} else if (formula === "odd") {
return [2, 1];
}
const parsed = formula.match(RE_NTH_ELEMENT);
if (!parsed) {
throw new Err... | cwe | CWE-1333 | JavaScript |
static int nntp_hcache_namer(const char *path, char *dest, size_t destlen)
{
return snprintf(dest, destlen, "%s.hcache", path);
} | cwe | CWE-119 | Unknown |
TiledInputFile::TiledInputFile (const char fileName[], int numThreads):
_data (new Data (numThreads))
{
_data->_streamData=NULL;
_data->_deleteStream=true;
//
// This constructor is called when a user
// explicitly wants to read a tiled file.
//
IStream* is = 0;
try
{
... | cwe | CWE-125 | Unknown |
/*
* GPAC - Multimedia Framework C SDK
*
* Authors: Jean Le Feuvre
* Copyright (c) Telecom ParisTech 2000-2021
* All rights reserved
*
* This file is part of GPAC / ISO Media File Format sub-project
*
* GPAC is free software; you can redistribute it and/or modify
* it under the terms of the GNU L... | cwe | CWE-190 | C/C++ |
package com.salesmanager.shop.admin.model.catalog;
import com.salesmanager.core.model.catalog.product.availability.ProductAvailability;
import com.salesmanager.core.model.catalog.product.price.ProductPriceDescription;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
public class Prod... | cwe | CWE-639 | Java |
static void msf2_dma_tx(MSF2EmacState *s)
{
NetClientState *nc = qemu_get_queue(s->nic);
hwaddr desc = s->regs[R_DMA_TX_DESC];
uint8_t buf[MAX_PKT_SIZE];
EmacDesc d;
int size;
uint8_t pktcnt;
uint32_t status;
if (!(s->regs[R_CFG1] & R_CFG1_TX_EN_MASK)) {
return;
}
while... | cwe | CWE-835 | C/C++ |
function PMA_secureSession()
{
// prevent session fixation and XSS
// (better to use session_status() if available)
if ((PMA_PHP_INT_VERSION >= 50400 && session_status() === PHP_SESSION_ACTIVE)
|| (PMA_PHP_INT_VERSION < 50400 && session_id() !== '')
) {
session_regenerate_id(true);
}... | cwe | CWE-200 | PHP |
function set(target, path, value) {
let currentTarget = target;
forEach(path, function(key, idx) {
if (key === '__proto__') {
throw new Error('illegal key: __proto__');
}
let nextKey = path[idx + 1];
let nextTarget = currentTarget[key];
if (isDefined(nextKey) && isNil(nextTarget)) {
... | cwe | CWE-1321 | JavaScript |
iperf_json_printf(const char *format, ...)
{
cJSON* o;
va_list argp;
const char *cp;
char name[100];
char* np;
cJSON* j;
o = cJSON_CreateObject();
if (o == NULL)
return NULL;
va_start(argp, format);
np = name;
for (cp = format; *cp != '\0'; ++cp) {
switch (*cp) {
... | cwe | CWE-787 | Unknown |
new Menu(mxUtils.bind(this,function(M,W){for(var U=0;U<S.length;U++)"-"==S[U]?M.addSeparator(W):V(M,W,mxResources.get(S[U])+"...",S[U])})))};EditorUi.prototype.installFormatToolbar=function(C){var D=this.editor.graph,G=document.createElement("div");G.style.cssText="position:absolute;top:10px;z-index:1;border-radius:4px... | cwe | CWE-20 | JavaScript |
# -*- coding: utf-8 -*-
# rdiffweb, A web interface to rdiff-backup repositories
# Copyright (C) 2012-2021 rdiffweb contributors
#
# 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 ... | cwe | CWE-352 | Python |
import namedavatar from 'namedavatar'
import { i18nReady, t } from './i18n.js'
import { Globalsettings } from '../api/globalsettings/globalsettings.js'
const clientTimecards = new Mongo.Collection('clientTimecards')
function getGlobalSetting(name) {
return Globalsettings.findOne({ name }) ? Globalsettings.findOne({... | cwe | CWE-79 | JavaScript |
ext4_xattr_release_block(handle_t *handle, struct inode *inode,
struct buffer_head *bh)
{
struct mb_cache_entry *ce = NULL;
int error = 0;
struct mb_cache *ext4_mb_cache = EXT4_GET_MB_CACHE(inode);
ce = mb_cache_entry_get(ext4_mb_cache, bh->b_bdev, bh->b_blocknr);
BUFFER_TRACE(bh, "get_write_access");
error ... | cwe | CWE-19 | C/C++ |
static Image *ReadTIFFImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
#define ThrowTIFFException(severity,message) \
{ \
if (tiff_pixels != (unsigned char *) NULL) \
tiff_pixels=(unsigned char *) RelinquishMagickMemory(tiff_pixels); \
if (quantum_info != (QuantumInfo *) NULL) \
quantum_info... | cwe | CWE-401 | Unknown |
cssclass : function(dir) {
var cname = (fm.UA.Touch ? 'elfinder-touch ' : '')+(dir.phash ? '' : root)+' '+navdir+' '+fm.perms2class(dir);
dir.dirs && !dir.link && (cname += ' ' + collapsed);
opts.getClass && (cname += ' ' + opts.getClass(dir));
dir.csscls && (cname += ' ' + fm.escape(dir.csscls))... | cwe | CWE-89 | JavaScript |
int SoundPool::play(int sampleID, float leftVolume, float rightVolume,
int priority, int loop, float rate)
{
ALOGV("play sampleID=%d, leftVolume=%f, rightVolume=%f, priority=%d, loop=%d, rate=%f",
sampleID, leftVolume, rightVolume, priority, loop, rate);
sp<Sample> sample;
SoundChannel* ch... | cwe | CWE-264 | C/C++ |
static int qrtr_recvmsg(struct socket *sock, struct msghdr *msg,
size_t size, int flags)
{
DECLARE_SOCKADDR(struct sockaddr_qrtr *, addr, msg->msg_name);
struct sock *sk = sock->sk;
struct sk_buff *skb;
struct qrtr_cb *cb;
int copied, rc;
lock_sock(sk);
if (sock_flag(sk, SOCK_ZAPPED)) {
release_sock(sk);
... | cwe | CWE-909 | Unknown |
string sanitize_proprietary_tags(string input_string)
{
unsigned int i;
size_t input_string_size;
bool strip = false;
bool tag_open = false;
int tag_open_idx = 0; //Are we within < > ?
bool closing_tag_open = false; //Are we within </ > ?
int orig_tag_open_idx = 0;
bool proprietary_tag = false; //Are we... | cwe | CWE-119 | C/C++ |
/*******************************************************************************
* This file is part of OpenNMS(R).
*
* Copyright (C) 2002-2014 The OpenNMS Group, Inc.
* OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc.
*
* OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc.
*
* OpenNMS(... | cwe | CWE-79 | Java |
static void prefetch_table(const volatile byte *tab, size_t len)
{
size_t i;
for (i = 0; i < len; i += 8 * 32)
{
(void)tab[i + 0 * 32];
(void)tab[i + 1 * 32];
(void)tab[i + 2 * 32];
(void)tab[i + 3 * 32];
(void)tab[i + 4 * 32];
(void)tab[i + 5 * 32];
(void)tab[i + 6 * ... | cwe | CWE-668 | C/C++ |
ft_smooth_render_generic( FT_Renderer render,
FT_GlyphSlot slot,
FT_Render_Mode mode,
const FT_Vector* origin,
FT_Render_Mode required_mode )
{
FT_Error error;
FT_Outline* out... | cwe | CWE-189 | Unknown |
/*!
* URI.js - Mutating URLs
*
* Version: 1.19.6
*
* Author: Rodney Rehm
* Web: http://medialize.github.io/URI.js/
*
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
*
*/
(function (root, factory) {
'use strict';
// https://github.com/umdjs/umd/blob/master/returnExports.js
... | cwe | CWE-601 | JavaScript |
/**
* Copyright (c) 2014-present, The osquery authors
*
* This source code is licensed as defined by the LICENSE file found in the
* root directory of this source tree.
*
* SPDX-License-Identifier: (Apache-2.0 OR GPL-2.0-only)
*/
#include <boost/algorithm/string.hpp>
#include <osquery/core/core.h>
#include <os... | cwe | CWE-77 | C/C++ |
void Compute(OpKernelContext* const context) override {
core::RefCountPtr<BoostedTreesEnsembleResource> resource;
// Get the resource.
OP_REQUIRES_OK(context, LookupResource(context, HandleFromInput(context, 0),
&resource));
// Get the inputs.
OpInputList ... | cwe | CWE-197 | Unknown |
/**
* Freshdesk ticket plugin. Drag tickets into the diagram. Tickets are
* updated on file open, page select and via Extras, Update Tickets.
*
* Drag freshdesk tickets into the diagram. Domain must match deskDomain.freshdesk.com.
*
* Use #C to configure the client as follows:
*
* https://www.draw.io/?p=tick... | cwe | CWE-94 | JavaScript |
/* Copyright 2011-2014 Autronica Fire and Security AS
*
* 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 later version.
*
* Autho... | cwe | CWE-772 | C/C++ |
static void copy_recurse_data(compiler_common *common, PCRE2_SPTR cc, PCRE2_SPTR ccend,
int type, int stackptr, int stacktop, BOOL has_quit)
{
delayed_mem_copy_status status;
PCRE2_SPTR alternative;
sljit_sw private_srcw[2];
sljit_sw shared_srcw[3];
sljit_sw kept_shared_srcw[2];
int private_count, shared_count, kept_... | cwe | CWE-125 | Unknown |
Http::FilterTrailersStatus Context::onResponseTrailers() {
if (!wasm_->onResponseTrailers_) {
return Http::FilterTrailersStatus::Continue;
}
if (wasm_->onResponseTrailers_(this, id_).u64_ == 0) {
return Http::FilterTrailersStatus::Continue;
}
return Http::FilterTrailersStatus::StopIteration;
} | cwe | CWE-476 | C/C++ |
int MSG_ReadBits( msg_t *msg, int bits ) {
int value;
int get;
qboolean sgn;
int i, nbits;
// FILE* fp;
value = 0;
if ( bits < 0 ) {
bits = -bits;
sgn = qtrue;
} else {
sgn = qfalse;
}
if (msg->oob) {
if(bits==8)
{
value = msg->data[msg->readcount];
msg->readcount += 1;
msg->bit += ... | cwe | CWE-119 | C/C++ |
static TEE_Result tee_svc_copy_param(struct tee_ta_session *sess,
struct tee_ta_session *called_sess,
struct utee_params *callee_params,
struct tee_ta_param *param,
void *tmp_buf_va[TEE_NUM_PARAMS],
struct mobj **mobj_tmp)
{
size_t n;
TEE_Result res;
size_t req_mem = 0;
... | cwe | CWE-119 | Unknown |
RList *r_bin_ne_get_entrypoints(r_bin_ne_obj_t *bin) {
RList *entries = r_list_newf (free);
if (!entries) {
return NULL;
}
RBinAddr *entry;
RList *segments = r_bin_ne_get_segments (bin);
if (!segments) {
r_list_free (entries);
return NULL;
}
if (bin->ne_header->csEntryPoint) {
entry = R_NEW0 (RBinAddr);... | cwe | CWE-787 | C/C++ |
/*
** codegen.c - mruby code generator
**
** See Copyright Notice in mruby.h
*/
#include <mruby.h>
#include <mruby/compile.h>
#include <mruby/proc.h>
#include <mruby/dump.h>
#include <mruby/numeric.h>
#include <mruby/string.h>
#include <mruby/debug.h>
#include <mruby/presym.h>
#include "node.h"
#include <mruby/opcode.... | cwe | CWE-476 | C/C++ |
static int add_uint64_element(struct ldb_context *ldb, struct ldb_message *msg,
const char *attr, uint64_t v)
{
struct ldb_message_element *el;
int ret;
if (ldb_msg_find_element(msg, attr) != NULL) {
return LDB_SUCCESS;
}
ret = samdb_msg_add_uint64(ldb, msg, msg, attr, v);
if (ret != LDB_SUCCESS) {
... | cwe | CWE-200 | Unknown |
php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper,
char *path,
char *mode,
int options,
char **opened_path,
... | cwe | CWE-119 | C/C++ |
header_cache_t* imap_hcache_open (IMAP_DATA* idata, const char* path)
{
IMAP_MBOX mx;
ciss_url_t url;
char cachepath[LONG_STRING];
char mbox[LONG_STRING];
if (path)
imap_cachepath (idata, path, mbox, sizeof (mbox));
else
{
if (!idata->ctx || imap_parse_path (idata->ctx->path, &mx) < 0)
retu... | cwe | CWE-22 | C/C++ |
static int RsaPad_PSS(const byte* input, word32 inputLen, byte* pkcsBlock,
word32 pkcsBlockLen, WC_RNG* rng, enum wc_HashType hType, int mgf,
int saltLen, int bits, void* heap)
{
int ret = 0;
int hLen, i, o, maskLen, hiBits;
byte* m;
byte* s;
#if defined(WOLFSSL_PSS_LONG_SALT) || def... | cwe | CWE-310 | C/C++ |
evbuffer_prepend(struct evbuffer *buf, const void *data, size_t datlen)
{
struct evbuffer_chain *chain, *tmp;
int result = -1;
EVBUFFER_LOCK(buf);
if (buf->freeze_start) {
goto done;
}
chain = buf->first;
if (chain == NULL) {
chain = evbuffer_chain_new(datlen);
if (!chain)
goto done;
evbuffer_chai... | cwe | CWE-189 | Unknown |
static int get_next_block(bunzip_data *bd)
{
struct group_data *hufGroup;
int dbufCount, dbufSize, groupCount, *base, *limit, selector,
i, j, runPos, symCount, symTotal, nSelectors, byteCount[256];
int runCnt = runCnt; /* for compiler */
uint8_t uc, symToByte[256], mtfSymbol[256], *selectors;
uint32_t *dbuf;
un... | cwe | CWE-190 | Unknown |
$text .= varset($val['helpText']) ? "<div class='field-help'>".$val['helpText']."</div>" : "";
$text .= "</td>\n</tr>\n";
}
$text .="<tr>
<td>".EPL_ADLAN_59."</td>
<td>{$del_text}
<div class='field-help'>".EPL_ADLAN_60."</div>
</td>
</tr>
</table>
<div class='buttons-bar center'>";
... | cwe | CWE-352 | PHP |
static void audit_log_execve_info(struct audit_context *context,
struct audit_buffer **ab)
{
int i, len;
size_t len_sent = 0;
const char __user *p;
char *buf;
p = (const char __user *)current->mm->arg_start;
audit_log_format(*ab, "argc=%d", context->execve.argc);
/*
* we need some kernel buffer to hol... | cwe | CWE-362 | C/C++ |
mrb_realloc(mrb_state *mrb, void *p, size_t len)
{
void *p2;
p2 = mrb_realloc_simple(mrb, p, len);
if (len == 0) return p2;
if (p2 == NULL) {
mrb_free(mrb, p);
mrb->gc.out_of_memory = TRUE;
mrb_raise_nomemory(mrb);
}
else {
mrb->gc.out_of_memory = FALSE;
}
return p2;
} | cwe | CWE-415 | C/C++ |
/*
** SQLCipher
** http://sqlcipher.net
**
** Copyright (c) 2008 - 2013, ZETETIC LLC
** 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 a... | cwe | CWE-89 | C/C++ |
/*
* . .o8 oooo
* .o8 "888 `888
* .o888oo oooo d8b oooo oooo .oooo888 .ooooo. .oooo.o 888 oooo
* 888 `888""8P `888 `888 d88' `888 d88' `88b d88( "8 888 .8P'
* 888 888 888 888 8... | cwe | CWE-190 | 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-824 | Python |
int
yyparse (void *yyscanner, YR_COMPILER* compiler)
{
/* The lookahead symbol. */
int yychar;
/* The semantic value of the lookahead symbol. */
/* Default value used for initialization, for pacifying older GCCs
or non-GCC compilers. */
YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
YYSTYPE yylval YY_INITIAL_... | cwe | CWE-125 | Unknown |
void CrwMap::encode0x1810(const Image& image,
const CrwMapping* pCrwMapping,
CiffHeader* pHead)
{
assert(pCrwMapping != 0);
assert(pHead != 0);
const ExifKey kX("Exif.Photo.PixelXDimension");
const ExifKey kY("Ex... | cwe | CWE-190 | Unknown |
static MagickBooleanType WriteTIFFImage(const ImageInfo *image_info,
Image *image)
{
const char
*mode,
*option;
CompressionType
compression;
EndianType
endian_type;
MagickBooleanType
debug,
status;
MagickOffsetType
scene;
QuantumInfo
*quantum_info;
QuantumType
q... | cwe | CWE-125 | C/C++ |
ScriptPromise ImageBitmapFactories::createImageBitmap(EventTarget& eventTarget, HTMLCanvasElement* canvas, int sx, int sy, int sw, int sh, ExceptionState& exceptionState)
{
ASSERT(eventTarget.toDOMWindow());
if (!canvas) {
exceptionState.throwTypeError("The canvas element provided is invalid.");
... | cwe | CWE-787 | C/C++ |
def make_rs256_token(payload = nil)
payload = { sub: 'abc123' } if payload.nil?
JWT.encode payload, rsa_private_key, 'RS256', kid: jwks_kid
end | cwe | CWE-347 | Ruby |
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 lhs;
int rv, ... | cwe | CWE-399 | Unknown |
idx.search(query, function(success, content) {
if (!success) {
console.log(content);
return;
}
if (originalQuery == $('#inputfield input').val().trim()) {
if (content.nbHits == 0) {
var noResults = '<p>No results matching your query</p><p><code>' + origi... | cwe | CWE-79 | JavaScript |
zfs_fuid_map_id(zfsvfs_t *zfsvfs, uint64_t fuid,
cred_t *cr, zfs_fuid_type_t type)
{
#ifdef HAVE_KSID
uint32_t index = FUID_INDEX(fuid);
const char *domain;
uid_t id;
if (index == 0)
return (fuid);
domain = zfs_fuid_find_by_idx(zfsvfs, index);
ASSERT(domain != NULL);
if (type == ZFS_OWNER || type == ZFS... | cwe | CWE-732 | 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 |
# -*- coding: utf-8 -*-
# rdiffweb, A web interface to rdiff-backup repositories
# Copyright (C) 2012-2021 rdiffweb contributors
#
# 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 ... | cwe | CWE-770 | Python |
const got = require('@/utils/got');
const cheerio = require('cheerio');
const timezone = require('@/utils/timezone');
const { parseDate } = require('@/utils/parse-date');
const iconv = require('iconv-lite');
const setCookie = function (cookieName, cookieValue, seconds, path, domain, secure) {
let expires = null;
... | cwe | CWE-918 | JavaScript |
'use strict';
const os = require('os');
const nconf = require('nconf');
const winston = require('winston');
const util = require('util');
const validator = require('validator');
const cookieParser = require('cookie-parser')(nconf.get('secret'));
const db = require('../database');
const user = require('../user');
cons... | cwe | CWE-665 | JavaScript |
function details($selected_events, $queue)
{
global $database_ged;
// get all needed infos into variables
$value_parts = explode(":", $selected_events);
$id = $value_parts[0];
$ged_type = $value_parts[1];
$sql = "SELECT * FROM ".$ged_type."_queue_".$queue." WHERE id = $id";
$result = sqlrequest($database_ged, ... | cwe | CWE-78 | PHP |
var getExtTemplates = function(isSearch)
{
list.style.display = 'none';
searchBox.style.display = 'none';
div.style.left = '30px';
setActiveTab(isSearch? -1 : 1); //deselect all of them if isSearch
if (oldTemplates == null)
{
oldTemplates = templates;
}
div.scrollTop = 0;... | cwe | CWE-94 | JavaScript |
privsep_read_loop(void)
{
struct privsep_command cmd;
int ret;
while (1) {
ret = readn(pfd, &cmd, sizeof(cmd));
if (ret <= 0) {
/* Error or EOF, give up */
if (ret < 0) {
flog(LOG_ERR, "Exiting, privsep_read_loop had readn error: %s\n",
strerror(errno));
} else {
flog(LOG_ERR, "Exiting... | cwe | CWE-20 | C/C++ |
static int burl_normalize_2F_to_slash_fix (buffer *b, int qs, int i)
{
char * const s = b->ptr;
const int blen = (int)buffer_string_length(b);
const int used = qs < 0 ? blen : qs;
int j = i;
for (; i < used; ++i, ++j) {
s[j] = s[i];
if (s[i] == '%' && s[i+1] == '2' && s[i+2] == 'F') ... | cwe | CWE-190 | C/C++ |
$key = strtolower($key);
$prop = '_' . $this->_fields[$key]['propname'];
if (isset($values[$key])) {
$value = trim($values[$key]);
} else {
$value = '';
}
// if the field is enabled, check it
if (!isset($disabled[$... | cwe | CWE-79 | PHP |
function PMA_getCentralColumnsCount($db)
{
$cfgCentralColumns = PMA_centralColumnsGetParams();
if (empty($cfgCentralColumns)) {
return 0;
}
$pmadb = $cfgCentralColumns['db'];
$GLOBALS['dbi']->selectDb($pmadb, $GLOBALS['controllink']);
$central_list_table = $cfgCentralColumns['table'];
... | cwe | CWE-89 | PHP |
def close_or_open(request, pk, close=True):
# todo: moderators should be able to close it
poll = get_object_or_404(
CommentPoll,
pk=pk,
comment__user=request.user
)
if close:
close_at = timezone.now()
else:
close_at = None
(CommentPoll.objects
.filt... | cwe | CWE-601 | Python |
/*
Copyright 2008-2018 LibRaw LLC (info@libraw.org)
LibRaw is free software; you can redistribute it and/or modify
it under the terms of the one of two licenses as you choose:
1. GNU LESSER GENERAL PUBLIC LICENSE version 2.1
(See file LICENSE.LGPL provided in LibRaw distribution archive for details).
2. COMMON... | cwe | CWE-125 | C/C++ |
// Copyright Istio 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 wri... | cwe | CWE-863 | Go |
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
TF_LITE_ENSURE_EQ(context, NumInputs(node), 2);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
const TfLiteTensor* input = GetInput(context, node, kInputTensor);
const TfLiteTensor* size = GetInput(context, node, kSizeTensor);
TfLiteTensor* o... | cwe | CWE-787 | C/C++ |
import { mainPage } from "../../support/page_objects/mainPage";
import { loginPage } from "../../support/page_objects/navigation";
import {
isPostgres,
isTestSuiteActive,
} from "../../support/page_objects/projectConstants";
export const genTest = (apiType, dbType) => {
if (!isTestSuiteActive(apiType, dbTy... | cwe | CWE-400 | JavaScript |
/*
* Copyright 2016 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* 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.apach... | cwe | CWE-287 | Java |
static HENHMETAFILE ReadEnhMetaFile(const char *path,ssize_t *width,
ssize_t *height)
{
#pragma pack( push, 2 )
typedef struct
{
DWORD dwKey;
WORD hmf;
SMALL_RECT bbox;
WORD wInch;
DWORD dwReserved;
WORD wCheckSum;
} APMHEADER, *PAPMHEADER;
#pragma pack( pop )
DWORD
dwSize;
ENH... | cwe | CWE-190 | C/C++ |
rt6_print(netdissect_options *ndo, register const u_char *bp, const u_char *bp2 _U_)
{
register const struct ip6_rthdr *dp;
register const struct ip6_rthdr0 *dp0;
register const u_char *ep;
int i, len;
register const struct in6_addr *addr;
dp = (const struct ip6_rthdr *)bp;
len = dp->ip6r_len;
/* 'ep' po... | cwe | CWE-125 | C/C++ |
ikev1_t_print(netdissect_options *ndo, u_char tpay _U_,
const struct isakmp_gen *ext, u_int item_len,
const u_char *ep, uint32_t phase _U_, uint32_t doi _U_,
uint32_t proto, int depth _U_)
{
const struct ikev1_pl_t *p;
struct ikev1_pl_t t;
const u_char *cp;
const char *idstr;
const struct attr... | cwe | CWE-125 | C/C++ |
FT_Bitmap_Convert( FT_Library library,
const FT_Bitmap *source,
FT_Bitmap *target,
FT_Int alignment )
{
FT_Error error = FT_Err_Ok;
FT_Memory memory;
FT_Int source_pitch, target_pitch;
if ( !library )
... | cwe | CWE-119 | C/C++ |
private def urlEncodeCookie(name: String, value: String, maxAgeSecs: Option[Int] = None) =
Cookie( | cwe | CWE-613 | Scala |
package main
import (
"errors"
"net/http"
"github.com/TykTechnologies/tyk-identity-broker/constants"
"github.com/TykTechnologies/tyk-identity-broker/providers"
tykerrors "github.com/TykTechnologies/tyk-identity-broker/error"
"github.com/gorilla/mux"
)
// Returns a profile ID
func getId(req *http.Request) (str... | cwe | CWE-287 | Go |
int LUKS2_keyslot_area(struct luks2_hdr *hdr,
int keyslot,
uint64_t *offset,
uint64_t *length)
{
json_object *jobj_keyslot, *jobj_area, *jobj;
if(LUKS2_keyslot_info(hdr, keyslot) == CRYPT_SLOT_INVALID)
return -EINVAL;
jobj_keyslot = LUKS2_get_keyslot_jobj(hdr, keyslot);
if (!jobj_keyslot)
return -ENOENT;
... | cwe | CWE-345 | Unknown |
void TableLookUp::setTable(int ntable, const std::vector<ushort16>& table) {
assert(!table.empty());
const int nfilled = table.size();
if (ntable > ntables) {
ThrowRDE("Table lookup with number greater than number of tables.");
}
ushort16* t = &tables[ntable * TABLE_SIZE];
if (!dither) {
for (int ... | 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-502 | Java |
(function()
{
Sidebar.prototype.addRackPalette = function(rack, dir)
{
for (var i = 0; i < rack.length; i++)
{
if (rack[i].toLowerCase() === 'general')
{
this.setCurrentSearchEntryLibrary('rack', 'rackGeneral');
this.addRackGeneralPalette();
}
else if (rack[i].toLowerCase() === 'f5')
{
... | cwe | CWE-284 | Java |
static int parse_token(char **name, char **value, char **cp)
{
char *end;
if (!name || !value || !cp)
return -BLKID_ERR_PARAM;
if (!(*value = strchr(*cp, '=')))
return 0;
**value = '\0';
*name = strip_line(*cp);
*value = skip_over_blank(*value + 1);
if (**value == '"') {
end = strchr(*value + 1, '"');
... | cwe | CWE-77 | Unknown |
int ParseRiffHeaderConfig (FILE *infile, char *infilename, char *fourcc, WavpackContext *wpc, WavpackConfig *config)
{
int is_rf64 = !strncmp (fourcc, "RF64", 4), got_ds64 = 0;
int64_t total_samples = 0, infilesize;
RiffChunkHeader riff_chunk_header;
ChunkHeader chunk_header;
WaveHeader WaveHeader;
... | cwe | CWE-119 | Unknown |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.