code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
Agraph_t *agroot(void* obj) { // fixes CVE-2019-11023 by moving the problem to the caller :-) if (obj == 0) return NILgraph; switch (AGTYPE(obj)) { case AGINEDGE: case AGOUTEDGE: return ((Agedge_t *) obj)->node->root; case AGNODE: return ((Agnode_t *) obj)->root; case AGRAPH: return ((Ag...
vuln
Safe
Unknown
private size_t donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size, int clazz, int swap, size_t align, int *flags) { Elf32_Nhdr nh32; Elf64_Nhdr nh64; size_t noff, doff; #ifdef ELFCORE int os_style = -1; #endif uint32_t namesz, descsz; unsigned char *nbuf = CAST(unsigned char *, vbuf); if (x...
vuln
Vulnerable
C/C++
private static String getAuthorizationCode(String email, String password) throws LoginException { String cookie; String loginWebpage; try { URLConnection connection = LOGIN_URL.openConnection(); System.out.println("Getting login cookie..."); cookie = connection.getHeaderField("set-cookie"); ...
vuln
Safe
Java
bool AXTableCell::isColumnHeaderCell() const { const AtomicString& scope = getAttribute(scopeAttr); return equalIgnoringCase(scope, "col") || equalIgnoringCase(scope, "colgroup"); }
vuln
Vulnerable
C/C++
pub fn retrieve_less_version() -> Option<usize> { let cmd = Command::new("less").arg("--version").output().ok()?; parse_less_version(&cmd.stdout) }
vuln
Vulnerable
Rust
static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8, AVStream *st, AVPacket *pkt, uint32_t *timestamp, const uint8_t *buf, int len, uint16_t seq, int flags) { int start_partition, end_packet; int extended_b...
vuln
Safe
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...
vuln
Vulnerable
Python
int btrfs_run_qgroups(struct btrfs_trans_handle *trans) { struct btrfs_fs_info *fs_info = trans->fs_info; int ret = 0; if (!fs_info->quota_root) return ret; spin_lock(&fs_info->qgroup_lock); while (!list_empty(&fs_info->dirty_qgroups)) { struct btrfs_qgroup *qgroup; qgroup = list_first_entry(&fs_info->dirt...
vuln
Vulnerable
C/C++
static int kvm_ppc_register_host_cpu_type(void) { TypeInfo type_info = { .name = TYPE_HOST_POWERPC_CPU, .class_init = kvmppc_host_cpu_class_init, }; PowerPCCPUClass *pvr_pcc; ObjectClass *oc; DeviceClass *dc; int i; pvr_pcc = kvm_ppc_get_host_cpu_class(); if (pvr_pcc == N...
vuln
Safe
C/C++
ssh_packet_set_postauth(struct ssh *ssh) { struct sshcomp *comp; int r, mode; debug("%s: called", __func__); /* This was set in net child, but is not visible in user child */ ssh->state->after_authentication = 1; ssh->state->rekeying = 0; for (mode = 0; mode < MODE_MAX; mode++) { if (ssh->state->newkeys[mode]...
vuln
Vulnerable
C/C++
public String prettyName() { int index = barcodeFormats.indexOf(mBarcodeFormat); if (index == -1 || index >= barcodePrettyNames.size()) { return mBarcodeFormat.name(); } return barcodePrettyNames.get(index); }
vuln
Safe
Java
static int shash_no_setkey(struct crypto_shash *tfm, const u8 *key, unsigned int keylen) { return -ENOSYS; }
vuln
Vulnerable
C/C++
def _set_cache(self, app: Flask, config) -> None: import_me = config["CACHE_TYPE"] from . import backends cache_obj = load_module(import_me, lookup_obj=backends) from . import serialization cache_args = config["CACHE_ARGS"][:] cache_options = { "default_time...
vuln
Safe
Python
tdata_t _TIFFmalloc(tsize_t s) { if (s == 0) return ((void *) NULL); return (malloc((size_t) s)); }
vuln
Safe
C/C++
package archiver import ( "bytes" "fmt" "io" "os" "path/filepath" "strings" "github.com/nwaples/rardecode" ) // Rar is for RAR archive format var Rar rarFormat func init() { RegisterFormat("Rar", Rar) } type rarFormat struct{} func (rarFormat) Match(filename string) bool { return strings.HasSuffix(string...
vuln
Vulnerable
Go
# -*- coding: utf-8 -*- """Define tables and columns.""" from collective.task import _ from collective.task import PMF from collective.task.adapters import EMPTY_STRING from html import escape from imio.helpers.adapters import NoEscapeLinkColumn from plone import api from Products.CMFPlone.utils import normalizeString...
vuln
Safe
Python
static int mace_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { AVFrame *frame = data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; int16_t **samples; MACEContext *ctx = avctx->priv_data; int i, j, k, l, ret...
vuln
Vulnerable
C/C++
static int snd_compress_check_input(struct snd_compr_params *params) { /* first let's check the buffer parameter's */ if (params->buffer.fragment_size == 0 || params->buffer.fragments > INT_MAX / params->buffer.fragment_size) return -EINVAL; /* now codec parameters */ if (params->codec.id == 0 || para...
vuln
Safe
C/C++
static target_ulong disas_insn(CPUX86State *env, DisasContext *s, target_ulong pc_start) { int b, prefixes; int shift; TCGMemOp ot, aflag, dflag; int modrm, reg, rm, mod, op, opreg, val; target_ulong next_eip, tval; int rex_w, rex_r; s->pc_start = s->pc = pc_s...
vuln
Vulnerable
C/C++
int diskutil_dd(const char *in, const char *out, const int bs, const long long count) { char *output = NULL; if (in && out) { LOGINFO("copying data from '%s'\n", in); LOGINFO(" to '%s' (blocks=%lld)\n", out, count); char if_str[MAX_PATH]; snprintf(if_str, sizeof(if_str), ...
vuln
Safe
Unknown
TPMI_RH_LOCKOUT_Unmarshal(TPMI_RH_LOCKOUT *target, BYTE **buffer, INT32 *size) { TPM_RC rc = TPM_RC_SUCCESS; TPMI_RH_LOCKOUT orig_target = *target; // libtpms added if (rc == TPM_RC_SUCCESS) { rc = TPM_HANDLE_Unmarshal(target, buffer, size); } if (rc == TPM_RC_SUCCESS) { switch (*target) { c...
vuln
Safe
Unknown
void ep2_map(ep2_t p, const uint8_t *msg, size_t len) { ep2_map_dst(p, msg, len, (const uint8_t *)"RELIC", 5); }
vuln
Safe
C/C++
@Override public Response getToken(String tokenID) { if (tokenID == null) throw new BadRequestException("Token ID is null."); CMS.debug("TokenService.getToken(\"" + tokenID + "\")"); try { TPSSubsystem subsystem = (TPSSubsystem) CMS.getSubsystem(TPSSubsystem.ID); ...
vuln
Vulnerable
Java
def _get_shared_models(self, args: "DictConfig") -> Dict[str, dict]: with open(args.blueprint.model_opt_path) as f: all_model_opts = yaml.safe_load(f.read()) active_model_opts = { model: opt for model, opt in all_model_opts.items() if self.conversations_ne...
vuln
Safe
Python
$("form#streamrule-form").on("click", "#sr-inverted", function() { var modalBody = $(this).closest("form#streamrule-form").find(".modal-body"); var old_val = $("#sr-result-category", modalBody).html(); if ($(this).is(":checked")) { // Add the not. new_val = "not " + old_...
vuln
Vulnerable
JavaScript
@Override public int setErrorParameter(BeforeEnterEvent event, ErrorParameter<NotFoundException> parameter) { if (getLogger().isDebugEnabled()) { getLogger().debug( parameter.hasCustomMessage() ? parameter.getCustomMessage() : "Route is...
vuln
Safe
Java
def __init__(self, sydent): self.sydent = sydent root = Resource() matrix = Resource() identity = Resource() api = Resource() v1 = self.sydent.servlets.v1 v2 = self.sydent.servlets.v2 validate = Resource() validate_v2 = Resource() email =...
vuln
Vulnerable
Python
def get_cms_details(url): # this function will fetch cms details using cms_detector response = {} cms_detector_command = 'python3 /usr/src/github/CMSeeK/cmseek.py -u {} --random-agent --batch --follow-redirect'.format(url) os.system(cms_detector_command) response['status'] = False response['mes...
vuln
Vulnerable
Python
/* * MOV, 3GP, MP4 muxer * Copyright (c) 2003 Thomas Raivio * Copyright (c) 2004 Gildas Bazin <gbazin at videolan dot org> * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it u...
vuln
Vulnerable
C/C++
static void qxl_reset_state(PCIQXLDevice *d) { QXLRam *ram = d->ram; QXLRom *rom = d->rom; assert(SPICE_RING_IS_EMPTY(&ram->cmd_ring)); assert(SPICE_RING_IS_EMPTY(&ram->cursor_ring)); d->shadow_rom.update_id = cpu_to_le32(0); *rom = d->shadow_rom; qxl_rom_set_dirty(d); init_qxl_ram(d); ...
vuln
Vulnerable
C/C++
package osxkeychain /* #cgo CFLAGS: -x objective-c -mmacosx-version-min=10.11 #cgo LDFLAGS: -framework Security -framework Foundation -mmacosx-version-min=10.11 #include "osxkeychain_darwin.h" #include <stdlib.h> */ import "C" import ( "errors" "strconv" "unsafe" "github.com/docker/docker-credential-helpers/cred...
vuln
Safe
Go
int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfiles files, rpmpsm psm, char ** failedFile) { FD_t payload = rpmtePayload(te); rpmfi fi = NULL; rpmfs fs = rpmteGetFileStates(te); rpmPlugins plugins = rpmtsPlugins(ts); int rc = 0; int fx = -1; int fc = rpmfilesFC(files); ...
vuln
Vulnerable
C/C++
public static void pringUsage() { System.out.println("Usage: log4j2-scan [--scan-log4j1] [--fix] target_path1 target_path2"); System.out.println(""); System.out.println("-f [config_file_path]"); System.out.println("\tSpecify config file path which contains scan target paths.\n" + "\tPaths should be separate...
vuln
Safe
Java
ssize_t vnc_client_read_buf(VncState *vs, uint8_t *data, size_t datalen) { ssize_t ret; int err = -1; if (vs->tls) { ret = qcrypto_tls_session_read(vs->tls, (char *)data, datalen); if (ret < 0) { err = errno; } } else { ret = qemu_recv(vs->csock, data, datalen...
vuln
Safe
C/C++
static void msix_mmio_writel(void *opaque, target_phys_addr_t addr, uint32_t val) { PCIDevice *dev = opaque; unsigned int offset = addr & (MSIX_PAGE_SIZE - 1); int vector = offset / MSIX_ENTRY_SIZE; memcpy(dev->msix_table_page + offset, &val, 4); if (!msix_is_masked(dev,...
vuln
Vulnerable
C/C++
static int draw_slice(AVFilterLink *inlink, int y0, int h, int slice_dir) { AlphaExtractContext *extract = inlink->dst->priv; AVFilterBufferRef *cur_buf = inlink->cur_buf; AVFilterBufferRef *out_buf = inlink->dst->outputs[0]->out_buf; if (extract->is_packed_rgb) { int x, y; uint8_t *pin,...
vuln
Safe
C/C++
int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt) { AVCodecInternal *avci = avctx->internal; int ret; *got_picture_ptr = 0; if ((avctx->...
vuln
Safe
C/C++
void ring_buffer_reset_online_cpus(struct trace_buffer *buffer) { struct ring_buffer_per_cpu *cpu_buffer; int cpu; /* prevent another thread from changing buffer sizes */ mutex_lock(&buffer->mutex); for_each_online_buffer_cpu(buffer, cpu) { cpu_buffer = buffer->buffers[cpu]; atomic_inc(&cpu_buffer->resize_d...
vuln
Safe
Unknown
private void deleteCallableVulnerabilityData(String externalVulnerabilityId, Long vulnerabilityId, DSLContext context) { var callableIds = context.select(VulnerabilitiesXCallables.VULNERABILITIES_X_CALLABLES.CALLABLE_ID) .from(VulnerabilitiesXCallables.VULNERABILITIES_X_CALLABLES) ...
vuln
Vulnerable
Java
async def massdm(self, ctx: commands.Context, role: discord.Role, *, message: str) -> None: """Sends a DM to all Members with the given Role. Allows for the following customizations: `{member}` is the member being messaged `{role}` is the role through which they are being messaged ...
vuln
Vulnerable
Python
@Override protected void dump(FileDescriptor fd, PrintWriter printWriter, String[] args) { if (!DumpUtils.checkDumpPermission(mContext, TAG, printWriter)) return; IndentingPrintWriter pw = new IndentingPrintWriter(printWriter, " "); pw.println("Current lock settings service state:"); ...
vuln
Vulnerable
Java
var common = require('./common'); var _tempDir = require('./tempdir').tempDir; var _pwd = require('./pwd'); var path = require('path'); var fs = require('fs'); var child = require('child_process'); var DEFAULT_MAXBUFFER_SIZE = 20 * 1024 * 1024; var DEFAULT_ERROR_CODE = 1; common.register('exec', _exec, { unix: fals...
vuln
Vulnerable
JavaScript
Status AutoParallel::Initialize(const GrapplerItem& item) { num_gpus_ = GetNumAvailableGPUs(); LOG(INFO) << "Number of GPUs: " << num_gpus_; item_ = &item; graph_ = item.graph; LOG(INFO) << "Original graph size: " << graph_.node_size(); if (item.fetch.empty()) { return Status(error::INVALID_ARGUMENT, "N...
vuln
Safe
C/C++
CommandInfoList *qmp_query_commands(Error **errp) { CommandInfoList *list = NULL; qmp_for_each_command(&qmp_commands, query_commands_cb, &list); return list; }
vuln
Vulnerable
C/C++
long do_sigreturn(CPUSH4State *regs) { struct target_sigframe *frame; abi_ulong frame_addr; sigset_t blocked; target_sigset_t target_set; target_ulong r0; int i; int err = 0; #if defined(DEBUG_SIGNAL) fprintf(stderr, "do_sigreturn\n"); #endif frame_addr = regs->gregs[15]; if (!lo...
vuln
Vulnerable
C/C++
krb5_ldap_get_password_policy_from_dn(krb5_context context, char *pol_name, char *pol_dn, osa_policy_ent_t *policy) { krb5_error_code st=0, tempst=0; LDAP *ld=NULL; LDAPMessage *result=NULL,*ent=NULL; kdb5_dal_handl...
vuln
Vulnerable
C/C++
# -*- coding: utf-8 -*- # udb, A web interface to manage IT network # Copyright (C) 2022 IKUS Software inc. # # 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 3 of the License, or ...
vuln
Safe
Python
static int splice_pipe_to_pipe(struct pipe_inode_info *ipipe, struct pipe_inode_info *opipe, size_t len, unsigned int flags) { struct pipe_buffer *ibuf, *obuf; int ret = 0, nbuf; bool input_wakeup = false; retry: ret = ipipe_prep(ipipe, flags); if (ret) return ret; ret = opipe_prep(opipe,...
vuln
Safe
Unknown
package org.thoughtcrime.securesms.linkpreview; import android.support.annotation.NonNull; import android.text.SpannableString; import android.text.TextUtils; import android.text.style.URLSpan; import android.text.util.Linkify; import com.annimon.stream.Stream; import java.util.Collections; import java.util.List; i...
vuln
Vulnerable
Java
static int spapr_vty_init(VIOsPAPRDevice *sdev) { VIOsPAPRVTYDevice *dev = (VIOsPAPRVTYDevice *)sdev; if (!dev->chardev) { fprintf(stderr, "spapr-vty: Can't create vty without a chardev!\n"); exit(1); } qemu_chr_add_handlers(dev->chardev, vty_can_receive, vty_re...
vuln
Safe
C/C++
static void setProperty(XMLInputFactory xmlInputFactory, String propertyName, Object value) { try { xmlInputFactory.setProperty(propertyName, value); } catch (IllegalArgumentException e) { printWarningAndRethrowEventually(e, XMLInputFactory.class, "property " + propertyName); ...
vuln
Safe
Java
public boolean cancel() { return native_cancel(); }
vuln
Vulnerable
Java
void backup_start(BlockDriverState *bs, BlockDriverState *target, int64_t speed, MirrorSyncMode sync_mode, BdrvDirtyBitmap *sync_bitmap, BlockdevOnError on_source_error, BlockdevOnError on_target_error, BlockCompletionFunc *cb, vo...
vuln
Safe
C/C++
int diskutil_ddzero(const char *path, const long long sectors, boolean zero_fill) { char *output = NULL; long long count = 1; long long seek = sectors - 1; if (path) { if (zero_fill) { count = sectors; seek = 0; } output = pruntf(TRUE, "%s %s if=/dev/zer...
vuln
Vulnerable
Unknown
/* Copyright 2013 Simo Sorce <simo@samba.org>, see COPYING for license */ /* This File implements the NTLM protocol as specified by: * [MS-NLMP]: NT LAN Manager (NTLM) Authentication Protocol * * Additional cross checking with: * http://davenport.sourceforge.net/ntlm.html */ #include <alloca.h> #include <en...
vuln
Vulnerable
C/C++
#include "source/extensions/compression/brotli/decompressor/brotli_decompressor_impl.h" #include <memory> namespace Envoy { namespace Extensions { namespace Compression { namespace Brotli { namespace Decompressor { BrotliDecompressorImpl::BrotliDecompressorImpl(Stats::Scope& scope, const std::string& stats_prefix, ...
vuln
Vulnerable
C/C++
void ConnectionImpl::StreamImpl::encodeData(Buffer::Instance& data, bool end_stream) { ASSERT(!local_end_stream_); local_end_stream_ = end_stream; parent_.stats_.pending_send_bytes_.add(data.length()); pending_send_data_.move(data); if (data_deferred_) { int rc = nghttp2_session_resume_data(parent_.sessio...
vuln
Safe
Unknown
private void cachePrevChanceResults(){ if (!main.rulesManager.anyRuleHasChance) return; String rulesPassed = null; String rulesDenied = null; if (getPDCLock()) { try { if (this.livingEntity.getPersistentDataContainer().has(main.namespaced_keys.chanceRule_All...
vuln
Safe
Java
int dd_chown(struct dump_dir *dd, uid_t new_uid) { if (!dd->locked) error_msg_and_die("dump_dir is not opened"); /* bug */ struct stat statbuf; if (!(stat(dd->dd_dirname, &statbuf) == 0 && S_ISDIR(statbuf.st_mode))) { perror_msg("stat('%s')", dd->dd_dirname); return 1; } ...
vuln
Safe
Unknown
COMP_METHOD *COMP_zlib(void) { COMP_METHOD *meth = &zlib_method_nozlib; #ifdef ZLIB_SHARED if (!zlib_loaded) { #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) zlib_dso = DSO_load(NULL, "ZLIB1", NULL, 0); #else zlib_dso = DSO_load(NULL, "z", NULL, 0); #endif if (zlib_dso != NULL) { p_com...
vuln
Safe
Unknown
static hwaddr ppc_hash64_htab_lookup(CPUPPCState *env, ppc_slb_t *slb, target_ulong eaddr, ppc_hash_pte64_t *pte) { hwaddr pteg_off, pte_offset; hwaddr hash; uint64_t vsid, epnshift, epnmask, epn, ptem; epnshift = (slb->vsid ...
vuln
Safe
C/C++
protected UploadServer getServer(GetServerCondition condition) { if (host == null || host.length() == 0) { return null; } synchronized (this) { if (ipGroupList == null || ipGroupList.size() == 0) { createIpGroupList(); ...
vuln
Vulnerable
Java
/* radare - LGPL - Copyright 2008-2022 nibble, pancake, inisider */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <r_hash.h> #include <r_types.h> #include <r_util.h> #include "pe.h" #include <time.h> #include <ht_uu.h> #define PE_IMAGE_FILE_MACHINE_RPI2 452 #define MAX_METADATA_STRING_LENGTH 256...
vuln
Safe
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_MAPTY...
vuln
Vulnerable
C/C++
static void compute_angular_endpoints_for_quant_levels( unsigned int weight_count, const float* dec_weight_quant_uvalue, const float* dec_weight_quant_sig, unsigned int max_quant_level, float low_value[12], float high_value[12] ) { unsigned int max_quant_steps = quantization_steps_for_level[max_quant_level]; a...
vuln
Safe
Unknown
int dd_delete(struct dump_dir *dd) { if (!dd->locked) { error_msg("unlocked problem directory %s cannot be deleted", dd->dd_dirname); return -1; } int r = delete_file_dir(dd->dd_dirname, /*skip_lock_file:*/ true); dd->locked = 0; /* delete_file_dir already removed .lock */ dd_cl...
vuln
Vulnerable
Unknown
grub_err_t grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector, grub_off_t offset, grub_size_t size, void *buf) { char *tmp_buf; unsigned real_offset; /* First of all, check if the region is within the disk. */ if (grub_disk_adjust_range (disk, &sector, &offset, size) != GRUB_ERR_NONE) { gru...
vuln
Vulnerable
C/C++
gostdsa_vko (const struct ecc_scalar *priv, const struct ecc_point *pub, size_t ukm_length, const uint8_t *ukm, uint8_t *out) { const struct ecc_curve *ecc = priv->ecc; unsigned bsize = (ecc_bit_size (ecc) + 7) / 8; mp_size_t size = ecc->p.size; mp_size_t itch = 4*size + ecc->mul_itch; mp_limb_t *scratc...
vuln
Safe
Unknown
#include "common/http/conn_manager_utility.h" #include <atomic> #include <cstdint> #include <string> #include "envoy/type/v3/percent.pb.h" #include "common/common/empty_string.h" #include "common/common/utility.h" #include "common/http/conn_manager_config.h" #include "common/http/header_utility.h" #include "common/h...
vuln
Vulnerable
C/C++
/* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Implementation of the Transmission Control Protocol(TCP). * * Authors: Ross Biro * Fred N. van Kempen, <wa...
vuln
Vulnerable
C/C++
void g_free(void *ptr) { __coverity_free__(ptr); __coverity_mark_as_afm_freed__(ptr, AFM_free); }
vuln
Safe
C/C++
formUpdateBuffer(Anchor *a, Buffer *buf, FormItemList *form) { Buffer save; char *p; int spos, epos, rows, c_rows, pos, col = 0; Line *l; copyBuffer(&save, buf); gotoLine(buf, a->start.line); switch (form->type) { case FORM_TEXTAREA: case FORM_INPUT_TEXT: case FORM_INPUT_FILE: ...
vuln
Safe
C/C++
public void mergeIfRequired() { logger.info("--------------: " + triplesCount); // Merge only if threshold in native store exceeded and not merging with hdt if (triplesCount >= getThreshold() && !isMergeTriggered) { logger.info("Merging..." + triplesCount); try { ...
vuln
Vulnerable
Java
void Compute(OpKernelContext* context) override { const Tensor& input = context->input(0); // MatrixDiagPart and MatrixDiagPartV2 both use this OpKernel. // MatrixDiagPart only has one input, so we have to check the number of // inputs before reading additional parameters in MatrixDiagV2. int32_t l...
vuln
Vulnerable
C/C++
def comments_closed? !(allow_comments? && published? && in_feedback_window?) end
vuln
Safe
Ruby
$this->setType('folder'); } // do not allow PHP and .htaccess files if (preg_match("@\.ph(p[\d+]?|t|tml|ps)$@i", $this->getFilename()) || $this->getFilename() == '.htaccess') { $this->setFilename($this->getFilename() . '.txt'); } if(mb_strlen($this->getFilename()) >...
vuln
Vulnerable
PHP
def handle_cursor(cls, cursor: "Cursor", query: Query, session: Session) -> None: """Updates progress information""" if tracking_url := cls.get_tracking_url(cursor): query.tracking_url = tracking_url session.commit() query_id = query.id poll_interval = query.data...
vuln
Vulnerable
Python
static void handle_method_call(GDBusConnection *connection, const gchar *caller, const gchar *object_path, const gchar *interface_name, const gchar *method_name, GVariant *parameters, ...
vuln
Vulnerable
Unknown
def _secure_path(path_tuple): if _has_insecure_pathelement(path_tuple): # belt-and-suspenders security; this should never be true # unless someone screws up the traversal_path code # (request.subpath is computed via traversal_path too) return None if any([_contains_slash(item) fo...
vuln
Vulnerable
Python
int nbd_send_request(int csock, struct nbd_request *request) { uint8_t buf[4 + 4 + 8 + 8 + 4]; cpu_to_be32w((uint32_t*)buf, NBD_REQUEST_MAGIC); cpu_to_be32w((uint32_t*)(buf + 4), request->type); cpu_to_be64w((uint64_t*)(buf + 8), request->handle); cpu_to_be64w((uint64_t*)(buf + 16), request->from); ...
vuln
Vulnerable
C/C++
static int kvm_put_vcpu_events(CPUState *env, int level) { struct kvm_vcpu_events events; if (!kvm_has_vcpu_events()) { return 0; } events.exception.injected = (env->exception_injected >= 0); events.exception.nr = env->exception_injected; events.exception.has_error_code = env->has_error_...
vuln
Vulnerable
C/C++
package rke2 import ( "context" "errors" "fmt" "regexp" "sort" "strings" "time" "github.com/rancher/channelserver/pkg/model" provv1 "github.com/rancher/rancher/pkg/apis/provisioning.cattle.io/v1" rkev1 "github.com/rancher/rancher/pkg/apis/rke.cattle.io/v1" "github.com/rancher/rancher/pkg/apis/rke.cattle.io...
vuln
Safe
Go
static bool generic_new(struct nf_conn *ct, const struct sk_buff *skb, unsigned int dataoff, unsigned int *timeouts) { return true; }
vuln
Vulnerable
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...
vuln
Vulnerable
Python
static int tls_decrypt_ticket(SSL *s, const unsigned char *etick, int eticklen, const unsigned char *sess_id, int sesslen, SSL_SESSION **psess) { SSL_SESSION *sess; unsigned char *sdec; const unsigned char *p; int slen, mlen, renew_ticket = 0; unsigned char tick_hmac[EVP_MAX_MD_SIZE]; HMAC_CTX hctx; EVP...
vuln
Vulnerable
Unknown
function getLegendHeaderHtml(statName) { var name = statName; if (panel.legend.header) { name = panel.legend.header; } var html = '<th class="pointer" data-stat="' + _.escape(statName) + '">' + name; if (panel.legend.sort === statN...
vuln
Safe
JavaScript
static Image *ReadEXRImage(const ImageInfo *image_info,ExceptionInfo *exception) { ExrWindow data_window, display_window; const ImfHeader *hdr_info; Image *image; ImageInfo *read_info; ImfInputFile *file; ImfRgba *scanline; MagickBooleanType status; register ssize_...
vuln
Safe
C/C++
int net_slirp_redir(const char *redir_str) { struct slirp_config_str *config; if (QTAILQ_EMPTY(&slirp_stacks)) { config = g_malloc(sizeof(*config)); pstrcpy(config->str, sizeof(config->str), redir_str); config->flags = SLIRP_CFG_HOSTFWD | SLIRP_CFG_LEGACY; config->next = slirp_co...
vuln
Vulnerable
C/C++
@PreInit public void initialize(FMLPreInitializationEvent evt) { Property templateItemId = BuildCraftCore.mainConfiguration.getItem("templateItem.id", DefaultProps.TEMPLATE_ITEM_ID); Property blueprintItemId = BuildCraftCore.mainConfiguration.getItem("blueprintItem.id", DefaultProps.BLUEPRINT_ITEM_ID); Property ...
vuln
Vulnerable
Java
/* * 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...
vuln
Safe
Java
public static long estimateNodeFrequency(DataFlowNode node) { long count = node.getIterations() == 0 ? 1 : node.getIterations(); if (node.isTopLevel()) return count; DataFlowNode loop = getLoopOfNode(node); count *= loop.getIterations(); while (!loop.isTopLevel()) { loop = getLoopOfLoop(loop); count...
vuln
Vulnerable
Java
mainloop_destroy_trigger(crm_trigger_t * source) { source->trigger = FALSE; if (source->id > 0) { g_source_remove(source->id); source->id = 0; } return TRUE; }
vuln
Safe
C/C++
public void refreshRow() throws SQLException { checkUpdateable(); if (onInsertRow) { throw new PSQLException(GT.tr("Can''t refresh the insert row."), PSQLState.INVALID_CURSOR_STATE); } if (isBeforeFirst() || isAfterLast() || castNonNull(rows, "rows").isEmpty()) { return; } ...
vuln
Vulnerable
Java
bool VariableUnserializer::matchString(folly::StringPiece str) { const char* p = m_buf; assertx(p <= m_end); int total = 0; if (*p == 'S' && type() == VariableUnserializer::Type::APCSerialize) { total = 2 + 8 + 1; if (p + total > m_end) return false; p++; if (*p++ != ':') return false; auto ...
vuln
Safe
C/C++
static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, void *yyscanner, HEX_LEX_ENVIRONMENT *lex_env) { YYUSE (yyvaluep); YYUSE (yyscanner); YYUSE (lex_env); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN ...
vuln
Vulnerable
C/C++
static int futex_lock_pi(u32 __user *uaddr, int fshared, int detect, ktime_t *time, int trylock) { struct hrtimer_sleeper timeout, *to = NULL; struct futex_hash_bucket *hb; struct futex_q q; int res, ret; if (refill_pi_state_cache()) return -ENOMEM; if (time) { to = &timeout; hrtimer_init_on_stack(&to...
vuln
Safe
Unknown
/* * Copyright (C) 2012-2018 Tobias Brunner * Copyright (C) 2006-2009 Martin Willi * HSR Hochschule fuer Technik Rapperswil * * 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 versio...
vuln
Safe
C/C++
static av_always_inline void mc_chroma_scaled(VP9Context *s, vp9_scaled_mc_func smc, vp9_mc_func (*mc)[2], uint8_t *dst_u, uint8_t *dst_v, ptrdiff_t dst_stride, ...
vuln
Vulnerable
C/C++
def branch_exists(self, branch): """ This checks to make sure the branch we are told to access exists in the repo """ try: heads = subprocess.run( ["git", "ls-remote", "--heads", "--", self.git_url], capture_output=True, ...
vuln
Safe
Python
static int make_ydt15_entry(int p2, int p1, int16_t *ydt) #else static int make_ydt15_entry(int p1, int p2, int16_t *ydt) #endif { int lo, hi; lo = ydt[p1]; lo += (lo * 32) + (lo * 1024); hi = ydt[p2]; hi += (hi * 32) + (hi * 1024); return (lo + (hi * (1 << 16))) * 2; }
vuln
Vulnerable
C/C++