code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
void fp24_exp_cyc_sim(fp24_t e, const fp24_t a, const bn_t b, const fp24_t c, const bn_t d) { int i, l, n0, n1, l0, l1; int8_t naf0[RLC_FP_BITS + 1], naf1[RLC_FP_BITS + 1], *_k, *_m; fp24_t r, t0[1 << (EP_WIDTH - 2)]; fp24_t s, t1[1 << (EP_WIDTH - 2)]; if (bn_is_zero(b)) { return fp24_exp_cyc(e, c, d); } if ...
vuln
Vulnerable
C/C++
GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_many(size_t lb) { void *result; /* Add EXTRA_BYTES and round up to a multiple of a granule. */ lb = SIZET_SAT_ADD(lb, EXTRA_BYTES + GRANULE_BYTES - 1) & ~(GRANULE_BYTES - 1); GC_generic_malloc_many(lb, NORMAL, &result); return result; }
vuln
Safe
Unknown
gstd_accept(int fd, char **display_creds, char **export_name, char **mech) { gss_name_t client; gss_OID mech_oid; struct gstd_tok *tok; gss_ctx_id_t ctx = GSS_C_NO_CONTEXT; gss_buffer_desc in, out; OM_uint32 maj, min; int ret; *display_creds = NULL; *export_name = NULL; out.length = 0; in.length = 0...
vuln
Vulnerable
C/C++
static int mod_session_init (void *instance, eap_handler_t *handler) { pwd_session_t *session; eap_pwd_t *inst = (eap_pwd_t *)instance; VALUE_PAIR *vp; pwd_id_packet_t *packet; if (!inst || !handler) { ERROR("rlm_eap_pwd: Initiate, NULL data provided"); return 0; } /* * make sure the server's been configu...
vuln
Safe
Unknown
png_check_chunk_length(png_const_structrp png_ptr, const png_uint_32 length) { png_alloc_size_t limit = PNG_UINT_31_MAX; # ifdef PNG_SET_USER_LIMITS_SUPPORTED if (png_ptr->user_chunk_malloc_max > 0 && png_ptr->user_chunk_malloc_max < limit) limit = png_ptr->user_chunk_malloc_max; # elif PNG_USER_CHU...
vuln
Safe
C/C++
void SoftAMR::onQueueFilled(OMX_U32 /* portIndex */) { List<BufferInfo *> &inQueue = getPortQueue(0); List<BufferInfo *> &outQueue = getPortQueue(1); if (mSignalledError || mOutputPortSettingsChange != NONE) { return; } while (!inQueue.empty() && !outQueue.empty()) { BufferInfo *inInfo = *inQueue.begi...
vuln
Vulnerable
C/C++
static void vhost_dev_sync_region(struct vhost_dev *dev, uint64_t mfirst, uint64_t mlast, uint64_t rfirst, uint64_t rlast) { uint64_t start = MAX(mfirst, rfirst); uint64_t end = MIN(mlast, rlast); vhost_log_chunk_t *from = dev->log + start ...
vuln
Safe
C/C++
addlists (char **old, char **new) { int i; if (old == NULL || new == NULL) return NULL; for (i = 0; new[i] != NULL; ++i) { old = enlist(old, new[i], strlen(new[i])); if (old == NULL) break; } return old; }
vuln
Vulnerable
Unknown
static ssize_t total_time_ms_show(struct device *dev, struct device_attribute *attr, char *buf) { struct wakeup_source *ws = dev_get_drvdata(dev); ktime_t active_time; ktime_t total_time = ws->total_time; if (ws->active) { active_time = ktime_sub(ktime_get(), ws->last_time); total_time = ktime_add(total_...
vuln
Vulnerable
Unknown
sds sdsMakeRoomFor(sds s, size_t addlen) { void *sh, *newsh; size_t avail = sdsavail(s); size_t len, newlen; char type, oldtype = s[-1] & SDS_TYPE_MASK; int hdrlen; /* Return ASAP if there is enough space left. */ if (avail >= addlen) return s; len = sdslen(s); sh = (char*)s-sdsHdr...
vuln
Vulnerable
C/C++
package com.salesmanager.shop.admin.controller.merchant; import com.salesmanager.core.business.services.content.ContentService; import com.salesmanager.core.business.services.merchant.MerchantStoreService; import com.salesmanager.core.business.services.reference.language.LanguageService; import com.salesmanager.core....
vuln
Vulnerable
Java
struct dst_entry *inet6_csk_route_req(const struct sock *sk, struct flowi6 *fl6, const struct request_sock *req, u8 proto) { struct inet_request_sock *ireq = inet_rsk(req); const struct ipv6_pinfo *np = inet6_sk(sk); struct in6_addr *final_p, final; struct dst_entry *dst; memset(fl6,...
vuln
Vulnerable
C/C++
apr_status_t modsecurity_tx_init(modsec_rec *msr) { const char *s = NULL; const apr_array_header_t *arr; char *semicolon = NULL; char *comma = NULL; apr_table_entry_t *te; int i; /* Register TX cleanup */ apr_pool_cleanup_register(msr->mp, msr, modsecurity_tx_cleanup, apr_pool_cleanup_n...
vuln
Safe
C/C++
TEST_F(ConnectionHandlerTest, ListenerFilterDisabledTimeout) { InSequence s; TestListener* test_listener = addListener(1, true, false, "test_listener", Network::Address::SocketType::Stream, std::chrono::milliseconds()); Network::MockListener* listener = new Network::MockListener(); Netw...
vuln
Vulnerable
Unknown
int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, const BIGNUM *order, const BIGNUM *cofactor) { if (generator == NULL) { ECerr(EC_F_EC_GROUP_SET_GENERATOR, ERR_R_PASSED_NULL_PARAMETER); return 0 ; } if (group->generator == NULL) { group->generator = EC_POINT_new(group); if (gro...
vuln
Vulnerable
Unknown
MagickExport void ConvertRGBToHSL(const Quantum red,const Quantum green, const Quantum blue,double *hue,double *saturation,double *lightness) { double c, max, min; /* Convert RGB to HSL colorspace. */ assert(hue != (double *) NULL); assert(saturation != (double *) NULL); assert(lightness ...
vuln
Safe
Unknown
static void gen_mfrom(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) GEN_PRIV; #else CHK_SV; gen_helper_602_mfrom(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); #endif }
vuln
Safe
C/C++
void CompileFromResponseCallback( const v8::FunctionCallbackInfo<v8::Value>& args) { ExceptionState exception_state(args.GetIsolate(), ExceptionState::kExecutionContext, "WebAssembly", "compile"); ExceptionToRejectPromiseScope reject_promise_sc...
vuln
Vulnerable
C/C++
amgtar_backup( application_argument_t *argument) { int dumpin; char *qdisk; char *incrname; char line[32768]; amregex_t *rp; off_t dump_size = -1; char *type; char startchr; int dataf = 1; int mesgf = 3; int ind...
vuln
Safe
Unknown
void BinaryParameter::setParam(const void* v, int len) { LOCK_CONFIG; if (immutable) return; vlog.debug("set %s(Binary)", getName()); delete [] value; value = 0; if (len) { value = new char[len]; length = len; memcpy(value, v, len); } }
vuln
Vulnerable
C/C++
static int count_contiguous_clusters(uint64_t nb_clusters, int cluster_size, uint64_t *l2_table, uint64_t stop_flags) { int i; uint64_t mask = stop_flags | L2E_OFFSET_MASK | QCOW2_CLUSTER_COMPRESSED; uint64_t first_entry = be64_to_cpu(l2_table[0]); uint64_t offset = first_entry & mask; if (!...
vuln
Vulnerable
C/C++
/* * FreeRTOS Kernel V10.4.2 * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, includ...
vuln
Vulnerable
C/C++
function _real_escape( $string ) { if ( $this->dbh ) { if ( $this->use_mysqli ) { return mysqli_real_escape_string( $this->dbh, $string ); } else { return mysql_real_escape_string( $string, $this->dbh ); } } $class = get_class( $this ); if ( function_exists( '__' ) ) { /* translators: %s: d...
vuln
Vulnerable
PHP
int jp2_encode(jas_image_t *image, jas_stream_t *out, const char *optstr) { jp2_box_t *box; jp2_ftyp_t *ftyp; jp2_ihdr_t *ihdr; jas_stream_t *tmpstream; int allcmptssame; jp2_bpcc_t *bpcc; long len; uint_fast16_t cmptno; jp2_colr_t *colr; char buf[4096]; uint_fast32_t overhead; jp2_cdefchan_t *cdefchanent; ...
vuln
Safe
C/C++
def user_verify(self): eid = self.email code = self.password if eid.strip() == '': return if code.strip() == '': return query = 'select * from usr where email like %s' cursor = g.conn.execute(query, (eid, )) for row in cursor: k...
vuln
Safe
Python
function sendFileInformations(file, peer_id, broadcast = false) { fileToSend = file; // check if valid if (fileToSend && fileToSend.size > 0) { // no peers in the room if (!thereIsPeerConnections()) { return userLog('info', 'No participants detected'); } let fileI...
vuln
Vulnerable
JavaScript
static int64_t get_bit_rate(AVCodecContext *ctx) { int64_t bit_rate; int bits_per_sample; switch (ctx->codec_type) { case AVMEDIA_TYPE_VIDEO: case AVMEDIA_TYPE_DATA: case AVMEDIA_TYPE_SUBTITLE: case AVMEDIA_TYPE_ATTACHMENT: bit_rate = ctx->bit_rate; break; case AVMEDIA_TY...
vuln
Safe
C/C++
def list_profile_dirs(self): profiles = list_bundled_profiles() if profiles: print() print("Available profiles in IPython:") self._print_profiles(profiles) print() print(" The first request for a bundled profile will copy it") pr...
vuln
Vulnerable
Python
unsigned long hbitmap_iter_skip_words(HBitmapIter *hbi) { size_t pos = hbi->pos; const HBitmap *hb = hbi->hb; unsigned i = HBITMAP_LEVELS - 1; unsigned long cur; do { cur = hbi->cur[--i]; pos >>= BITS_PER_LEVEL; } while (cur == 0); if (i == 0 && cur == (1UL << (BITS_PER_...
vuln
Safe
C/C++
static void v9fs_walk(void *opaque) { int name_idx; V9fsFidState *newfidp = NULL; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; err = pdu_unmarshal(pdu, offset, "ddw", &fid, &newfid, &nwnames); if (err < 0) { pdu_complete(pdu, err); return ; } V9fsFidState *newfidp = ...
vuln
Safe
C/C++
public function createComment($id, $source = "leaves/leaves"){ $this->auth->checkIfOperationIsAllowed('view_leaves'); $data = getUserContext($this); $oldComment = $this->leaves_model->getCommentsLeave($id); $newComment = new stdClass; $newComment->type = "comment"; $newComment->autho...
vuln
Vulnerable
PHP
static inline void gen_op_sdivx(TCGv dst, TCGv src1, TCGv src2) { int l1, l2; TCGv r_temp1, r_temp2; l1 = gen_new_label(); l2 = gen_new_label(); r_temp1 = tcg_temp_local_new(); r_temp2 = tcg_temp_local_new(); tcg_gen_mov_tl(r_temp1, src1); tcg_gen_mov_tl(r_temp2, src2); gen_trap_ifdi...
vuln
Safe
C/C++
static ssize_t _hostsock_readv( oe_fd_t* desc, const struct oe_iovec* iov, int iovcnt) { ssize_t ret = -1; sock_t* sock = _cast_sock(desc); void* buf = NULL; size_t buf_size = 0; if (!sock || (!iov && iovcnt) || iovcnt < 0 || iovcnt > OE_IOV_MAX) OE_RAISE_ERRNO(OE_EINVAL); ...
vuln
Vulnerable
Unknown
static void destroy_surface(struct swaylock_surface *surface) { wl_list_remove(&surface->link); if (surface->layer_surface != NULL) { zwlr_layer_surface_v1_destroy(surface->layer_surface); } if (surface->surface != NULL) { wl_surface_destroy(surface->surface); } destroy_buffer(&surface->buffers[0]); destroy_...
vuln
Vulnerable
Unknown
job_run(const char *cmd, struct session *s, const char *cwd, job_update_cb updatecb, job_complete_cb completecb, job_free_cb freecb, void *data, int flags) { struct job *job; struct environ *env; pid_t pid; int nullfd, out[2]; const char *home; sigset_t set, oldset; if (socketpair(AF_UNIX, SOCK_STR...
vuln
Safe
Unknown
def bootstrap_tls( config, init_system, dns_name, fs_id, mountpoint, options, state_file_dir=STATE_FILE_DIR, fallback_ip_address=None, ): tls_port_sock = choose_tls_port_and_get_bind_sock(config, options) tls_port = get_tls_port_from_sock(tls_port_sock) try: # overri...
vuln
Vulnerable
Python
static always_inline int get_segment (CPUState *env, mmu_ctx_t *ctx, target_ulong eaddr, int rw, int type) { target_phys_addr_t sdr, hash, mask, sdr_mask, htab_mask; target_ulong sr, vsid, vsid_mask, pgidx, page_mask; #if defined(TARGET_PPC64) int attr; #endif int d...
vuln
Safe
C/C++
function addDiscountToCart() { // global $user, $order; global $order; //lookup discount to see if it's real and valid, and not already in our cart //this will change once we allow more than one coupon code $discount = new discounts(); $discount = $discount->getCouponByNa...
vuln
Vulnerable
PHP
public void updateActions(final Menu menu) { final AppViewModel selection = mSelection.getValue(); if (selection == null) return; final IslandAppInfo app = selection.info(); Analytics.$().trace("app", app.packageName).trace("user", Users.toId(app.user)).trace("hidden", app.isHidden()) .trace("system", app.i...
vuln
Vulnerable
Java
char *rfbProcessFileTransferReadBuffer(rfbClientPtr cl, uint32_t length) { char *buffer=NULL; int n=0; FILEXFER_ALLOWED_OR_CLOSE_AND_RETURN("", cl, NULL); /* We later alloc length+1, which might wrap around on 32-bit systems if length equals 0XFFFFFFFF, i.e. SIZE_MAX for 32-bit systems...
vuln
Vulnerable
C/C++
#include "common/router/router.h" #include <chrono> #include <cstdint> #include <memory> #include <string> #include "envoy/event/dispatcher.h" #include "envoy/event/timer.h" #include "envoy/grpc/status.h" #include "envoy/http/conn_pool.h" #include "envoy/runtime/runtime.h" #include "envoy/upstream/cluster_manager.h" ...
vuln
Vulnerable
C/C++
func (as *AdminServer) registerRoutes() { router := mux.NewRouter() // Base Front-end routes router.HandleFunc("/", mid.Use(as.Base, mid.RequireLogin)) router.HandleFunc("/login", mid.Use(as.Login, as.limiter.Limit)) router.HandleFunc("/logout", mid.Use(as.Logout, mid.RequireLogin)) router.HandleFunc("/reset_pass...
vuln
Safe
Go
function I(t,e,r){var i=r/t.blocksPerLine|0;var n=r%t.blocksPerLine;if(t.blocks[i]===undefined&&c.tolerantDecoding)return;e(t,t.blocks[i][n])}
vuln
Vulnerable
JavaScript
/* PEF support for BFD. Copyright (C) 1999-2020 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Founda...
vuln
Safe
C/C++
/* * Copyright 2022 Thoughtworks, 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 agr...
vuln
Vulnerable
Java
const Cluster* Segment::GetNext(const Cluster* pCurr) { assert(pCurr); assert(pCurr != &m_eos); assert(m_clusters); long idx = pCurr->m_index; if (idx >= 0) { assert(m_clusterCount > 0); assert(idx < m_clusterCount); assert(pCurr == m_clusters[idx]); ++idx; if (idx >= m_clusterCount) return &...
vuln
Safe
C/C++
private void renderClaim() { if (claim == null) { return; } if (claim.isPlayable() && MainActivity.appPlayer != null) { MainActivity.appPlayer.setPlayWhenReady(isPlaying); } Helper.setViewVisibility(layoutLoadingState, View.GONE); Helper.setViewV...
vuln
Vulnerable
Java
static int mov_text_decode_frame(AVCodecContext *avctx, void *data, int *got_sub_ptr, AVPacket *avpkt) { AVSubtitle *sub = data; int ret, ts_start, ts_end; AVBPrint buf; char *ptr = avpkt->data; char *end; int text_length, tsmb_type, style_entries, tsmb_size, tra...
vuln
Safe
C/C++
/* Copyright 2016 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
private boolean findMember(String host, int port, String dnSearchIn, boolean useSsl, String dnFind, boolean recursiveSearch) throws NamingException { Hashtable<String,Object> env = new Hashtable<String,Object>(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); String provUrl = retrie...
vuln
Vulnerable
Java
rpl_daoack_print(netdissect_options *ndo, const u_char *bp, u_int length) { const struct nd_rpl_daoack *daoack = (const struct nd_rpl_daoack *)bp; const char *dagid_str = "<elided>"; ND_TCHECK2(*daoack, ND_RPL_DAOACK_MIN_LEN); if (length < ND_RPL_DAOACK_MIN_LEN) ...
vuln
Safe
C/C++
/** * Copyright (C) 2011 Xavier Jodoin (xavier@jodoin.me) * * 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
Safe
Java
/* eslint-env browser, jquery */ /* eslint no-console: ["error", { allow: ["warn", "error"] }] */ /* global moment, serverurl */ import Prism from 'prismjs' import hljs from 'highlight.js' import PDFObject from 'pdfobject' import S from 'string' import { saveAs } from 'file-saver' import escapeHTML from 'escape-html' ...
vuln
Vulnerable
JavaScript
var match_1 = this._osc_st.exec(this._buffer); if (match_1 === null) { pkt.kind = PacketKind.Incomplete; return pkt; } if (match_1[3]) { pkt.kind = PacketKind.ESC; ...
vuln
Safe
JavaScript
static int vhost_user_set_owner(struct vhost_dev *dev) { VhostUserMsg msg = { .request = VHOST_USER_SET_OWNER, .flags = VHOST_USER_VERSION, }; if (vhost_user_write(dev, &msg, NULL, 0) < 0) { return -1; } return 0; }
vuln
Safe
C/C++
@Packet public void onFlying(WrappedInFlyingPacket packet, long timeStamp) { if(packet.isPos()) { //We check if the player is in ground, since theoretically the y should be zero. double lDeltaY = data.playerInfo.lClientGround ? 0 : data.playerInfo.lDeltaY; double predicte...
vuln
Vulnerable
Java
public void addExpiry(String cookie, Long time) { expiryDates.put(cookie, time); if (config.isTrue(PluginSettings.DEV_MODE)) { logger.info("Cookie " + cookie + " will expire " + time); } }
vuln
Vulnerable
Java
/* Copyright (c) 2017 - 2022 LiteSpeed Technologies Inc. See LICENSE. */ #include <assert.h> #include <string.h> #include <sys/queue.h> #include <sys/types.h> #include "lsquic.h" #include "lsquic_types.h" #include "lsquic_int_types.h" #include "lsquic_packet_common.h" #include "lsquic_packet_in.h" #include "lsquic_pa...
vuln
Safe
C/C++
static int fsmVerify(const char *path, rpmfi fi) { int rc; int saveerrno = errno; struct stat dsb; mode_t mode = rpmfiFMode(fi); rc = fsmStat(path, 1, &dsb); if (rc) return rc; if (S_ISREG(mode)) { /* HP-UX (and other os'es) don't permit unlink on busy files. */ char *rmpath = rstrscat(...
vuln
Vulnerable
C/C++
void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict) { QObject *data; int devfn; if (do_pcie_aer_inject_error(mon, qdict, &data) < 0) { return; } qdict = qobject_to_qdict(data); assert(qdict); devfn = (int)qdict_get_int(qdict, "devfn"); monitor_printf(mon, "OK id: %s ...
vuln
Vulnerable
C/C++
@Override public void init() { if (this.minecraft.player == null) { return; } this.render = this.itemRenderer; // this.buttons.clear(); this.scrollList = new ScrollingBlockList((this.getWidth() / 2) - 37, this.getHeight() / 2 + 10, 203, 185, this.itemList, this);...
vuln
Vulnerable
Java
@Override public void onPrepareOptionsMenu(Menu menu) { if (mFinishing) { return; } super.onPrepareOptionsMenu(menu); final MenuItem uninstallAllUsersItem = menu.findItem(UNINSTALL_ALL_USERS_MENU); uninstallAllUsersItem.setVisible( shouldShowUninst...
vuln
Safe
Java
static const char* ConvertScalar(PyObject* v, Eigen::half* out) { // NOTE(nareshmodi): Is there a way to convert to C double without the // intermediate Python double? This will help with ConvertOneFloat as well. Safe_PyObjectPtr as_float = make_safe(PyNumber_Float(v)); double v_double = PyFloat_AS_DOUB...
vuln
Vulnerable
C/C++
void *ztrymalloc_usable(size_t size, size_t *usable) { void *ptr = malloc(size+PREFIX_SIZE); if (!ptr) return NULL; #ifdef HAVE_MALLOC_SIZE size = zmalloc_size(ptr); update_zmalloc_stat_alloc(size); if (usable) *usable = size; return ptr; #else *((size_t*)ptr) = size; update_zmalloc_sta...
vuln
Vulnerable
Unknown
static MagickBooleanType Huffman2DEncodeImage(const ImageInfo *image_info, Image *image,Image *inject_image) { Image *group4_image; ImageInfo *write_info; MagickBooleanType status; size_t length; unsigned char *group4; status=MagickTrue; write_info=CloneImageInfo(image_info); ...
vuln
Vulnerable
Unknown
did_set_string_option( int opt_idx, /* index in options[] table */ char_u **varp, /* pointer to the option variable */ int new_value_alloced, /* new value was allocated */ char_u *oldval, /* previous value of the option */ char_u *errbuf, /* buffer for errors, or NULL */ int opt_flags) ...
vuln
Vulnerable
C/C++
static int wc3_read_header(AVFormatContext *s, AVFormatParameters *ap) { Wc3DemuxContext *wc3 = s->priv_data; ByteIOContext *pb = s->pb; unsigned int fourcc_tag; unsigned int size; AVStream *st; int ret = 0; int current_palette = 0; char *buffer; int i; ...
vuln
Vulnerable
C/C++
Handle MethodHandles::resolve_MemberName(Handle mname, KlassHandle caller, TRAPS) { Handle empty; assert(java_lang_invoke_MemberName::is_instance(mname()), ""); if (java_lang_invoke_MemberName::vmtarget(mname()) != NULL) { // Already resolved. DEBUG_ONLY(int vmindex = java_lang_invoke_MemberName::vmindex...
vuln
Safe
Unknown
/* * * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu) * All rights reserved. See COPYRIGHT. * * 7 Oct 1997 added checks for 0 data. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ /* this streams writes */ #include <stdio.h> #include <unistd.h> #include <sys/types.h> #include...
vuln
Vulnerable
C/C++
static VFIOGroup *vfio_get_group(int groupid, AddressSpace *as) { VFIOGroup *group; char path[32]; struct vfio_group_status status = { .argsz = sizeof(status) }; QLIST_FOREACH(group, &group_list, next) { if (group->groupid == groupid) { if (group->container->space->as ==...
vuln
Safe
C/C++
/* * GPAC - Multimedia Framework C SDK * * Authors: Jean Le Feuvre * Copyright (c) Telecom ParisTech 2005-2012 * All rights reserved * * This file is part of GPAC / command-line client * * GPAC is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General ...
vuln
Vulnerable
C/C++
static int try_seek_hole(BlockDriverState *bs, off_t start, off_t *data, off_t *hole) { #if defined SEEK_HOLE && defined SEEK_DATA BDRVRawState *s = bs->opaque; *hole = lseek(s->fd, start, SEEK_HOLE); if (*hole == -1) { return -errno; } if (*hole > start) { *...
vuln
Vulnerable
C/C++
/*====================================================================* - Copyright (C) 2001 Leptonica. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source c...
vuln
Safe
C/C++
@Override public float getFloat(LootContext context) { final BlockEntity entity = context.getParam(LootContextParams.BLOCK_ENTITY); if (entity instanceof CropBlockEntity crop) { return Mth.lerp(crop.getYield(), min.getFloat(context), max.getFloat(context)); } ...
vuln
Vulnerable
Java
public Committer buildCommitter(Committer c) { targetCommitter = c; return (o, w, wd, e, tid) -> blockBuffer.put(owner, w.publicKeyHash, new byte[0], wd.serialize(), tid) .thenCompose(newHash -> { CommittedWriterData updated = new CommittedWriterData(MaybeMultihash.of...
vuln
Safe
Java
@Method(0x80029300L) public static void renderText(final LodString text, final int x, int y, final int a3, final int a4) { //LAB_80029358 int length; for(length = 0; ; length++) { final int c = text.charAt(length); if(c == 0xa0ff) { currentText_800bdca0.charAt(length, 0xffff); ...
vuln
Vulnerable
Java
void SendTo(v8::Isolate* isolate, gin_helper::ErrorThrower thrower, int32_t web_contents_id, const std::string& channel, v8::Local<v8::Value> arguments) { if (!electron_ipc_remote_) { thrower.ThrowError(kIPCMethodCalledAfterContextReleasedError); r...
vuln
Safe
Unknown
static void apply_independent_coupling_fixed(AACContext *ac, SingleChannelElement *target, ChannelElement *cce, int index) { int i, c, shift, round, tmp; const int gain = cce->coup.gain[index][0]; const int *src = cce->ch[0].ret; ...
vuln
Vulnerable
C/C++
/* * Global javascript utilities */ /* global $ */ var static_url = ""; /* * A simple function to initialize the value of the global variable * 'media_url' (corresponding to django's MEDIA_URL variable). */ function set_static_url(url) { static_url = url; } /* * Shortcut function that construct an url fro...
vuln
Vulnerable
Python
static int wc3_read_header(AVFormatContext *s, AVFormatParameters *ap) { Wc3DemuxContext *wc3 = s->priv_data; ByteIOContext *pb = s->pb; unsigned int fourcc_tag; unsigned int size; AVStream *st; int ret = 0; char *buffer; wc3->width = WC3_DEFAULT_WIDTH; ...
vuln
Safe
C/C++
static int ne2000_buffer_full(NE2000State *s) { int avail, index, boundary; index = s->curpag << 8; boundary = s->boundary << 8; if (index < boundary) return 1; return 0; }
vuln
Vulnerable
Unknown
PyMemoTable_Set(PyMemoTable *self, PyObject *key, Py_ssize_t value) { PyMemoEntry *entry; assert(key != NULL); entry = _PyMemoTable_Lookup(self, key); if (entry->me_key != NULL) { entry->me_value = value; return 0; } Py_INCREF(key); entry->me_key = key; entry->me_value ...
vuln
Safe
C/C++
// -*- Mode: Go; indent-tabs-mode: t -*- /* * Copyright (C) 2014-2018 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 hop...
vuln
Safe
Go
public static CharSequence commonizeSpans(CharSequence text) { if (!(text instanceof Spanned)) { return text; } var spanned = (Spanned) text; var spannable = new SpannableStringBuilder(text.toString()); var spans = spanned.getSpans(0, spanned.length(), CharacterStyle....
vuln
Vulnerable
Java
struct razer_report razer_chroma_extended_matrix_set_custom_frame2(unsigned char row_index, unsigned char start_col, unsigned char stop_col, unsigned char *rgb_data, size_t packetLength) { const size_t row_length = (size_t) (((stop_col + 1) - start_col) * 3); // Some devices need a specific packet length, most ...
vuln
Vulnerable
C/C++
u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport) { u32 hash[MD5_DIGEST_WORDS]; hash[0] = (__force u32)saddr; hash[1] = (__force u32)daddr; hash[2] = (__force u32)dport ^ net_secret[14]; hash[3] = net_secret[15]; md5_transform(hash, net_secret); return hash[0]; }
vuln
Safe
Unknown
async def _make_well_known_request( self, server_name: bytes, retry: bool ) -> Tuple[IResponse, bytes]: """Make the well known request. This will retry the request if requested and it fails (with unable to connect or receives a 5xx error). Args: server_name: nam...
vuln
Safe
Python
int fb_copy_cmap(const struct fb_cmap *from, struct fb_cmap *to) { unsigned int tooff = 0, fromoff = 0; size_t size; if (to->start > from->start) fromoff = to->start - from->start; else tooff = from->start - to->start; if (fromoff >= from->len || tooff >= to->len) return -EINVAL; size = min_t(size_t, to->...
vuln
Safe
Unknown
MagickExport MagickBooleanType EqualizeImage(Image *image, ExceptionInfo *exception) { #define EqualizeImageTag "Equalize/Image" CacheView *image_view; double black[CompositePixelChannel+1], *equalize_map, *histogram, *map, white[CompositePixelChannel+1]; MagickBooleanType status...
vuln
Vulnerable
C/C++
struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data) { int ret = -ENOMEM, i, node; struct io_wq *wq; wq = kcalloc(1, sizeof(*wq), GFP_KERNEL); if (!wq) return ERR_PTR(-ENOMEM); wq->nr_wqes = num_online_nodes(); wq->wqes = kcalloc(wq->nr_wqes, sizeof(struct io_wqe *), GFP_KERNEL); if (!wq->wq...
vuln
Vulnerable
Unknown
cdf_read_short_sector(const cdf_stream_t *sst, void *buf, size_t offs, size_t len, const cdf_header_t *h, cdf_secid_t id) { assert((size_t)CDF_SHORT_SEC_SIZE(h) == len); (void)memcpy(((char *)buf) + offs, ((const char *)sst->sst_tab) + CDF_SHORT_SEC_POS(h, id), len); return len; }
vuln
Vulnerable
C/C++
int ff_generate_sliding_window_mmcos(H264Context *h, int first_slice) { MMCO mmco_temp[MAX_MMCO_COUNT], *mmco = first_slice ? h->mmco : mmco_temp; int mmco_index = 0, i; assert(h->long_ref_count + h->short_ref_count <= h->sps.ref_frame_count); if (h->short_ref_count && h->long_ref_count + h->sho...
vuln
Vulnerable
C/C++
static Image *ReadCINImage(const ImageInfo *image_info,ExceptionInfo *exception) { #define MonoColorType 1 #define RGBColorType 3 char property[MaxTextExtent]; CINInfo cin; Image *image; MagickBooleanType status; MagickOffsetType offset; QuantumInfo *quantum_info; QuantumT...
vuln
Safe
C/C++
package api // Visibility is the type of a visibility. type Visibility string const ( // Public is the PUBLIC visibility. Public Visibility = "PUBLIC" // Protected is the PROTECTED visibility. Protected Visibility = "PROTECTED" // Private is the PRIVATE visibility. Private Visibility = "PRIVATE" ) func (e Visi...
vuln
Safe
Go
/* NetHack 3.6 windows.c $NHDT-Date: 1575245096 2019/12/02 00:04:56 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.60 $ */ /* Copyright (c) D. Cohrs, 1993. */ /* NetHack may be freely redistributed. See license for details. */ #include "hack.h" #ifdef TTY_GRAPHICS #include "wintty.h" #endif #ifdef CURSES_GRAPHICS e...
vuln
Vulnerable
C/C++
def _init_script_templating(self): from jinja2 import BaseLoader, ChoiceLoader, Environment, TemplateNotFound from jinja2.ext import Extension from jinja2.nodes import Include from octoprint.util.jinja import FilteredFileSystemLoader class SnippetExtension(Extension): ...
vuln
Vulnerable
Python
/* * Copyright (C) 2012-2018 Tobias Brunner * Copyright (C) 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 version 2 o...
vuln
Safe
C/C++
static int execute(struct sockaddr *addr) { static char line[1000]; int pktlen, len, i; if (addr) { char addrbuf[256] = ""; int port = -1; if (addr->sa_family == AF_INET) { struct sockaddr_in *sin_addr = (void *) addr; inet_ntop(addr->sa_family, &sin_addr->sin_addr, addrbuf, sizeof(addrbuf)); port =...
vuln
Safe
Unknown
import os from typing import List, Union from django.conf import settings from django.conf.urls import include from django.conf.urls.i18n import i18n_patterns from django.contrib.auth.views import ( LoginView, PasswordResetCompleteView, PasswordResetConfirmView, PasswordResetDoneView, ) from django.url...
vuln
Vulnerable
Python
static pj_xml_node *xml_parse_node( pj_pool_t *pool, pj_scanner *scanner) { pj_xml_node *node; pj_str_t end_name; PJ_CHECK_STACK(); if (*scanner->curptr != '<') on_syntax_error(scanner); /* Handle Processing Instructino (PI) construct (i.e. "<?") */ if (*scanner->curptr == '<' && *(scanner->...
vuln
Safe
C/C++