code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
pixops_scale_nearest (guchar *dest_buf, int render_x0, int render_y0, int render_x1, int render_y1, int dest_rowstride, int dest_channels, gboolean dest_has_alpha, const guchar ...
vuln
Vulnerable
Unknown
/* 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...
vuln
Safe
Go
static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *skb, struct request_sock *req, struct dst_entry *dst, struct request_sock *req_unhash, bool *own_req) { struct inet_request_sock *ireq; struct ipv6_pinfo *newnp; const struct ipv6_pinfo *np = inet6_sk(sk); struct...
vuln
Safe
C/C++
static int su3000_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num) { struct dvb_usb_device *d = i2c_get_adapdata(adap); struct dw2102_state *state; if (!d) return -ENODEV; state = d->priv; if (mutex_lock_interruptible(&d->i2c_mutex) < 0) return -EAGAIN; if (mutex_lock_interrupt...
vuln
Safe
Unknown
TfLiteStatus NonMaxSuppressionMultiClassRegularHelper(TfLiteContext* context, TfLiteNode* node, OpData* op_data, const float* scores) { const TfLiteTensor* ...
vuln
Safe
C/C++
jbig2_decode_symbol_dict(Jbig2Ctx *ctx, Jbig2Segment *segment, const Jbig2SymbolDictParams *params, const byte *data, size_t size, Jbig2ArithCx *GB_stats, Jbig2ArithCx *GR_stats) { Jbig2SymbolDict *SDNEWSYMS = NULL; Jbig2SymbolDict *SDEXSYMS = NULL; uint32_t...
vuln
Safe
Unknown
private void addFilesOrDirectory() { // Can't use FileUtils.selectFilesForOpen() because it doesn't support // selecting directories, or adding custom components to the dialog JFileChooser fileChooser = new JFileChooser(); Configuration config = Configuration.getInstance(); if ((...
vuln
Safe
Java
public function saveOption(Request $request) { $cleanFromXss = true; $option = $request->all(); // Allow for this keys and groups if (isset($option['option_key'])) { foreach ($this->whitelistedGroupKeys as $group => $keys) { if ($option['option_group'] =...
vuln
Safe
PHP
@Override protected void handleLookup(CommandLookupTopic lookup) { final long requestId = lookup.getRequestId(); final boolean authoritative = lookup.isAuthoritative(); // use the connection-specific listener name by default. final String advertisedListenerName = loo...
vuln
Vulnerable
Java
func padBuffer(buffer []byte, blockSize int) []byte { missing := blockSize - (len(buffer) % blockSize) ret, out := resize(buffer, len(buffer)+missing) padding := bytes.Repeat([]byte{byte(missing)}, missing) copy(out, padding) return ret }
vuln
Vulnerable
Go
////////////////////////////////////////////////////////////////////////////////////// // akashi - a server for Attorney Online 2 // // Copyright (C) 2020 scatterflower // // ...
vuln
Vulnerable
C/C++
sraSpanInsertBefore(sraSpan *newspan, sraSpan *before) { newspan->_next = before; newspan->_prev = before->_prev; before->_prev->_next = newspan; before->_prev = newspan; }
vuln
Vulnerable
C/C++
rb_dir_s_empty_p(VALUE obj, VALUE dirname) { VALUE result, orig; const char *path; enum {false_on_notdir = 1}; FilePathValue(dirname); orig = rb_str_dup_frozen(dirname); dirname = rb_str_encode_ospath(dirname); dirname = rb_str_dup_frozen(dirname); path = RSTRING_PTR(dirname); #if defi...
vuln
Safe
Unknown
__u32 secure_ipv6_id(const __be32 daddr[4]) { const struct keydata *keyptr; __u32 hash[4]; keyptr = get_keyptr(); hash[0] = (__force __u32)daddr[0]; hash[1] = (__force __u32)daddr[1]; hash[2] = (__force __u32)daddr[2]; hash[3] = (__force __u32)daddr[3]; return half_md4_transform(hash, keyptr->secret); }
vuln
Vulnerable
Unknown
static ssize_t _hostsock_recvmsg( oe_fd_t* sock_, struct oe_msghdr* msg, int flags) { ssize_t ret = -1; sock_t* sock = _cast_sock(sock_); oe_errno = 0; void* buf = NULL; size_t buf_size = 0; size_t data_size = 0; oe_socklen_t namelen_out = 0; size_t controllen_out = 0; /...
vuln
Safe
Unknown
static int theora_decode_tables(AVCodecContext *avctx, GetBitContext *gb) { Vp3DecodeContext *s = avctx->priv_data; int i, n, matrices, inter, plane; if (s->theora >= 0x030200) { n = get_bits(gb, 3); if (n) { for (i = 0; i < 64; i++) { s->filter_limit_values[i] =...
vuln
Vulnerable
C/C++
# Copyright 2022, Kay Hayen, mailto:kay.hayen@gmail.com # # Part of "Nuitka", an optimizing Python compiler that is compatible and # integrates with CPython, but also works on its own. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in complianc...
vuln
Vulnerable
Python
static int ovl_rename2(struct inode *olddir, struct dentry *old, struct inode *newdir, struct dentry *new, unsigned int flags) { int err; enum ovl_path_type old_type; enum ovl_path_type new_type; struct dentry *old_upperdir; struct dentry *new_upperdir; struct dentry *olddentry; struct dentry *...
vuln
Safe
C/C++
from __future__ import print_function import json import sys import errno import argparse import os import pipes import pprint import re import shlex import subprocess import shutil import bz2 import io from distutils.version import StrictVersion # If not run from node/, cd to node/. os.chdir(os.path.dirname(__file_...
vuln
Vulnerable
JavaScript
int BIO_vprintf(BIO *bio, const char *format, va_list args) { int ret; size_t retlen; char hugebuf[1024 * 2]; /* Was previously 10k, which is unreasonable * in small-stack environments, like threads * or DOS programs. */ char *hugebuf...
vuln
Vulnerable
Unknown
/* * This file is part of the KeepKey project. * * Copyright (C) 2015 KeepKey LLC * * This library 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 3 of the License, or * (at your ...
vuln
Vulnerable
C/C++
xmlBufCreateSize(size_t size) { xmlBufPtr ret; ret = (xmlBufPtr) xmlMalloc(sizeof(xmlBuf)); if (ret == NULL) { xmlBufMemoryError(NULL, "creating buffer"); return(NULL); } ret->use = 0; ret->error = 0; ret->buffer = NULL; ret->alloc = xmlBufferAllocScheme; ret->size = (size ...
vuln
Vulnerable
Unknown
@Override public default void rotate(EntityPlayer player, ItemStack stack, Rotation rotation, boolean client) { LittlePreviews previews = getLittlePreview(stack, false); if (previews == null || previews.isEmpty()) return; previews.rotatePreviews(rotation, previews.getContext().ro...
vuln
Safe
Java
def get_user_contributions(project_id: int) -> ProjectContributionsDTO: """ Get all user contributions on a project""" contrib_query = '''select m.mapped_by, m.username, m.mapped, v.validated_by, v.username, v.validated from (select t.mapped_by, u.username, count(t.mapped_by...
vuln
Vulnerable
Python
package com.salesmanager.core.business.services.common.generic; import java.io.Serializable; import java.lang.reflect.ParameterizedType; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import com.salesmanager.core.business.exception.ServiceException; import com.salesmanager.core....
vuln
Safe
Java
pkinit_check_kdc_pkid(krb5_context context, pkinit_plg_crypto_context plg_cryptoctx, pkinit_req_crypto_context req_cryptoctx, pkinit_identity_crypto_context id_cryptoctx, unsigned char *pdid_buf, unsigned int p...
vuln
Safe
C/C++
static int svq1_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data) { SVQ1Context * const s = avctx->priv_data; AVFrame *pict = data; AVFrame * const p= (AVFrame*)&s->picture; AVFrame temp; int i; if(avctx->pix_fmt != PIX_FMT_YUV410P){ av_log(avctx, AV_L...
vuln
Safe
C/C++
LoggerContext getLoggerContext(final ClassLoader classLoader) { LoggerContext ctx; final int key = computeKey(classLoader); // If possible, avoid using Guava cache since the callable puts unwanted pressure on the garbage collector. ctx = builtContexts.get(key); if (ctx == null) { synchronized ...
vuln
Safe
Java
char *ldb_dn_escape_value(TALLOC_CTX *mem_ctx, struct ldb_val value) { char *dst; size_t len; if (!value.length) return NULL; /* allocate destination string, it will be at most 3 times the source */ dst = talloc_array(mem_ctx, char, value.length * 3 + 1); if ( ! dst) { tal...
vuln
Safe
C/C++
/* linenoise.c -- guerrilla line editing library against the idea that a * * Copyright (c) 2010, Salvatore Sanfilippo <antirez at gmail dot com> * Copyright (c) 2010, Pieter Noordhuis <pcnoordhuis at gmail dot com> * * All rights reserved. * * Redistribution and use in source and binary forms, with or without *...
vuln
Safe
C/C++
cmsFloat64Number ParseFloatNumber(const char *Buffer) { cmsFloat64Number dnum = 0.0; int sign = 1; if (*Buffer == '-' || *Buffer == '+') { sign = (*Buffer == '-') ? -1 : 1; Buffer++; } while (*Buffer && isdigit((int) *Buffer)) { dnum = dnum * 10.0 + (*Buffer - '0'); ...
vuln
Vulnerable
Unknown
int lj_debug_getinfo(lua_State *L, const char *what, lj_Debug *ar, int ext) { int opt_f = 0, opt_L = 0; TValue *frame = NULL; TValue *nextframe = NULL; GCfunc *fn; if (*what == '>') { TValue *func = L->top - 1; api_check(L, tvisfunc(func)); fn = funcV(func); L->top--; what++; } else { ...
vuln
Vulnerable
C/C++
@Override public void removePermissions(Properties pageProperties) { for (String key : getApiExtensionResourcesPermissionsMapping(pageProperties).keySet()) { resourcesPermissionsMapping.removeProperty(key); } compoundPermissionsMapping.removeProperty(pageProperties.getProperty(Pa...
vuln
Vulnerable
Java
/* * GPAC - Multimedia Framework C SDK * * Authors: Jean Le Feuvre * Copyright (c) Telecom ParisTech 2000-2021 * All rights reserved * * This file is part of GPAC / ISO Media File Format sub-project * * GPAC is free software; you can redistribute it and/or modify * it under the terms of the GNU ...
vuln
Vulnerable
C/C++
static void ehci_advance_state(EHCIState *ehci, int async) { EHCIQueue *q = NULL; int again; int iter = 0; do { if (ehci_get_state(ehci, async) == EST_FETCHQH) { iter++; assert(iter < MAX_ITERATIONS); #if 0 if (iter ...
vuln
Vulnerable
C/C++
int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) { int i; Picture *pic; s->mb_skipped = 0; assert(s->last_picture_ptr==NULL || s->out_format != FMT_H264 || s->codec_id == CODEC_ID_SVQ3); if (s->pict_type != AV_PICTURE_TYPE_B && s->last_picture_ptr && s->last_picture_ptr != s->next_...
vuln
Safe
C/C++
public double executeTask(double time, double efficiency) { double remainingTime = 0D; if (currentTask != null) { // For effort driven task, reduce the effective time based on efficiency. if (efficiency < .1D) { efficiency = .1D; } if (currentTask.isEffortDriven()) { time *= efficiency; }...
vuln
Vulnerable
Java
public static void loadConfig() { JsonElement jsonElement = Configuration.config.get("BloomBlock"); if (jsonElement.isJsonArray()) { JsonArray bloomBlocks = jsonElement.getAsJsonArray(); for (JsonElement block : bloomBlocks) { JsonObject jsonObj = block.getAsJsonO...
vuln
Vulnerable
Java
static int dv_extract_audio(uint8_t* frame, uint8_t* ppcm[4], const DVprofile *sys) { int size, chan, i, j, d, of, smpls, freq, quant, half_ch; uint16_t lc, rc; const uint8_t* as_pack; uint8_t *pcm, ipcm; as_pack = dv_extract_pack(frame, dv_audio_source); if (!as_pack...
vuln
Safe
C/C++
PHP_FUNCTION(file_put_contents) { php_stream *stream; char *filename; int filename_len; zval *data; int numbytes = 0; long flags = 0; zval *zcontext = NULL; php_stream_context *context = NULL; php_stream *srcstream = NULL; char mode[3] = "wb"; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/|lr!", ...
vuln
Safe
Unknown
SPL_METHOD(SplObjectStorage, unserialize) { spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(getThis()); char *buf; size_t buf_len; const unsigned char *p, *s; php_unserialize_data_t var_hash; zval entry, inf; zval *pcount, *pmembers; spl_SplObjectStorageElement *element; zend_long count; if (zend_parse_par...
vuln
Safe
C/C++
static int bgp_capability_software_version(struct peer *peer, struct capability_header *hdr) { struct stream *s = BGP_INPUT(peer); char str[BGP_MAX_SOFT_VERSION + 1]; size_t end = stream_get_getp(s) + hdr->length; uint8_t len; SET_FLAG(peer->cap, PEER_CAP_SOFT_VERSION_RCV); len = stream_getc(s); if (st...
vuln
Safe
C/C++
CBINDInstallDlg::RegisterService() { SC_HANDLE hSCManager; SC_HANDLE hService; CString StartName; if (m_accountName == LOCAL_SERVICE) StartName = LOCAL_SERVICE; else StartName = ".\\" + m_accountName; /* * We need to change the service rather than create it * if the service already exists. Do nothing if ...
vuln
Safe
Unknown
int ha_myisam::repair(THD *thd, MI_CHECK &param, bool do_optimize) { int error=0; uint local_testflag=param.testflag; bool optimize_done= !do_optimize, statistics_done=0; const char *old_proc_info=thd->proc_info; char fixed_name[FN_REFLEN]; MYISAM_SHARE* share = file->s; ha_rows rows= file->state->records...
vuln
Vulnerable
C/C++
/* * card-tcos.c: Support for TCOS cards * * Copyright (C) 2011 Peter Koch <pk@opensc-project.org> * Copyright (C) 2002 g10 Code GmbH * Copyright (C) 2001 Juha Yrjölä <juha.yrjola@iki.fi> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General P...
vuln
Safe
C/C++
def _singleton_init(self, configuration = None): super(ApplicationConfiguration, self)._singleton_init() self.log = logging.getLogger('%s.%s' % (__name__, self.__class__.__name__)) self.jeos_images = { } if configuration: if not isinstance(configuration, dict): ...
vuln
Safe
Python
static int load_em86(struct linux_binprm *bprm) { char *interp, *i_name, *i_arg; struct file * file; int retval; struct elfhdr elf_ex; /* Make sure this is a Linux/Intel ELF executable... */ elf_ex = *((struct elfhdr *)bprm->buf); if (memcmp(elf_ex.e_ident, ELFMAG, SELFMAG) != 0) return -ENOEXEC; /* First...
vuln
Vulnerable
Unknown
@GuardedBy("mSessions") private void reconcileStagesLocked(String volumeUuid) { final ArraySet<File> unclaimedStages = getStagingDirsOnVolume(volumeUuid); // Ignore stages claimed by active sessions for (int i = 0; i < mSessions.size(); i++) { final PackageInstallerSession sessio...
vuln
Vulnerable
Java
protected function shouldRedirect(Request $request, Shop $shop) { return //for example: template preview, direct shop selection via url ( $request->isGet() && $request->getQuery('__shop') !== null && $request->getQuery('__shop') != $shop->getId() ...
vuln
Vulnerable
PHP
void do_connect(struct st_command *command) { int con_port= opt_port; char *con_options; my_bool con_ssl= 0, con_compress= 0; my_bool con_pipe= 0, con_shm= 0, con_cleartext_enable= 0; my_bool con_secure_auth= 1; struct st_connection* con_slot; #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) my_boo...
vuln
Safe
Unknown
/* * Copyright (c) 2009-2012, Salvatore Sanfilippo <antirez at gmail dot com> * All rights reserved. * * 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 co...
vuln
Safe
C/C++
static struct fileIdentDesc *udf_find_entry(struct inode *dir, const struct qstr *child, struct udf_fileident_bh *fibh, struct fileIdentDesc *cfi) { struct fileIdentDesc *fi = NULL; loff_t f_pos; int block, flen; unsigned char *fname = NULL; unsigned char *nameptr; uint8_t lfi; uint16_...
vuln
Safe
C/C++
#!/usr/bin/env python3 # -*-coding:UTF-8 -* """ The ZMQ_Feed_Q Module ===================== This module is consuming the Redis-list created by the ZMQ_Feed_Q Module, And save the paste on disk to allow others modules to work on them. ..todo:: Be able to choose to delete or not the saved paste after processing. ..todo...
vuln
Vulnerable
Python
static int ioreq_parse(struct ioreq *ioreq) { struct XenBlkDev *blkdev = ioreq->blkdev; uintptr_t mem; size_t len; int i; xen_be_printf(&blkdev->xendev, 3, "op %d, nr %d, handle %d, id %" PRId64 ", sector %" PRId64 "\n", ioreq->req.operation, ioreq->req.nr_segments, ioreq->req.handle, io...
vuln
Safe
C/C++
void Compute(OpKernelContext* context) override { // Here's the basic idea: // Batch and depth dimension are independent from row and col dimension. And // because FractionalAvgPool currently only support pooling along row and // col, we can basically think of this 4D tensor backpropagation as // op...
vuln
Vulnerable
C/C++
prime_stub(struct module_qstate* qstate, struct iter_qstate* iq, int id, uint8_t* qname, uint16_t qclass) { /* Lookup the stub hint. This will return null if the stub doesn't * need to be re-primed. */ struct iter_hints_stub* stub; struct delegpt* stub_dp; struct module_qstate* subq; if(!qname) return 0; stu...
vuln
Vulnerable
Unknown
private Document convert(PostDoc post) { var doc = new Document(); doc.add(new StringField("name", post.getName(), YES)); doc.add(new StoredField("title", post.getTitle())); var content = Jsoup.clean(stripToEmpty(post.getExcerpt()) + stripToEmpty(post.getContent()), Safelist...
vuln
Vulnerable
Java
static int local_create_mapped_attr_dir(FsContext *ctx, const char *path) { int err; char attr_dir[PATH_MAX]; char *tmp_path = g_strdup(path); snprintf(attr_dir, PATH_MAX, "%s/%s/%s", ctx->fs_root, dirname(tmp_path), VIRTFS_META_DIR); err = mkdir(attr_dir, 0700); if (err < 0 && errn...
vuln
Safe
C/C++
miniflow_extract(struct dp_packet *packet, struct miniflow *dst) { const struct pkt_metadata *md = &packet->md; const void *data = dp_packet_data(packet); size_t size = dp_packet_size(packet); uint64_t *values = miniflow_values(dst); struct mf_ctx mf = { FLOWMAP_EMPTY_INITIALIZER, values, ...
vuln
Safe
Unknown
void ff_get_guid(AVIOContext *s, ff_asf_guid *g) { assert(sizeof(*g) == 16); avio_read(s, *g, sizeof(*g)); }
vuln
Vulnerable
C/C++
/* * Handle git attributes. See gitattributes(5) for a description of * the file syntax, and attr.h for a description of the API. * * One basic design decision here is that we are not going to support * an insanely large number of attributes. */ #include "cache.h" #include "config.h" #include "exec-cmd.h" #incl...
vuln
Safe
C/C++
SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, unsigned long, nbytes, int __user *, start, void __user *, arg) { unsigned long w; struct percpu_struct *cpu; switch (op) { case GSI_IEEE_FP_CONTROL: /* Return current software fp control & status bits. */ /* Note that DU doesn't veri...
vuln
Safe
C/C++
create_policy_2_svc(cpol_arg *arg, struct svc_req *rqstp) { static generic_ret ret; char *prime_arg; gss_buffer_desc client_name, service_name; OM_uint32 minor_stat; kadm5_server_handle_t handle; cons...
vuln
Vulnerable
C/C++
static int audio_decode_frame(VideoState *is) { int data_size, resampled_data_size; int64_t dec_channel_layout; int got_frame = 0; av_unused double audio_clock0; int wanted_nb_samples; AVRational tb; int ret; int reconfigure; if (!is->frame) if (!(is->frame = av_frame_alloc()...
vuln
Safe
C/C++
this.disableChatSoundUser = function(inst) { if (inst.find('> i').text() == 'volume_off') { $.get(this.wwwDir+ 'user/setsettingajax/chat_message/1'); confLH.new_message_sound_user_enabled = 1; inst.find('> i').text('volume_up'); } else { $.get(this.wwwDir+ 'user/setsettingajax/ch...
vuln
Vulnerable
JavaScript
def to_python(self, data): """ Based on Django's ImageField """ f = super().to_python(data) if f is None: return None from PIL import Image # We need to get a file object for Pillow. We might have a path or we might # have to read the data in...
vuln
Safe
Python
static bool blit_region_is_unsafe(struct CirrusVGAState *s, int32_t pitch, int32_t addr) { if (pitch < 0) { int64_t min = addr + ((int64_t)s->cirrus_blt_height-1) * pitch; int32_t max = addr + s->cirrus_blt_width; if (min < 0 || max >...
vuln
Safe
C/C++
void ImageLoader::DoUpdateFromElement(BypassMainWorldBehavior bypass_behavior, UpdateFromElementBehavior update_behavior, const KURL& url, ReferrerPolicy referrer_policy, ...
vuln
Vulnerable
C/C++
checked_xmalloc (size_t size) checked_xmalloc (size_t num, size_t size) { size_t res; if (check_mul_overflow(num, size, &res)) abort(); alloc_limit_assert ("checked_xmalloc", res); return xmalloc (num, size); }
vuln
Safe
C/C++
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...
vuln
Vulnerable
PHP
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
Safe
C/C++
DLLEXPORT unsigned long tjPlaneSizeYUV(int componentID, int width, int stride, int height, int subsamp) { unsigned long long retval = 0; int pw, ph; if (width < 1 || height < 1 || subsamp < 0 || subsamp >= NUMSUBOPT) THROWG("tjPlaneSizeYUV(): Invalid argument"); pw =...
vuln
Safe
Unknown
getftp (struct url *u, wgint passed_expected_bytes, wgint *qtyread, wgint restval, ccon *con, int count, wgint *last_expected_bytes, FILE *warc_tmp) { int csock, dtsock, local_sock, res; uerr_t err = RETROK; /* appease the compiler */ FILE *fp; char *respline, *tms; const char *user, ...
vuln
Safe
Unknown
void ndpi_search_h323(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { struct ndpi_packet_struct *packet = &flow->packet; u_int16_t dport = 0, sport = 0; NDPI_LOG_DBG(ndpi_struct, "search H323\n"); /* The TPKT protocol is used by ISO 8072 (on port 102) and H.323. So t...
vuln
Safe
C/C++
"""Base Tornado handlers for the notebook server.""" # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import datetime import functools import ipaddress import json import mimetypes import os import re import sys import traceback import types import warnings from htt...
vuln
Vulnerable
Python
def instance_rules(self, instance, network_info): ctxt = context.get_admin_context() ipv4_rules = [] ipv6_rules = [] # Initialize with basic rules self._do_basic_rules(ipv4_rules, ipv6_rules, network_info) # Set up rules to allow traffic to/from DHCP server self...
vuln
Vulnerable
Python
static int GetTypeBufSize(matvar_t *matvar, size_t *size) { int err; size_t nBytes = 0, data_bytes; size_t tag_size = 8; size_t nelems = 1; size_t rank_size, field_size, field_buf_size; *size = 0; err = SafeMulDims(matvar, &nelems); if ( err ) return 1; /* Add rank and dim...
vuln
Vulnerable
C/C++
int qcow2_check_metadata_overlap(BlockDriverState *bs, int ign, int64_t offset, int64_t size) { BDRVQcowState *s = bs->opaque; int chk = s->overlap_check & ~ign; int i, j; if (!size) { return 0; } if (chk & QCOW2_OL_MAIN_HEADER) { if (offset < s->...
vuln
Vulnerable
C/C++
import { mapGetters } from 'vuex'; import { isValidURL } from '../helper/URLHelper'; export default { computed: { ...mapGetters({ currentChat: 'getSelectedChat', accountId: 'getCurrentAccountId', }), attributes() { return this.$store.getters['attributes/getAttributesByModel']( th...
vuln
Safe
JavaScript
// issues: nested multiline comments Prism.languages.swift = Prism.languages.extend('clike', { 'string': { pattern: /("|')(?:\\(?:\((?:[^()]|\([^)]+\))+\)|\r\n|[^(])|(?!\1)[^\\\r\n])*\1/, greedy: true, inside: { 'interpolation': { pattern: /\\\((?:[^()]|\([^)]+\))+\)/, inside: { delimiter: { ...
vuln
Safe
JavaScript
private static void logMethod(Method method) throws Throwable { XposedBridge.hookMethod(method, new XC_MethodHook() { @Override protected void beforeHookedMethod(MethodHookParam param) { if (param.getResult() == null) return; XposedBridge.log(method.getNam...
vuln
Vulnerable
Java
@Bean @ConditionalOnMissingBean AzureTokenCredentialResolver azureTokenCredentialResolver( ClientSecretCredentialBuilderFactory clientSecretCredentialBuilderFactory, ClientCertificateCredentialBuilderFactory clientCertificateCredentialBuilderFactory, UsernamePasswordCredentialBuilderFact...
vuln
Vulnerable
Java
int setpwnam(struct passwd *pwd) { FILE *fp = NULL, *pwf = NULL; int save_errno; int found; int namelen; int buflen = 256; int contlen, rc; char *linebuf = NULL; char *tmpname = NULL; char *atomic_dir = "/etc"; pw_init(); if ((fp = xfmkstemp(&tmpname, atomic_dir)) == NULL) return -1; /* ptmp should be ...
vuln
Vulnerable
C/C++
int tcpedit_dlt_l2len(tcpeditdlt_t *ctx, int dlt, const u_char *packet, const int pktlen) { tcpeditdlt_plugin_t *plugin; assert(ctx); assert(dlt >= 0); assert(packet); if ((plugin = tcpedit_dlt_getplugin(ctx, dlt)) == NULL) { tcpedit_seterr(ctx->tcpedit, "Unable to find plugin for DLT 0...
vuln
Vulnerable
C/C++
StyleItem[] merge (long items, int itemCount) { if (styles.length > stylesCount) { StyleItem[] newStyles = new StyleItem[stylesCount]; System.arraycopy(styles, 0, newStyles, 0, stylesCount); styles = newStyles; } final int end = segmentsText.length(); int start = 0, itemIndex = 0, styleIndex = 0; /* * Maxi...
vuln
Safe
Java
static int fts3AllocateSegdirIdx( Fts3Table *p, int iLangid, /* Language id */ int iIndex, /* Index for p->aIndex */ int iLevel, int *piIdx ){ int rc; /* Return Code */ sqlite3_stmt *pNextIdx; /* Query for next idx at level iLevel */...
vuln
Vulnerable
Unknown
$parent = $dIF->getItemFromDb($item->getParentId()); $content .= '<tr>'; $content .= '<td>' . '<a href="/plugins/docman/?group_id=' . $params['group_id'] . '&action=details&id=' . $item->getId() . '">' . $item->getTitle() . '</a></td>'; $content .= '<td>'; ...
vuln
Vulnerable
PHP
private void setupParserListener(MultiSourceReader multiSourceReader, GraphqlParser parser, GraphqlAntlrToLanguage toLanguage) { int maxTokens = toLanguage.getParserOptions().getMaxTokens(); // prevent a billion laugh attacks by restricting how many tokens we allow ParseTreeListener listener = n...
vuln
Safe
Java
_asn1_get_objectid_der (const unsigned char *der, int der_len, int *ret_len, char *str, int str_size) { int len_len, len, k; int leading; char temp[20]; unsigned long val, val1; *ret_len = 0; if (str && str_size > 0) str[0] = 0; /* no oid */ if (str == NULL || der_len <= 0) return ASN1_GENE...
vuln
Safe
Unknown
/* * 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
Vulnerable
Java
@POST @Path("/namespaces/{namespace-id}/artifacts/{artifact-name}") @AuditPolicy(AuditDetail.HEADERS) public BodyConsumer addArtifact(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") final String namespaceId, @PathParam("a...
vuln
Vulnerable
Java
def getSubmissionDateFromDatabase(submission): database = sqlite3.connect('database.db') cursor = database.cursor() return cursor.execute("SELECT Date FROM ChallengeRankings WHERE SubmissionID = ?", [str(submission.id)]).fetchone()[0] database.close()
vuln
Safe
Python
static struct mnt_namespace *create_mnt_ns(struct vfsmount *m) { struct mnt_namespace *new_ns = alloc_mnt_ns(&init_user_ns); if (!IS_ERR(new_ns)) { struct mount *mnt = real_mount(m); mnt->mnt_ns = new_ns; new_ns->root = mnt; new_ns->mounts++; list_add(&mnt->mnt_list, &new_ns->list); } else { mntput(m); ...
vuln
Safe
Unknown
int nfc_llcp_send_connect(struct nfc_llcp_sock *sock) { struct nfc_llcp_local *local; struct sk_buff *skb; u8 *service_name_tlv = NULL, service_name_tlv_length; u8 *miux_tlv = NULL, miux_tlv_length; u8 *rw_tlv = NULL, rw_tlv_length, rw; int err; u16 size = 0; __be16 miux; pr_debug("Sending CONNECT\n"); loca...
vuln
Safe
C/C++
package fleet const ( // ActionRead refers to reading an entity. ActionRead = "read" // ActionList refers to listing an entity. ActionList = "list" // ActionWrite refers to writing (CRUD operations) an entity. ActionWrite = "write" // ActionWriteRole is a write to a user's global roles and teams. ActionWriteRo...
vuln
Vulnerable
Go
struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, const u8 *addr, gfp_t gfp) { struct ieee80211_local *local = sdata->local; struct sta_info *sta; struct timespec uptime; struct ieee80211_tx_latency_bin_ranges *tx_latency; int i; sta = kzalloc(sizeof(*sta) + local->hw.sta_data_size, gfp); ...
vuln
Safe
C/C++
@Override public PacketContext handle(BeeconChangePacket message) { return (player, level) -> { if (level.isLoaded(message.pos())){ BlockEntity tileEntity = level.getBlockEntity(message.pos()); if (tileEntity instanceof EnderBeeconBlockEntity b...
vuln
Vulnerable
Java
static int __init acpi_custom_method_init(void)
vuln
Safe
C/C++
static int qcow2_do_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVQcow2State *s = bs->opaque; unsigned int len, i; int ret = 0; QCowHeader header; Error *local_err = NULL; uint64_t ext_end; uint64_t l1_vm_state_index; ret = bdrv_pread(...
vuln
Safe
C/C++
SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops, unsigned, nsops, const struct timespec __user *, timeout) { int error = -EINVAL; struct sem_array *sma; struct sembuf fast_sops[SEMOPM_FAST]; struct sembuf* sops = fast_sops, *sop; struct sem_undo *un; int undos = 0, alter = 0, max, locknum;...
vuln
Safe
C/C++