code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
/* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com * Copyright (c) 2016 Facebook * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * This program is distributed in th...
cwe
CWE-190
C/C++
static void sfb_init_perturbation(u32 slot, struct sfb_sched_data *q) { q->bins[slot].perturbation = prandom_u32(); }
cwe
CWE-330
Unknown
def vault_encrypt(v_plaintexts, mp): iv = '01234567' vault_code = vault_encode(v_plaintexts, mp) des3 = DES3.new(hash_mp(mp), DES3.MODE_CFB, iv) # plaintext= staruct.pack("%sI" % len(vault_code), *vault_code) c = des3.encrypt(vault_code) return c
cwe
CWE-327
Python
/* * Copyright (C) 2011, 2012, 2013 Citrix Systems * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, thi...
cwe
CWE-682
C/C++
# Natural Language Toolkit: Transformation-based learning # # Copyright (C) 2001-2021 NLTK Project # Author: Marcus Uneson <marcus.uneson@gmail.com> # based on previous (nltk2) version by # Christopher Maloof, Edward Loper, Steven Bird # URL: <https://www.nltk.org/> # For license information, see LICENSE.TXT impo...
cwe
CWE-1333
Python
WRITE_JSON_ELEMENT(ObjStart) { /* increase depth, save: before first key-value no comma needed. */ ctx->depth++; ctx->commaNeeded[ctx->depth] = false; return writeChar(ctx, '{'); }
cwe
CWE-703
Unknown
ParseNameValue(const char * buffer, int bufsize, struct NameValueParserData * data) { struct xmlparser parser; data->l_head = NULL; data->portListing = NULL; data->portListingLength = 0; /* init xmlparser object */ parser.xmlstart = buffer; parser.xmlsize = bufsize; parser.data = data; par...
cwe
CWE-119
C/C++
static ssize_t smtcfb_read(struct fb_info *info, char __user *buf, size_t count, loff_t *ppos) { unsigned long p = *ppos; u32 *buffer, *dst; u32 __iomem *src; int c, i, cnt = 0, err = 0; unsigned long total_size; if (!info || !info->screen_base) return -ENODEV; if (info->state != FBINFO_STATE_RUNNING)...
cwe
CWE-787
C/C++
/** * oEmbed Plugin plugin * Licensed under the MIT license * jQuery Embed Plugin: http://code.google.com/p/jquery-oembed/ (MIT License) * Plugin for: http://ckeditor.com/license (GPL/LGPL/MPL: http://ckeditor.com/license) */ (function() { CKEDITOR.plugins.add('oembed', { icons: 'o...
cwe
CWE-19
JavaScript
bool SharedMemory::Create(const SharedMemoryCreateOptions& options) { DCHECK_EQ(-1, mapped_file_); if (options.size == 0) return false; if (options.size > static_cast<size_t>(std::numeric_limits<int>::max())) return false; base::ThreadRestrictions::ScopedAllowIO allow_io; FILE *fp; bool fix_size = tr...
cwe
CWE-264
C/C++
def try_compile_and_link(compiler, source='', flags=[], verbose=False): ensure_tmp_dir_exists() with tempfile.NamedTemporaryFile() as sfile: ofile = tempfile.mktemp() try: sfile.file.write(bytes(source, 'utf-8')) sfile.file.flush() ret = subprocess.run([compil...
cwe
CWE-377
Python
bool WebMediaPlayerImpl::HasSingleSecurityOrigin() const { if (data_source_) return data_source_->HasSingleOrigin(); return true; }
cwe
CWE-346
C/C++
<div class='graphWrapper' style='width:100%;' id='wrapper_<?php print $graph['local_graph_id']?>' graph_width='<?php print $graph['width'];?>' graph_height='<?php print $graph['height'];?>' title_font_size='<?php print ((read_user_setting('custom_fonts') == 'on') ? read_user_setting('title_size') : read_config_option('...
cwe
CWE-79
PHP
package com.salesmanager.shop.admin.model.orders; import com.salesmanager.core.model.common.Billing; import com.salesmanager.core.model.common.Delivery; import com.salesmanager.core.model.order.orderstatus.OrderStatus; import javax.persistence.Embedded; import java.io.Serializable; import java.util.Arrays; import jav...
cwe
CWE-79
Java
parse_bracket_exp (void) { int invert; int c, c1, c2; charclass ccl; /* Used to warn about [:space:]. Bit 0 = first character is a colon. Bit 1 = last character is a colon. Bit 2 = includes any other character but a colon. Bit 3 = includes ranges, char/equiv classes or collation elements. ...
cwe
CWE-189
Unknown
document.createElement("div");pa.className="geTempDlgNewDiagramCatItemLbl";pa.innerHTML=qa;ma.appendChild(pa);Ca.appendChild(ma);mxEvent.addListener(ma,"click",function(){function Ka(){var Ra=Ia.querySelector(".geTemplateDrawioCatLink");null!=Ra?Ra.click():setTimeout(Ka,200)}Z=!0;var Ia=M.querySelector(".geTemplatesLis...
cwe
CWE-20
JavaScript
do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, char *fname, int flen, struct iattr *iap, struct svc_fh *resfhp, int createmode, u32 *verifier, bool *truncp, bool *created) { struct dentry *dentry, *dchild = NULL; struct inode *dirp; __be32 err; int host_err; __u32 v_mtime=0, v_atime=0; ...
cwe
CWE-732
Unknown
ssize_t oe_recvfrom( int sockfd, void* buf, size_t len, int flags, const struct oe_sockaddr* src_addr, oe_socklen_t* addrlen) { ssize_t ret = -1; oe_fd_t* sock; if (!(sock = oe_fdtable_get(sockfd, OE_FD_TYPE_SOCKET))) OE_RAISE_ERRNO(oe_errno); ret = sock->ops.socket.rec...
cwe
CWE-200
Unknown
unsigned int get_random_int(void) { struct keydata *keyptr; __u32 *hash = get_cpu_var(get_random_int_hash); int ret; keyptr = get_keyptr(); hash[0] += current->pid + jiffies + get_cycles(); ret = half_md4_transform(hash, keyptr->secret); put_cpu_var(get_random_int_hash); return ret; }
cwe
CWE-703
Unknown
xfs_attr_node_addname(xfs_da_args_t *args) { xfs_da_state_t *state; xfs_da_state_blk_t *blk; xfs_inode_t *dp; xfs_mount_t *mp; int committed, retval, error; trace_xfs_attr_node_addname(args); /* * Fill in bucket of arguments/results/context to carry around. */ dp = args->dp; mp = dp->i_mount; restart: s...
cwe
CWE-19
C/C++
int Effect_command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize, void *pCmdData, uint32_t *replySize, void *pReplyData){ EffectContext * pContext = (EffectContext *) self; int retsize; if(pContext->EffectType == LVM_BASS_BOOST){ } if(pContext->EffectType == LVM_VIRTUALIZER...
cwe
CWE-119
C/C++
public void update(DatabaseTypeUpdateRequest request) { databaseTypeDao.selectOptionalById(request.getId()).ifPresent(data -> { if (DatabaseTypes.has(data.getDatabaseType())) { throw DomainErrors.MUST_NOT_MODIFY_SYSTEM_DEFAULT_DATABASE_TYPE.exception(); } Dat...
cwe
CWE-20
Java
http.ServerResponse.prototype.safeRedirect = function (url) { const fullURL = new URL(url, config.urlPrefix); if (!fullURL.toString().startsWith(config.urlPrefix)) return this.forbidden(); this.redirect(url); };
cwe
CWE-601
JavaScript
//////////////////////////////////////////////////////////////////////////////// /// DISCLAIMER /// /// Copyright 2014-2021 ArangoDB GmbH, Cologne, Germany /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany /// /// Licensed under the Apache License, Version 2.0 (the "License"); /// you may not use this file except...
cwe
CWE-918
C/C++
mp_join_print(netdissect_options *ndo, const u_char *opt, u_int opt_len, u_char flags) { const struct mp_join *mpj = (const struct mp_join *) opt; if (!(opt_len == 12 && flags & TH_SYN) && !(opt_len == 16 && (flags & (TH_SYN | TH_ACK)) == (TH_SYN | TH_ACK)) && !(op...
cwe
CWE-787
Unknown
Jsi_Value *Jsi_ValueArrayIndex(Jsi_Interp *interp, Jsi_Value *args, int index) { Jsi_Obj *obj = args->d.obj; Jsi_Value *v; assert(args->vt == JSI_VT_OBJECT); if (obj->isarrlist && obj->arr) return ((index < 0 || (uint)index >= obj->arrCnt) ? NULL : obj->arr[index]); char unibuf[100]; Jsi...
cwe
CWE-120
C/C++
/** * plugin for displaying ROIs over an image canvas * * Requires Raphael http://raphaeljs.com/ * and scale.raphael.js http://shapevent.com/scaleraphael/ */ $.fn.roi_display = function(options) { return this.each(function(){ var self = this; var viewerId = this.id; var $viewport...
cwe
CWE-116
Python
/* Keyring handling * * Copyright (C) 2004-2005, 2008, 2013 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.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 Found...
cwe
CWE-255
C/C++
int snd_usbmidi_create(struct snd_card *card, struct usb_interface *iface, struct list_head *midi_list, const struct snd_usb_audio_quirk *quirk) { struct snd_usb_midi *umidi; struct snd_usb_midi_endpoint_info endpoints[MIDI_MAX_ENDPOINTS]; int out_ports, in_ports; int i, err; umidi = kz...
cwe
CWE-703
C/C++
DIR *dd_init_next_file(struct dump_dir *dd) { // if (!dd->locked) // error_msg_and_die("dump_dir is not opened"); /* bug */ if (dd->next_dir) closedir(dd->next_dir); dd->next_dir = opendir(dd->dd_dirname); if (!dd->next_dir) { error_msg("Can't open directory '%s'", dd->dd_dir...
cwe
CWE-20
Unknown
/* * 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 Compute(OpKernelContext* ctx) override { const Tensor& handle = ctx->input(0); const string& name = handle.scalar<tstring>()(); auto session_state = ctx->session_state(); OP_REQUIRES(ctx, session_state != nullptr, errors::FailedPrecondition( "DeleteSessionTensor ...
cwe
CWE-703
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-79
Java
public function delete($fileName = null) { $this->validateFileName(); list($name, $extension) = $this->model->getFileNameParts(); return $this->datasource->delete( $this->model->getObjectTypeDirName(), $name, $extension ); }
cwe
CWE-863
PHP
// mkerrors.sh -m32 // Code generated by the command above; see README.md. DO NOT EDIT. // +build 386,darwin // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m32 _const.go package unix import "syscall" const ( AF_APPLETALK = 0x10 AF_CCITT = 0xa ...
cwe
CWE-287
Go
package controller import ( "github.com/answerdev/answer/internal/base/handler" "github.com/answerdev/answer/internal/base/middleware" "github.com/answerdev/answer/internal/base/reason" "github.com/answerdev/answer/internal/base/translator" "github.com/answerdev/answer/internal/base/validator" "github.com/answer...
cwe
CWE-284
Go
CAMLprim value caml_bitvect_test(value bv, value n) { int pos = Int_val(n); return Val_int(Byte_u(bv, pos >> 3) & (1 << (pos & 7))); }
cwe
CWE-119
C/C++
init_pci(struct vmctx *ctx) { struct mem_range mr; struct pci_vdev_ops *ops; struct businfo *bi; struct slotinfo *si; struct funcinfo *fi; size_t lowmem; int bus, slot, func; int success_cnt = 0; int error; pci_emul_iobase = PCI_EMUL_IOBASE; pci_emul_membase32 = vm_get_lowmem_limit(ctx); pci_emul_membase64...
cwe
CWE-617
C/C++
#ifdef HAVE_LIBWEBP #include <stdio.h> #include <math.h> #include <string.h> #include <stdlib.h> #include "gd.h" #include "gdhelpers.h" #include "webp/decode.h" #include "webp/encode.h" #define GD_WEBP_ALLOC_STEP (4*1024) gdImagePtr gdImageCreateFromWebp (FILE * inFile) { gdImagePtr im; gdIOCtx *in = gdNewFileCtx(i...
cwe
CWE-190
C/C++
// SPDX-License-Identifier: GPL-3.0-or-later #include "../libnetdata.h" // ---------------------------------------------------------------------------- // URL encode / decode // code from: http://www.geekhideout.com/urlcode.shtml /* Converts a hex character to its integer value */ char from_hex(char ch) { return...
cwe
CWE-200
C/C++
getprivs_ret * get_privs_2_svc(krb5_ui_4 *arg, struct svc_req *rqstp) { static getprivs_ret ret; gss_buffer_desc client_name, service_name; OM_uint32 minor_stat; kadm5_server_handle_t handle; const char *errmsg = NULL; ...
cwe
CWE-772
C/C++
static u32 __peek_user_compat(struct task_struct *child, addr_t addr) { struct user32 *dummy32 = NULL; per_struct32 *dummy_per32 = NULL; addr_t offset; __u32 tmp; if (addr < (addr_t) &dummy32->regs.acrs) { /* * psw and gprs are stored on the stack */ if (addr == (addr_t) &dummy32->regs.psw.mask) { /*...
cwe
CWE-399
Unknown
package service import ( "context" "fmt" "net" "net/netip" "strings" "time" "github.com/go-errors/errors" grpc_auth "github.com/grpc-ecosystem/go-grpc-middleware/auth" "github.com/openfga/openfga/pkg/encoder" "github.com/openfga/openfga/pkg/encrypter" "github.com/openfga/openfga/pkg/logger" "github.com/op...
cwe
CWE-863
Go
copy: function (from, dist, callback) { var that = this, cmd = ''; dist = path.resolve(dist); fs.lstat(from, function (err, stats) { if (err) { callback(err); } else { if (stats.isDirectory()) { that.mkdir(dist, function (err) { if (err) { ...
cwe
CWE-77
JavaScript
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or a...
cwe
CWE-617
Python
void RenderFrameDevToolsAgentHost::AttachSession(DevToolsSession* session) { session->SetRenderer(frame_host_ ? frame_host_->GetProcess()->GetID() : ChildProcessHost::kInvalidUniqueID, frame_host_); protocol::EmulationHandler* emulation_handler = n...
cwe
CWE-20
C/C++
static int atusb_get_and_show_revision(struct atusb *atusb) { struct usb_device *usb_dev = atusb->usb_dev; unsigned char buffer[3]; int ret; /* Get a couple of the ATMega Firmware values */ ret = atusb_control_msg(atusb, usb_rcvctrlpipe(usb_dev, 0), ATUSB_ID, ATUSB_REQ_FROM_DEV, 0, 0, buffer, 3, 1000); i...
cwe
CWE-399
Unknown
GetNumWrongData(const byte * curPtr, const int maxnum) { int count = 0; if (1 == maxnum) { return (1); } while (*(curPtr + count) != *(curPtr + count + 1) && maxnum > count) { count++; } return (count); }
cwe
CWE-787
C/C++
/* Copyright (c) 2017 - 2021 LiteSpeed Technologies Inc. See LICENSE. */ /* * lsquic_parse_ietf_v1.c -- Parsing functions specific to IETF QUIC v1 */ #include <assert.h> #include <inttypes.h> #include <errno.h> #include <stddef.h> #include <string.h> #include <sys/queue.h> #ifndef WIN32 #include <sys/types.h> #else...
cwe
CWE-476
C/C++
nbd_unlocked_opt_go (struct nbd_handle *h) { int err; nbd_completion_callback c = { .callback = go_complete, .user_data = &err }; int r = nbd_unlocked_aio_opt_go (h, &c); if (r == -1) return r; r = wait_for_option (h); if (r == 0 && err) { assert (nbd_internal_is_state_negotiating (get_next_state ...
cwe
CWE-617
C/C++
static void addModuleArgument(sqlite3 *db, Table *pTable, char *zArg){ int nBytes = sizeof(char *)*(2+pTable->nModuleArg); char **azModuleArg; azModuleArg = sqlite3DbRealloc(db, pTable->azModuleArg, nBytes); if( azModuleArg==0 ){ sqlite3DbFree(db, zArg); }else{ int i = pTable->nModuleArg++; az...
cwe
CWE-190
C/C++
static RzDyldRebaseInfos *get_rebase_infos(RzDyldCache *cache) { RzDyldRebaseInfos *result = RZ_NEW0(RzDyldRebaseInfos); if (!result) { return NULL; } if (!cache->hdr->slideInfoOffset || !cache->hdr->slideInfoSize) { ut32 total_slide_infos = 0; ut32 n_slide_infos[MAX_N_HDR]; ut32 i; for (i = 0; i < cach...
cwe
CWE-787
C/C++
op_replace(oparg_T *oap, int c) { int n, numc; int num_chars; char_u *newp, *oldp; size_t oldlen; struct block_def bd; char_u *after_p = NULL; int had_ctrl_v_cr = FALSE; if ((curbuf->b_ml.ml_flags & ML_EMPTY ) || oap->empty) return OK; // nothing to do if (c == REPLAC...
cwe
CWE-122
C/C++
static int path_set_acls(Item *item, const char *path) { int r = 0; #if HAVE_ACL char fn[STRLEN("/proc/self/fd/") + DECIMAL_STR_MAX(int)]; _cleanup_close_ int fd = -1; struct stat st; assert(item); assert(path); fd = open(path, O_NOFOLLOW|O_CLOEXEC|O_PATH); ...
cwe
CWE-59
Unknown
CopyGetData(CopyState cstate, void *databuf, int minread, int maxread) { int bytesread = 0; switch (cstate->copy_dest) { case COPY_FILE: bytesread = fread(databuf, 1, maxread, cstate->copy_file); if (ferror(cstate->copy_file)) ereport(ERROR, (errcode_for_file_access(), errmsg("could not r...
cwe
CWE-89
Unknown
TfLiteStatus PrepareHashtableSize(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE_EQ(context, NumInputs(node), 1); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); const TfLiteTensor* input_resource_id_tensor = GetInput(context, node, kInputResourceIdTensor); TF_LITE_ENSURE_EQ(context, input_r...
cwe
CWE-787
C/C++
gsm_xsmp_client_connect (GsmXSMPClient *client, SmsConn conn, unsigned long *mask_ret, SmsCallbacks *callbacks_ret) { client->priv->conn = conn; if (client->priv->protocol_timeout) { g_source_remove (c...
cwe
CWE-835
C/C++
static wStream* rdg_receive_packet(rdpRdg* rdg) { wStream* s; const size_t header = sizeof(RdgPacketHeader); size_t packetLength; assert(header <= INT_MAX); s = Stream_New(NULL, 1024); if (!s) return NULL; if (!rdg_read_all(rdg->tlsOut, Stream_Buffer(s), header)) { Stream_Free(s, TRUE); return NULL; } ...
cwe
CWE-125
C/C++
R_API void r_anal_bb_free(RAnalBlock *bb) { if (!bb) { return; } r_anal_cond_free (bb->cond); R_FREE (bb->fingerprint); r_anal_diff_free (bb->diff); bb->diff = NULL; R_FREE (bb->op_bytes); r_anal_switch_op_free (bb->switch_op); bb->switch_op = NULL; bb->fingerprint = NULL; bb->cond = NULL; R_FREE (bb->lab...
cwe
CWE-416
C/C++
module.exports = function parse_str (str, array) { // eslint-disable-line camelcase // discuss at: https://locutus.io/php/parse_str/ // original by: Cagri Ekin // improved by: Michael White (https://getsprink.com) // improved by: Jack // improved by: Brett Zamir (https://brett-zamir....
cwe
CWE-915
JavaScript
def get(self, location, connection=None): location = location.store_location if not connection: connection = self.get_connection(location) try: resp_headers, resp_body = connection.get_object( container=location.container, obj=location.obj, ...
cwe
CWE-200
Python
function updateBasicSettings(PDFStructure &$structure) { // set headline if (isset($_POST['headline'])) { $structure->setTitle(str_replace('<', '', str_replace('>', '', $_POST['headline']))); } // set logo if (isset($_POST['logoFile'])) { $structure->setLogo($_POST['logoFile']); } // set folding marks if (i...
cwe
CWE-79
PHP
#include "source/extensions/filters/http/oauth2/filter.h" #include <algorithm> #include <chrono> #include <memory> #include <string> #include <vector> #include "source/common/common/assert.h" #include "source/common/common/empty_string.h" #include "source/common/common/enum_to_int.h" #include "source/common/common/fm...
cwe
CWE-306
C/C++
"""Base Tornado handlers for the Jupyter server.""" # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import datetime import functools import ipaddress import json import mimetypes import os import re import sys import traceback import types import warnings from http...
cwe
CWE-601
Python
function decodeMap (buf, offset, length, headerLength, options) { const _temp = decodeArray(buf, offset, 2 * length, headerLength) if (!_temp) return null const [ result, consumedBytes ] = _temp var isPlainObject = !options.preferMap if (isPlainObject) { for (let i = 0; i < 2 * length; i += ...
cwe
CWE-1321
JavaScript
MediaStreamDispatcherHost::MediaStreamDispatcherHost( int render_process_id, int render_frame_id, MediaStreamManager* media_stream_manager) : render_process_id_(render_process_id), render_frame_id_(render_frame_id), media_stream_manager_(media_stream_manager), salt_and_origin_ca...
cwe
CWE-189
C/C++
def rename Log.add_info(request, params.inspect) @mail_folder = MailFolder.find(params[:id]) unless params[:thetisBoxEdit].nil? or params[:thetisBoxEdit].empty? @mail_folder.name = params[:thetisBoxEdit] @mail_folder.save end render(:partial => 'ajax_folder_name', :layout => false) e...
cwe
CWE-89
Ruby
Manager.prototype.handleHandshake = function (data, req, res) { var self = this , origin = req.headers.origin , headers = { 'Content-Type': 'text/plain' }; function writeErr (status, message) { if (data.query.jsonp && jsonpolling_re.test(data.query.jsonp)) { res.writeHead(200, { 'Cont...
cwe
CWE-330
JavaScript
function showChannelHighlights() { var tbody = $('.js-highlights-tbody'); var rows = ""; var shouldSortTable = true; for (var i = 0; i < highlightsStats.streams.length; i++) { var strm = highlightsStats.streams[i]; var row = '<tr>'; row += '<td><span class="fake-link js-highlig...
cwe
CWE-79
JavaScript
static void sdhci_send_command(SDHCIState *s) { SDRequest request; uint8_t response[16]; int rlen; s->errintsts = 0; s->acmd12errsts = 0; request.cmd = s->cmdreg >> 8; request.arg = s->argument; trace_sdhci_send_command(request.cmd, request.arg); rlen = sdbus_do_command(&s->sdbus, ...
cwe
CWE-119
Unknown
bool ReceiverWasAdded(const RtpTransceiverState& transceiver_state) { uintptr_t receiver_id = RTCRtpReceiver::getId( transceiver_state.receiver_state()->webrtc_receiver().get()); for (const auto& receiver : handler_->rtp_receivers_) { if (receiver->Id() == receiver_id) return false; ...
cwe
CWE-416
C/C++
function check_admin_referer( $action = -1, $query_arg = '_wpnonce' ) { if ( -1 == $action ) { _doing_it_wrong( __FUNCTION__, __( 'You should specify a nonce action to be verified by using the first parameter.' ), '3.2.0' ); } $adminurl = strtolower( admin_url() ); $referer = strtolower( wp_get_referer() )...
cwe
CWE-843
PHP
static int ext4_writepage(struct page *page, struct writeback_control *wbc) { int ret = 0; loff_t size; unsigned int len; struct buffer_head *page_bufs; struct inode *inode = page->mapping->host; trace_ext4_writepage(inode, page); size = i_size_read(inode); if (page->index == size >> PAGE_CACHE_SHIFT) l...
cwe
CWE-703
Unknown
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* start = GetInput(context, node, kStartTensor); const TfLiteTensor* limit = GetInput(context, node, kLimitTensor); const TfLiteTensor* delta = GetInput(context, node, kDeltaTensor); TfLiteTensor* output = GetOutput(context, node, ...
cwe
CWE-125
C/C++
export default function shave (target, maxHeight, opts = {}) { if (!maxHeight) throw Error('maxHeight is required') let els = (typeof target === 'string') ? document.querySelectorAll(target) : target if (!els) return const character = opts.character || '…' const classname = opts.classname || 'js-shave' con...
cwe
CWE-79
JavaScript
public URL createURL(String spaces, String name, String queryString, String anchor, String wikiId, XWikiContext context, FilesystemExportContext exportContext) throws Exception { // Check if the current user has the right to view the SX file. We do this since this is what would happen // in ...
cwe
CWE-22
Java
UWORD16 impeg2d_get_mb_addr_incr(stream_t *ps_stream) { UWORD16 u2_mb_addr_incr = 0; while (impeg2d_bit_stream_nxt(ps_stream,MB_ESCAPE_CODE_LEN) == MB_ESCAPE_CODE) { impeg2d_bit_stream_flush(ps_stream,MB_ESCAPE_CODE_LEN); u2_mb_addr_incr += 33; } u2_mb_addr_incr += impeg2d_dec_vld_...
cwe
CWE-200
C/C++
const got = require('@/utils/got'); const cheerio = require('cheerio'); const { parseDate } = require('@/utils/parse-date'); const { art } = require('@/utils/render'); const path = require('path'); const toSize = (raw) => { const matches = raw.match(/(\d+(\.\d+)?)(\w+)/); return matches[3] === 'GB' ? matches[1...
cwe
CWE-918
JavaScript
package object; import util.DBManager; import util.FormatManager; import java.sql.ResultSet; import java.util.ArrayList; import java.util.HashMap; /** * * @author Nick */ public class Variant { private int id; private String chr; private int chrInt; private int position; private String ref; ...
cwe
CWE-89
JavaScript
WebGLObject::WebGLObject(WebGLRenderingContext* context) : m_object(0) , m_attachmentCount(0) , m_deleted(false) { }
cwe
CWE-119
Unknown
end_element(PInfo pi, const char *ename) { if (TRACE <= pi->options->trace) { char indent[128]; if (DEBUG <= pi->options->trace) { char buf[1024]; printf("===== end element stack(%d) =====\n", helper_stack_depth(&pi->helpers)); snprintf(buf, sizeof(buf) - 1, "</%s>", ename); debug_stack(...
cwe
CWE-20
Unknown
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); // There are two ways in which the 'output' can be made dynamic: it could be // a string tensor, or its shape cannot b...
cwe
CWE-125
C/C++
def get_auth_groups Log.add_info(request, params.inspect) begin @folder = Folder.find(params[:id]) rescue @folder = nil end @groups = Group.where(nil).to_a session[:folder_id] = params[:id] render(:partial => 'ajax_auth_groups', :layout => false) end
cwe
CWE-89
Ruby
import datetime import hashlib import itertools import logging import os import time from collections import defaultdict from dataclasses import dataclass from operator import itemgetter from typing import ( AbstractSet, Any, Callable, Collection, Dict, Iterable, List, Mapping, Optio...
cwe
CWE-362
Python
/** * Licensed to The Apereo Foundation under one or more contributor license * agreements. See the NOTICE file distributed with this work for additional * information regarding copyright ownership. * * * The Apereo Foundation licenses this file to you under the Educational * Community License, Version 2.0 (the ...
cwe
CWE-863
Java
SiteInstance* parent_site_instance() const { return parent_site_instance_.get(); }
cwe
CWE-787
C/C++
/** * Copyright (c) 2006-2012, JGraph Ltd */ /** * Editor constructor executed on page load. */ Editor = function(chromeless, themes, model, graph, editable) { mxEventSource.call(this); this.chromeless = (chromeless != null) ? chromeless : this.chromeless; this.initStencilRegistry(); this.graph = graph || this....
cwe
CWE-78
JavaScript
static TfLiteRegistration DynamicCopyOpRegistration() { TfLiteRegistration reg = {nullptr, nullptr, nullptr, nullptr}; reg.prepare = [](TfLiteContext* context, TfLiteNode* node) { // Output 0 is dynamic TfLiteTensor* output0 = GetOutput(context, node, 0); SetTensorToDynamic(output0); //...
cwe
CWE-125
C/C++
_dbus_validate_signature_with_reason (const DBusString *type_str, int type_pos, int len) { const unsigned char *p; const unsigned char *end; int last; int struct_depth; int array_depth; int dict_entry_dep...
cwe
CWE-20
Unknown
/* 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-197
C/C++
protected function itemLocked($hash) { if (!elFinder::$commonTempPath) { return false; } $lock = elFinder::$commonTempPath . DIRECTORY_SEPARATOR . $hash . '.lock'; if (file_exists($lock)) { if (filemtime($lock) + $this->itemLockExpire < time()) { ...
cwe
CWE-78
PHP
int zsetAdd(robj *zobj, double score, sds ele, int *flags, double *newscore) { /* Turn options into simple to check vars. */ int incr = (*flags & ZADD_INCR) != 0; int nx = (*flags & ZADD_NX) != 0; int xx = (*flags & ZADD_XX) != 0; *flags = 0; /* We'll return our response flags. */ double curscor...
cwe
CWE-190
Unknown
@staticmethod def get_mapped_projects(user_id: int, preferred_locale: str) -> UserMappedProjectsDTO: """ Get all projects a user has mapped on """ # This query looks scary, but we're really just creating an outer join between the query that gets the # counts of all mapped tasks and the quer...
cwe
CWE-89
Python
static int Downmix_Command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize, void *pCmdData, uint32_t *replySize, void *pReplyData) { downmix_module_t *pDwmModule = (downmix_module_t *) self; downmix_object_t *pDownmixer; int retsize; if (pDwmModule == NULL || pDwmModule->context.state == DOWNMIX_STATE_U...
cwe
CWE-119
C/C++
def create_basename_core(basename): try: basename = basename.casefold() except Exception: basename = basename.lower() basename = basename.replace(' ', '-') basename = re.sub(r'<[^>]*>', r'', basename) basename = re.sub(r'[^a-z0-9\-]', r'', basename) basename = re.sub(r'\-\-', r'...
cwe
CWE-22
Python
def build_command_line(command, params = nil) return command.to_s if params.nil? || params.empty? "#{command} #{assemble_params(sanitize(params))}" end
cwe
CWE-78
Ruby
$(function() { openUploadModalDialog(); }); function openUploadModalDialog(){ $('.upload').click(function(e) { e.preventDefault(); var $this = $(this); var show_title = getQueryVariable('show_title', this.href); var show_comment = getQueryVariable('show_comment', this.href);...
cwe
CWE-79
JavaScript
/*- * Copyright (c) 2003-2011 Tim Kientzle * Copyright (c) 2011-2012 Michihiro NAKAJIMA * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain th...
cwe
CWE-787
C/C++
/* * The contents of this file are subject to the OpenMRS Public License * Version 1.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://license.openmrs.org * * Software distributed under the License is distributed on an "AS IS" *...
cwe
CWE-79
Java
void PrintFormatNumber(void * ValuePtr, int Format, int ByteCount) { int s,n; for(n=0;n<16;n++){ switch(Format){ case FMT_SBYTE: case FMT_BYTE: printf("%02x",*(uchar *)ValuePtr); s=1; break; case FMT_USHORT: printf("%d",Get16u(ValuePtr)); s=2; break; ...
cwe
CWE-703
Unknown