code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
static int64_t scene_sad8(FrameRateContext *s, uint8_t *p1, int p1_linesize, uint8_t* p2, int p2_linesize, const int width, const int height) { int64_t sad; int x, y; for (sad = y = 0; y < height - 7; y += 8) { for (x = 0; x < width - 7; x += 8) { sad += s->sad(p1 + y * p1_linesize + x, ...
vuln
Safe
C/C++
static void fpm_child_resources_use(struct fpm_child_s *child) /* {{{ */ { struct fpm_worker_pool_s *wp; for (wp = fpm_worker_all_pools; wp; wp = wp->next) { if (wp == child->wp || wp == child->wp->shared) { continue; } fpm_scoreboard_free(wp); } fpm_scoreboard_child_use(child, getpid()); fpm_stdio_child...
vuln
Safe
Unknown
@Packet public void onFlying(WrappedInFlyingPacket packet, long timeStamp) { if(packet.isPos() && (data.playerInfo.deltaXZ > 0 || data.playerInfo.deltaY != 0)) { //We check if the player is in ground, since theoretically the y should be zero. double lDeltaY = data.playerInfo.lClientG...
vuln
Vulnerable
Java
static int img_compare(int argc, char **argv) { const char *fmt1 = NULL, *fmt2 = NULL, *cache, *filename1, *filename2; BlockBackend *blk1, *blk2; BlockDriverState *bs1, *bs2; int64_t total_sectors1, total_sectors2; uint8_t *buf1 = NULL, *buf2 = NULL; int pnum1, pnum2; int allocated1, allocat...
vuln
Vulnerable
C/C++
function inetChecksite(url, callback) { return new Promise((resolve) => { process.nextTick(() => { let result = { url: url, ok: false, status: 404, ms: null }; if (typeof url !== 'string') { if (callback) { callback(result); } return resolve(resul...
vuln
Safe
JavaScript
TEE_Result syscall_hash_update(unsigned long state, const void *chunk, size_t chunk_size) { TEE_Result res; struct tee_cryp_state *cs; struct tee_ta_session *sess; /* No data, but size provided isn't valid parameters. */ if (!chunk && chunk_size) return TEE_ERROR_BAD_PARAMETERS; /* Zero length hash is vali...
vuln
Safe
Unknown
static int ahci_dma_set_inactive(IDEDMA *dma) { AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma); DPRINTF(ad->port_no, "dma done\n"); ahci_write_fis_d2h(ad, NULL); ad->dma_cb = NULL; if (!ad->check_bh) { ad->check_bh = qemu_bh_new(ahci_check_cmd_bh, ad); qemu_bh_schedul...
vuln
Safe
C/C++
xfs_set_acl(struct inode *inode, struct posix_acl *acl, int type) { int error = 0; if (!acl) goto set_acl; error = -E2BIG; if (acl->a_count > XFS_ACL_MAX_ENTRIES(XFS_M(inode->i_sb))) return error; if (type == ACL_TYPE_ACCESS) { umode_t mode = inode->i_mode; error = posix_acl_equiv_mode(acl, &mode); i...
vuln
Vulnerable
C/C++
httpSpecialClientSideHandler(int status, FdEventHandlerPtr event, StreamRequestPtr srequest) { HTTPConnectionPtr connection = srequest->data; HTTPRequestPtr request = connection->request; int push; if((request->object->flags & OBJECT_ABORTED) ||...
vuln
Vulnerable
Unknown
package org.yaxim.androidclient.service; import java.io.File; import java.text.Collator; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.uti...
vuln
Safe
Java
public static File createTempDir(int port) throws IOException { File tempDir = Files.createTempDirectory("portofino.tomcat." + "." + port).toFile(); tempDir.deleteOnExit(); return tempDir; }
vuln
Safe
Java
char *auth_server(int f_in, int f_out, int module, const char *host, const char *addr, const char *leader) { char *users = lp_auth_users(module); char challenge[MAX_DIGEST_LEN*2]; char line[BIGPATHBUFLEN]; char **auth_uid_groups = NULL; int auth_uid_groups_cnt = -1; const char *err = NULL; int group_match = ...
vuln
Vulnerable
Unknown
private void distributeFluid(int channel, FluidTank tank, FluidStack fluid) { // Tank, From, Amount to receive List<MutableTriple<IFluidHandler, IFluidHandler, Integer>> tanks = new ArrayList<>(); int amount = fluid.amount; FluidStack maxFluid = fluid.copy(); double availableCap...
vuln
Vulnerable
Java
tt_cmap14_validate( FT_Byte* table, FT_Validator valid ) { FT_Byte* p; FT_ULong length; FT_ULong num_selectors; if ( table + 2 + 4 + 4 > valid->limit ) FT_INVALID_TOO_SHORT; p = table + 2; length = TT_NEXT_ULONG( p ); num_selectors...
vuln
Vulnerable
Unknown
public void onSetMobileIcon(int viewIndex, MobileIconState state) { View view = mGroup.getChildAt(viewIndex); if (view instanceof StatusBarMobileView) { ((StatusBarMobileView) view).applyMobileState(state); } else { return; } i...
vuln
Safe
Java
static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file, QDict *options, int flags, BlockDriver *drv, Error **errp) { int ret, open_flags; const char *filename; Error *local_err = NULL; assert(drv != NULL); assert(bs->file == NULL); assert(options != NULL && bs->options != o...
vuln
Safe
C/C++
QPDFAnnotationObjectHelper::getFlags() { QPDFObjectHandle flags_obj = this->oh.getKey("/F"); return flags_obj.isInteger() ? flags_obj.getIntValue() : 0; }
vuln
Vulnerable
Unknown
/*! Copyright (c) REBUILD <https://getrebuild.com/> and/or its owners. All rights reserved. rebuild is dual-licensed under commercial and open source licenses (GPLv3). See LICENSE and COMMERCIAL in the project root for license information. */ package com.rebuild.web.project; import cn.devezhao.commons.CalendarUtils;...
vuln
Vulnerable
Java
pipe_write(struct kiocb *iocb, const struct iovec *_iov, pipe_write(struct kiocb *iocb, struct iov_iter *from) { struct file *filp = iocb->ki_filp; struct pipe_inode_info *pipe = filp->private_data; ssize_t ret = 0; int do_wakeup = 0; size_t total_len = iov_iter_count(from); ssize_t chars; /* Null write s...
vuln
Safe
C/C++
static void co_schedule_bh_cb(void *opaque) { AioContext *ctx = opaque; QSLIST_HEAD(, Coroutine) straight, reversed; QSLIST_MOVE_ATOMIC(&reversed, &ctx->scheduled_coroutines); QSLIST_INIT(&straight); while (!QSLIST_EMPTY(&reversed)) { Coroutine *co = QSLIST_FIRST(&reversed); QSLIST_R...
vuln
Safe
C/C++
/* * Copyright (c) 2010 Aurelien Jacobs <aurel@gnuage.org> * * 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 Free Software Foundation; either * version 2.1 of the License, or (a...
vuln
Safe
C/C++
# -*- coding: utf-8 -*- # rdiffweb, A web interface to rdiff-backup repositories # Copyright (C) 2012-2021 rdiffweb contributors # # 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 ...
vuln
Safe
Python
void Compute(OpKernelContext* ctx) override { const Tensor& sorted_inputs_t = ctx->input(0); const Tensor& values_t = ctx->input(1); // must have same batch dim_size for both OP_REQUIRES(ctx, sorted_inputs_t.dim_size(0) == values_t.dim_size(0), Status(error::INVALID_ARGUMENT, ...
vuln
Vulnerable
Unknown
@Override public void transform(Deobfuscator deobfuscator) throws Exception { deobfuscator.classes().stream() .filter(classNode -> classNode.superName.equals("java/lang/ClassLoader")) .filter(classNode -> classNode.fields != null) .filter(classNode -> !classNo...
vuln
Safe
Java
public final synchronized void close() throws SQLException { // finalize any remaining statements before closing db synchronized (stmts) { Iterator<Map.Entry<Long, CoreStatement>> i = stmts.entrySet().iterator(); while (i.hasNext()) { Map.Entry<Long, CoreStatement...
vuln
Vulnerable
Java
void eb_mul_halve(eb_t r, const eb_t p, const bn_t k) { int i, j, l, trc, cof; int8_t naf[RLC_FB_BITS + 1], *_k; eb_t q, s, t[1 << (EB_WIDTH - 2)]; bn_t n, m; fb_t u, v, w, z; if (bn_is_zero(k) || eb_is_infty(p)) { eb_set_infty(r); return; } bn_null(m); bn_null(n); eb_null(q); eb_null(s); for (i = 0; ...
vuln
Vulnerable
C/C++
glue(cirrus_bitblt_rop_fwd_, ROP_NAME)(CirrusVGAState *s, uint8_t *dst,const uint8_t *src, int dstpitch,int srcpitch, int bltwidth,int bltheight) { int x,y; dstpitch -= bltwidth; srcpitch -= bltwidth; if (dstpitch < ...
vuln
Safe
Unknown
finished_read (void *vp, int *error) { struct command *command = vp; if (*error) { fprintf (stderr, "read at offset %" PRId64 " failed: %s\n", command->offset, strerror (*error)); exit (EXIT_FAILURE); } if (allocated || sparse_size == 0) { /* If sparseness detection (see below) is tur...
vuln
Safe
Unknown
bgp_update_print(netdissect_options *ndo, const u_char *dat, int length) { struct bgp bgp; const u_char *p; int withdrawn_routes_len; int len; int i; ND_TCHECK2(dat[0], BGP_SIZE); if (length < BGP_SIZE) goto trunc; memcpy(&bgp, dat, BGP_SIZE); p = dat + BGP_SIZE; /*XXX*/ length -= BGP_SIZE...
vuln
Safe
Unknown
def present(name, uid=None, gid=None, gid_from_name=False, groups=None, optional_groups=None, remove_groups=True, home=None, createhome=True, password=None, enforce_password=True, empty_pa...
vuln
Safe
Python
public void testWhereWithNotLikeFunction() { Entity from = from(Entity.class); where(lower(from.getCode())).notLike("%test%"); Query<Entity> select = select(from); assertEquals("select entity_0 from Entity entity_0 where lower(entity_0.code) not like :function_1", select.getQuery()); assertEquals("%test%", se...
vuln
Safe
Java
PHP_METHOD(Phar, offsetGet) { char *fname, *error; size_t fname_len; zval zfname; phar_entry_info *entry; zend_string *sfname; PHAR_ARCHIVE_OBJECT(); if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &fname, &fname_len) == FAILURE) { return; } /* security is 0 here so that we can get a better error message t...
vuln
Safe
Unknown
@Override public long archiveFolder(long folderId, String comment) throws ServerException { Session session = validateSession(getThreadLocalRequest()); DocumentManager manager = (DocumentManager) Context.get().getBean(DocumentManager.class); DocumentHistory transaction = new DocumentHistory(); transaction.set...
vuln
Vulnerable
Java
/* * Copyright (C) 2014-2016 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT A...
vuln
Safe
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...
vuln
Safe
Java
const got = require('@/utils/got'); const cheerio = require('cheerio'); const self = { _getProfile: async (ctx) => { const key = 'gouhuo-profile'; let profile = await ctx.cache.get(key); if (!profile) { const response = await got({ method: 'get', ...
vuln
Vulnerable
JavaScript
/** * Copyright (c) 2006-2020, JGraph Ltd * Copyright (c) 2006-2020, draw.io AG */ (function() { // Adds scrollbars for menus that exceed the page height var mxPopupMenuShowMenu = mxPopupMenu.prototype.showMenu; mxPopupMenu.prototype.showMenu = function() { this.div.style.overflowY = 'auto'; this.div.style.o...
vuln
Safe
Java
MemTxResult address_space_read_continue(AddressSpace *as, hwaddr addr, MemTxAttrs attrs, uint8_t *buf, int len, hwaddr addr1, hwaddr l, MemoryRegion *mr) { uint8_t *ptr; uint64_t val; MemT...
vuln
Vulnerable
Unknown
int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){ int i; int w= s->width; int h= s->height; InternalBuffer *buf; int *picture_number; if(pic->data[0]!=NULL) { av_log(s, AV_LOG_ERROR, "pic->data[0]!=NULL in avcodec_default_get_buffer\n"); return -1; } if(s->...
vuln
Safe
C/C++
def get_recipe_from_file(self, file): recipe_xml = file recipe = Recipe.objects.create( name=recipe_xml.find('title').text.strip(), created_by=self.request.user, internal=True, space=self.request.space) if recipe_xml.find('preptime') is not None and recipe_xml.find('pre...
vuln
Vulnerable
Python
_makeHeader(name) { let div = document.createElement('div'); div.className = 'vis-configuration vis-config-header'; div.innerHTML = name; this._makeItem([],div); }
vuln
Vulnerable
JavaScript
from pypika import Parameter, functions from pypika.enums import SqlTypes from pypika.terms import Criterion from tortoise import Model from tortoise.backends.base.executor import BaseExecutor from tortoise.fields import BigIntField, Field, IntField, SmallIntField from tortoise.filters import ( contains, ends_...
vuln
Vulnerable
Python
check_compat_entry_size_and_hooks(struct compat_ipt_entry *e, struct xt_table_info *newinfo, unsigned int *size, const unsigned char *base, const unsigned char *limit, const unsigned int *hook_entries, const unsigned int *underflows, const char *name) { struct xt_entry_match *...
vuln
Safe
C/C++
def add_acl_role(auth_user, name, description) cmd = [PCS, "acl", "role", "create", name.to_s] if description.to_s != "" cmd << "description=#{description.to_s}" end stdout, stderror, retval = run_cmd(auth_user, *cmd) if retval != 0 return stderror.join("\n").strip end return "" end
vuln
Safe
Ruby
static void property_get_bool(Object *obj, Visitor *v, void *opaque, const char *name, Error **errp) { BoolProperty *prop = opaque; bool value; value = prop->get(obj, errp); visit_type_bool(v, &value, name, errp); }
vuln
Vulnerable
C/C++
public void init() { category.add(enabled, showTime, showActivity); AxolotlClient.CONFIG.addCategory(category); if(OSUtil.getOS() == OSUtil.OperatingSystem.OTHER){ enabled.setForceOff(true, DisableReason.CRASH); } }
vuln
Safe
Java
static cmd_rec *make_ftp_cmd(pool *p, char *buf, size_t buflen, int flags) { register unsigned int i, j; char *arg, *ptr, *wrd; size_t arg_len; cmd_rec *cmd; pool *subpool; array_header *tarr; int have_crnul = FALSE, str_flags = PR_STR_FL_PRESERVE_COMMENTS|flags; /* Be pedantic (and RFC-compliant) by n...
vuln
Safe
C/C++
static void write_picture(AVFormatContext *s, int index, AVPicture *picture, int pix_fmt, int w, int h) { UINT8 *buf, *src, *dest; int size, j, i; size = avpicture_get_size(pix_fmt, w, h); buf = malloc(size); if (!buf) return; switch(pix_fmt) { case PI...
vuln
Vulnerable
C/C++
ast_for_arguments(struct compiling *c, const node *n) { /* This function handles both typedargslist (function definition) and varargslist (lambda definition). parameters: '(' [typedargslist] ')' typedargslist: (tfpdef ['=' test] (',' tfpdef ['=' test])* [',' [ '*' [tfpdef] (',' ...
vuln
Vulnerable
C/C++
static int arm_gic_common_init(SysBusDevice *dev) { GICState *s = FROM_SYSBUS(GICState, dev); int num_irq = s->num_irq; if (s->num_cpu > NCPU) { hw_error("requested %u CPUs exceeds GIC maximum %d\n", s->num_cpu, NCPU); } s->num_irq += GIC_BASE_IRQ; if (s->num_irq > GIC_M...
vuln
Vulnerable
C/C++
public void updateBuildLogic(){ if(type.buildSpeed <= 0f) return; if(!headless){ //visual activity update if(lastActive != null && buildAlpha <= 0.01f){ lastActive = null; } buildAlpha = Mathf.lerpDelta(buildAlpha, activelyBuilding() ? 1f...
vuln
Vulnerable
Java
/* * The MIT License * * Copyright 2010 Sony Ericsson Mobile Communications. All rights reserved. * Copyright 2013 Sony Mobile Communications AB. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "...
vuln
Safe
Java
import copy import logging from functools import wraps from typing import Dict, Sequence from django.core.cache import caches from django.http import HttpRequest, JsonResponse from django.http.response import HttpResponseNotModified from django.utils.safestring import mark_safe from django.views.decorators.csrf import...
vuln
Safe
Python
status_t MyOpusExtractor::readNextPacket(MediaBuffer **out) { if (mOffset <= mFirstDataOffset && mStartGranulePosition < 0) { MediaBuffer *mBuf; uint32_t numSamples = 0; uint64_t curGranulePosition = 0; while (true) { status_t err = _readNextPacket(&mBuf, /* calcVorbisTimestamp = */false); if (err != OK && err !...
vuln
Safe
C/C++
/* radare - LGPL - Copyright 2010-2018 - nibble, pancake */ #include <stdio.h> #include <r_types.h> #include <r_util.h> #include "dyldcache.h" static int r_bin_dyldcache_init(struct r_bin_dyldcache_obj_t* bin) { int len = r_buf_fread_at (bin->b, 0, (ut8*)&bin->hdr, "16c4i7l", 1); if (len == -1) { perror ("read (...
vuln
Safe
C/C++
public void setProperties(ConfigurationBeanLoader loader, Collection<PropertyStatement> propertyStatements) throws PropertyTypeException, ConfigurationBeanLoaderException { for (PropertyStatement ps : propertyStatements) { PropertyMethod pm = propertyMethods.get(ps.getPredicateUri()); if (pm == null) { ...
vuln
Safe
Java
function setGuestLobbyMessage(message) { try { check(message, String); const { meetingId, requesterUserId } = extractCredentials(this.userId); check(meetingId, String); check(requesterUserId, String); const payload = { message }; Logger.info(`User=${requesterUserId} set guest lobby message...
vuln
Vulnerable
JavaScript
/* * . .o8 oooo * .o8 "888 `888 * .o888oo oooo d8b oooo oooo .oooo888 .ooooo. .oooo.o 888 oooo * 888 `888""8P `888 `888 d88' `888 d88' `88b d88( "8 888 .8P' * 888 888 888 888 8...
vuln
Safe
JavaScript
@SubscribeEvent public void onRender2D(RenderGameOverlayEvent.Pre.Text e) { IBlockState blockState = getLookingAtBlockState(); if (blockState == null) { return; } Helper2D.startScale(getX(), getY(), getSize()); if (Cloud.INSTANCE.modManager.getMod(getName()).isTo...
vuln
Vulnerable
Java
@Override public void debug( CharSequence content ) { if ( getLogger().isDebugEnabled() ) { getLogger().debug(toString(content)); } }
vuln
Safe
Java
IDNSpoofChecker::IDNSpoofChecker() { UErrorCode status = U_ZERO_ERROR; checker_ = uspoof_open(&status); if (U_FAILURE(status)) { checker_ = nullptr; return; } uspoof_setRestrictionLevel(checker_, USPOOF_HIGHLY_RESTRICTIVE); SetAllowedUnicodeSet(&status); int32_t checks = uspoof_getChecks(check...
vuln
Vulnerable
C/C++
public boolean invalidateMediaContent (ComplexReceiver textMediaReceiver, @Nullable TextMedia specificMedia) { if (BitwiseUtils.getFlag(textFlags, FLAG_DESTROYED)) { return false; } if (specificMedia == null) { // Force parent to call requestMedia() instead return false; } final in...
vuln
Safe
Java
@Override public void scan(boolean directionDown, boolean skipSubChannel) throws RemoteException { mLogger.logRadioEvent("Scan with direction %s, skipSubChannel? %s", directionDown ? "down" : "up", skipSubChannel ? "yes" : "no"); synchronized (mLock) { checkNotClosedLocke...
vuln
Vulnerable
Java
/* +----------------------------------------------------------------------+ | HipHop for PHP | +----------------------------------------------------------------------+ | Copyright (c) 2010-2016 Facebook, Inc. (http://www.facebook.com) | | Copyrigh...
vuln
Vulnerable
C/C++
static int do_remount(struct path *path, int flags, int mnt_flags, void *data) { int err; struct super_block *sb = path->mnt->mnt_sb; struct mount *mnt = real_mount(path->mnt); if (!check_mnt(mnt)) return -EINVAL; if (path->dentry != path->mnt->mnt_root) return -EINVAL; /* Don't allow changing of l...
vuln
Safe
C/C++
private boolean supportsSoftButtonImages() { if (currentWindowCapability == null || currentWindowCapability.getSoftButtonCapabilities() == null || currentWindowCapability.getSoftButtonCapabilities().size() == 0 || currentWindowCapability.getSoftButtonCapabilities().get(0) == ...
vuln
Safe
Java
static av_cold int roq_encode_init(AVCodecContext *avctx) { RoqContext *enc = avctx->priv_data; av_lfg_init(&enc->randctx, 1); enc->framesSinceKeyframe = 0; if ((avctx->width & 0xf) || (avctx->height & 0xf)) { av_log(avctx, AV_LOG_ERROR, "Dimensions must be divisible by 16\n"); return AV...
vuln
Safe
C/C++
input.keypress(function(event) { if(event.keyCode == 13) { event.preventDefault(); event.stopPropagation(); var li=$(this).parent(); $(this).remove(); li.text('+ '+settings.createText); li.before(createItem(this)); var select=button.parent().next(); var opti...
vuln
Safe
JavaScript
function j(a){var b,c=[],d=a.blocks;for(b in d)Object.prototype.hasOwnProperty.call(d,b)&&c.push('"'+b+'":'+d[b]);return c.length?(a.blocks="ctx=ctx.shiftBlocks(blocks);","var blocks={"+c.join(",")+"};"):(a.blocks="",a.blocks)}
vuln
Safe
JavaScript
func parseObject(c *parseContext, i int, path string) (int, bool) { var pmatch, kesc, vesc, ok, hit bool var key, val string rp := parseObjectPath(path) if !rp.more && rp.piped { c.pipe = rp.pipe c.piped = true } for i < len(c.json) { for ; i < len(c.json); i++ { if c.json[i] == '"' { // parse_key_st...
vuln
Safe
Go
BdrvDirtyBitmap *bdrv_create_dirty_bitmap(BlockDriverState *bs, int granularity) { int64_t bitmap_size; BdrvDirtyBitmap *bitmap; assert((granularity & (granularity - 1)) == 0); granularity >>= BDRV_SECTOR_BITS; assert(granularity); bitmap_size = (bdrv_getlength(bs) >> BDRV_SECTOR_BITS); bitm...
vuln
Vulnerable
C/C++
private void removeTagItemTags(final Long id, final Set<String> tags) { jdbcTemplate .update(String.format(SQL_DELETE_TAG_ITEM_TAGS, "'" + Joiner.on("','").skipNulls().join(tags) + "'"), new SqlParameterValue(Types.BIGINT, id)); }
vuln
Vulnerable
Java
right: (window_width - cursor_rect.right), bottom: (window_height - cursor_rect.bottom) }; //Get the width and the height of the tooltip var tooltip_width = tooltip_div.width(); if (tooltip_width > 300) tooltip_width = 300; var tooltip_height = tooltip_div.height(); if (space_left.right < toolti...
vuln
Safe
JavaScript
import os from shutil import ExecError import time import re import logging import uuid from lxml.html.clean import clean_html import pypandoc import knowledge_graph import random import string from flask import Flask, render_template, request, redirect, url_for, send_from_directory, make_response from werkzeug.utils ...
vuln
Vulnerable
Python
/* 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...
vuln
Safe
C/C++
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { // Get a buffer that contains the full frame ByteBuf buffer = (ByteBuf) msg; // Update parse request latency metrics final BiConsumer<Long, Throwable> registerRequestParseLatency = (timeBefor...
vuln
Vulnerable
Java
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package html import ( "errors" "fmt" "io" "strings" a "golang.org/x/net/html/atom" ) // A parser implements the HTML5 parsing algorithm: // https://html...
vuln
Safe
Go
static int ssl_parse_supported_elliptic_curves( ssl_context *ssl, const unsigned char *buf, size_t len ) { size_t list_size, our_size; const unsigned char *p; const ecp_curve_info *curve_info, **curves; list...
vuln
Safe
C/C++
static RzList *relocs(RzBinFile *bf) { rz_return_val_if_fail(bf && bf->o, NULL); QnxObj *qo = bf->o->bin_obj; return rz_list_clone(qo->fixups); }
vuln
Vulnerable
Unknown
def start_interaction_loop(self): # Avoid circular imports from autogpt.app import execute_command, get_command # Interaction Loop self.cycle_count = 0 command_name = None arguments = None user_input = "" # Signal handler for interrupting y -N de...
vuln
Safe
Python
static int send_palette_rect(VncState *vs, int x, int y, int w, int h, VncPalette *palette) { int stream = 2; int level = tight_conf[vs->tight->compression].idx_zlib_level; int colors; ssize_t bytes; #ifdef CONFIG_VNC_PNG if (tight_can_send_png_rect(vs, w, h)) { ...
vuln
Safe
Unknown
http_rxchunk(struct http *hp) { char *q; int l, i; l = hp->prxbuf; do (void)http_rxchar(hp, 1, 0); while (hp->rxbuf[hp->prxbuf - 1] != '\n'); vtc_dump(hp->vl, 4, "len", hp->rxbuf + l, -1); i = strtoul(hp->rxbuf + l, &q, 16); bprintf(hp->chunklen, "%d", i); if ((q == hp->rxbuf + l) || (*q != '\0' && !vct_i...
vuln
Safe
Unknown
def spree_current_user return nil unless doorkeeper_token return @spree_current_user if @spree_current_user doorkeeper_authorize! @spree_current_user ||= Spree.user_class.find_by(id: doorkeeper_token.resource_owner_id) end
vuln
Safe
Ruby
def stream_exists_backend(request, user_profile, stream_id, autosubscribe): # type: (HttpRequest, UserProfile, int, bool) -> HttpResponse try: stream = get_and_validate_stream_by_id(stream_id, user_profile.realm) except JsonableError: stream = None result = {"exists": bool(stream)} i...
vuln
Safe
Python
/******************************************************************************* * Copyright (c) 2013 Mover Zhou * * 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.apac...
vuln
Vulnerable
Java
@Override public void draw(RitualRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) { RenderSystem.enableBlend(); this.arrow.draw(matrixStack, this.ritualCenterX + this.recipeOutputOffsetX - 20, this.ritualCenterY); RenderSystem.disableBlend(); Pentacle pentacle =...
vuln
Safe
Java
static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) { BN_CTX *ctx; BIGNUM k, kq, *K, *kinv = NULL, *r = NULL; BIGNUM l, m; int ret = 0; int q_bits; if (!dsa->p || !dsa->q || !dsa->g) { DSAerr(DSA_F_DSA_SIGN_SETUP, DSA_R_MISSING_PARA...
vuln
Safe
Unknown
static int mov_write_audio_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track) { int64_t pos = avio_tell(pb); int version = 0; uint32_t tag = track->tag; if (track->mode == MODE_MOV) { if (track->timescale > UINT16_MAX || !track->par->channels) { if (mov_ge...
vuln
Safe
C/C++
private void addNumberToWhiteList(String phoneNo){ phoneNo = Utils.normalizePhoneNumber(phoneNo); if(contactsListView_datasource.contains(phoneNo)){ Toast.makeText(this, R.string.contact_already_in_the_list, Toast.LENGTH_SHORT).show(); return; } whitelistDbHandler...
vuln
Vulnerable
Java
static int snd_seq_ioctl_remove_events(struct snd_seq_client *client, void __user *arg) { struct snd_seq_remove_events info; if (copy_from_user(&info, arg, sizeof(info))) return -EFAULT; /* * Input mostly not implemented XXX. */ if (info.remove_mode & SNDRV_SEQ_REMOVE_INPUT) { /* * No restr...
vuln
Vulnerable
Unknown
const busboyOptions = deepmerge.all([{ headers: Object.assign({}, req.headers) }, options || {}, opts || {}]) const stream = busboy(busboyOptions) let completed = false let files = 0 req.on('error', function (err) { stream.destroy() if (!completed) { completed = true done(er...
vuln
Vulnerable
JavaScript
jas_seq2d_t *jas_seq2d_copy(jas_seq2d_t *x) { jas_matrix_t *y; jas_matind_t i; jas_matind_t j; y = jas_seq2d_create(jas_seq2d_xstart(x), jas_seq2d_ystart(x), jas_seq2d_xend(x), jas_seq2d_yend(x)); assert(y); for (i = 0; i < x->numrows_; ++i) { for (j = 0; j < x->numcols_; ++j) { *jas_matrix_getref(y, i, j...
vuln
Safe
C/C++
static HashTable* spl_object_storage_debug_info(zval *obj, int *is_temp TSRMLS_DC) /* {{{ */ { spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(obj TSRMLS_CC); spl_SplObjectStorageElement *element; HashTable *props; HashPosition pos; zval *tmp, *storage; char md5str[33]; int nam...
vuln
Safe
Unknown
static xmlDocPtr dom_document_parser(zval *id, int mode, char *source, int source_len, int options TSRMLS_DC) /* {{{ */ { xmlDocPtr ret; xmlParserCtxtPtr ctxt = NULL; dom_doc_propsptr doc_props; dom_object *intern; php_libxml_ref_obj *document = NULL; int validate, recover, resolve_externals, keep_blanks, s...
vuln
Safe
Unknown
void ScreenRecorder::RemoveAllConnections() { DCHECK(network_loop_->BelongsToCurrentThread()); connections_.clear(); }
vuln
Safe
C/C++
_gnutls_server_name_recv_params (gnutls_session_t session, const opaque * data, size_t _data_size) { int i; const unsigned char *p; uint16_t len, type; ssize_t data_size = _data_size; int server_names = 0; if (session->security_parameters.entity == GNUTLS_SERVER) { DECR_LENGTH_RET (data_size...
vuln
Safe
C/C++
void ensureAuthenticatedUserCanDeleteFromIndex(AsyncExecutionId executionId, ActionListener<Void> listener) { GetRequest internalGet = new GetRequest(index).preference(executionId.getEncoded()) .id(executionId.getDocId()) .fetchSourceContext(new FetchSourceContext(true, new String[] { HE...
vuln
Safe
Java
Fraction::Fraction(int32_t num,int32_t den) { // Reduce resolution of fraction until we are in a safe range. // We need this as adding fractions may lead to very large denominators // (e.g. 0x10000 * 0x10000 > 0x100000000 -> overflow, leading to integer 0) while (denominator > MAX_FRACTION_VALUE || denominator...
vuln
Safe
C/C++
void ComputeAsync(OpKernelContext* c, DoneCallback done) override { auto col_params = new CollectiveParams(); auto done_with_cleanup = [col_params, done = std::move(done)]() { done(); col_params->Unref(); }; core::RefCountPtr<CollectiveGroupResource> resource; OP_REQUIRES_OK_ASYNC(c, Loo...
vuln
Safe
C/C++
static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t size, int flags) { struct sock *sk = sock->sk; struct ipx_sock *ipxs = ipx_sk(sk); struct sockaddr_ipx *sipx = (struct sockaddr_ipx *)msg->msg_name; struct ipxhdr *ipx = NULL; struct sk_buff *skb; int copied, rc; lock_s...
vuln
Vulnerable
C/C++