code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
static int juniper_parse_header(netdissect_options *ndo, const u_char *p, const struct pcap_pkthdr *h, struct juniper_l2info_t *l2info) { const struct juniper_cookie_table_t *lp = juniper_cookie_table; u_int idx, jnx_ext_len, jnx_header_len = 0; uint8_t tlv_type,tlv_len; uint32_t co...
vuln
Safe
C/C++
static int do_session_handshake (lua_State *L, int status, lua_KContext ctx) { int rc; struct ssh_userdata *sshu = NULL; assert(lua_gettop(L) == 4); sshu = (struct ssh_userdata *) nseU_checkudata(L, 3, SSH2_UDATA, "ssh2"); while ((rc = libssh2_session_handshake(sshu->session, sshu->sp[0])) == LIBS...
vuln
Vulnerable
C/C++
TEE_Result syscall_authenc_dec_final(unsigned long state, const void *src_data, size_t src_len, void *dst_data, uint64_t *dst_len, const void *tag, size_t tag_len) { TEE_Result res; struct tee_cryp_state *cs; struct tee_ta_session *sess; size_t dlen = 0; res = tee_ta_get_current_session(&sess); if (res != ...
vuln
Safe
C/C++
function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1) { // List of special chars for filenames in windows are defined on page https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file // Char '>' '<' '|' '$' and ';' are special chars for shells. // Char '/' and '\' are file delimiters. $filesy...
vuln
Vulnerable
PHP
void perf_event_enable(struct perf_event *event) { struct perf_event_context *ctx = event->ctx; struct task_struct *task = ctx->task; if (!task) { /* * Enable the event on the cpu that it's on */ cpu_function_call(event->cpu, __perf_event_enable, event); return; } raw_spin_lock_irq(&ctx->lock); if (...
vuln
Vulnerable
Unknown
/* * Copyright © 2015-2018 Aeneas Rekkas <aeneas+oss@aeneas.io> * * 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...
vuln
Vulnerable
Go
# -*- coding: utf-8 -*- # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe import _ from datetime import timedelta from frappe.desk.form import assign_to from frappe.utils.jinja import ...
vuln
Safe
Python
static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; unsigned int i, entries, sample_size, field_size, num_bytes; GetBitContext gb; unsigned char* buf; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1...
vuln
Vulnerable
C/C++
int archive_write_open2(struct archive *_a, void *client_data, archive_open_callback *opener, archive_write_callback *writer, archive_close_callback *closer, archive_free_callback *freer) { struct archive_write *a = (struct archive_write *)_a; struct archive_write_filter *client_filter; int ret, r1; archiv...
vuln
Vulnerable
C/C++
int perf_config(config_fn_t fn, void *data) { int ret = 0, found = 0; const char *home = NULL; /* Setting $PERF_CONFIG makes perf read _only_ the given config file. */ if (config_exclusive_filename) return perf_config_from_file(fn, config_exclusive_filename, data); if (perf_config_system() && !access(perf_...
vuln
Safe
C/C++
bool SessionModelAssociator::WriteTabContentsToSyncModel( const SyncedWindowDelegate& window, const SyncedTabDelegate& tab, int64 sync_id, sync_api::WriteTransaction* trans) { DCHECK(CalledOnValidThread()); sync_api::WriteNode tab_node(trans); if (!tab_node.InitByIdLookup(sync_id)) { LOG(ERRO...
vuln
Vulnerable
C/C++
@Override protected String doInBackground(Uri... params) { File file = null; int size = -1; try { try { if (returnCursor != null && returnCursor.moveToFirst()) { if (mUri.getScheme() != null) if (mUri.getScheme().equals...
vuln
Safe
Java
static MYSQL *db_connect(char *host, char *database, char *user, char *passwd) { MYSQL *mysql; if (verbose) fprintf(stdout, "Connecting to %s\n", host ? host : "localhost"); if (!(mysql= mysql_init(NULL))) return 0; if (opt_compress) mysql_options(mysql,MYSQL_OPT_COMPRESS,Nu...
vuln
Vulnerable
Unknown
import dayjs from 'dayjs' import utc from 'dayjs/plugin/utc' import { saveAs } from 'file-saver' import { FlowRouter } from 'meteor/ostrio:flow-router-extra' import { NullXlsx } from '@neovici/nullxlsx' import './periodtimetable.html' import './pagination.js' import './limitpicker.js' import { i18nReady, t } from '../....
vuln
Safe
JavaScript
static Image *ReadPDFImage(const ImageInfo *image_info,ExceptionInfo *exception) { char command[MagickPathExtent], *density, filename[MagickPathExtent], input_filename[MagickPathExtent], message[MagickPathExtent], *options, postscript_filename[MagickPathExtent]; const char *option; ...
vuln
Safe
C/C++
int kvm_init(MachineClass *mc) { static const char upgrade_note[] = "Please upgrade to at least kernel 2.6.29 or recent kvm-kmod\n" "(see http: struct { const char *name; int num; } num_cpus[] = { { "SMP", smp_cpus }, { "hotpluggable", max_cpus }, ...
vuln
Vulnerable
C/C++
def closed? !@connected end
vuln
Vulnerable
Ruby
bool decode(ArgumentDecoder* decoder, RetainPtr<CFURLRef>& result) { RetainPtr<CFURLRef> baseURL; bool hasBaseURL; if (!decoder->decodeBool(hasBaseURL)) return false; if (hasBaseURL) { if (!decode(decoder, baseURL)) return false; } RetainPtr<CFStringRef> string; ...
vuln
Safe
C/C++
static int mem_read(jas_stream_obj_t *obj, char *buf, int cnt) { int n; assert(cnt >= 0); assert(buf); JAS_DBGLOG(100, ("mem_read(%p, %p, %d)\n", obj, buf, cnt)); jas_stream_memobj_t *m = (jas_stream_memobj_t *)obj; n = m->len_ - m->pos_; cnt = JAS_MIN(n, cnt); memcpy(buf, &m->buf_[m->pos_], cnt); m->pos_ += ...
vuln
Vulnerable
Unknown
def parse_and_validate_server_name(server_name: str) -> Tuple[str, Optional[int]]: """Split a server name into host/port parts and do some basic validation. Args: server_name: server name to parse Returns: host/port parts. Raises: ValueError if the server name could not be par...
vuln
Vulnerable
Python
ast_for_for_stmt(struct compiling *c, const node *n0, bool is_async) { const node * const n = is_async ? CHILD(n0, 1) : n0; asdl_seq *_target, *seq = NULL, *suite_seq; expr_ty expression; expr_ty target, first; const node *node_target; int end_lineno, end_col_offset; int has_type_comment; ...
vuln
Safe
C/C++
require('../services/Requisitions'); import Util from 'lib/util'; const QuickNode = require('../model/QuickNode'); /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ (function() { 'use strict'; const quickAddPanelBasicView = require('../../views/quick-add-panel-basi...
vuln
Safe
Java
@Override public void setLivingAnimations(Rhino rhino, Integer uniqueID, @Nullable AnimationEvent customPredicate) { super.setLivingAnimations(rhino, uniqueID, customPredicate); if (customPredicate == null) return; List<EntityModelData> extraDataOfType = customPredicate.getExtraDataOfType(...
vuln
Safe
Java
@DELETE @Path("/{uuid}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation( value = "Deletes a vulnerability", code = 204 ) @ApiResponses(value = { @ApiResponse(code = 401, message = "Unauthorized"), @ApiResp...
vuln
Safe
Java
private void startPairing(String serverIp, int pairingPort) { String ownIp = getIp(); String ownPublicKey = sharedPreferences.getString(getString(R.string.preferences_own_public_key), null); if (ownIp == null || ownPublicKey == null) { return; } DialogPairingBinding...
vuln
Safe
Java
static bool arm_cpu_has_work(CPUState *cs) { ARMCPU *cpu = ARM_CPU(cs); return !cpu->powered_off && cs->interrupt_request & (CPU_INTERRUPT_FIQ | CPU_INTERRUPT_HARD | CPU_INTERRUPT_VFIQ | CPU_INTERRUPT_VIRQ | CPU_INTERRUPT_EXITTB); }
vuln
Vulnerable
C/C++
/* * Copyright 2016 Red Hat, Inc. and/or its affiliates * and other contributors as indicated by the @author tags. * * 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.apach...
vuln
Vulnerable
Java
# -*- test-case-name: twisted.web.test.test_distrib -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Distributed web servers. This is going to have to be refactored so that argument parsing is done by each subprocess and not by the main web server (i.e. GET, POST etc.). """ import copy...
vuln
Safe
Python
# Copyright 2022 The HuggingFace Team. 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 applicabl...
vuln
Safe
Python
static int ssl_verify_server_cert(Vio *vio, const char* server_hostname, const char **errptr) { SSL *ssl; X509 *server_cert; char *cp1, *cp2; char *buf; DBUG_ENTER("ssl_verify_server_cert"); DBUG_PRINT("enter", ("server_hostname: %s", server_hostname)); if (!(ssl= (SSL*)vio->ssl_arg)) { *errptr= "N...
vuln
Vulnerable
Unknown
int imap_open_connection(struct ImapAccountData *adata) { if (mutt_socket_open(adata->conn) < 0) return -1; adata->state = IMAP_CONNECTED; if (imap_cmd_step(adata) != IMAP_RES_OK) { imap_close_connection(adata); return -1; } if (mutt_istr_startswith(adata->buf, "* OK")) { if (!mutt_istr...
vuln
Safe
C/C++
var userfieldsTable = $('#userfields-table').DataTable({ 'order': [[1, 'asc']], 'columnDefs': [ { 'orderable': false, 'targets': 0 }, { 'searchable': false, "targets": 0 } ] }); $('#userfields-table tbody').removeClass("d-none"); userfieldsTable.columns.adjust().draw(); $("#search").on("keyup", Delay(function(...
vuln
Safe
JavaScript
sixel_allocator_malloc( sixel_allocator_t /* in */ *allocator, /* allocator object */ size_t /* in */ n) /* allocation size */ { /* precondition */ assert(allocator); assert(allocator->fn_malloc); if (n == 0) { sixel_helper_set_additional_message( "...
vuln
Vulnerable
Unknown
// SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2005-2014 Brocade Communications Systems, Inc. * Copyright (c) 2014- QLogic Corporation. * All rights reserved * www.qlogic.com * * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter. */ /* * bfa_attr.c Linux driver configuration interf...
vuln
Safe
C/C++
get_preview_thumbnail (const char *uri, int size) { GdkPixbuf *pixbuf; GFile *file; GFileInfo *file_info; GInputStream *input_stream; GObject *object; g_return_val_if_fail (uri != NULL, NULL); input_stream = NULL; file = g_file_new_for_uri (uri); /*...
vuln
Safe
Unknown
void bn_make(bn_t a, size_t digits) { if (digits < 0) { RLC_THROW(ERR_NO_VALID); } /* Allocate at least one digit. */ digits = RLC_MAX(digits, 1); #if ALLOC == DYNAMIC if (digits % RLC_BN_SIZE != 0) { /* Pad the number of digits to a multiple of the block. */ digits += (RLC_BN_SIZE - digits % RLC_BN_SIZE); ...
vuln
Safe
C/C++
static ssize_t mcf_fec_receive(NetClientState *nc, const uint8_t *buf, size_t size) { mcf_fec_state *s = qemu_get_nic_opaque(nc); mcf_fec_bd bd; uint32_t flags = 0; uint32_t addr; uint32_t crc; uint32_t buf_addr; uint8_t *crc_ptr; unsigned int buf_len; size_t retsize; DPRINTF("do...
vuln
Vulnerable
C/C++
@Override public void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); MoreBlockCollectionBean moreBlock = Pp.h().a(moreBlockName); addHeaderBlock(moreBlock.spec); addBlocks(moreBlock.blocks); resizeBottomViews(); }
vuln
Vulnerable
Java
PHP_FUNCTION(fnmatch) { char *pattern, *filename; int pattern_len, filename_len; long flags = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &pattern, &pattern_len, &filename, &filename_len, &flags) == FAILURE) { return; } if (strlen(pattern) != pattern_len) { RETURN_FALSE; } if (strlen(...
vuln
Safe
Unknown
inboth (char **left, char **right) { char **both; char **temp; int lnum, rnum; if (left == NULL || right == NULL) return NULL; both = malloc(sizeof *both); if (both == NULL) return NULL; both[0] = NULL; for (lnum = 0; left[lnum] != NULL; ++lnum) { for (rnum = 0; right[rnum] != NULL; +...
vuln
Vulnerable
Unknown
virgl_cmd_get_capset(VuGpu *g, struct virtio_gpu_ctrl_command *cmd) { struct virtio_gpu_get_capset gc; struct virtio_gpu_resp_capset *resp; uint32_t max_ver, max_size; VUGPU_FILL_CMD(gc); virgl_renderer_get_cap_set(gc.capset_id, &max_ver, &max_si...
vuln
Vulnerable
Unknown
FLAC_API FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples) { unsigned i, j = 0, channel; const unsigned channels = encoder->protected_->channels, blocksize = encoder->protected_->blocksize; FLAC__ASSERT(0 != encoder); FLAC__ASSERT(0 != encod...
vuln
Vulnerable
Unknown
static int rev_body(int s, int stype, unsigned char *context) { char *buf = NULL; int i; int ret = 1; SSL *con; BIO *io, *ssl_bio, *sbio; buf = app_malloc(bufsize, "server rev buffer"); io = BIO_new(BIO_f_buffer()); ssl_bio = BIO_new(BIO_f_ssl()); if ((io == NULL) || (ssl_bio == NUL...
vuln
Safe
Unknown
def write(self, bib_data, filename): def process_person_roles(entry): for role, persons in entry.persons.iteritems(): yield role, list(process_persons(persons)) def process_person(person): for type in ('first', 'middle', 'prelast', 'last', 'lineage'): ...
vuln
Safe
Python
status_t HevcParameterSets::addNalUnit(const uint8_t* data, size_t size) { if (size < 1) { ALOGE("empty NAL b/35467107"); return ERROR_MALFORMED; } uint8_t nalUnitType = (data[0] >> 1) & 0x3f; status_t err = OK; switch (nalUnitType) { case 32: // VPS if (size...
vuln
Safe
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
Safe
Python
@OnlyIn(Dist.CLIENT) @Nullable @Override public <A extends BipedModel<?>> A getArmorModel(LivingEntity entityLiving, ItemStack itemStack, EquipmentSlotType armorSlot, A _default) { SolVisageModel<?> model = new SolVisageModel<>(); model.bipedHeadwear.showModel = armorSlot == EquipmentSlotTyp...
vuln
Safe
Java
const express = require('express'); const cb = require('cb'); const createError = require('http-errors'); const debug = require('../lib/debug')('auth'); const { get: getConfig } = require('../lib/config'); const { get: getClient } = require('../lib/client'); const { requiresAuth } = require('./requiresAuth'); const at...
vuln
Safe
JavaScript
check_limit(VALUE str, VALUE opt) { if (NIL_P(str)) return; StringValue(str); size_t slen = RSTRING_LEN(str); size_t limit = get_limit(opt); if (slen > limit) { rb_raise(rb_eArgError, "string length (%"PRI_SIZE_PREFIX"u) exceeds the limit %"PRI_SIZE_PREFIX"u", slen, limit); } }
vuln
Vulnerable
Unknown
static always_inline void gen_op_arith_neg (DisasContext *ctx, TCGv ret, TCGv arg1, int ov_check) { int l1 = gen_new_label(); int l2 = gen_new_label(); TCGv t0 = tcg_temp_local_new(TCG_TYPE_TL); #if defined(TARGET_PPC64) if (ctx->sf_mode) { tcg_gen_movi_tl(t0, arg1); tcg_gen_brcondi_tl(T...
vuln
Safe
C/C++
static int decode_i_frame(FourXContext *f, AVFrame *frame, const uint8_t *buf, int length) { int x, y, ret; const int width = f->avctx->width; const int height = f->avctx->height; const unsigned int bitstream_size = AV_RL32(buf); int token_count av_unused; unsigned int prestream_size; const...
vuln
Safe
C/C++
@SubscribeEvent public void tick(RenderWorldLastEvent event) { if (mc.player != null && mc.inGameHasFocus && !mc.gameSettings.hideGUI) { World world = mc.world; EntityPlayer player = mc.player; ItemStack stack = mc.player.getHeldItemMainhand(); if...
vuln
Safe
Java
@SuppressWarnings("UnusedReturnValue") private boolean borderlessmining_setBorderlessFullscreen(boolean newValue) { RenderSystem.assertThread(RenderSystem::isInInitPhase); if (borderlessFullscreen != newValue) { borderlessFullscreen = newValue; // Kludge to fix fullscreen option button text not changing on F...
vuln
Safe
Java
INIT_ERROR_STATE CHECK_STATE(_size <= 32) CHECK_STATE(_randBuff); sgx_sha_state_handle_t shaStateHandle; CHECK_STATE(sgx_sha256_init(&shaStateHandle) == SGX_SUCCESS); CHECK_STATE(sgx_sha256_update(globalRandom, 32, shaStateHandle) == SGX_SUCCESS); CHECK_STATE(sgx_sha256_get_hash(shaStateHandl...
vuln
Safe
C/C++
void Compute(OpKernelContext* context) override { // Only create one, if one does not exist already. Report status for all // other exceptions. If one already exists, it unrefs the new one. // An epsilon value of zero could cause performance issues and is therefore, // disallowed. const Tensor* epsi...
vuln
Vulnerable
C/C++
static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags) { struct inode *inode; struct dentry *parent; struct fuse_mount *fm; struct fuse_inode *fi; int ret; inode = d_inode_rcu(entry); if (inode && is_bad_inode(inode)) goto invalid; else if (time_before64(fuse_dentry_time(entry), get_jiff...
vuln
Vulnerable
Unknown
static Exit_status safe_connect() { mysql= mysql_init(NULL); if (!mysql) { error("Failed on mysql_init."); return ERROR_STOP; } SSL_SET_OPTIONS(mysql); if (opt_plugin_dir && *opt_plugin_dir) mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir); if (opt_default_auth && *opt_default_auth) ...
vuln
Safe
C/C++
def sanitize_string(host) if host.start_with?(".") /\A(.+\.)?#{Regexp.escape(host[1..-1])}\z/i else /\A#{Regexp.escape host}\z/i end end
vuln
Vulnerable
Ruby
static int ahash_op_unaligned(struct ahash_request *req, int (*op)(struct ahash_request *)) { int err; err = ahash_save_req(req, ahash_op_unaligned_done); if (err) return err; err = op(req); if (err == -EINPROGRESS || (err == -EBUSY && (ahash_request_flags(req) & CRYPTO_TFM_REQ_MAY_BACK...
vuln
Safe
Unknown
tt_cmap8_validate( FT_Byte* table, FT_Validator valid ) { FT_Byte* p = table + 4; FT_Byte* is32; FT_UInt32 length; FT_UInt32 num_groups; if ( table + 16 + 8192 > valid->limit ) FT_INVALID_TOO_SHORT; length = TT_NEXT_ULONG( p ); if ( table + leng...
vuln
Vulnerable
C/C++
MagickExport void XTextViewWidget(Display *display, const XResourceInfo *resource_info,XWindows *windows, const MagickBooleanType mono,const char *title,const char **textlist) { #define DismissButtonText "Dismiss" char primary_selection[MaxTextExtent]; int i; static MagickStatusType mask = (Ma...
vuln
Safe
Unknown
static void startElement(struct solv_xmlparser *xmlp, int state, const char *name, const char **atts) { struct parsedata *pd = xmlp->userdata; Pool *pool = pd->pool; Solvable *s = pd->solvable; const char *type; /* ignore all language tags */ if (pd->skiplang || solv_xmlparser_find_attr("xml:lang", atts)) ...
vuln
Vulnerable
C/C++
static void dump_table(char *table, char *db) { char ignore_flag; char buf[200], table_buff[NAME_LEN+3]; DYNAMIC_STRING query_string; char table_type[NAME_LEN]; char *result_table, table_buff2[NAME_LEN*2+3], *opt_quoted_table; int error= 0; ulong rownr, row_break, total_length, init_length; uint...
vuln
Vulnerable
Unknown
TPM_RC TPM2B_NV_PUBLIC_Unmarshal(TPM2B_NV_PUBLIC *target, BYTE **buffer, INT32 *size) { TPM_RC rc = TPM_RC_SUCCESS; INT32 startSize; if (rc == TPM_RC_SUCCESS) { rc = UINT16_Unmarshal(&target->size, buffer, size); } if (rc == TPM_RC_SUCCESS) { if (target->size == 0) { rc = TPM_RC_SIZE; }...
vuln
Safe
C/C++
def cluster_status_remote(params, request, session) if not allowed_for_local_cluster(session, Permissions::READ) return 403, 'Permission denied' end cluster_name = $cluster_name # If node is not in a cluster, return empty data if not cluster_name or cluster_name.empty? overview = { :cluster_nam...
vuln
Vulnerable
Ruby
/*- * Copyright 2014 Square Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to...
vuln
Safe
Go
mysql_list_fields(MYSQL *mysql, const char *table, const char *wild) { MYSQL_RES *result; MYSQL_DATA *query; char buff[255]; int length= 0; LINT_INIT(query); length= snprintf(buff, 128, "%s%c%s", table, '\0', wild ? wild : ""); if (ma_simple_command(mysql, COM_FIELD_LIST,buff,length,1,0) || !(que...
vuln
Vulnerable
Unknown
static int get_cod(J2kDecoderContext *s, J2kCodingStyle *c, uint8_t *properties) { J2kCodingStyle tmp; int compno; if (s->buf_end - s->buf < 5) return AVERROR(EINVAL); tmp.log2_prec_width = tmp.log2_prec_height = 15; tmp.csty = bytestream_get_byte(&s->buf); if (bytestream_get_byte(&...
vuln
Vulnerable
C/C++
/** * * Ulfius Framework * * REST framework library * * ulfius.c: framework functions definitions * * Copyright 2015-2020 Nicolas Mora <mail@babelouest.org> * * 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 b...
vuln
Safe
C/C++
TIFFSeek(TIFF* tif, uint32 row, uint16 sample ) { register TIFFDirectory *td = &tif->tif_dir; uint32 strip; int whole_strip; tmsize_t read_ahead = 0; /* ** Establish what strip we are working from. */ if (row >= td->td_imagelength) { /* out of range */ TIFFErrorExt(tif->tif_cli...
vuln
Safe
C/C++
def get_window( window: Union[str, Tuple[str, float]], win_length: int, fftbins: bool = True, dtype: str = 'float64', ) -> Tensor: """Return a window of a given length and type. Args: window (Union[str, Tuple[str, float]]): The window function applied to the signal before the Fourier tr...
vuln
Safe
Python
vorbis_comment(AVFormatContext * as, uint8_t *buf, int size) { const uint8_t *p = buf; const uint8_t *end = buf + size; unsigned s, n, j; if (size < 8) return -1; s = bytestream_get_le32(&p); if (end - p < s) return -1; p += s; n = bytestream_get_le32(&p); while (p <...
vuln
Vulnerable
C/C++
sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg) { void __user *p = (void __user *)arg; int __user *ip = p; int result, val, read_only; Sg_device *sdp; Sg_fd *sfp; Sg_request *srp; unsigned long iflags; if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp))) return -ENXIO;...
vuln
Safe
Unknown
void blk_cleanup_queue(struct request_queue *q) { /* mark @q DYING, no new request or merges will be allowed afterwards */ mutex_lock(&q->sysfs_lock); blk_set_queue_dying(q); blk_queue_flag_set(QUEUE_FLAG_NOMERGES, q); blk_queue_flag_set(QUEUE_FLAG_NOXMERGES, q); blk_queue_flag_set(QUEUE_FLAG_DYING, q); mutex_u...
vuln
Safe
C/C++
# -*- coding: utf-8 -*- from __future__ import unicode_literals, absolute_import from collections import OrderedDict import re import yaml from io import StringIO from configparser import ConfigParser, NoOptionError from .regex import URL_REGEX, HASH_REGEX from .dependencies import DependencyFile, Dependency from ...
vuln
Vulnerable
Python
@EventHandler public void onArrow(ProjectileLaunchEvent evt) { if (plugin.getConfig().getBoolean("PreventBowBombExploit")) { if (evt.getEntity() instanceof Arrow || evt.getEntity() instanceof SpectralArrow) { if (evt.getEntity().getVelocity().lengthSquared() > plugin.getConfig()....
vuln
Safe
Java
ExecAlterObjectDependsStmt(AlterObjectDependsStmt *stmt, ObjectAddress *refAddress) { ObjectAddress address; ObjectAddress refAddr; Relation rel; address = get_object_address_rv(stmt->objectType, stmt->relation, (List *) stmt->object, &rel, AccessExclusiveLock, false); /* * If a relation was involve...
vuln
Vulnerable
C/C++
void sum_update(const char *p, int32 len) { switch (cursum_type) { case CSUM_MD5: md5_update(&md, (uchar *)p, len); break; case CSUM_MD4: case CSUM_MD4_OLD: case CSUM_MD4_BUSTED: if (len + sumresidue < CSUM_CHUNK) { memcpy(md.buffer + sumresidue, p, len); sumresidue += len; break; } if ...
vuln
Vulnerable
Unknown
static int on_part_data( multipart_parser *parser, const char *at, size_t length) { multipart_parser_data_t *data = NULL; ogs_assert(parser); data = multipart_parser_get_data(parser); ogs_assert(data); if (data->num_of_part < OGS_SBI_MAX_NUM_OF_PART && at && length) { SWITCH(data->...
vuln
Safe
Unknown
@WorkerThread private void loadAppInfo() { getPackageInfoInternal(); if (mPackageInfo == null) { appInfo.postValue(null); return; } AppDetailsItem<PackageInfo> appDetailsItem = new AppDetailsItem<>(mPackageInfo); appDetailsItem.name = mPackageName; ...
vuln
Vulnerable
Java
/*------------------------------------------------------------------------- * * selfuncs.c * Selectivity functions and index cost estimation functions for * standard operators and index access methods. * * Selectivity routines are registered in the pg_operator catalog * in the "oprrest" and "oprjoin" att...
vuln
Safe
C/C++
pci_lintr_deassert(struct pci_vdev *dev) { if (dev->lintr.pin <= 0) { pr_warn("%s: Invalid intr pin on dev [%s]\n", __func__, dev->name); return; } pthread_mutex_lock(&dev->lintr.lock); if (dev->lintr.state == ASSERTED) { dev->lintr.state = IDLE; pci_irq_deassert(dev); } else if (dev->lintr.state == PENDI...
vuln
Safe
C/C++
import json from tornado import web from ...base.handlers import APIHandler, json_errors class NbconvertRootHandler(APIHandler): SUPPORTED_METHODS = ('GET',) @web.authenticated @json_errors def get(self): try: from IPython.nbconvert.exporters.export import exporter_map ex...
vuln
Safe
Python
GC_API GC_ATTR_MALLOC void * GC_CALL GC_debug_malloc_atomic(size_t lb, GC_EXTRA_PARAMS) { void * result = GC_malloc_atomic(lb + DEBUG_BYTES); if (result == 0) { GC_err_printf("GC_debug_malloc_atomic(%lu) returning NULL (%s:%d)\n", ...
vuln
Vulnerable
Unknown
/* * Copyright 2014-2018 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by app...
vuln
Vulnerable
Java
MagickExport MagickBooleanType AnnotateImage(Image *image, const DrawInfo *draw_info,ExceptionInfo *exception) { char *p, primitive[MagickPathExtent], *text, **textlist; DrawInfo *annotate, *annotate_info; GeometryInfo geometry_info; MagickBooleanType status; PointInfo ...
vuln
Vulnerable
C/C++
processDescription (event, router, conf, sessionManager, SessionValidator) { var argsURLFragment = event ? (event.args ? event.args[0] : "") : "", urlParams = URIUtils.parseQueryString(argsURLFragment), gotoURL = urlParams.goto; SessionValidator.stop(); ...
vuln
Safe
JavaScript
DeviceState *sysbus_create_varargs(const char *name, target_phys_addr_t addr, ...) { DeviceState *dev; SysBusDevice *s; va_list va; qemu_irq irq; int n; dev = qdev_create(NULL, name); s = sysbus_from_qdev(dev); qdev_init(dev); if (addr != (target_ph...
vuln
Vulnerable
C/C++
public void finish() throws IOException { if (!def.finished()) { def.finish(); while (!def.finished()) { int len = def.deflate(buf, 0, buf.length); if (def.finished() && len <= buf.length - TRAILER_SIZE) { // last deflater buffer. Fit t...
vuln
Vulnerable
Java
XcursorCommentCreate (XcursorUInt comment_type, int length) { XcursorComment *comment; if (length > XCURSOR_COMMENT_MAX_LEN) return NULL; { XcursorComment *comment; if (length < 0 || length > XCURSOR_COMMENT_MAX_LEN) return NULL; comment = malloc (sizeof (XcursorComment) + length + 1); ...
vuln
Safe
C/C++
/* * This file includes functions to transform a concrete syntax tree (CST) to * an abstract syntax tree (AST). The main function is Ta3AST_FromNode(). * */ #include "Python.h" #include "Python-ast.h" #include "node.h" #include "ast.h" #include "token.h" #include "pythonrun.h" #include <assert.h> // VS 2010 doesn...
vuln
Safe
Python
void gdImageWBMPCtx (gdImagePtr image, int fg, gdIOCtx * out) { int x, y, pos; Wbmp *wbmp; /* create the WBMP */ if ((wbmp = createwbmp (gdImageSX (image), gdImageSY (image), WBMP_WHITE)) == NULL) { gd_error("Could not create WBMP"); return; } /* fill up the WBMP structure */ pos = 0; for (y = 0; y < gdIm...
vuln
Vulnerable
C/C++
def get_recipe_from_file(self, file): recipe = Recipe.objects.create( name=file['name'].strip(), created_by=self.request.user, internal=True, space=self.request.space) try: if file['recipeYield'] != '': recipe.servings = int(file['recipeY...
vuln
Vulnerable
Python
search_memslots(struct kvm_memslots *slots, gfn_t gfn) { int start = 0, end = slots->used_slots; int slot = atomic_read(&slots->lru_slot); struct kvm_memory_slot *memslots = slots->memslots; if (gfn >= memslots[slot].base_gfn && gfn < memslots[slot].base_gfn + memslots[slot].npages) return &memslots[slot]; ...
vuln
Vulnerable
C/C++
static int complete_mmio(struct kvm_vcpu *vcpu) { struct kvm_run *run = vcpu->run; int r; if (!(vcpu->arch.pio.count || vcpu->mmio_needed)) return 1; if (vcpu->mmio_needed) { vcpu->mmio_needed = 0; if (!vcpu->mmio_is_write) memcpy(vcpu->mmio_data + vcpu->mmio_index, run->mmio.data, 8); vcpu->...
vuln
Vulnerable
Unknown
function l(){var b,c,d,e,f,h,i,k;if(Bc++,b=vc,c=m(),c!==X){for(d=[],e=S();e!==X;)d.push(e),e=S();d!==X?(e=O(),e!==X?(f=j(),f!==X?(h=q(),h!==X?(i=n(),i===X&&(i=ba),i!==X?(wc=vc,k=ca(c,f,h,i),k=k?da:aa,k!==X?(wc=b,c=ea(c,f,h,i),b=c):(vc=b,b=aa)):(vc=b,b=aa)):(vc=b,b=aa)):(vc=b,b=aa)):(vc=b,b=aa)):(vc=b,b=aa)}else vc=b,b=...
vuln
Vulnerable
JavaScript
static void slirp_smb(SlirpState* s, Monitor *mon, const char *exported_dir, struct in_addr vserver_addr) { static int instance; char smb_conf[128]; char smb_cmdline[128]; FILE *f; snprintf(s->smb_dir, sizeof(s->smb_dir), "/tmp/qemu-smb.%ld-%d", (long)getpid(), ins...
vuln
Vulnerable
C/C++
func isReqAuthenticated(r *http.Request, region string) (s3Error APIErrorCode) { if r == nil { return ErrInternalError } if errCode := reqSignatureV4Verify(r, region); errCode != ErrNone { return errCode } payload, err := ioutil.ReadAll(r.Body) if err != nil { logger.LogIf(context.Background(), err) ret...
vuln
Vulnerable
Go
static void qemu_cleanup_net_client(NetClientState *nc) { QTAILQ_REMOVE(&net_clients, nc, next); if (nc->info->cleanup) { nc->info->cleanup(nc); } }
vuln
Safe
C/C++
Prism.languages.fortran={"quoted-number":{pattern:/[BOZ](['"])[A-F0-9]+\1/i,alias:"number"},string:{pattern:/(?:\w+_)?(['"])(?:\1\1|&(?:\r\n?|\n)(?:\s*!.+(?:\r\n?|\n))?|(?!\1).)*(?:\1|&)/,inside:{comment:{pattern:/(&(?:\r\n?|\n)\s*)!.*/,lookbehind:!0}}},comment:{pattern:/!.*/,greedy:!0},boolean:/\.(?:TRUE|FALSE)\.(?:_\...
vuln
Vulnerable
JavaScript