code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
OMX_ERRORTYPE SoftFlacEncoder::internalGetParameter( OMX_INDEXTYPE index, OMX_PTR params) { ALOGV("SoftFlacEncoder::internalGetParameter(index=0x%x)", index); switch (index) { case OMX_IndexParamAudioPcm: { OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams = (OMX_AUDIO_PARAM_PCMMODET...
cwe
CWE-119
C/C++
int del_timer(struct timer_list *timer) { struct timer_base *base; unsigned long flags; int ret = 0; debug_assert_init(timer); timer_stats_timer_clear_start_info(timer); if (timer_pending(timer)) { base = lock_timer_base(timer, &flags); ret = detach_if_pending(timer, base, true); spin_unlock_irqrestore(&b...
cwe
CWE-200
Unknown
/* * Will get included into the login dialog, NOT into the regular OctoPrint * web application. */ $(function () { var OctoPrint = window.OctoPrint; OctoPrint.loginui = { startedUp: false }; var overlayElement = $("#login-overlay"); var errorElement = $("#login-error"); var offline...
cwe
CWE-307
Python
long long EBMLHeader::Parse(IMkvReader* pReader, long long& pos) { assert(pReader); long long total, available; long status = pReader->Length(&total, &available); if (status < 0) // error return status; pos = 0; long long end = (available >= 1024) ? 1024 : available; for (;;) { unsigned char b = 0; ...
cwe
CWE-20
C/C++
#!/usr/bin/env python # -*- coding: utf-8 -*- # # webgateway/views.py - django application view handling functions # # Copyright (c) 2007-2020 Glencoe Software, Inc. All rights reserved. # # This software is distributed under the terms described by the LICENCE file # you can find at the root of the distribution bundle,...
cwe
CWE-601
Python
shiftAnchorPosition(AnchorList *al, HmarkerList *hl, int line, int pos, int shift) { Anchor *a; size_t b, e, s = 0; int cmp; if (al == NULL || al->nanchor == 0) return; s = al->nanchor / 2; for (b = 0, e = al->nanchor - 1; b <= e; s = (b + e + 1) / 2) { a = &al->anchors[s]; cmp = onAn...
cwe
CWE-476
C/C++
int cg_mkdir(const char *path, mode_t mode) { struct fuse_context *fc = fuse_get_context(); char *fpath = NULL, *path1, *cgdir = NULL, *controller; const char *cgroup; int ret; if (!fc) return -EIO; controller = pick_controller_from_path(fc, path); if (!controller) return -EINVAL; cgroup = find_cgroup_i...
cwe
CWE-264
C/C++
ProcRenderAddGlyphs (ClientPtr client) { GlyphSetPtr glyphSet; REQUEST(xRenderAddGlyphsReq); GlyphNewRec glyphsLocal[NLOCALGLYPH]; GlyphNewPtr glyphsBase, glyphs, glyph_new; int remain, nglyphs; CARD32 *gids; xGlyphInfo *gi; CARD8 *bits; unsigned int s...
cwe
CWE-20
Unknown
public static function showModal($params) { if (!isset($params['argument']) || empty($params['argument'])) { return array( 'processed' => true, 'process_status' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatcommand', 'Please provide moda...
cwe
CWE-116
PHP
public function onRouteShutdown(Enlight_Controller_EventArgs $args) { /** @var Enlight_Controller_Request_RequestHttp $request */ $request = $args->getRequest(); $config = $this->Config(); if ($request->getModuleName() === 'backend' || $request->getModuleName() === 'api') { ...
cwe
CWE-79
PHP
/* 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-20
Python
void CoordinatorImpl::RegisterClientProcess( mojom::ClientProcessPtr client_process_ptr, mojom::ProcessType process_type) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); mojom::ClientProcess* client_process = client_process_ptr.get(); client_process_ptr.set_connection_error_handler( base::BindO...
cwe
CWE-787
C/C++
isdn_ioctl(struct file *file, uint cmd, ulong arg) { uint minor = iminor(file_inode(file)); isdn_ctrl c; int drvidx; int ret; int i; char __user *p; char *s; union iocpar { char name[10]; char bname[22]; isdn_ioctl_struct iocts; isdn_net_ioctl_phone phone; isdn_net_ioctl_cfg cfg; } iocpar; void __us...
cwe
CWE-119
Unknown
async def verify_token(self, token): """ verify session token """ try: async with aiopg.create_pool(self.dsn) as pool: async with pool.acquire() as conn: async with conn.cursor() as cur: query = f""" SELECT aio.{self...
cwe
CWE-89
Python
static int local_symlink(FsContext *fs_ctx, const char *oldpath, V9fsPath *dir_path, const char *name, FsCred *credp) { int err = -1; int dirfd; dirfd = local_opendir_nofollow(fs_ctx, dir_path->data); if (dirfd == -1) { return -1; } /* Determine the security mo...
cwe
CWE-732
Unknown
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE_EQ(context, NumInputs(node), 1); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); const TfLiteTensor* cond_tensor = GetInput(context, node, kInputConditionTensor); TfLiteTensor* output = GetOutput(context, node, kOutputTensor...
cwe
CWE-125
C/C++
int pmixp_coll_tree_unpack(Buf buf, pmixp_coll_type_t *type, int *nodeid, pmixp_proc_t **r, size_t *nr) { pmixp_proc_t *procs = NULL; uint32_t nprocs = 0; uint32_t tmp; int i, rc; /* 1. extract the type of collective */ if (SLURM_SUCCESS != (rc = unpack32(&tmp, buf))) { PMIXP_ERROR("Cannot unpack collect...
cwe
CWE-120
Unknown
# for now fetch the development settings only from .common import * # these persons receive error notification ADMINS = ( ('Webmasters', 'webmaster@evolution-events.nl'), ) MANAGERS = ADMINS # turn off all debugging DEBUG = False # You will have to determine, which hostnames should be served by Django ALLOWED_HO...
cwe
CWE-200
Python
long Segment::DoLoadClusterUnknownSize(long long& pos, long& len) { assert(m_pos < 0); assert(m_pUnknownSize); #if 0 assert(m_pUnknownSize->GetElementSize() < 0); //TODO: verify this const long long element_start = m_pUnknownSize->m_element_start; pos = -m_pos; assert(pos > element_start); lo...
cwe
CWE-20
C/C++
vtp_print (netdissect_options *ndo, const u_char *pptr, u_int length) { int type, len, tlv_len, tlv_value, mgmtd_len; const u_char *tptr; const struct vtp_vlan_ *vtp_vlan; if (length < VTP_HEADER_LEN) goto trunc; tptr = pptr; ND_TCHECK2(*tptr, VTP_HEADER_LEN); type = *...
cwe
CWE-125
C/C++
/* 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-476
Go
# -*- coding: utf-8 -*- from django.contrib.auth.decorators import login_required from django.shortcuts import render, redirect, get_object_or_404 from ...core.utils.views import is_post, post_data from ..models import Comment from .forms import FlagForm @login_required def create(request, comment_id): comment ...
cwe
CWE-601
Python
function At(t){for(var e=0,n=0;n<t.length;n++)e=31*e+t.charCodeAt(n)|0;return St(e)}
cwe
CWE-200
JavaScript
void SpatialMaxPool(OpKernelContext* context, Tensor* output, const Tensor& tensor_in, const PoolParameters& params, const Padding& padding) { // On GPU, use Eigen's Spatial Max Pooling. On CPU, use an // EigenMatrix version that is currently faster than Eigen's ...
cwe
CWE-354
Unknown
void SoundPool::doLoad(sp<Sample>& sample) { ALOGV("doLoad: loading sample sampleID=%d", sample->sampleID()); sample->startLoad(); mDecodeThread->loadSample(sample->sampleID()); }
cwe
CWE-264
C/C++
/* * Copyright (c) 2014 Open Grid Computing, Inc. All rights reserved. * Copyright (c) 2005-2007 Network Appliance, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Vers...
cwe
CWE-404
C/C++
import os import shutil import subprocess import sys import tempfile import traceback from pathlib import Path from typing import List from flask import Response, request from werkzeug.utils import secure_filename from archivy import click_web from .input_fields import FieldId logger = None def exec(command_path)...
cwe
CWE-352
Python
void unix_notinflight(struct file *fp) { struct sock *s = unix_get_socket(fp); if (s) { struct unix_sock *u = unix_sk(s); spin_lock(&unix_gc_lock); BUG_ON(list_empty(&u->link)); if (atomic_long_dec_and_test(&u->inflight)) list_del_init(&u->link); unix_tot_inflight--; spin_unlock(&unix_gc_lock); } }
cwe
CWE-119
C/C++
u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr, __be16 dport) { struct keydata *keyptr = get_keyptr(); u32 hash[12]; memcpy(hash, saddr, 16); hash[4] = (__force u32)dport; memcpy(&hash[5], keyptr->secret, sizeof(__u32) * 7); return twothirdsMD4Transform((const __u32 *)daddr, h...
cwe
CWE-703
Unknown
static void yurex_delete(struct kref *kref) { struct usb_yurex *dev = to_yurex_dev(kref); dev_dbg(&dev->interface->dev, "%s\n", __func__); usb_put_dev(dev->udev); if (dev->cntl_urb) { usb_kill_urb(dev->cntl_urb); kfree(dev->cntl_req); if (dev->cntl_buffer) usb_free_coherent(dev->udev, YUREX_BUF_SIZE, ...
cwe
CWE-416
Unknown
CopyFrom(CopyState cstate) { HeapTuple tuple; TupleDesc tupDesc; Datum *values; bool *nulls; ResultRelInfo *resultRelInfo; EState *estate = CreateExecutorState(); /* for ExecConstraints() */ ExprContext *econtext; TupleTableSlot *myslot; MemoryContext oldcontext = CurrentMemoryContext; ErrorContextC...
cwe
CWE-89
Unknown
"use strict"; const OBJECT = "object"; /** * Apply a JSON merge patch onto a document * https://tools.ietf.org/html/rfc7396 * @param {Object} doc - JSON object document * @param {Object} patch - JSON object patch * @return {Object} - JSON object document */ module.exports = function apply(doc, patc...
cwe
CWE-1321
JavaScript
vhost_scsi_send_evt(struct vhost_scsi *vs, struct vhost_scsi_tpg *tpg, struct se_lun *lun, u32 event, u32 reason) { struct vhost_scsi_evt *evt; evt = vhost_scsi_allocate_evt(vs, event, reason); if (!evt) return; if (tpg && lun) { /* TODO: share lun setup code with virtio-scsi.ko */ /* ...
cwe
CWE-119
Unknown
/** * @file * IMAP login authentication method * * @authors * Copyright (C) 1999-2001,2005,2009 Brendan Cully <brendan@kublai.com> * * @copyright * 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 * Fo...
cwe
CWE-74
C/C++
ecc_gostdsa_verify (const struct ecc_curve *ecc, const mp_limb_t *pp, /* Public key */ size_t length, const uint8_t *digest, const mp_limb_t *rp, const mp_limb_t *sp, mp_limb_t *scratch) { /* Procedure, according to GOST R 34.10. q denotes the group order. 1. Check 0 < r, s < q. 2. v ...
cwe
CWE-787
Unknown
static Image *ReadVIFFImage(const ImageInfo *image_info, ExceptionInfo *exception) { #define VFF_CM_genericRGB 15 #define VFF_CM_ntscRGB 1 #define VFF_CM_NONE 0 #define VFF_DEP_DECORDER 0x4 #define VFF_DEP_NSORDER 0x8 #define VFF_DES_RAW 0 #define VFF_LOC_IMPLICIT 1 #define VFF_MAPTYP_NONE 0 #define VFF_MAPTY...
cwe
CWE-787
C/C++
MonCapParser() : MonCapParser::base_type(moncap) { using qi::char_; using qi::int_; using qi::ulong_long; using qi::lexeme; using qi::alnum; using qi::_val; using qi::_1; using qi::_2; using qi::_3; using qi::eps; using qi::lit; quoted_string %= lexeme['"' >> +(c...
cwe
CWE-285
Unknown
public void testCycle_ECDH_ES_Curve_P256_attackPoint1() throws Exception { ECKey ecJWK = generateECJWK(ECKey.Curve.P_256); BigInteger privateReceiverKey = ecJWK.toECPrivateKey().getS(); JWEHeader header = new JWEHeader.Builder(JWEAlgorithm.ECDH_ES, EncryptionMethod.A128GCM) .agreementPartyUInfo(B...
cwe
CWE-347
Java
OMX_ERRORTYPE SimpleSoftOMXComponent::internalGetParameter( OMX_INDEXTYPE index, OMX_PTR params) { switch (index) { case OMX_IndexParamPortDefinition: { OMX_PARAM_PORTDEFINITIONTYPE *defParams = (OMX_PARAM_PORTDEFINITIONTYPE *)params; if (defParams->nPortIndex >=...
cwe
CWE-119
C/C++
/* * Copyright (c) 2007 Mellanox Technologies. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this sou...
cwe
CWE-119
C/C++
/* Request a key from userspace * * Copyright (C) 2004-2007 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-862
C/C++
function j(e,t,n){}
cwe
CWE-284
JavaScript
SMBC_attr_server(TALLOC_CTX *ctx, SMBCCTX *context, const char *server, uint16_t port, const char *share, char **pp_workgroup, char **pp_username, char **pp_password) { int flags; struct cli_s...
cwe
CWE-20
Unknown
Cues::Cues( Segment* pSegment, long long start_, long long size_, long long element_start, long long element_size) : m_pSegment(pSegment), m_start(start_), m_size(size_), m_element_start(element_start), m_element_size(element_size), m_cue_points(NULL), m_count(0), m_p...
cwe
CWE-119
C/C++
int __usb_get_extra_descriptor(char *buffer, unsigned size, unsigned char type, void **ptr) { struct usb_descriptor_header *header; while (size >= sizeof(struct usb_descriptor_header)) { header = (struct usb_descriptor_header *)buffer; if (header->bLength < 2) { printk(KERN_ERR "%s: bog...
cwe
CWE-400
Unknown
import random import string import hashlib import requests class passeo: def __init__(self): def generate(length, numbers=False, symbols=False, uppercase=False, lowercase=False, space=False, save=False): password = '' if numbers: password += string.digits ...
cwe
CWE-338
Python
package com.salesmanager.shop.admin.controller.merchant; import java.io.InputStream; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import javax.annotation.Resource; import javax.inject.Inject; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.Htt...
cwe
CWE-79
Java
/* +----------------------------------------------------------------------+ | HipHop for PHP | +----------------------------------------------------------------------+ | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) | +---------...
cwe
CWE-119
C/C++
int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2], unsigned char multicast_spec, u8 protocol_version) { struct hsr_priv *hsr; struct hsr_port *port; int res; hsr = netdev_priv(hsr_dev); INIT_LIST_HEAD(&hsr->ports); INIT_LIST_HEAD(&hsr->node_db); INIT_LIST_HEAD(&hsr->self_node_d...
cwe
CWE-401
C/C++
package com.salesmanager.shop.admin.model.permission; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonPrope...
cwe
CWE-639
Java
TEE_Result syscall_cryp_obj_populate(unsigned long obj, struct utee_attribute *usr_attrs, unsigned long attr_count) { TEE_Result res; struct tee_ta_session *sess; struct tee_obj *o; const struct tee_cryp_obj_type_props *type_props; TEE_Attribute *attrs = NULL; res = tee_ta_get_current_session(&sess); if (...
cwe
CWE-190
C/C++
/* * Copyright 2013-2020 the original author or 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by a...
cwe
CWE-863
Java
struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir, umode_t mode, const struct qstr *qstr, __u32 goal, uid_t *owner, __u32 i_flags, int handle_type, unsigned int line_no, int nblocks) { struct super_block *sb; struct buffer_head *inode_bitmap_bh = NULL; struct ...
cwe
CWE-416
Unknown
std::wstring GetSwitchValueFromCommandLine(const std::wstring& command_line, const std::wstring& switch_name) { assert(!command_line.empty()); assert(!switch_name.empty()); std::vector<std::wstring> as_array = TokenizeCommandLineToArray(command_line); std::wstri...
cwe
CWE-88
C/C++
static Image *ReadWPGImage(const ImageInfo *image_info, ExceptionInfo *exception) { typedef struct { size_t FileId; MagickOffsetType DataOffset; unsigned int ProductType; unsigned int FileType; unsigned char MajorVersion; unsigned char MinorVersion; unsigned int EncryptKey; unsigne...
cwe
CWE-400
Unknown
mcs_recv_connect_response(STREAM mcs_data) { uint8 result; int length; STREAM s; s = iso_recv(NULL); if (s == NULL) return False; ber_parse_header(s, MCS_CONNECT_RESPONSE, &length); ber_parse_header(s, BER_TAG_RESULT, &length); in_uint8(s, result); if (result != 0) { error("MCS connect: %d\n", result);...
cwe
CWE-787
Unknown
package io.onedev.server; import java.io.Serializable; import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionE...
cwe
CWE-94
Java
TcpOption *tcpGetOption(TcpHeader *segment, uint8_t kind) { size_t length; uint_t i; TcpOption *option; //Make sure the TCP header is valid if(segment->dataOffset < 5) return NULL; //Compute the length of the options field length = segment->dataOffset * 4 - sizeof(TcpHeader); //Point to...
cwe
CWE-20
C/C++
ssize_t tpm_read(struct file *file, char __user *buf, size_t size, loff_t *off) { struct tpm_chip *chip = file->private_data; ssize_t ret_size; del_singleshot_timer_sync(&chip->user_read_timer); flush_work_sync(&chip->work); ret_size = atomic_read(&chip->data_pending); atomic_set(&chip->data_pending, 0); if ...
cwe
CWE-200
Unknown
{% load i18n %} /* global inventreeLoad, inventreeSave, */ /* exported customGroupSorter, downloadTableData, reloadtable, renderLink, reloadTableFilters, */ /** * Reload a named table * @param table */ function reloadtable(table) { $(table).bootstrapTable('refresh'); } /** * Dow...
cwe
CWE-1236
Python
def getSeriesDateFromDatabase(submission): database = sqlite3.connect('database.db') cursor = database.cursor() return cursor.execute("SELECT StartDate FROM SeriesTracking WHERE SeriesTitle = '" + str(getTitle(submission)) + "'").fetchone()[0] database.close()
cwe
CWE-89
Python
from importlib import import_module from os import path, listdir from string import lower from debug import logger import paths class MsgBase(object): def encode(self): self.data = {"": lower(type(self).__name__)} def constructObject(data): try: classBase = eval(data[""] + "." + data[""].tit...
cwe
CWE-20
Java
// // Copyright (C) 2013 University of Dundee & Open Microscopy Environment. // All rights reserved. // // 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 // Licen...
cwe
CWE-79
Python
static void _slurm_rpc_submit_batch_job(slurm_msg_t *msg) { static int active_rpc_cnt = 0; int error_code = SLURM_SUCCESS; DEF_TIMERS; uint32_t job_id = 0, priority = 0; struct job_record *job_ptr = NULL; slurm_msg_t response_msg; submit_response_msg_t submit_msg; job_desc_msg_t *job_desc_msg = (job_desc_msg_t ...
cwe
CWE-20
Unknown
static void vcpu_scan_ioapic(struct kvm_vcpu *vcpu) { if (!kvm_apic_hw_enabled(vcpu->arch.apic)) return; bitmap_zero(vcpu->arch.ioapic_handled_vectors, 256); if (irqchip_split(vcpu->kvm)) kvm_scan_ioapic_routes(vcpu, vcpu->arch.ioapic_handled_vectors); else { if (vcpu->arch.apicv_active) kvm_x86_ops->syn...
cwe
CWE-476
C/C++
function checkAndSetValidation(container) { var issue_els = []; $("input, select, textarea", container).each(function(){ if($(this).prop('required') && (!$.trim($(this).val()) || (Array.isArray($(this).val()) && $(this).val().length==0) ) ){ issue_els.push($(this)); } }) // I...
cwe
CWE-707
JavaScript
/* * 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-668
Java
gdk_pixbuf_loader_close (GdkPixbufLoader *loader, GError **error) { GdkPixbufLoaderPrivate *priv; gboolean retval = TRUE; g_return_val_if_fail (loader != NULL, TRUE); g_return_val_if_fail (GDK_IS_PIXBUF_LOADER (loader), TRUE); priv = loader->priv; /* we expect it's ...
cwe
CWE-20
Unknown
"use strict"; var osmStream = require('osm-stream'), reqwest = require('reqwest'), moment = require('moment'), _ = require('underscore'), LRU = require('lru-cache'), query_string = require('querystring'); var bboxArray = ["-90.0", "-180.0", "90.0", "180.0"]; var mapCenter = [51.505, -0.09]; var fi...
cwe
CWE-79
JavaScript
void DocumentLoader::CommitNavigation(const AtomicString& mime_type, const KURL& overriding_url) { if (state_ != kProvisional) return; if (!GetFrameLoader().StateMachine()->CreatingInitialEmptyDocument()) { SetHistoryItemStateForCommit( GetFrameLoader().GetDocu...
cwe
CWE-285
C/C++
@SuppressLint("SdCardPath") private void startNewUpload( User user, List<String> requestedUploads, boolean onWifiOnly, boolean whileChargingOnly, NameCollisionPolicy nameCollisionPolicy, int localAction, boolean isCreateRemoteFolder, int createdBy, ...
cwe
CWE-200
Java
function At(t){for(var e=0,n=0;n<t.length;n++)e=31*e+t.charCodeAt(n)|0;return St(e)}
cwe
CWE-601
JavaScript
def read_body raise Mechanize::ResponseCodeError.new(self) unless File.exist? @file_path if directory? yield dir_body else open @file_path, 'rb' do |io| yield io.read end end end
cwe
CWE-78
Ruby
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { auto* params = reinterpret_cast<TfLiteL2NormParams*>(node->builtin_data); TF_LITE_ENSURE_EQ(context, NumInputs(node), 1); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); const TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLit...
cwe
CWE-125
C/C++
/* * * Copyright (C) 2006-2011 Anders Brander <anders@brander.dk>, * * Anders Kvist <akv@lnxbx.dk> and Klaus Post <klauspost@gmail.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 Foundation; e...
cwe
CWE-59
C/C++
public static UnsafeAccess getInstance() { SecurityCheck.getInstance(); return INSTANCE; }
cwe
CWE-200
Java
/** * The core of bmoor's usefulness * @module bmoor **/ /** * Tests if the value is undefined * * @function isUndefined * @param {*} value - The variable to test * @return {boolean} **/ function isUndefined( value ) { return value === undefined; } /** * Tests if the value is not undefined * * @function ...
cwe
CWE-20
JavaScript
package com.salesmanager.shop.admin.controller.user; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler; import org.springframework.stereotype.Control...
cwe
CWE-639
Java
"""``chameleon.tales`` expressions.""" from ast import NodeTransformer from ast import parse from chameleon.astutil import Static from chameleon.astutil import Symbol from chameleon.codegen import template from chameleon.tales import NotExpr from chameleon.tales import StringExpr from AccessControl.ZopeGuards import...
cwe
CWE-22
Python
void LibRaw::kodak_thumb_loader() { INT64 est_datasize = T.theight * T.twidth / 3; // is 0.3 bytes per pixel good estimate? if (ID.toffset < 0) throw LIBRAW_EXCEPTION_IO_CORRUPT; if (ID.toffset + est_datasize > ID.input->size() + THUMB_READ_BEYOND) throw LIBRAW_EXCEPTION_IO_EOF; // some kodak ca...
cwe
CWE-125
C/C++
func SearchUserByName(opt SearchOption) (us []*User, err error) { // Prevent SQL inject. opt.Keyword = strings.TrimSpace(opt.Keyword) if len(opt.Keyword) == 0 { return us, nil } opt.Keyword = strings.Split(opt.Keyword, " ")[0] if len(opt.Keyword) == 0 { return us, nil } opt.Keyword = strings.ToLower(opt.Ke...
cwe
CWE-89
Go
void generic_pipe_buf_get(struct pipe_inode_info *pipe, struct pipe_buffer *buf) { get_page(buf->page); }
cwe
CWE-416
C/C++
static int install_relocation_handler(int num_cpus, size_t save_state_size) { struct smm_loader_params smm_params = { .per_cpu_stack_size = CONFIG_SMM_STUB_STACK_SIZE, .num_concurrent_stacks = num_cpus, .per_cpu_save_state_size = save_state_size, .num_concurrent_save_states = 1, .handler = smm_do_relocation,...
cwe
CWE-269
Unknown
char* dexOptGenerateCacheFileName(const char* fileName, const char* subFileName) { char nameBuf[512]; char absoluteFile[sizeof(nameBuf)]; const size_t kBufLen = sizeof(nameBuf) - 1; const char* dataRoot; char* cp; /* * Get the absolute path of the Jar or DEX file. */ absoluteFile[0] = '\0'; if (fi...
cwe
CWE-264
C/C++
int mk_request_error(int http_status, struct client_session *cs, struct session_request *sr) { int ret, fd; mk_ptr_t message, *page = 0; struct error_page *entry; struct mk_list *head; struct file_info finfo; mk_header_set_http_status(sr, http_status); /* * We are...
cwe
CWE-20
Unknown
// mkerrors.sh -Wall -Werror -static -I/tmp/include -fsigned-char // Code generated by the command above; see README.md. DO NOT EDIT. // +build arm64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char _const.go package unix import "syscall" ...
cwe
CWE-287
Go
static jpc_enc_band_t *band_create(jpc_enc_band_t *band, jpc_enc_cp_t *cp, jpc_enc_rlvl_t *rlvl, jpc_tsfb_band_t *bandinfos) { uint_fast16_t bandno; uint_fast16_t gblbandno; uint_fast16_t rlvlno; jpc_tsfb_band_t *bandinfo; jpc_enc_tcmpt_t *tcmpt; uint_fast32_t prcno; jpc_enc_prc_t *prc; tcmpt = rlvl->tcmpt; ...
cwe
CWE-189
Unknown
function createSubResolver(parentScopes,resolver,prop,value){const rootScopes=resolver._rootScopes;const fallback=resolveFallback(resolver._fallback,prop,value);const allScopes=[...parentScopes,...rootScopes];const set=new Set();set.add(value);let key=addScopesFromKey(set,allScopes,prop,fallback||prop);if(key===null){r...
cwe
CWE-1321
JavaScript
package client import ( "encoding/json" "fmt" api "k8s.io/api/storage/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/kubeedge/beehive/pkg/core/model" "github.com/kubeedge/kubeedge/edge/pkg/common/message" "github.com/kubeedge/kubeedge/edge/pkg/common/modules" "github.com/kubeedge/kubeedge/edge...
cwe
CWE-476
Go
void uverbs_user_mmap_disassociate(struct ib_uverbs_file *ufile) { struct rdma_umap_priv *priv, *next_priv; lockdep_assert_held(&ufile->hw_destroy_rwsem); while (1) { struct mm_struct *mm = NULL; /* Get an arbitrary mm pointer that hasn't been cleaned yet */ mutex_lock(&ufile->umap_lock); while (!list_emp...
cwe
CWE-362
C/C++
TfLiteTensor* GetTempRhs(TfLiteContext* context, TfLiteNode* node, const TfLiteTensor* rhs) { TfLiteTensor* transposed_rhs = GetTemporary(context, node, 1); if (rhs->type == kTfLiteInt8) { // Get the quantization params from the RHS tensor. transposed_rhs->params.scale = rhs->params...
cwe
CWE-125
Unknown
dwarf_elf_object_access_load_section(void* obj_in, Dwarf_Half section_index, Dwarf_Small** section_data, int* error) { dwarf_elf_object_access_internals_t*obj = (dwarf_elf_object_access_internals_t*)obj_in; if (section_index == 0) { return DW_DLV_NO_ENTRY; } { Elf_S...
cwe
CWE-476
C/C++
static char *__filterQuotedShell(const char *arg) { r_return_val_if_fail (arg, NULL); char *a = malloc (strlen (arg) + 1); if (!a) { return NULL; } char *b = a; while (*arg) { switch (*arg) { case ' ': case '=': case '\r': case '\n': break; default: *b++ = *arg; break; } arg++; }...
cwe
CWE-78
C/C++
private void sendStreamingResponse(HttpExchange pExchange, ParsedUri pParsedUri, JSONStreamAware pJson) throws IOException { Headers headers = pExchange.getResponseHeaders(); if (pJson != null) { headers.set("Content-Type", getMimeType(pParsedUri) + "; charset=utf-8"); String cal...
cwe
CWE-79
Java
static int mark_source_chains(const struct xt_table_info *newinfo, unsigned int valid_hooks, void *entry0) { unsigned int hook; /* No recursion; use packet counter to save back ptrs (reset * to 0 as we leave), and comefrom to save source hook bitmask. */ for (hook = 0; hook < NF_ARP_NUMHOOKS; hook++) {...
cwe
CWE-787
Unknown
// SPDX-License-Identifier: GPL-2.0-only /* * CAN driver for "8 devices" USB2CAN converter * * Copyright (C) 2012 Bernd Krumboeck (krumboeck@universalnet.at) * * This driver is inspired by the 3.2.0 version of drivers/net/can/usb/ems_usb.c * and drivers/net/can/usb/esd_usb2.c * * Many thanks to Gerhard Bertelsm...
cwe
CWE-415
C/C++
ProcessStandbyMessage(void) { char msgtype; resetStringInfo(&reply_message); /* * Read the message contents. */ if (pq_getmessage(&reply_message, 0)) { ereport(COMMERROR, (errcode(ERRCODE_PROTOCOL_VIOLATION), errmsg("unexpected EOF on standby connection"))); proc_exit(0); } /* * Check mess...
cwe
CWE-89
Unknown
RList *r_bin_ne_get_relocs(r_bin_ne_obj_t *bin) { RList *segments = bin->segments; if (!segments) { return NULL; } RList *entries = bin->entries; if (!entries) { return NULL; } RList *symbols = bin->symbols; if (!symbols) { return NULL; } ut16 *modref = malloc (bin->ne_header->ModRefs * sizeof (ut16));...
cwe
CWE-129
C/C++
static Image *ReadVIFFImage(const ImageInfo *image_info, ExceptionInfo *exception) { #define VFF_CM_genericRGB 15 #define VFF_CM_ntscRGB 1 #define VFF_CM_NONE 0 #define VFF_DEP_DECORDER 0x4 #define VFF_DEP_NSORDER 0x8 #define VFF_DES_RAW 0 #define VFF_LOC_IMPLICIT 1 #define VFF_MAPTYP_NONE 0 #define VFF_MAP...
cwe
CWE-119
Unknown
static int ssl_scan_serverhello_tlsext(SSL *s, unsigned char **p, unsigned char *d, int n, int *al) { unsigned short length; unsigned short type; unsigned short size; unsigned char *data = *p; int tlsext_servername = 0; int renegotiate_seen = 0; #ifndef OPENSSL_NO_NEXTPROTONEG s->s3->next_proto_neg_seen = 0; #...
cwe
CWE-362
Unknown