code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
bool Item_field::fix_fields(THD *thd, Item **reference) { DBUG_ASSERT(fixed == 0); Field *from_field= (Field *)not_found_field; bool outer_fixed= false; SELECT_LEX *select= thd->lex->current_select; if (select && select->in_tvc) { my_error(ER_FIELD_REFERENCE_IN_TVC, MYF(0), full_name()); return(1);...
cwe
CWE-703
Unknown
xmlParseStartTag2(xmlParserCtxtPtr ctxt, const xmlChar **pref, const xmlChar **URI, int *tlen) { const xmlChar *localname; const xmlChar *prefix; const xmlChar *attname; const xmlChar *aprefix; const xmlChar *nsname; xmlChar *attvalue; const xmlChar **atts = ctxt->atts; ...
vuln
Vulnerable
C/C++
static int pfkey_register(struct sock *sk, struct sk_buff *skb, const struct sadb_msg *hdr, void * const *ext_hdrs) { struct pfkey_sock *pfk = pfkey_sk(sk); struct sk_buff *supp_skb; if (hdr->sadb_msg_satype > SADB_SATYPE_MAX) return -EINVAL; if (hdr->sadb_msg_satype != SADB_SATYPE_UNSPEC) { if (pfk->register...
cwe
CWE-362
C/C++
static int fill_thread_core_info(struct elf_thread_core_info *t, const struct user_regset_view *view, long signr, size_t *total) { unsigned int i; /* * NT_PRSTATUS is the one special case, because the regset data * goes into the pr_reg field inside the note contents, rather * than being the whole not...
vuln
Vulnerable
C/C++
protected void tickPrinter() { ItemStack blueprint = inventory.getStackInSlot(0); blockSkipped = false; if (blueprint.isEmpty() && !statusMsg.equals("idle")) { state = State.STOPPED; statusMsg = "idle"; sendUpdate = true; return; } // Skip if not Active if (state == State.STOPPED) { if (p...
vuln
Vulnerable
Java
# -*- 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
function load() { w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/admin.php'); $this->_page = w3tc_get_current_page(); /** * Run plugin action */ $action = false; foreach ($_REQUEST as $key => $value) { if (strpos($key, 'w3tc_') === 0) { ...
cwe
CWE-352
PHP
/** @file index.c * @brief Functions to parse index records * * Copyright (c) 2020 Bartek Fabiszewski * http://www.fabiszewski.net * * This file is part of libmobi. * Licensed under LGPL, either version 3, or any later. * See <http://www.gnu.org/licenses/> */ #define _GNU_SOURCE 1 #ifndef __USE_BSD #define _...
vuln
Vulnerable
C/C++
protected function parse() { parent::parse(); // grab the error-type from the parameters $errorType = $this->getParameter('type'); // set correct headers switch($errorType) { case 'module-not-allowed': case 'action-not-allowed': SpoonHTTP::setHeadersByCode(403); break; case 'not-found':...
vuln
Safe
PHP
static unsigned int help(struct sk_buff *skb, enum ip_conntrack_info ctinfo, unsigned int protoff, unsigned int matchoff, unsigned int matchlen, struct nf_conntrack_expect *exp) { char buffer[sizeof("4294967296 65635")]; u_int16_t port; unsigned int ret; /* Reply comes from server. */ ...
cwe
CWE-119
C/C++
void operator()(OpKernelContext* ctx, const CPUDevice& d, int64 num_batches, int64 samples_per_batch, int64 num_elements, typename TTypes<T>::ConstFlat means, typename TTypes<T>::ConstFlat stddevs, typename TTypes<T>::ConstFlat minvals, ...
vuln
Vulnerable
C/C++
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { AnsiContext *s = avctx->priv_data; uint8_t *buf = avpkt->data; int buf_size = avpkt->size; const uint8_t *buf_end = buf+buf_size; int ret, i, count;...
cwe
CWE-190
Unknown
static OPJ_BOOL opj_tcd_code_block_enc_allocate_data(opj_tcd_cblk_enc_t * p_code_block) { OPJ_UINT32 l_data_size; /* +1 is needed for https://github.com/uclouvain/openjpeg/issues/835 */ /* and actually +2 required for https://github.com/uclouvain/openjpeg/issues/982 */ /* and +7 for https://git...
cwe
CWE-122
C/C++
static void unzzip_cat_file(ZZIP_DIR* disk, char* name, FILE* out) { ZZIP_FILE* file = zzip_file_open (disk, name, 0); if (file) { char buffer[1024]; int len; while ((len = zzip_file_read (file, buffer, 1024))) { fwrite (buffer, 1, len, out); } zzip_file_close (file); } }
vuln
Vulnerable
C/C++
function EventSource (url, eventSourceInitDict) { var readyState = EventSource.CONNECTING Object.defineProperty(this, 'readyState', { get: function () { return readyState } }) Object.defineProperty(this, 'url', { get: function () { return url } }) var self = this self.reconne...
cwe
CWE-212
JavaScript
rpmRC rpmReadPackageFile(rpmts ts, FD_t fd, const char * fn, Header * hdrp) { char *msg = NULL; Header h = NULL; Header sigh = NULL; hdrblob blob = NULL; hdrblob sigblob = NULL; rpmVSFlags vsflags = rpmtsVSFlags(ts) | RPMVSF_NEEDPAYLOAD; rpmKeyring keyring = rpmtsGetKeyring(ts, 1); struc...
cwe
CWE-345
Unknown
static void vnc_dpy_copy(DisplayState *ds, int src_x, int src_y, int dst_x, int dst_y, int w, int h) { VncDisplay *vd = ds->opaque; VncState *vs, *vn; uint8_t *src_row; uint8_t *dst_row; int i,x,y,pitch,depth,inc,w_lim,s; int cmp_bytes; vnc_refresh_server_surface(vd); QTAILQ_FOREACH_SAF...
cwe
CWE-125
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,...
vuln
Safe
Java
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { super.channelInactive(ctx); // update active channel count stats RequestStats.ACTIVE_CHANNEL_COUNT_INSTANCE.decrementAndGet(); log.info("channel inactive {}", ctx.channel()); close(); }
vuln
Vulnerable
Java
Utf8DecoderBase::Utf8DecoderBase() : unbuffered_start_(NULL), utf16_length_(0), last_byte_of_buffer_unused_(false) {}
cwe
CWE-119
Unknown
/** * Parse Server Configuration Builder * * This module builds the definitions file (src/Options/Definitions.js) * from the src/Options/index.js options interfaces. * The Definitions.js module is responsible for the default values as well * as the mappings for the CLI. * * To rebuild the definitions file, run ...
cwe
CWE-74
JavaScript
void CreateNgrams(const tstring* data, tstring* output, int num_ngrams, int ngram_width) const { for (int ngram_index = 0; ngram_index < num_ngrams; ++ngram_index) { int pad_width = get_pad_width(ngram_width); int left_padding = std::max(0, pad_width - ngram_index); int right_p...
cwe
CWE-703
Unknown
// Ogg Vorbis audio decoder - v1.16 - public domain // http://nothings.org/stb_vorbis/ // // Original version written by Sean Barrett in 2007. // // Originally sponsored by RAD Game Tools. Seeking implementation // sponsored by Phillip Bennefall, Marc Andersen, Aaron Baker, // Elias Software, Aras Pranckevicius, and Se...
cwe
CWE-369
C/C++
void* IOBuf::operator new(size_t size) { size_t fullSize = offsetof(HeapStorage, buf) + size; auto storage = static_cast<HeapStorage*>(checkedMalloc(fullSize)); new (&storage->prefix) HeapPrefix(kIOBufInUse, fullSize); if (io_buf_alloc_cb) { io_buf_alloc_cb(storage, fullSize); } return &(storage->buf...
cwe
CWE-787
Unknown
(function (root, factory){ 'use strict'; /*istanbul ignore next:cant test*/ if (typeof module === 'object' && typeof module.exports === 'object') { module.exports = factory(); } else if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define([], factory); } ...
vuln
Safe
JavaScript
var Gogo = (function() { // create our angular module and tell angular what route(s) it will handle var pluginName = "gogo"; var simplePlugin = angular.module(pluginName, ['hawtioCore']) .factory('log', function() { return Logger.get("Gogo"); }).config(function($routeProvider) { $routeProvid...
cwe
CWE-352
Java
static int old_codec47(SANMVideoContext *ctx, int top, int left, int width, int height) { int i, j, seq, compr, new_rot, tbl_pos, skip; int stride = ctx->pitch; uint8_t *dst = ((uint8_t*)ctx->frm0) + left + top * stride; uint8_t *prev1 = (uint8_t*)ctx->frm1; uint8_t *pre...
vuln
Safe
C/C++
int btrfs_add_link(struct btrfs_trans_handle *trans, struct inode *parent_inode, struct inode *inode, const char *name, int name_len, int add_backref, u64 index) { int ret = 0; struct btrfs_key key; struct btrfs_root *root = BTRFS_I(parent_inode)->root; u64 ino = btrfs_ino(inode); u64 parent_ino = btrfs_...
cwe
CWE-310
Unknown
function finish () { if (!that.disconnected && that.will) { that.broker.publish(that.will, that, function (err) { if (!err) { that.broker.persistence.delWill({ id: that.id, brokerId: that.broker.id }, nop) } }) that.will = null // this fu...
cwe
CWE-863
JavaScript
static int dirac_unpack_idwt_params(DiracContext *s) { GetBitContext *gb = &s->gb; int i, level; unsigned tmp; #define CHECKEDREAD(dst, cond, errmsg) \ tmp = svq3_get_ue_golomb(gb); \ if (cond) { \ av_log(s->avctx, AV_LOG_ERROR, errmsg); \ return -1; \ }\ dst = tmp; align...
vuln
Vulnerable
C/C++
def get_request_kwargs(cls, form, url=None, **kwargs): """Extract input data from the form.""" method = str(form.get("method", "get")) action = form.get("action") url = urllib.parse.urljoin(url, action) if url is None: # This happens when both `action` and `url` are None. ...
vuln
Vulnerable
Python
static ssize_t psi_write(struct file *file, const char __user *user_buf, size_t nbytes, enum psi_res res) { char buf[32]; size_t buf_size; struct seq_file *seq; struct psi_trigger *new; if (static_branch_likely(&psi_disabled)) return -EOPNOTSUPP; if (!nbytes) return -EINVAL; buf_size = min(nbytes, siz...
cwe
CWE-416
Unknown
@Override protected final void onMenuClick(Player player, int slot, InventoryAction action, ClickType click, ItemStack cursor, ItemStack clicked, boolean cancelled) { if (this.mode == EditMode.CHANCE && this.canEditItem(slot) && slot < this.getSize() - 9) { // Prevent exploiting chances menu holding an item ...
vuln
Safe
Java
function dockerContainerProcesses(containerID, callback) { containerID = containerID || ''; let result = []; return new Promise((resolve) => { process.nextTick(() => { if (containerID) { if (!_docker_socket) { _docker_socket = new DockerSocket(); } _docker_socket.getP...
vuln
Vulnerable
JavaScript
config_monitor( config_tree *ptree ) { int_node *pfilegen_token; const char *filegen_string; const char *filegen_file; FILEGEN *filegen; filegen_node *my_node; attr_val *my_opts; int filegen_type; int filegen_flag; /* Set the statistics directory */ if (ptree->stats_dir) stats_config(STATS_STATSDIR, ptre...
cwe
CWE-20
C/C++
MagickExport MagickBooleanType AnnotateImage(Image *image, const DrawInfo *draw_info,ExceptionInfo *exception) { char *p, color[MagickPathExtent], primitive[MagickPathExtent], *text, **textlist; DrawInfo *annotate, *annotate_info; GeometryInfo geometry_info; MagickBooleanTyp...
vuln
Vulnerable
C/C++
// Copyright (c) the JPEG XL Project Authors. All rights reserved. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. #include "lib/extras/codec_apng.h" // Parts of this code are taken from apngdis, which has the following license: /* APNG Disassembler 2.8 * *...
cwe
CWE-369
C/C++
func dumptable(w http.ResponseWriter, r *http.Request, parray []string) { user, pw := getCredentials(r) database := parray[0] table := parray[1] conn, err := sql.Open("mysql", dsn(user, pw, database)) checkY(err) defer conn.Close() statement, err := conn.Prepare("select * from " + table) checkY(err) rows, ...
vuln
Vulnerable
Go
/* * Copyright 2000-2020 Vaadin Ltd. * * 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...
cwe
CWE-200
Java
#!/usr/bin/env python # -*- coding: utf-8 -*- # # # # Copyright (c) 2008-2015 University of Dundee. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or...
cwe
CWE-200
Python
@Override public void worldLoad() { if (spawnLocation != null) spawnLocation.setWorld(Bukkit.getWorld(worldName)); spawn(true); }
vuln
Safe
Java
static Var* Pe_r_bin_pe_parse_var(RBinPEObj* pe, PE_DWord* curAddr) { Var* var = calloc (1, sizeof (*var)); if (!var) { pe_printf ("Warning: calloc (Var)\n"); return NULL; } if ((var->wLength = r_buf_read_le16_at (pe->b, *curAddr)) == UT16_MAX) { pe_printf ("Warning: read (Var wLength)\n"); free_Var (var); ...
cwe
CWE-400
C/C++
struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off, const struct bpf_insn *patch, u32 len) { u32 insn_adj_cnt, insn_rest, insn_delta = len - 1; const u32 cnt_max = S16_MAX; struct bpf_prog *prog_adj; /* Since our patchlet doesn't expand the image, we're done. */ if (insn_delta == 0) ...
vuln
Safe
C/C++
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #include "ESTreeIRGen.h" #include "llvh/ADT/SmallString.h" namespace hermes { namespace irgen { //===---------------------------...
vuln
Safe
C/C++
static void vfio_listener_region_add(MemoryListener *listener, MemoryRegionSection *section) { VFIOContainer *container = container_of(listener, VFIOContainer, iommu_data.listener); hwaddr iova, end; void *vaddr; int ret; ...
vuln
Vulnerable
C/C++
QPDF_Array::getItem(int n) const { if ((n < 0) || (n >= static_cast<int>(this->items.size()))) { throw std::logic_error( "INTERNAL ERROR: bounds error accessing QPDF_Array element"); } return this->items.at(n); }
vuln
Vulnerable
Unknown
/** * 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 "osquery/sql/sqlite_util.h" #include "osquery/sql/virtual_table.h" #incl...
cwe
CWE-77
C/C++
__u32 secure_ipv6_id(const __be32 daddr[4]) { const struct keydata *keyptr; __u32 hash[4]; keyptr = get_keyptr(); hash[0] = (__force __u32)daddr[0]; hash[1] = (__force __u32)daddr[1]; hash[2] = (__force __u32)daddr[2]; hash[3] = (__force __u32)daddr[3]; return half_md4_transform(hash, keyptr->secret); }
cwe
CWE-703
Unknown
TfLiteStatus EvalHybridPerChannel(TfLiteContext* context, TfLiteNode* node, TfLiteDepthwiseConvParams* params, OpData* data, const TfLiteTensor* input, const TfLiteTensor* filter, cons...
vuln
Vulnerable
C/C++
(function() { // Adds Arrow shapes with control points Sidebar.prototype.addArrows2Palette = function() { var s = 'html=1;shadow=0;dashed=0;align=center;verticalAlign=middle;shape=mxgraph.arrows2.'; var s2 = 'html=1;shadow=0;dashed=0;fillColor=none;strokeColor=none;shape=mxgraph.arrows2.'; var gn = 'mxgraph.ar...
vuln
Safe
Java
static int find_optimal_param(uint64_t sum, int n) { int k; uint64_t sum2; if (sum <= n >> 1) return 0; sum2 = sum - (n >> 1); k = av_log2(av_clipl_int32(sum2 / n)); return FFMIN(k, MAX_RICE_PARAM); }
vuln
Safe
C/C++
def get_value(self): if self.column.render_function: # We don't want to escape our html return self.column.render_function(self.object) field = getattr(self.object, self.column.field_name) if self.column.field_name else None if type(self.object) == dict: valu...
vuln
Vulnerable
Python
inline int check(int itemSize, int nItems=1, bool wait=true) { if (ptr + itemSize * nItems > end) { if (ptr + itemSize > end) return overrun(itemSize, nItems, wait); nItems = (end - ptr) / itemSize; } return nItems; }
cwe
CWE-122
C/C++
int HeaderMapWrapper::luaGet(lua_State* state) { const char* key = luaL_checkstring(state, 2); const Http::HeaderEntry* entry = headers_.get(Http::LowerCaseString(key)); if (entry != nullptr) { lua_pushlstring(state, entry->value().getStringView().data(), entry->value().getStringView().len...
vuln
Vulnerable
Unknown
/* * Copyright 2022 Thoughtworks, 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
cwe
CWE-532
Java
/* * GPAC - Multimedia Framework C SDK * * Authors: Jean Le Feuvre * Copyright (c) Telecom ParisTech 2000-2021 * All rights reserved * * This file is part of GPAC / text import filter * * GPAC is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General P...
vuln
Vulnerable
C/C++
def load(self): if len(self.tile) != 1 or self.tile[0][0] != "iptc": return ImageFile.ImageFile.load(self) type, tile, box = self.tile[0] encoding, offset = tile self.fp.seek(offset) # Copy image data to temporary file o_fd, outfile = tempfile.mkstemp(tex...
vuln
Safe
Python
~ScopedRequest() { if (requested_) { owner_->delegate_->StopEnumerateDevices(request_id_); } }
cwe
CWE-399
C/C++
static int rscc_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { RsccContext *ctx = avctx->priv_data; GetByteContext *gbc = &ctx->gbc; GetByteContext tiles_gbc; AVFrame *frame = data; const uint8_t *pixels, *raw; uint8_t *inf...
vuln
Vulnerable
C/C++
Send an email message */ PHP_FUNCTION(imap_mail) { char *to=NULL, *message=NULL, *headers=NULL, *subject=NULL, *cc=NULL, *bcc=NULL, *rpath=NULL; int to_len, message_len, headers_len, subject_len, cc_len, bcc_len, rpath_len, argc = ZEND_NUM_ARGS(); if (zend_parse_parameters(argc TSRMLS_CC, "sss|ssss", &to, &to_len, ...
cwe
CWE-476
Unknown
'use strict' function _process (v, mod) { var i var r if (typeof mod === 'function') { r = mod(v) if (r !== undefined) { v = r } } else if (Array.isArray(mod)) { for (i = 0; i < mod.length; i++) { r = mod[i](v) if (r !== undefined) { v = r } } } return ...
cwe
CWE-74
JavaScript
static void quorum_aio_finalize(QuorumAIOCB *acb) { BDRVQuorumState *s = acb->common.bs->opaque; int i, ret = 0; if (acb->vote_ret) { ret = acb->vote_ret; } acb->common.cb(acb->common.opaque, ret); if (acb->is_read) { for (i = 0; i < s->num_children; i++) { qemu_vfree...
vuln
Vulnerable
C/C++
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { auto* data = reinterpret_cast<TfLiteAudioMicrofrontendParams*>(node->user_data); FrontendReset(data->state); const TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); ...
cwe
CWE-787
C/C++
// ximainfo.cpp : main attributes /* 03/10/2004 v1.00 - Davide Pizzolato - www.xdp.it * CxImage version 7.0.2 07/Feb/2011 */ #include "ximage.h" #if defined(_LINUX) || defined(__APPLE__) #ifdef UNICODE #define _tcsnicmp(a,b,c) wcscasecmp(a,b) #else #define _tcsnicmp(a,b,c) strcasecmp(a,b) ...
cwe
CWE-770
C/C++
/* Copyright (c) 2017 - 2021 LiteSpeed Technologies Inc. See LICENSE. */ /* * lsquic_spi.c - implementation of Stream Priority Iterator. */ #include <assert.h> #include <inttypes.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <sys/queue.h> #include <sys/types.h> #ifdef WIN32 #include <vc_co...
vuln
Vulnerable
C/C++
static int chr_can_read(void *opaque) { SCLPConsole *scon = opaque; return scon->iov ? SIZE_BUFFER_VT220 - scon->iov_data_len : 0; }
vuln
Safe
C/C++
static void fast_addr_spec_with_generic_uri(pbelle_sip_messageParser ctx, belle_sip_header_address_t* object) { belle_sip_uri_t* fast_uri56; #undef RETURN_TYPE_fast_uri56 #define RETURN_TYPE_fast_uri56 belle_sip_uri_t* belle_generic_uri_t* generic_uri57; #undef RETURN_TYPE_generic_uri57 #define...
vuln
Safe
C/C++
ProcXkbSetNames(ClientPtr client) { DeviceIntPtr dev; CARD32 *tmp; Atom bad; int rc; REQUEST(xkbSetNamesReq); REQUEST_AT_LEAST_SIZE(xkbSetNamesReq); if (!(client->xkbClientFlags & _XkbClientInitialized)) return BadAccess; CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManag...
cwe
CWE-119
Unknown
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/ui/views/select_file_dialog_extension.h" #include <map> #include <memory> #include <string> #include <utility> #include "as...
cwe
CWE-416
C/C++
static bool ldap_push_filter(struct asn1_data *data, struct ldb_parse_tree *tree) { int i; switch (tree->operation) { case LDB_OP_AND: case LDB_OP_OR: asn1_push_tag(data, ASN1_CONTEXT(tree->operation==LDB_OP_AND?0:1)); for (i=0; i<tree->u.list.num_elements; i++) ...
cwe
CWE-399
C/C++
static Image *ReadSCTImage(const ImageInfo *image_info,ExceptionInfo *exception) { char magick[2]; Image *image; MagickBooleanType status; MagickRealType height, width; Quantum pixel; register IndexPacket *indexes; register ssize_t i, x; register PixelPacket ...
cwe
CWE-120
C/C++
empe_inlinepgp_signed_parse (EMailParserExtension *extension, EMailParser *parser, CamelMimePart *part, GString *part_id, GCancellable *cancellable, GQueue *out_mail_parts) { ...
vuln
Safe
Unknown
void ValidateInputTensors(OpKernelContext* ctx, const Tensor& in0, const Tensor& in1) override { OP_REQUIRES( ctx, in0.dims() >= 2, errors::InvalidArgument("In[0] ndims must be >= 2: ", in0.dims())); OP_REQUIRES( ctx, in1.dims() >= 2, errors::InvalidA...
cwe
CWE-125
Unknown
archive_read_format_zip_cleanup(struct archive_read *a) { struct zip *zip; struct zip_entry *zip_entry, *next_zip_entry; zip = (struct zip *)(a->format->data); #ifdef HAVE_ZLIB_H if (zip->stream_valid) inflateEnd(&zip->stream); #endif #if HAVE_LZMA_H && HAVE_LIBLZMA if (zip->zipx_lzma_valid) { lzma_end(&...
vuln
Safe
C/C++
def set_body(self, body): self.data = yaml.load(body)
vuln
Vulnerable
Python
static int local_unlinkat(FsContext *ctx, V9fsPath *dir, const char *name, int flags) { int ret; int dirfd; if (ctx->export_flags & V9FS_SM_MAPPED_FILE && local_is_mapped_file_metadata(ctx, name)) { errno = EINVAL; return -1; } dirfd = local_opendi...
vuln
Safe
Unknown
aio_write_f(int argc, char **argv) { int nr_iov, c; int pattern = 0xcd; struct aio_ctx *ctx = calloc(1, sizeof(struct aio_ctx)); BlockDriverAIOCB *acb; while ((c = getopt(argc, argv, "CqP:")) != EOF) { switch (c) { case 'C': ctx->Cflag = 1; break; case 'q': ctx->qflag = 1; break; case 'P': p...
vuln
Safe
C/C++
/* * XDR support for nfsd * * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> */ #include "vfs.h" #include "xdr.h" #include "auth.h" #define NFSDDBG_FACILITY NFSDDBG_XDR /* * Mapping of S_IF* types to NFS file types */ static u32 nfs_ftypes[] = { NFNON, NFCHR, NFCHR, NFBAD, NFDIR, NFBAD, NFBLK, ...
cwe
CWE-399
C/C++
/* Copyright 2020 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
C/C++
int LibRaw::ljpeg_start(struct jhead *jh, int info_only) { ushort c, tag, len; int cnt = 0; uchar data[0x10000]; const uchar *dp; memset(jh, 0, sizeof *jh); jh->restart = INT_MAX; if ((fgetc(ifp), fgetc(ifp)) != 0xd8) return 0; do { if (feof(ifp)) return 0; if (cnt++ > 1024) r...
cwe
CWE-125
C/C++
ipmi_spd_print_fru(struct ipmi_intf * intf, uint8_t id) { struct ipmi_rs * rsp; struct ipmi_rq req; struct fru_info fru; uint8_t *spd_data, msg_data[4]; int len, offset; msg_data[0] = id; memset(&req, 0, sizeof(req)); req.msg.netfn = IPMI_NETFN_STORAGE; req.msg.cmd = GET_FRU_INFO; req.msg.data = msg_data; ...
cwe
CWE-120
C/C++
public void setKeep(Group group, Channel channel) { if (!group.isHidden()) Prefers.putKeep(home.getName() + AppDatabase.SYMBOL + group.getName() + AppDatabase.SYMBOL + channel.getName()); }
vuln
Vulnerable
Java
/* 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 di...
cwe
CWE-74
Go
public void build(BalanceConfig conf, ForgeConfigSpec.Builder builder) { if (balanceModifications.size() > 0) { LOGGER.info("Building balance configuration with {} modifications", balanceModifications.size()); } for (Map.Entry<String, Map<String, Conf>> stringMapEntry : categoryConfi...
vuln
Vulnerable
Java
def _exec_cmd(self, cmd): """Executes adb commands in a new shell. This is specific to executing adb binary because stderr is not a good indicator of cmd execution status. Args: cmds: A string that is the adb command to execute. Returns: The output of t...
cwe
CWE-78
Python
/* Copyright 2020 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-908
C/C++
package com.salesmanager.shop.admin.controller.products; import com.salesmanager.core.business.services.catalog.product.ProductService; import com.salesmanager.core.business.utils.ajax.AjaxPageableResponse; import com.salesmanager.core.business.utils.ajax.AjaxResponse; import com.salesmanager.core.model.catalog.produc...
cwe
CWE-639
Java
static int create_vorbis_context(vorbis_enc_context *venc, AVCodecContext *avctx) { vorbis_enc_floor *fc; vorbis_enc_residue *rc; vorbis_enc_mapping *mc; int i, book, ret; venc->channels = avctx->channels; venc->sample_rate = avctx->sample_rate; venc->lo...
vuln
Safe
C/C++
static int parallels_create(const char *filename, QemuOpts *opts, Error **errp) { int64_t total_size, cl_size; uint8_t tmp[BDRV_SECTOR_SIZE]; Error *local_err = NULL; BlockBackend *file; uint32_t bat_entries, bat_sectors; ParallelsHeader header; int ret; total_size = ROUND_UP(qemu_opt_ge...
vuln
Safe
C/C++
public void onGlobalLayout() { if (getActivity() != null) { transcriptListView.getViewTreeObserver().removeOnGlobalLayoutListener(this); final float transcriptRowHeight = getActivity().getResources().getDimension(R.dimen.transcript_row_heig...
vuln
Safe
Java
rsvg_filter_primitive_component_transfer_render (RsvgFilterPrimitive * self, RsvgFilterContext * ctx) { gint x, y, c; guint i; gint temp; gint rowstride, height, width; RsvgIRect boundarys; RsvgNodeComponentTransferFunc *channels[4]; Component...
vuln
Safe
Unknown
rfbBool rfbSendRectEncodingZRLE(rfbClientPtr cl, int x, int y, int w, int h) { zrleOutStream* zos; rfbFramebufferUpdateRectHeader rect; rfbZRLEHeader hdr; int i; if (cl->preferredEncoding == rfbEncodingZYWRLE) { if (cl->tightQualityLevel < 0) { cl->zywrleLevel = 1; } else if (cl->tightQualityLevel ...
vuln
Vulnerable
Unknown
public function specialLogin( $error = null ) { $request = $this->getRequest(); $out = $this->getOutput(); $out->setPageTitle( wfMessage('soa2-login-title')->escaped() ); if ($error) { $this->error($error); } else if ( $request->wasPosted() && $request->getCheck( 'username' ) ) { $username = $reque...
vuln
Safe
PHP
read_header_block (PSDimage *img_a, FILE *f, GError **error) { guint16 version; gchar sig[4]; gchar buf[6]; if (fread (sig, 4, 1, f) < 1 || fread (&version, 2, 1, f) < 1 || fread (buf, 6, 1, f) < 1 || fread (&img_a->channels, 2, 1, f) < 1 ...
cwe
CWE-190
Unknown
async function encrypt(oid, cipher_algo, hash_algo, m, Q, fingerprint) { const { V, Z } = await genPublicEphemeralKey(oid, cipher_algo, hash_algo, Q, fingerprint); return { V: new BN(V), C: aes_kw.wrap(Z, m.toString()) }; }
cwe
CWE-327
JavaScript
function validateAuthToken(meetingId, requesterUserId, requesterToken) { const REDIS_CONFIG = Meteor.settings.private.redis; const CHANNEL = REDIS_CONFIG.channels.toAkkaApps; const EVENT_NAME = 'ValidateAuthTokenReqMsg'; const sessionId = `${meetingId}--${requesterUserId}`; this.setUserId(sessionId); cons...
vuln
Vulnerable
JavaScript
def _create_token(cls, user_id: Optional[str], issued_on: float) -> str: """Creates a new CSRF token. Args: user_id: str|None. The user_id for which the token is generated. issued_on: float. The timestamp at which the token was issued. Returns: str. The gene...
vuln
Vulnerable
Python
void ZipTest::testDecompress() { std::string testFile = getTestFile("data", "test.zip"); std::ifstream inp(testFile.c_str(), std::ios::binary); assert (inp.good()); Decompress dec(inp, Poco::Path::temp()); dec.EError += Poco::Delegate<ZipTest, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> >(thi...
vuln
Safe
Unknown
void impeg2d_dec_hdr(void *pv_dec,impeg2d_video_decode_ip_t *ps_ip, impeg2d_video_decode_op_t *ps_op) { UWORD32 u4_bits_read; dec_state_t *ps_dec; ps_dec = (dec_state_t *)pv_dec; ps_op->s_ivd_video_decode_op_t.u4_error_code = 0; impeg2d_bit_stream_init(&(ps_dec->s_bit_stream),ps_ip->s_ivd_video_dec...
vuln
Safe
C/C++
int TfLiteIntArrayGetSizeInBytes(int size) { static TfLiteIntArray dummy; int computed_size = sizeof(dummy) + sizeof(dummy.data[0]) * size; #if defined(_MSC_VER) // Context for why this is needed is in http://b/189926408#comment21 computed_size -= sizeof(dummy.data[0]); #endif return computed_size; }
cwe
CWE-190
C/C++