code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
it 'is possible to return errors in jsonapi format' do get '/' expect(last_response.body).to eq('{"error":"rain!"}') end
cwe
CWE-79
Ruby
/** * * Rhonabwy JSON Web Encryption (JWE) library * * jwe.c: functions definitions * * Copyright 2020-2022 Nicolas Mora <mail@babelouest.org> * * This program 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 Softw...
cwe
CWE-347
C/C++
static function getParentGroup($group_id) { global $user; $mdb2 = getConnection(); $sql = "select parent_id from tt_groups where id = $group_id and org_id = $user->org_id and status = 1"; $res = $mdb2->query($sql); if (!is_a($res, 'PEAR_Error')) { $val = $res->fetchRow(); return $val[...
cwe
CWE-89
PHP
U;return L.apply(this,arguments)};v.hoverIcons.getStateAt=function(H,S,U){return d(H.cell)?null:this.graph.view.getState(this.graph.getCellAt(S,U))};var M=x.duplicateCells;x.duplicateCells=function(H,S){H=null!=H?H:this.getSelectionCells();for(var U=H.slice(0),Q=0;Q<U.length;Q++){var W=x.view.getState(U[Q]);if(null!=W&...
cwe
CWE-20
JavaScript
void sqlcipher_exportFunc(sqlite3_context *context, int argc, sqlite3_value **argv) { sqlite3 *db = sqlite3_context_db_handle(context); const char* targetDb, *sourceDb; int targetDb_idx = 0; u64 saved_flags = db->flags; /* Saved value of the db->flags */ u32 saved_mDbFlags = db->mDbFlags; /* Sa...
cwe
CWE-476
Unknown
return code.includes(hash); }); if (containsMentions) { // disable code highlighting if there is a mention in there // highlighting will be wrong anyway because this is not valid code return code; } return hljs.highlightAuto(code).value; }, });
cwe
CWE-79
JavaScript
#include "TerminalClient.hpp" #include "TelemetryService.hpp" namespace et { vector<PortForwardSourceRequest> parseRangesToRequests(const string& input) { vector<PortForwardSourceRequest> pfsrs; auto j = split(input, ','); for (auto& pair : j) { vector<string> sourceDestination = split(pair, ':'); try {...
cwe
CWE-362
C/C++
void *zmalloc(size_t size) { void *ptr = malloc(size+PREFIX_SIZE); if (!ptr) zmalloc_oom_handler(size); #ifdef HAVE_MALLOC_SIZE update_zmalloc_stat_alloc(zmalloc_size(ptr)); return ptr; #else *((size_t*)ptr) = size; update_zmalloc_stat_alloc(size+PREFIX_SIZE); return (char*)ptr+PREFIX_SIZE;...
cwe
CWE-190
Unknown
protected function dataValue() { return [ ['foo', "'foo'"], ['bar', "'bar'"], ['42', "'42'"], ['+33', "'+33'"], [null, 'NULL'], ['null', 'NULL'], ['NULL', 'NULL'], ['`field`', '`field`'], ['`field', "'`field'"] ]; }
cwe
CWE-89
PHP
void perf_event_enable(struct perf_event *event) { struct perf_event_context *ctx = event->ctx; struct task_struct *task = ctx->task; if (!task) { /* * Enable the event on the cpu that it's on */ cpu_function_call(event->cpu, __perf_event_enable, event); return; } raw_spin_lock_irq(&ctx->lock); i...
cwe
CWE-264
C/C++
QPDF_Stream::understandDecodeParams( std::string const& filter, QPDFObjectHandle decode_obj, int& predictor, int& columns, int& colors, int& bits_per_component, bool& early_code_change) { bool filterable = true; std::set<std::string> keys = decode_obj.getKeys(); for (std::set<std::string>::i...
cwe
CWE-787
Unknown
/* * 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++
import logging from contextlib import ExitStack from dateutil import parser from functools import wraps import socket import ipaddress from urllib.parse import urlparse from six import text_type from sshtunnel import open_tunnel from redash import settings, utils from redash.utils import json_loads, query_is_select_n...
cwe
CWE-918
Python
Response DOMHandler::SetFileInputFiles( std::unique_ptr<protocol::Array<std::string>> files, Maybe<DOM::NodeId> node_id, Maybe<DOM::BackendNodeId> backend_node_id, Maybe<String> in_object_id) { if (host_) { for (size_t i = 0; i < files->length(); i++) { #if defined(OS_WIN) ChildProcess...
cwe
CWE-269
C/C++
import { noopTest, edit, merge } from './helpers.js'; /** * Block-Level Grammar */ export const block = { newline: /^(?: *(?:\n|$))+/, code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/, fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/, hr: /^ {0,3}((?:- *){...
cwe
CWE-1333
JavaScript
'use strict'; const dictionary = require("./dictionary.js"); const g_constants = require("./constants.js"); const g_crypto = require('crypto'); const http = require('http'); const https = require('https'); const url = require('url'); var fs = require('fs'); const util = require('util'); const admin_utils = require("....
cwe
CWE-89
JavaScript
QPDF_Stream::pipeStreamData(Pipeline* pipeline, int encode_flags, qpdf_stream_decode_level_e decode_level, bool suppress_warnings, bool will_retry) { std::vector<std::string> filters; int predictor = 1; int columns = 0; ...
cwe
CWE-787
Unknown
/** * Copyright (c) 2006-2012, JGraph Ltd */ /** * Construcs a new sidebar for the given editor. */ function Sidebar(editorUi, container) { this.editorUi = editorUi; this.container = container; this.palettes = new Object(); this.taglist = new Object(); this.lastCreated = 0; this.showTooltips = true; this.gra...
cwe
CWE-284
Java
xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3) { unsigned long value = 0L; char ch; if (name != NULL) { value += 30 * (*name); while ((ch = *name++) != 0) { value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); }...
cwe
CWE-399
Unknown
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++
void Filter::onUpstreamEvent(Network::ConnectionEvent event) { // Update the connecting flag before processing the event because we may start a new connection // attempt in initializeUpstreamConnection. bool connecting = connecting_; connecting_ = false; if (event == Network::ConnectionEvent::RemoteClose || ...
cwe
CWE-416
Unknown
def get_image(path): def get_absolute_path(path): import os script_dir = os.path.dirname(__file__) # <-- absolute dir the script is in rel_path = path abs_file_path = os.path.join(script_dir, rel_path) return abs_file_path return send_file( get_absolute_path(f"....
cwe
CWE-22
Python
MagickExport MemoryInfo *AcquireVirtualMemory(const size_t count, const size_t quantum) { MemoryInfo *memory_info; size_t length; length=count*quantum; if ((count == 0) || (quantum != (length/count))) { errno=ENOMEM; return((MemoryInfo *) NULL); } memory_info=(MemoryInfo *) Mag...
cwe
CWE-189
Unknown
# -*- coding: utf-8 -*- # This file is part of Shuup. # # Copyright (c) 2012-2021, Shuup Commerce Inc. All rights reserved. # # This source code is licensed under the OSL-3.0 license found in the # LICENSE file in the root directory of this source tree. import csv import six from babel.dates import format_datetime from...
cwe
CWE-1236
Python
static int udf_read_inode(struct inode *inode, bool hidden_inode) { struct buffer_head *bh = NULL; struct fileEntry *fe; struct extendedFileEntry *efe; uint16_t ident; struct udf_inode_info *iinfo = UDF_I(inode); struct udf_sb_info *sbi = UDF_SB(inode->i_sb); struct kernel_lb_addr *iloc = &iinfo->i_location; un...
cwe
CWE-189
C/C++
public Operation.OperationResult executeFixedCostOperation( final MessageFrame frame, final EVM evm) { Bytes shiftAmount = frame.popStackItem(); if (shiftAmount.size() > 4 && (shiftAmount = shiftAmount.trimLeadingZeros()).size() > 4) { frame.popStackItem(); frame.pushStackItem(UInt256.ZERO); ...
cwe
CWE-681
Java
public Cipher decrypt() { try { Cipher cipher = Secret.getCipher(ALGORITHM); cipher.init(Cipher.DECRYPT_MODE, getKey()); return cipher; } catch (GeneralSecurityException e) { throw new AssertionError(e); } }
cwe
CWE-326
Java
exports.parse = exports.decode = decode exports.stringify = exports.encode = encode exports.safe = safe exports.unsafe = unsafe var eol = typeof process !== 'undefined' && process.platform === 'win32' ? '\r\n' : '\n' function encode (obj, opt) { var children = [] var out = '' if (typeof opt === 'string') {...
cwe
CWE-1321
Java
/** * @file * IMAP helper functions * * @authors * Copyright (C) 1996-1998,2010,2012-2013 Michael R. Elkins <me@mutt.org> * Copyright (C) 1996-1999 Brandon Long <blong@fiction.net> * Copyright (C) 1999-2009,2012 Brendan Cully <brendan@kublai.com> * * @copyright * This program is free software: you can redistr...
cwe
CWE-22
C/C++
import io import mimetypes import uuid import warnings from collections.abc import Mapping from http.cookiejar import CookieJar from urllib.parse import quote_plus, urlencode as _urlencode from twisted.internet.interfaces import IProtocol from twisted.internet.defer import Deferred from twisted.python.components impor...
cwe
CWE-200
Python
null,null,null,10,null,null,!1,null,0<c.length?c:null)}catch(k){this.handleError(k)}};EditorUi.prototype.writeImageToClipboard=function(c,e,g,k){var m=this.base64ToBlob(c.substring(c.indexOf(",")+1),"image/png");c=new ClipboardItem({"image/png":m,"text/html":new Blob(['<img src="'+c+'" width="'+e+'" height="'+g+'">'],{...
cwe
CWE-94
JavaScript
/* Copyright The Helm 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, software distrib...
cwe
CWE-20
Go
def __getattr__(_self, attr): if attr == "nameResolver": return nameResolver else: return getattr(real_reactor, attr)
cwe
CWE-601
Python
static OPJ_BOOL bmp_read_rle8_data(FILE* IN, OPJ_UINT8* pData, OPJ_UINT32 stride, OPJ_UINT32 width, OPJ_UINT32 height) { OPJ_UINT32 x, y; OPJ_UINT8 *pix; const OPJ_UINT8 *beyond; beyond = pData + stride * height; pix = pData; x = y = 0U; while (y < height...
cwe
CWE-834
C/C++
void MojoAudioInputIPC::StreamCreated( media::mojom::AudioInputStreamPtr stream, media::mojom::AudioInputStreamClientRequest stream_client_request, mojo::ScopedSharedBufferHandle shared_memory, mojo::ScopedHandle socket, bool initially_muted) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); ...
cwe
CWE-787
C/C++
static int filter_frame(AVFilterLink *inlink, AVFrame *in) { GradFunContext *s = inlink->dst->priv; AVFilterLink *outlink = inlink->dst->outputs[0]; AVFrame *out; int p, direct; if (av_frame_is_writable(in)) { direct = 1; out = in; } else { direct = 0; out = ff_g...
cwe
CWE-119
C/C++
protected FrameHeaderData parseFrame(ByteBuffer data) throws IOException { if (prefaceCount < PREFACE_BYTES.length) { while (data.hasRemaining() && prefaceCount < PREFACE_BYTES.length) { if (data.get() != PREFACE_BYTES[prefaceCount]) { IoUtils.safeClose(getUnderly...
cwe
CWE-668
Java
JsonServerSelectionTestCase(fs::path testFilePath) { parseTest(testFilePath); }
cwe
CWE-755
Unknown
static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p, struct user_namespace *user_ns) { mm->mmap = NULL; mm->mm_rb = RB_ROOT; mm->vmacache_seqnum = 0; atomic_set(&mm->mm_users, 1); atomic_set(&mm->mm_count, 1); init_rwsem(&mm->mmap_sem); INIT_LIST_HEAD(&mm->mmlist); mm->core_state = NUL...
cwe
CWE-416
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 dynamicGetbuf (gdIOCtxPtr ctx, void *buf, int len) { int rlen, remain; dpIOCtxPtr dctx; dynamicPtr *dp; dctx = (dpIOCtxPtr) ctx; dp = dctx->dp; remain = dp->logicalSize - dp->pos; if (remain >= len) { rlen = len; } else { if (remain == 0) { return EOF; } rlen = remain; } memcpy(buf, (...
cwe
CWE-119
C/C++
snmpDecodePacket(SnmpRequest * rq) { struct snmp_pdu *PDU; u_char *Community; u_char *buf = rq->buf; int len = rq->len; allow_t allow = ACCESS_DENIED; if (!Config.accessList.snmp) { debugs(49, DBG_IMPORTANT, "WARNING: snmp_access not configured. agent query DENIED from : " << rq->from);...
cwe
CWE-772
C/C++
int yr_re_exec( uint8_t* re_code, uint8_t* input_data, size_t input_size, int flags, RE_MATCH_CALLBACK_FUNC callback, void* callback_args) { uint8_t* ip; uint8_t* input; uint8_t mask; uint8_t value; RE_FIBER_LIST fibers; RE_THREAD_STORAGE* storage; RE_FIBER* fiber; RE_FIBER...
cwe
CWE-125
C/C++
function _getHtmlHeaderColumn($title, $name, $pageName, $entityIds, $listorder, $orderdirection, $showColumn = true) { $str = ''; $entity = _getEntityString($entityIds); if ($listorder == $name) { if (($orderdirection == '') || ($orderdirection == 'down')) { $str = "<a href='$pageName?{$...
cwe
CWE-79
PHP
package com.salesmanager.shop.mapper.catalog; import javax.inject.Inject; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; import org.springframework.stereotype.Component; import com.salesmanager.core.business.services.catalog.product.ProductService; import com.salesmanager.core...
cwe
CWE-639
Java
static int set_next_request(void) { current_req = list_first_entry_or_null(&floppy_reqs, struct request, queuelist); if (current_req) { current_req->error_count = 0; list_del_init(&current_req->queuelist); } return current_req != NULL; }
cwe
CWE-416
Unknown
mrb_proc_init_copy(mrb_state *mrb, mrb_value self) { mrb_value proc = mrb_get_arg1(mrb); if (!mrb_proc_p(proc)) { mrb_raise(mrb, E_ARGUMENT_ERROR, "not a proc"); } mrb_proc_copy(mrb_proc_ptr(self), mrb_proc_ptr(proc)); return self; }
cwe
CWE-190
Unknown
#include "allocated_buffer-inl.h" #include "base_object-inl.h" #include "env-inl.h" #include "node_buffer.h" #include "node_crypto.h" #include "crypto/crypto_common.h" #include "node.h" #include "node_internals.h" #include "node_url.h" #include "string_bytes.h" #include "memory_tracker-inl.h" #include "v8.h" #include ...
cwe
CWE-295
JavaScript
int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) { int ret; sigset_t sigsaved; /* Make sure they initialize the vcpu with KVM_ARM_VCPU_INIT */ if (unlikely(vcpu->arch.target < 0)) return -ENOEXEC; ret = kvm_vcpu_first_run_init(vcpu); if (ret) return ret; if (run->exit_reason == KVM_...
cwe
CWE-399
C/C++
_PUBLIC_ size_t strlen_m_ext_handle(struct smb_iconv_handle *ic, const char *s, charset_t src_charset, charset_t dst_charset) { size_t count = 0; #ifdef DEVELOPER switch (dst_charset) { case CH_DOS: case CH_UNIX: smb_panic("cannot call strlen_m_ext() with a variable dest charset (must be UTF16* or UTF8)"...
cwe
CWE-200
C/C++
snmp_ber_decode_integer(unsigned char *buf, uint32_t *buff_len, uint32_t *num) { uint8_t i, len, type; buf = snmp_ber_decode_type(buf, buff_len, &type); if(buf == NULL || type != BER_DATA_TYPE_INTEGER) { /* * Sanity check * Invalid type in buffer */ return NULL; } buf = snmp_ber_deco...
cwe
CWE-125
C/C++
static void read_module(RBuffer *b, ut64 addr, struct minidump_module *module) { st64 o_addr = r_buf_seek (b, 0, R_BUF_CUR); r_buf_seek (b, addr, R_BUF_SET); module->base_of_image = r_buf_read_le64 (b); module->size_of_image = r_buf_read_le32 (b); module->check_sum = r_buf_read_le32 (b); module->time_date_stamp =...
cwe
CWE-400
C/C++
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { TfLiteTensor* output_values = GetOutput(context, node, kOutputValues); TfLiteTensor* output_indexes = GetOutput(context, node, kOutputIndexes); if (IsDynamicTensor(output_values)) { TF_LITE_ENSURE_OK(context, ResizeOutput(context, node)); } con...
cwe
CWE-787
C/C++
const std::array<unsigned char, 16> uuid() const { int len = 0; const char* data = nullptr; if (type() == BinData && binDataType() == BinDataType::newUUID) data = binData(len); uassert(ErrorCodes::InvalidUUID, "uuid must be a 16-byte binary field with UUID (4)...
cwe
CWE-613
Unknown
function barrettReduce(x) { x.drShiftTo(this.m.t-1,this.r2); if(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); } this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3); this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2); while(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1); x.subTo(this.r2,x); while(...
cwe
CWE-835
JavaScript
# encoding: utf-8 '''API functions for adding data to CKAN.''' import logging import random import re from socket import error as socket_error import datetime import six import ckan.common from sqlalchemy import func import ckan.lib.plugins as lib_plugins import ckan.logic as logic import ckan.plugins as plugins i...
cwe
CWE-79
Python
bool PM_io_parser<PMDEC>::read_vertex(Vertex_handle v) { // precondition: nodes exist // syntax: index { mark, point, isolated object } int n; bool iso; int f; Mark m; Point p; if ( !(in >> n) || !check_sep("{") || !(in >> iso) || !(in >> f) || !check_sep(",") || !(in >> m) ||...
cwe
CWE-269
Unknown
/* * Copyright 2004-2005 Paul Querna * Copyright 2008 Nikos Mavrogiannopoulos * Copyright 2011 Dash Shendy * Copyright 2015-2020 Fiona Klute * * 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 th...
cwe
CWE-835
C/C++
MemoryRegion *memory_map(struct uc_struct *uc, hwaddr begin, size_t size, uint32_t perms) { MemoryRegion *ram = g_new(MemoryRegion, 1); memory_region_init_ram(uc, ram, size, perms); if (ram->addr == -1) { // out of memory return NULL; } memory_region_add_subregion(uc->system_memory...
cwe
CWE-476
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
// Copyright 2018 Google Inc. // // 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in...
cwe
CWE-78
JavaScript
PPB_URLLoader_Impl::~PPB_URLLoader_Impl() { }
cwe
CWE-416
C/C++
private def checkSessionId( site: SiteBrief, anySillySid: Opt[St], anyFancySidPart12Maybe3: Opt[St], anyFancySidPart4: Opt[St], anyFancySidPart5: Opt[St], dao: SessionSiteDaoMixin, now: When, expireIdleAfterMillis: i64): CheckSidResult = { val hasFanc...
cwe
CWE-613
JavaScript
def get_file(recipe): if not recipe.link: recipe.link = Dropbox.get_share_link(recipe) recipe.save() response = requests.get(recipe.link.replace('www.dropbox.', 'dl.dropboxusercontent.')) return io.BytesIO(response.content)
cwe
CWE-918
Python
return ia}function A(){function ea(ra,ia){var Da=mxResources.get(ra);null==Da&&(Da=ra.substring(0,1).toUpperCase()+ra.substring(1));18<Da.length&&(Da=Da.substring(0,18)+"&hellip;");return Da+" ("+ia.length+")"}function ta(ra,ia,Da){mxEvent.addListener(ia,"click",function(){Ea!=ia&&(Ea.style.backgroundColor="",Ea=ia,Ea....
cwe
CWE-94
JavaScript
opj_image_t* OPJ_CALLCONV opj_image_create(OPJ_UINT32 numcmpts, opj_image_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc) { OPJ_UINT32 compno; opj_image_t *image = NULL; image = (opj_image_t*) opj_calloc(1, sizeof(opj_image_t)); if (image) { image->color_space = clrspc; image->nu...
cwe
CWE-787
Unknown
constructor(autoSingletons, debug) { this.debugEnabled = (typeof debug === 'boolean' && debug === true); this.autoInitSingletons = (typeof autoSingletons === 'boolean' && autoSingletons === false); this.plugins = {}; this.listeners = {}; this.foundBaseUrl = null; this.dom...
cwe
CWE-1321
JavaScript
public static function checkIp6($requestIp, $ip) { if (!((extension_loaded('sockets') && defined('AF_INET6')) || @inet_pton('::1'))) { throw new \RuntimeException('Unable to check Ipv6. Check that PHP was not compiled with option "disable-ipv6".'); } if (false !== strpos($ip, '/...
cwe
CWE-89
JavaScript
import itertools from flask import request, abort, _app_ctx_stack, redirect from flask_security.core import AnonymousUser from security_monkey.datastore import User try: from flask.ext.login import current_user except ImportError: current_user = None from .models import RBACRole, RBACUserMixin from . import...
cwe
CWE-601
Python
// Package errors provides simple error handling primitives. // // The traditional error handling idiom in Go is roughly akin to // // if err != nil { // return err // } // // which when applied recursively up the call stack results in error reports // without context or debugging information. The e...
cwe
CWE-287
Go
function dol_print_error($db='',$error='') { global $conf,$langs,$argv; global $dolibarr_main_prod; $out = ''; $syslog = ''; // Si erreur intervenue avant chargement langue if (! $langs) { require_once DOL_DOCUMENT_ROOT .'/core/class/translate.class.php'; $langs = new Translate('', $conf); $langs->load("...
cwe
CWE-79
PHP
/* * Swagger Petstore * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator p...
cwe
CWE-732
Java
void operator()(OpKernelContext* context, const T1* input_data, int input_batches, int input_height, int input_width, int input_depth, int input_offset, const T2* filter_data, int filter_height, int filter_width, int filter_count, int filter_offset...
cwe
CWE-369
C/C++
import logging import requests from flask import redirect, url_for, Blueprint, flash, request, session from flask_oauthlib.client import OAuth from redash import models, settings from redash.authentication import ( create_and_login_user, logout_and_redirect_to_index, get_next_path, ) from redash.authentica...
cwe
CWE-601
Python
def verify_signature(jwt) head = token_head(jwt) # Make sure the algorithm is supported and get the decode key. if head[:alg] == 'RS256' [rs256_decode_key(head[:kid]), head[:alg]] elsif head[:alg] == 'HS256' [@client_secret, head[:alg]] else raise O...
cwe
CWE-347
Ruby
/* * Stellarium * Copyright (C) 2014 Alexander Wolf * * 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. * * This ...
cwe
CWE-22
C/C++
package pipelineserver import ( "net/http" "github.com/concourse/concourse/atc" "github.com/concourse/concourse/atc/db" ) type RejectArchivedHandlerFactory struct { teamFactory db.TeamFactory } func NewRejectArchivedHandlerFactory(factory db.TeamFactory) RejectArchivedHandlerFactory { return RejectArchivedHand...
cwe
CWE-863
Go
void qemu_spice_display_init_common(SimpleSpiceDisplay *ssd) { qemu_mutex_init(&ssd->lock); QTAILQ_INIT(&ssd->updates); ssd->mouse_x = -1; ssd->mouse_y = -1; if (ssd->num_surfaces == 0) { ssd->num_surfaces = 1024; } ssd->bufsize = (16 * 1024 * 1024); ssd->buf = g_malloc(ssd->bufs...
cwe
CWE-200
Unknown
static int download(struct SPDBDownloader *pd) { SPDBDownloaderOpt *opt = pd->opt; char *curl_cmd = NULL; char *extractor_cmd = NULL; char *abspath_to_archive = NULL; char *abspath_to_file = NULL; char *archive_name = NULL; size_t archive_name_len = 0; char *symbol_store_path = NULL; char *dbg_file = NULL; ch...
cwe
CWE-78
C/C++
// Copyright 2014 The Gogs Authors. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. package db import ( "crypto/hmac" "crypto/sha256" "crypto/tls" "encoding/hex" "fmt" "io/ioutil" "strings" "time" jsoniter "github.com/json-iterator...
cwe
CWE-918
Go
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
static MagickBooleanType WritePDFImage(const ImageInfo *image_info,Image *image) { #define CFormat "/Filter [ /%s ]\n" #define ObjectsPerImage 14 DisableMSCWarning(4310) static const char XMPProfile[]= { "<?xpacket begin=\"%s\" id=\"W5M0MpCehiHzreSzNTczkc9d\"?>\n" "<x:xmpmeta xmlns:x=\"adobe:ns...
cwe
CWE-772
Unknown
virtio_dev_rx_batch_packed(struct virtio_net *dev, struct vhost_virtqueue *vq, struct rte_mbuf **pkts) { bool wrap_counter = vq->avail_wrap_counter; struct vring_packed_desc *descs = vq->desc_packed; uint16_t avail_idx = vq->last_avail_idx; uint64_t desc_addrs[PACKED_BATCH_SIZE]; struct virtio_net_hdr_...
cwe
CWE-665
C/C++
int rad_packet_recv(int fd, struct rad_packet_t **p, struct sockaddr_in *addr) { struct rad_packet_t *pack; struct rad_attr_t *attr; struct rad_dict_attr_t *da; struct rad_dict_vendor_t *vendor; uint8_t *ptr; int n, id, len, vendor_id; socklen_t addr_len = sizeof(*addr); *p = NULL; pack = rad_packet_alloc(0)...
cwe
CWE-787
Unknown
public function render() { $languageService = $this->getLanguageService(); $options = $this->data['renderData']['fieldControlOptions']; $title = $options['title'] ?? 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.edit'; $parameterArray = $this->data['parameterAr...
cwe
CWE-20
PHP
bool PermissionsData::CanCaptureVisiblePage(const GURL& document_url, int tab_id, std::string* error) const { bool has_active_tab = false; bool has_all_urls = false; url::Origin origin = url::Origin::Create(document_url); ...
cwe
CWE-863
C/C++
static void test_modules() { assert_true_rule( "import \"tests\" \ rule test { \ condition: tests.constants.one + 1 == tests.constants.two \ }", NULL); assert_true_rule( "import \"tests\" \ rule test { \ condition: tests.constants.foo == \"foo\" \ }", ...
cwe
CWE-119
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-369
C/C++
exsltFuncRegisterImportFunc (exsltFuncFunctionData *data, exsltFuncImportRegData *ch, const xmlChar *URI, const xmlChar *name, ATTRIBUTE_UNUSED const xmlChar *ignored) { exsltFuncFunctionData *func=NULL; if ((data == NULL) || (ch == NULL) || (URI == NULL) || (name == NULL)) ...
cwe
CWE-119
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-125
C/C++
TEE_Result syscall_asymm_verify(unsigned long state, const struct utee_attribute *usr_params, size_t num_params, const void *data, size_t data_len, const void *sig, size_t sig_len) { TEE_Result res; struct tee_cryp_state *cs; struct tee_ta_session *sess; struct tee_obj *o; size_t hash_size; int salt_len ...
cwe
CWE-787
Unknown
xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) { const xmlChar *cur = input; xmlChar *buffer = NULL; xmlChar *out = NULL; int buffer_size = 0; int html = 0; if (input == NULL) return(NULL); if (doc != NULL) html = (doc->type == XML_HTML_DOCUMENT_NODE); /* ...
cwe
CWE-189
Unknown
QStringList JlCompress::extractDir(QuaZip &zip, const QString &dir) { if(!zip.open(QuaZip::mdUnzip)) { return QStringList(); } QDir directory(dir); QStringList extracted; if (!zip.goToFirstFile()) { return QStringList(); } do { QString name = zip.getCurrentFileName()...
cwe
CWE-22
C/C++
resolve_op_from_commit (FlatpakTransaction *self, FlatpakTransactionOperation *op, const char *checksum, GFile *sideload_path, GVariant *commit_data) { g_autoptr(GBytes) metadata_bytes = NULL; g_autoptr(GVariant) commit_...
cwe
CWE-276
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* input = GetInput(context, node, kInputTensor); const TfLiteTensor* seq_lengths = GetInput(context, node, kSeqLengthsTensor); TF...
cwe
CWE-125
C/C++
static void uv__process_child_init(const uv_process_options_t* options, int stdio_count, int (*pipes)[2], int error_fd) { int close_fd; int use_fd; int fd; if (options->flags & UV_PROCESS_DETACHED) sets...
cwe
CWE-264
C/C++
function gce_ajax_list() { $nonce = $_POST['gce_nonce']; // check to see if the submitted nonce matches with the // generated nonce we created earlier if ( ! wp_verify_nonce( $nonce, 'gce_ajax_nonce' ) ) { die ( 'Request has failed.'); } $grouped = $_POST['gce_grouped']; $start ...
cwe
CWE-79
PHP
int disrsi_( int stream, int *negate, unsigned *value, unsigned count) { int c; unsigned locval; unsigned ndigs; char *cp; char scratch[DIS_BUFSIZ+1]; assert(negate != NULL); assert(value != NULL); assert(count); assert(stream >= 0); assert(dis_getc != NULL); assert(dis...
cwe
CWE-119
C/C++
// SPDX-License-Identifier: BSD-2-Clause /* * Copyright (c) 2014, STMicroelectronics International N.V. */ #include <util.h> #include <kernel/tee_common_otp.h> #include <kernel/tee_common.h> #include <tee_api_types.h> #include <kernel/tee_ta_manager.h> #include <utee_types.h> #include <tee/tee_svc.h> #include <tee/te...
cwe
CWE-125
C/C++
static int cloop_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVCloopState *s = bs->opaque; uint32_t offsets_size, max_compressed_block_size = 1, i; int ret; bs->read_only = 1; /* read header */ ret = bdrv_pread(bs->file, 128, &s->block_size, 4)...
cwe
CWE-20
C/C++