code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
void Compute(OpKernelContext* ctx) override { const Tensor& indices_tensor = ctx->input(0); OP_REQUIRES(ctx, TensorShapeUtils::IsVector(indices_tensor.shape()) || TensorShapeUtils::IsScalar(indices_tensor.shape()), errors::InvalidArgument( ...
cwe
CWE-369
C/C++
function generate(target, hierarchies, forceOverride) { let current = target; hierarchies.forEach(info => { const descriptor = normalizeDescriptor(info); const { value, type, create, override, created, skipped, got } = descriptor; const name = getNonEmptyPropName(current, descriptor); ...
cwe
CWE-1321
JavaScript
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE_EQ(context, NumInputs(node), 3); OpContext op_context(context, node); TF_LITE_ENSURE_EQ(context, NumOutputs(node), op_context.params->num_splits); auto input_type = op_context.input->type; TF_LITE_ENSURE(context, ...
cwe
CWE-125
C/C++
func verifyHandler(w http.ResponseWriter, r *http.Request) { challenge := r.URL.Query().Get("hub.challenge") if challenge == "" { w.WriteHeader(400) return } w.WriteHeader(200) w.Write([]byte(challenge)) }
cwe
CWE-79
Go
void sctp_assoc_update(struct sctp_association *asoc, struct sctp_association *new) { struct sctp_transport *trans; struct list_head *pos, *temp; /* Copy in new parameters of peer. */ asoc->c = new->c; asoc->peer.rwnd = new->peer.rwnd; asoc->peer.sack_needed = new->peer.sack_needed; asoc->peer.auth_cap...
cwe
CWE-703
C/C++
plperl_validator(PG_FUNCTION_ARGS) { Oid funcoid = PG_GETARG_OID(0); HeapTuple tuple; Form_pg_proc proc; char functyptype; int numargs; Oid *argtypes; char **argnames; char *argmodes; bool is_trigger = false; bool is_event_trigger = false; int i; /* Get the new function's pg_proc entry */...
cwe
CWE-264
Unknown
addPreviewPopover(file, template, imageSrc) { const thisInstance = this; let fileSize = ''; const fileInfo = this.getFileInfo(file.hash); if (typeof fileInfo.size !== 'undefined') { fileSize = `<div class="p-1 bg-white border rounded small position-absolute">${fileInfo.size}</div>`; } let deleteBtn = '';...
cwe
CWE-79
JavaScript
start_input_tga (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) { tga_source_ptr source = (tga_source_ptr) sinfo; U_CHAR targaheader[18]; int idlen, cmaptype, subtype, flags, interlace_type, components; unsigned int width, height, maplen; boolean is_bottom_up; #define GET_2B(offset) ((unsigned int) UCH(targa...
cwe
CWE-369
C/C++
static struct desc_struct *get_desc(unsigned short sel) { struct desc_ptr gdt_desc = {0, 0}; unsigned long desc_base; #ifdef CONFIG_MODIFY_LDT_SYSCALL if ((sel & SEGMENT_TI_MASK) == SEGMENT_LDT) { struct desc_struct *desc = NULL; struct ldt_struct *ldt; /* Bits [15:3] contain the index of the desire...
cwe
CWE-416
C/C++
/** * Copyright (c) 2006-2020, JGraph Ltd * Copyright (c) 2006-2020, draw.io AG */ /** * Constructs a new point for the optional x and y coordinates. If no * coordinates are given, then the default values for <x> and <y> are used. * @constructor * @class Implements a basic 2D point. Known subclassers = {@link m...
cwe
CWE-79
JavaScript
int fpm_scoreboard_init_main() /* {{{ */ { struct fpm_worker_pool_s *wp; unsigned int i; #ifdef HAVE_TIMES #if (defined(HAVE_SYSCONF) && defined(_SC_CLK_TCK)) fpm_scoreboard_tick = sysconf(_SC_CLK_TCK); #else /* _SC_CLK_TCK */ #ifdef HZ fpm_scoreboard_tick = HZ; #else /* HZ */ fpm_scoreboard_tick = 100; #endif /*...
cwe
CWE-787
Unknown
T){var N=Graph.customFontElements[T];null!=N&&N.url!=E&&(N.elt.parentNode.removeChild(N.elt),N=null);null==N?(N=E,"http:"==E.substring(0,5)&&(N=PROXY_URL+"?url="+encodeURIComponent(E)),N={name:u,url:E,elt:Graph.createFontElement(u,N)},Graph.customFontElements[T]=N,Graph.recentCustomFonts[T]=N,E=document.getElementsByTa...
cwe
CWE-20
JavaScript
DeepTiledInputFile::Data::~Data () { delete [] numXTiles; delete [] numYTiles; for (size_t i = 0; i < tileBuffers.size(); i++) delete tileBuffers[i]; if (multiPartBackwardSupport) delete multiPartFile; for (size_t i = 0; i < slices.size(); i++) delete slices[i]; }
cwe
CWE-125
Unknown
/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s: * Copyright © 2016 Red Hat, Inc * * 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 Software Foundation; either * version 2.1 of the License, ...
cwe
CWE-116
C/C++
static void coroutine_fn v9fs_xattrcreate(void *opaque) { int flags; int32_t fid; int64_t size; ssize_t err = 0; V9fsString name; size_t offset = 7; V9fsFidState *file_fidp; V9fsFidState *xattr_fidp; V9fsPDU *pdu = opaque; v9fs_string_init(&name); err = pdu_unmarshal(pdu, of...
cwe
CWE-119
C/C++
fn main() -> std::io::Result<()> { env::set_var("RUST_LOG", "swhks=trace"); env_logger::init(); let pid_file_path = String::from("/tmp/swhks.pid"); let sock_file_path = String::from("/tmp/swhkd.sock"); if Path::new(&pid_file_path).exists() { log::trace!("Reading {} file and checking for ru...
cwe
CWE-668
Rust
function l(a,b){var c,d,e="";for(c=1,d=b.length;d>c;c++)e+=r.compileNode(a,b[c]);return e}
cwe
CWE-1321
JavaScript
/* * 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-200
Java
AP_DECLARE(void) ap_increment_counts(ap_sb_handle_t *sb, request_rec *r) { worker_score *ws; apr_off_t bytes; if (!sb) return; ws = &ap_scoreboard_image->servers[sb->child_num][sb->thread_num]; if (pfn_ap_logio_get_last_bytes != NULL) { bytes = pfn_ap_logio_get_last_bytes(r->connec...
cwe
CWE-476
C/C++
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); optimized_ops::Round(GetTensorShape(input), GetTensorData<float>(input), GetTensorShape(output), ...
cwe
CWE-125
C/C++
/* $Id$ */ /* * The crypt_blowfish homepage is: * * http://www.openwall.com/crypt/ * * This code comes from John the Ripper password cracker, with reentrant * and crypt(3) interfaces added, but optimizations specific to password * cracking removed. * * Written by Solar Designer <solar at openwall.com> in 1998...
cwe
CWE-787
C/C++
$files[$i] = '.' . DIRECTORY_SEPARATOR . basename($file); } $files = array_map('escapeshellarg', $files); $cmd = $arc['cmd'] . ' ' . $arc['argc'] . ' ' . escapeshellarg($name) . ' ' . implode(' ', $files); $err_out = ''; $this->procExec($c...
cwe
CWE-918
PHP
/* Copyright (c) 2017 - 2021 LiteSpeed Technologies Inc. See LICENSE. */ /* * lsquic_pr_queue.c -- packet request queue. */ #include <assert.h> #include <errno.h> #include <inttypes.h> #include <stdlib.h> #include <string.h> #include <sys/queue.h> #ifndef WIN32 #include <netinet/in.h> #include <sys/socket.h> #endi...
cwe
CWE-476
C/C++
Number(I.value),[e[t]])}}finally{f.getModel().endUpdate()}});O.className="geBtn gePrimaryBtn";mxEvent.addListener(m,"keypress",function(t){13==t.keyCode&&O.click()});n=document.createElement("div");n.style.marginTop="20px";n.style.textAlign="right";b.editor.cancelFirst?(n.appendChild(c),n.appendChild(O)):(n.appendChild...
cwe
CWE-20
JavaScript
/* ELF executable support for BFD. Copyright (C) 1993-2020 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. 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 Sof...
cwe
CWE-119
C/C++
/* 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++
def self.dump(object) MultiJson.dump object, mode: :compat, escape_mode: :xss_safe, time_format: :ruby end
cwe
CWE-79
Ruby
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.mixme = {})); }(this, (function (exp...
cwe
CWE-1321
JavaScript
/* Copyright 2018 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-125
Python
static void umount_tree(struct mount *mnt, enum umount_tree_flags how) { LIST_HEAD(tmp_list); struct mount *p; if (how & UMOUNT_PROPAGATE) propagate_mount_unlock(mnt); /* Gather the mounts to umount */ for (p = mnt; p; p = next_mnt(p, mnt)) { p->mnt.mnt_flags |= MNT_UMOUNT; list_move(&p->mnt_list, &tmp_lis...
cwe
CWE-400
Unknown
/* nbdkit * Copyright (C) 2013-2019 Red Hat Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the f...
cwe
CWE-406
C/C++
function bp_core_admin_slugs_options() { // Get the existing WP pages. $existing_pages = bp_core_get_directory_page_ids(); // Set up an array of components (along with component names) that have directory pages. $directory_pages = bp_core_admin_get_directory_pages(); if ( !empty( $directory_pages ) ) : ?> <h...
cwe
CWE-284
PHP
static int x509parse_verifycrl(x509_cert *crt, x509_cert *ca, x509_crl *crl_list) { int flags = 0; int hash_id; unsigned char hash[64]; if( ca == NULL ) return( flags ); /* * TODO: What happens if no CRL is present? * Suggestion: Revocation state should be unknown if no C...
cwe
CWE-310
Unknown
PHPAPI php_url *php_url_parse_ex(char const *str, size_t length) { char port_buf[6]; php_url *ret = ecalloc(1, sizeof(php_url)); char const *s, *e, *p, *pp, *ue; s = str; ue = s + length; /* parse scheme */ if ((e = memchr(s, ':', length)) && e != s) { /* validate scheme */ p = s; while (p < e) { /* s...
cwe
CWE-20
C/C++
PackLinuxElf64::canPack() { union { unsigned char buf[sizeof(Elf64_Ehdr) + 14*sizeof(Elf64_Phdr)]; //struct { Elf64_Ehdr ehdr; Elf64_Phdr phdr; } e; } u; COMPILE_TIME_ASSERT(sizeof(u) <= 1024) fi->readx(u.buf, sizeof(u.buf)); fi->seek(0, SEEK_SET); Elf64_Ehdr const *const ehdr =...
cwe
CWE-415
Unknown
# -*- coding: utf-8 -*- # Copyright 2014 OpenMarket Ltd # Copyright 2018 New Vector 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 # #...
cwe
CWE-20
Python
static int zrle_compress_data(VncState *vs, int level) { z_streamp zstream = &vs->zrle.stream; buffer_reset(&vs->zrle.zlib); if (zstream->opaque != vs) { int err; zstream->zalloc = vnc_zlib_zalloc; zstream->zfree = vnc_zlib_zfree; err = deflateInit2(zstream, level, Z_DEFL...
cwe
CWE-401
Unknown
def reset_password @admin_user = Motor::AdminUser.find(params[:admin_user_id]) authorize!(:manage, @admin_user) Devise::Mailer.default_url_options = { host: request.host, protocol: request.protocol, port: request.port } @admin_user.send_reset_password_instructions head :ok end
cwe
CWE-116
Ruby
/* * Copyright 2016 http://www.hswebframework.org * * 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 ap...
cwe
CWE-352
Java
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-915
JavaScript
void Compute(OpKernelContext* const context) override { // node_id_range const Tensor* node_id_range_t; OP_REQUIRES_OK(context, context->input("node_id_range", &node_id_range_t)); const auto node_id_range = node_id_range_t->vec<int32>(); const int32_t node_id_first = node_id_range(0); // inclusive ...
cwe
CWE-824
C/C++
static int l2cap_parse_conf_req(struct l2cap_chan *chan, void *data, size_t data_size) { struct l2cap_conf_rsp *rsp = data; void *ptr = rsp->data; void *endptr = data + data_size; void *req = chan->conf_req; int len = chan->conf_len; int type, hint, olen; unsigned long val; struct l2cap_conf_rfc rfc = { .mode =...
cwe
CWE-125
Unknown
#!/usr/bin/env python2 # vim:fileencoding=utf-8 from __future__ import (unicode_literals, division, absolute_import, print_function) __license__ = 'GPL v3' __copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>' import cPickle from PyQt5.Qt import ( Qt, QListWidget, QListWidgetItem,...
cwe
CWE-502
Python
static INLINE UINT16 ntlm_av_pair_get_id(const NTLM_AV_PAIR* pAvPair) { UINT16 AvId; Data_Read_UINT16(&pAvPair->AvId, AvId); return AvId; }
cwe
CWE-125
C/C++
/* 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-193
Python
void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb) { struct in_pktinfo *pktinfo = PKTINFO_SKB_CB(skb); bool prepare = (inet_sk(sk)->cmsg_flags & IP_CMSG_PKTINFO) || ipv6_sk_rxinfo(sk); if (prepare && skb_rtable(skb)) { /* skb->cb is overloaded: prior to this point it is IP{6}CB * wh...
cwe
CWE-476
Unknown
may_get_cmd_block(exarg_T *eap, char_u *p, char_u **tofree, int *flags) { char_u *retp = p; if (*p == '{' && ends_excmd2(eap->arg, skipwhite(p + 1)) && eap->getline != NULL) { garray_T ga; char_u *line = NULL; ga_init2(&ga, sizeof(char_u *), 10); if (ga_add_string(&ga, p) == FAIL) ...
cwe
CWE-416
C/C++
function cn(e){var t=e.transaction,n=e.entry,r=e.event,i=e.timeOrigin,o=e.eventEnd,a=e.description,s=o?n[o]:n[r+"End"],l=n[r+"Start"];l&&s&&dn(t,{op:"browser",description:null!=a?a:r,startTimestamp:i+(0,Gt.XL)(l),endTimestamp:i+(0,Gt.XL)(s)})}
cwe
CWE-79
JavaScript
window.OME.handleChgrp = function(webindex, staticurl) { webindex_url = webindex; static_url = staticurl; // gid, gname, oid $chgrpform.dialog({"title": "Move to Group", height: 450, width: 400}); $chgrpform.dialog('open'); $chgrpform.empty(); ...
cwe
CWE-79
JavaScript
applySettings( input, settings ){ DEFAULTS.templates = this.templates var _s = this.settings = extend({}, DEFAULTS, settings) _s.disabled = input.hasAttribute('disabled') _s.readonly = _s.readonly || input.hasAttribute('readonly') _s.placeholder = input.getAttribute('placeholde...
cwe
CWE-79
JavaScript
static void _sx_sasl_client_process(sx_t s, sx_plugin_t p, Gsasl_session *sd, const char *mech, const char *in, int inlen) { _sx_sasl_t ctx = (_sx_sasl_t) p->private; _sx_sasl_sess_t sctx = NULL; char *buf = NULL, *out = NULL, *realm = NULL, **ext_id; char hostname[256]; int ret; #ifdef HAVE_SSL ...
cwe
CWE-287
C/C++
MojoResult Core::WrapPlatformSharedBufferHandle( const MojoPlatformHandle* platform_handle, size_t size, const MojoSharedBufferGuid* guid, MojoPlatformSharedBufferHandleFlags flags, MojoHandle* mojo_handle) { DCHECK(size); ScopedPlatformHandle handle; MojoResult result = MojoPlatformHand...
cwe
CWE-787
C/C++
struct page *follow_devmap_pmd(struct vm_area_struct *vma, unsigned long addr, pmd_t *pmd, int flags) { unsigned long pfn = pmd_pfn(*pmd); struct mm_struct *mm = vma->vm_mm; struct dev_pagemap *pgmap; struct page *page; assert_spin_locked(pmd_lockptr(mm, pmd)); /* * When we COW a devmap PMD entry, we split ...
cwe
CWE-362
Unknown
function setupJitsiLocalStorage() { const urlParams = parseURLParams(window.location); if (shouldUseHostPageLocalStorage(urlParams)) { try { const localStorageContent = JSON.parse(urlParams['appData.localStorageContent']); if (typeof localStorageContent === 'object') { ...
cwe
CWE-1321
JavaScript
#!/usr/bin/python3 import os import logging import stat import shutil import gettext from gi.repository import GLib, Gio, GObject import util from util import FileType import prefs import warp_pb2 _ = gettext.gettext FILE_INFOS = ",".join([ "standard::size", "standard::allocated-size", "standard::name"...
cwe
CWE-59
Python
#!/usr/bin/env python # # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from datetime import datetime from typing import Any, Dict, Generic, List, Optional, Tuple, TypeVar, Union from uuid import UUID, uuid4 from pydantic import BaseModel, Field, root_validator, validator from pydantic.datacl...
cwe
CWE-346
Python
cdp_decode(struct lldpd *cfg, char *frame, int s, struct lldpd_hardware *hardware, struct lldpd_chassis **newchassis, struct lldpd_port **newport) { struct lldpd_chassis *chassis; struct lldpd_port *port; struct lldpd_mgmt *mgmt; struct in_addr addr; #if 0 u_int16_t cksum; #endif u_int8_t *software = NULL...
cwe
CWE-617
C/C++
xsltCompileLocationPathPattern(xsltParserContextPtr ctxt, int novar) { SKIP_BLANKS; if ((CUR == '/') && (NXT(1) == '/')) { /* * since we reverse the query * a leading // can be safely ignored */ NEXT; NEXT; ctxt->comp->priority = 0.5; /* '//' means not 0 priority */ xsltCompileRelativePathPattern(ctx...
cwe
CWE-399
C/C++
virDomainDiskSourceFormatNetwork(virBufferPtr attrBuf, virBufferPtr childBuf, virStorageSourcePtr src, unsigned int flags) { size_t n; g_autofree char *path = NULL; virBufferAsprintf(attrBuf, " protocol='%s'"...
cwe
CWE-212
Unknown
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* Fluent Bit * ========== * Copyright (C) 2019-2021 The Fluent Bit Authors * Copyright (C) 2015-2018 Treasure Data Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in co...
cwe
CWE-415
C/C++
function transform() { var $input = $( this ), $slider = $input.siblings( '.rwmb-slider' ), $valueLabel = $slider.siblings( '.rwmb-slider-value-label' ).find( 'span' ), value = $input.val(), options = $slider.data( 'options' ); $slider.html( '' ); $valueLabel.text( value ); if (...
cwe
CWE-79
JavaScript
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-787
C/C++
""" .. References and links rendered by Sphinx are kept here as "module documentation" so that they can be used in the ``Logger`` docstrings but do not pollute ``help(logger)`` output. .. |Logger| replace:: :class:`~Logger` .. |add| replace:: :meth:`~Logger.add()` .. |remove| replace:: :meth:`~Logger.remove()` .. |...
cwe
CWE-269
Python
def cluster_stop(params, request, session) if params[:name] params_without_name = params.reject {|key, value| key == "name" or key == :name } code, response = send_request_with_token( session, params[:name], 'cluster_stop', true, params_without_name ) else if not allowed_for_local_cl...
cwe
CWE-384
Ruby
PHP_FUNCTION(curl_escape) { char *str = NULL, *res = NULL; size_t str_len = 0; zval *zid; php_curl *ch; if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &zid, &str, &str_len) == FAILURE) { return; } if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NU...
cwe
CWE-119
C/C++
/* 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
delegpt_add_rrset_A(struct delegpt* dp, struct regional* region, struct ub_packed_rrset_key* ak, uint8_t lame) { struct packed_rrset_data* d=(struct packed_rrset_data*)ak->entry.data; size_t i; struct sockaddr_in sa; socklen_t len = (socklen_t)sizeof(sa); log_assert(!dp->dp_type_mlc); ...
cwe
CWE-400
Unknown
int tcp_read_sock(struct sock *sk, read_descriptor_t *desc, sk_read_actor_t recv_actor) { struct sk_buff *skb; struct tcp_sock *tp = tcp_sk(sk); u32 seq = tp->copied_seq; u32 offset; int copied = 0; if (sk->sk_state == TCP_LISTEN) return -ENOTCONN; while ((skb = tcp_recv_skb(sk, seq, &offset)) != NULL) { ...
cwe
CWE-119
C/C++
static int accept_server_socket(int sfd) { struct sockaddr_un remote; struct pollfd pfd; int fd; socklen_t len = sizeof(struct sockaddr_un); BTIF_TRACE_EVENT("accept fd %d", sfd); /* make sure there is data to process */ pfd.fd = sfd; pfd.events = POLLIN; if (poll(&pfd, 1, 0) == 0) { ...
cwe
CWE-284
C/C++
public boolean isAvailable() { try { GeoTools.getInitialContext(); return true; } catch (NamingException e) { return false; } }
cwe
CWE-20
Java
jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines) { my_main_ptr main_ptr = (my_main_ptr)cinfo->main; my_coef_ptr coef = (my_coef_ptr)cinfo->coef; my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample; JDIMENSION i, x; int y; JDIMENSION lines_per_iMCU_row, lines_left_in_iMCU_row, lines_...
cwe
CWE-476
Unknown
/* * * Copyright 2019 Asylo 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 agree...
cwe
CWE-787
C/C++
sp<IMemory> MetadataRetrieverClient::getFrameAtTime(int64_t timeUs, int option) { ALOGV("getFrameAtTime: time(%lld us) option(%d)", timeUs, option); Mutex::Autolock lock(mLock); Mutex::Autolock glock(sLock); mThumbnail.clear(); if (mRetriever == NULL) { ALOGE("retriever is not initialized"); return ...
cwe
CWE-20
C/C++
def resource_cleanup(params, request, session) if not allowed_for_local_cluster(session, Permissions::WRITE) return 403, 'Permission denied' end stdout, stderr, retval = run_cmd( session, PCS, "resource", "cleanup", params[:resource] ) if retval == 0 return JSON.generate({"success" => "true"}) e...
cwe
CWE-384
Ruby
static bool matchExpression(MprJson *obj, int operator, char *value) { if (!(obj->type & MPR_JSON_VALUE)) { return 0; } value = stok(value, "'\"", NULL); switch (operator) { case JSON_OP_EQ: return smatch(obj->value, value); case JSON_OP_NE: return !smatch(obj->value, val...
cwe
CWE-476
C/C++
/* * MPEG-4 decoder * Copyright (c) 2000,2001 Fabrice Bellard * Copyright (c) 2002-2010 Michael Niedermayer <michaelni@gmx.at> * * This file is part of FFmpeg. * * FFmpeg 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 ...
cwe
CWE-617
C/C++
public function rules() { $rules = []; $inputs = $this->all(); $validateEmail = false; $validateUsername = false; if (!isset($inputs['username']) || !isset($inputs['email'])) { $validateUsername = true; } if (isset($inputs['email']) && !isset(...
cwe
CWE-190
PHP
xsltAttrListTemplateProcess(xsltTransformContextPtr ctxt, xmlNodePtr target, xmlAttrPtr attrs) { xmlAttrPtr attr, copy, last; xmlNodePtr oldInsert, text; xmlNsPtr origNs = NULL, copyNs = NULL; const xmlChar *value; xmlChar *valueAVT; if ((ctxt == NULL) || (target == NULL) ...
cwe
CWE-399
C/C++
/* Copyright 2019 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-190
Python
public function read($sessionId) { $sql = "SELECT $this->dataCol FROM $this->table WHERE $this->idCol = :id"; try { $stmt = $this->pdo->prepare($sql); $stmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); $stmt->execute(); // We use fetchAll instead ...
cwe
CWE-89
JavaScript
'use strict'; const assert = require('assert'); const renderer = require('./renderer'); const chromeLauncher = require('chrome-launcher'); const express = require('express'); const fs = require('fs'); const compression = require('compression'); const path = require('path'); const https = require('https'); const app = ...
cwe
CWE-200
JavaScript
png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal) { #ifdef PNG_USE_LOCAL_ARRAYS PNG_PLTE; #endif png_uint_32 i; png_colorp pal_ptr; png_byte buf[3]; png_debug(1, "in png_write_PLTE"); if (( #ifdef PNG_MNG_FEATURES_SUPPORTED !(png_ptr->mng_features_permit...
cwe
CWE-120
C/C++
package com.mayank.rucky.utils; import java.util.Date; import java.util.Random; public class Randoms { Random random; Randoms() { random = new Random(); Date date = new Date(); random.setSeed(date.getTime()); } public int randomTheme() { return random.nextInt(Constan...
cwe
CWE-327
Java
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % M M AAA TTTTT L AAA BBBB ...
cwe
CWE-125
C/C++
function __processMessage$1(modules, message) { var config = modules.config, crypto = modules.crypto; if (!config.cipherKey) return message; try { return crypto.decrypt(message); } catch (e) { return message; } }
cwe
CWE-331
JavaScript
/* PEF support for BFD. Copyright (C) 1999-2020 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. 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 Founda...
cwe
CWE-476
C/C++
void CoordinatorImpl::PerformNextQueuedGlobalMemoryDump() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); QueuedRequest* request = GetCurrentRequest(); if (request == nullptr) return; std::vector<QueuedRequestDispatcher::ClientInfo> clients; for (const auto& kv : clients_) { auto client_identity =...
cwe
CWE-787
C/C++
static int i8042_start(struct serio *serio) { struct i8042_port *port = serio->port_data; port->exists = true; mb(); return 0; }
cwe
CWE-476
Unknown
ref_param_read_signal_error(gs_param_list * plist, gs_param_name pkey, int code) { iparam_list *const iplist = (iparam_list *) plist; iparam_loc loc; ref_param_read(iplist, pkey, &loc, -1); /* can't fail */ *loc.presult = code; switch (ref_param_read_get_policy(plist, pkey)) { case ...
cwe
CWE-704
C/C++
def comments_closed? !(allow_comments? && in_feedback_window?) end
cwe
CWE-863
Ruby
public function fromData($data, $filename) { if ($data === null) { return; } $tempPath = temp_path(basename($filename)); FileHelper::put($tempPath, $data); $file = $this->fromFile($tempPath); FileHelper::delete($tempPath); return $file; }
cwe
CWE-362
PHP
public function localFileSystemInotify($path, $standby, $compare) { if (isset($this->sessionCache['localFileSystemInotify_disable'])) { return false; } $path = realpath($path); $mtime = filemtime($path); if ($mtime != $compare) { return $mtime; } $inotifywait = defined('ELFINER_INOTIFYWAIT_PATH')? E...
cwe
CWE-89
JavaScript
static av_cold int vqa_decode_init(AVCodecContext *avctx) { VqaContext *s = avctx->priv_data; int i, j, codebook_index; s->avctx = avctx; avctx->pix_fmt = PIX_FMT_PAL8; /* make sure the extradata made it */ if (s->avctx->extradata_size != VQA_HEADER_SIZE) { av_log(s->avctx, AV_LOG_ERRO...
cwe
CWE-119
Unknown
uint32_t virtio_config_readl(VirtIODevice *vdev, uint32_t addr) { VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); uint32_t val; k->get_config(vdev, vdev->config); if (addr > (vdev->config_len - sizeof(val))) return (uint32_t)-1; val = ldl_p(vdev->config + addr); return val; }
cwe
CWE-269
C/C++
BufferedRandomDevice::BufferedRandomDevice(size_t bufferSize) : bufferSize_(bufferSize), buffer_(new unsigned char[bufferSize]), ptr_(buffer_.get() + bufferSize) { // refill on first use }
cwe
CWE-787
C/C++
bjc_compress(const byte *row, uint raster, byte *compressed) { const byte *end_row = row; register const byte *exam = row; register byte *cptr = compressed; /* output pointer into compressed bytes */ end_row += raster; while ( exam < end_row ) { /* Search ahead in the input looking for a run */ /* o...
cwe
CWE-787
Unknown
package io.github.karlatemp.unsafeaccessor; import org.jetbrains.annotations.Contract; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.reflect.AccessibleObject; import java.lang.reflect.Field; import java.util.function.Consumer; /** * JVM Root Access. * * @since 1.1.0...
cwe
CWE-200
Java
TfLiteStatus ResizeOutputandTemporaryTensors(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input = GetInput(context, node, kInputTensor); const int num_dims = NumDimensions(input); TF_LITE_ENSURE(context, num_dims >= 2); const TfLiteTensor* fft_leng...
cwe
CWE-787
C/C++
cib_send_tls(gnutls_session * session, xmlNode * msg) { char *xml_text = NULL; # if 0 const char *name = crm_element_name(msg); if (safe_str_neq(name, "cib_command")) { xmlNodeSetName(msg, "cib_result"); } # endif xml_text = dump_xml_unformatted(msg); if (xml_text != NULL) { ...
cwe
CWE-399
C/C++
$tmpfname = $tempDir . DIRECTORY_SEPARATOR . 'ELF_FATCH_' . md5($url.microtime(true)); $_name = ''; // check is data: if (substr($url, 0, 5) === 'data:') { list($data, $args['name'][$i]) = $this->parse_data_scheme($url, $extTable); } else { $fp = fopen($tmpfname, 'wb'); $data...
cwe
CWE-89
JavaScript