code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
static void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst, int dstWidth, const uint8_t *src, int srcW, int xInc) { int32_t *filterPos = c->hLumFilterPos; int16_t *filter = c->hLumFilter; void *mmx2FilterCode= c->lumMmx2FilterCode; ...
vuln
Safe
C/C++
snmp_message_encode(unsigned char *out, uint32_t *out_len, snmp_header_t *header, snmp_varbind_t *varbinds, uint32_t varbind_num) { snmp_varbind_t *varbind; uint32_t original_out_len, last_out_len; int8_t i; original_out_len = *out_len; for(i = varbind_num - 1; i >= 0; i--) { varbind ...
vuln
Vulnerable
C/C++
public boolean equals(final Object obj) { if (! (obj instanceof RawDigestPassword)) { return false; } RawDigestPassword other = (RawDigestPassword) obj; return MessageDigest.isEqual(digest, other.digest) && username.equals(other.username) && realm.equals(other.realm) && getAl...
vuln
Safe
Java
/* * 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, ...
vuln
Safe
C/C++
private ArrayList<SharedLibraryInfo> collectSharedLibraryInfos( @NonNull List<String> requestedLibraries, @Nullable long[] requiredVersions, @Nullable String[][] requiredCertDigests, @NonNull String packageName, @NonNull String libraryType, boolean required, int targetSdk...
vuln
Vulnerable
Java
__author__ = "Gina Häußge <osd@foosel.net>" __license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html" __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License" import atexit import base64 import functools import logging import logging.config i...
vuln
Safe
Python
umount_one (const char *spec, const char *node, const char *type, const char *opts, struct mntentchn *mc) { int umnt_err = 0; int isroot; int res = 0; int status; int extra_flags = 0; const char *loopdev, *target = node; char *targetbuf = NULL; int myloop = 0; /* Special case for root. As of 0.99pl10 we...
vuln
Vulnerable
C/C++
static int64_t coroutine_fn vvfat_co_get_block_status(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int *n, BlockDriverState **file) { *n = bs->total_sectors - sector_num; if (*n > nb_sectors) { *n = nb_sectors; } else if (*n < 0) { return 0; } return BDRV_BLOCK_DATA; }
vuln
Safe
C/C++
void ide_data_writel(void *opaque, uint32_t addr, uint32_t val) { IDEBus *bus = opaque; IDEState *s = idebus_active_if(bus); uint8_t *p; if (!(s->status & DRQ_STAT) || ide_is_pio_out(s)) { p = s->data_ptr; *(uint32_t *)p = le32_to_cpu(val); p += 4; s->data_ptr = p; if (p >= s->d...
vuln
Vulnerable
C/C++
public static PrivateCrafting deserialize(final IFactoryController controller, final CompoundTag compound) { final ItemStack stack = ItemStackUtils.deserializeFromNBT(compound.getCompound(NBT_STACK)); final int count = compound.getInt(NBT_COUNT); final int minCount = compound.getInt(NBT_MIN_...
vuln
Safe
Java
public Vector3f GetCoordinates(final Face face, final Vector3f out) { Vector3f tmp = VECTORS.get(); Vector3f tmp1 = VECTORS.get(); Vector3f tmp2 = VECTORS.get(); Vector3f o = VECTORS.get(); o.scale(-face.d, face.n); float[] a = floatArrays.getFixed(3); tmp1.sub(face.v[0].w, o); tmp2.sub(face....
vuln
Vulnerable
Java
/** * Copyright (c) 2020, JGraph Ltd * Copyright (c) 2020, draw.io AG */ package com.mxgraph.online; import java.io.IOException; import java.io.InputStream; import java.util.logging.Logger; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; i...
vuln
Vulnerable
Java
static void ram_block_add(struct uc_struct *uc, RAMBlock *new_block) { RAMBlock *block; RAMBlock *last_block = NULL; new_block->offset = find_ram_offset(uc, new_block->max_length); if (!new_block->host) { new_block->host = phys_mem_alloc(uc, new_block->max_length, &new_block->m...
vuln
Safe
C/C++
int CLASS parse_jpeg(int offset) { int len, save, hlen, mark; fseek(ifp, offset, SEEK_SET); if (fgetc(ifp) != 0xff || fgetc(ifp) != 0xd8) return 0; while (fgetc(ifp) == 0xff && (mark = fgetc(ifp)) != 0xda) { order = 0x4d4d; len = get2() - 2; save = ftell(ifp); if (mark == 0xc0 || mark == ...
vuln
Vulnerable
C/C++
static inline void http1_consume_data(intptr_t uuid, http1pr_s *p) { if (fio_pending(uuid) > 4) { goto throttle; } ssize_t i = 0; size_t org_len = p->buf_len; int pipeline_limit = 8; if (!p->buf_len) return; do { i = http1_fio_parser(.parser = &p->parser, .buffer = p->...
vuln
Vulnerable
C/C++
av_cold int ffv1_init_slice_contexts(FFV1Context *f) { int i; f->slice_count = f->num_h_slices * f->num_v_slices; av_assert0(f->slice_count > 0); for (i = 0; i < f->slice_count; i++) { FFV1Context *fs = av_mallocz(sizeof(*fs)); int sx = i % f->num_h_slices; int sy ...
vuln
Vulnerable
C/C++
static int test_modexp_mont5(void) { BIGNUM *a = NULL, *p = NULL, *m = NULL, *d = NULL, *e = NULL; BIGNUM *b = NULL, *n = NULL, *c = NULL; BN_MONT_CTX *mont = NULL; int st = 0; if (!TEST_ptr(a = BN_new()) || !TEST_ptr(p = BN_new()) || !TEST_ptr(m = BN_new()) || !...
vuln
Vulnerable
Unknown
/* * GPAC - Multimedia Framework C SDK * * Authors: Jean Le Feuvre * Copyright (c) Telecom ParisTech 2000-2021 * All rights reserved * * This file is part of GPAC / NALU (AVC, HEVC, VVC) reframer filter * * GPAC is free software; you can redistribute it and/or modify * it under the terms of the ...
vuln
Safe
C/C++
async def _static_request_handler( self, file_or_directory, use_modified_since, use_content_range, stream_large_files, request, content_type=None, __file_uri__=None, ): # Merge served directory and requested file if provided root_path =...
vuln
Safe
Python
static void __inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap, int destroy, struct nlmsghdr *nlh, u32 portid) { struct in_ifaddr *promote = NULL; struct in_ifaddr *ifa, *ifa1 = *ifap; struct in_ifaddr *last_prim = in_dev->ifa_list; struct in_ifaddr *prev_prom = NULL; int do_promote = IN_DEV_PROM...
vuln
Vulnerable
C/C++
package com.hccake.ballcat.codegen.engine; import com.hccake.ballcat.codegen.exception.TemplateRenderException; import java.util.Map; /** * 模板引擎 * * @author hccake */ public interface TemplateEngine { /** * 当前模板引擎对应的类型枚举 * @return TemplateEngineTypeEnum */ TemplateEngineTypeEnum type(); /** * 渲染模板字符...
vuln
Safe
Java
static unsigned int help(struct sk_buff *skb, enum ip_conntrack_info ctinfo, unsigned int protoff, unsigned int matchoff, unsigned int matchlen, struct nf_conntrack_expect *exp) { char buffer[sizeof("4294967296 65635")]; u_int16_t port; unsigned int ret; /* Reply comes from server. */ ...
vuln
Vulnerable
C/C++
int net_get(int s, void *arg, int *len) { struct net_hdr nh; int plen; if (net_read_exact(s, &nh, sizeof(nh)) == -1) { return -1; } plen = ntohl(nh.nh_len); if (!(plen <= *len)) printf("PLEN %d type %d len %d\n", plen, nh.nh_type, *len); assert(plen <= *len); /* XXX */ *len = plen;...
vuln
Vulnerable
Unknown
def _check_auth(self, must_admin, redir_login=True): """ check if a user is autheticated and, optionnaly an administrator if user not authentifaced -> redirection to login page (with base64 of the originaly requested page (redirection after login) if user authenticated, not admin and...
vuln
Vulnerable
Python
Gfx::Gfx(XRef *xrefA, OutputDev *outA, int pageNum, Dict *resDict, Catalog *catalogA, double hDPI, double vDPI, PDFRectangle *box, PDFRectangle *cropBox, int rotate, GBool (*abortCheckCbkA)(void *data), void *abortCheckCbkDataA) #ifdef USE_CMS : iccColorSpaceCache(5) #endif { int i; xref = xrefA; catalo...
vuln
Vulnerable
C/C++
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % ...
vuln
Safe
C/C++
static void print_bpf_insn(struct bpf_insn *insn) { u8 class = BPF_CLASS(insn->code); if (class == BPF_ALU || class == BPF_ALU64) { if (BPF_SRC(insn->code) == BPF_X) verbose("(%02x) %sr%d %s %sr%d\n", insn->code, class == BPF_ALU ? "(u32) " : "", insn->dst_reg, bpf_alu_string[BPF_OP(insn->code) >...
vuln
Vulnerable
C/C++
void MainWindow::showUpgradePrompt() { if (Settings.checkUpgradeAutomatic()) { showStatusMessage("Checking for upgrade..."); m_network.get(QNetworkRequest(QUrl("https://check.shotcut.org/version.json"))); } else { QAction* action = new QAction(tr("Click here to check for a new version of...
vuln
Safe
C/C++
pixman_format_code_t qemu_default_pixman_format(int bpp, bool native_endian) { if (native_endian) { switch (bpp) { case 15: return PIXMAN_x1r5g5b5; case 16: return PIXMAN_r5g6b5; case 24: return PIXMAN_r8g8b8; case 32: return PI...
vuln
Safe
C/C++
@Inject(method = "<init>(Lnet/minecraft/world/level/Level;Lnet/minecraft/world/level/ChunkPos;Lnet/minecraft/world/level/chunk/UpgradeData;Lnet/minecraft/world/ticks/LevelChunkTicks;Lnet/minecraft/world/ticks/LevelChunkTicks;J[Lnet/minecraft/world/level/chunk/LevelChunkSection;Lnet/minecraft/world/level/chunk/LevelChun...
vuln
Safe
Java
void Browser::SetWebContentsBlocked(content::WebContents* web_contents, bool blocked) { int index = tab_strip_model_->GetIndexOfWebContents(web_contents); if (index == TabStripModel::kNoTab) { return; } tab_strip_model_->SetTabBlocked(index, blocked); bool browser...
vuln
Vulnerable
C/C++
void memory_mapping_filter(MemoryMappingList *list, int64_t begin, int64_t length) { MemoryMapping *cur, *next; QTAILQ_FOREACH_SAFE(cur, &list->head, next, next) { if (cur->phys_addr >= begin + length || cur->phys_addr + cur->length <= begin) { QTAILQ_R...
vuln
Safe
C/C++
tTcpIpPacketParsingResult ParaNdis_CheckSumVerify( tCompletePhysicalAddress *pDataPages, ULONG ulDataLength, ULONG ulStartOffset, ...
vuln
Safe
C/C++
int encryptFinal(byte[] plain, int plainOffset, int plainLen, byte[] cipher, int cipherOffset) { int ret; synchronized (this) { if (plain == cipher) { ret = nativeCrypto.CBCFinalEncrypt(nativeContext, plain.clone(), plainOffset, ...
vuln
Safe
Java
static int mxg_update_cache(AVFormatContext *s, unsigned int cache_size) { MXGContext *mxg = s->priv_data; unsigned int current_pos = mxg->buffer_ptr - mxg->buffer; unsigned int soi_pos; int ret; if (current_pos > current_pos + cache_size) return AVERROR(ENOMEM); soi_pos = mxg->soi_...
vuln
Vulnerable
C/C++
xfs_fs_fill_super( struct super_block *sb, void *data, int silent) { struct inode *root; struct xfs_mount *mp = NULL; int flags = 0, error = -ENOMEM; /* * allocate mp and do all low-level struct initializations before we * attach it to the super */ mp = xfs_mount_alloc(sb); if (!mp) goto out; ...
vuln
Vulnerable
C/C++
@Override public void writeToParcel(Parcel dest, int flags) { dest.writeCharSequence(mDisplayLabel); dest.writeCharSequence(mExtendedInfo); dest.writeParcelable(mResolvedIntent, 0); dest.writeTypedList(mSourceIntents); dest.writeBoolean(mIsSuspended); dest.writeBoolea...
vuln
Safe
Java
private static boolean isChangeEnabled(String changeName, long changeId) { boolean enabled = Compatibility.isChangeEnabled(changeId); // Compatibility changes aren't available in the system process, but this should never be // enabled for it. if (Process.myUid() == Process.SYSTEM_UID) {...
vuln
Vulnerable
Java
@Override public boolean equals(Object other) { return other instanceof HashPasswordSpec && MessageDigest.isEqual(digest, ((HashPasswordSpec)other).digest); }
vuln
Safe
Java
import {extend, defer, requestAnimationFrame} from "../../utils/core"; import DefaultViewManager from "../default"; import Snap from "../helpers/snap"; import { EVENTS } from "../../utils/constants"; import debounce from "lodash/debounce"; class ContinuousViewManager extends DefaultViewManager { constructor(options) ...
vuln
Vulnerable
JavaScript
int avpriv_dv_produce_packet(DVDemuxContext *c, AVPacket *pkt, uint8_t* buf, int buf_size) { int size, i; uint8_t *ppcm[4] = {0}; if (buf_size < DV_PROFILE_BYTES || !(c->sys = avpriv_dv_frame_profile(c->sys, buf, buf_size)) || buf_size < c->sys->frame_size) { ...
vuln
Safe
Unknown
static BIGNUM *srp_Calc_k(BIGNUM *N, BIGNUM *g) { /* k = SHA1(N | PAD(g)) -- tls-srp draft 8 */ unsigned char digest[SHA_DIGEST_LENGTH]; unsigned char *tmp; EVP_MD_CTX ctxt; int longg ; int longN = BN_num_bytes(N); if ((tmp = OPENSSL_malloc(longN)) == NULL) return NULL; ...
vuln
Vulnerable
C/C++
@Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action == null) return; switch (action) { case TorServiceConstants.LOCAL_ACTION_LOG: { Message msg = mStatusUpdateHan...
vuln
Vulnerable
Java
void OPPROTO op_udivx_T1_T0(void) { if (T1 == 0) { raise_exception(TT_DIV_ZERO); } T0 /= T1; FORCE_RET(); }
vuln
Safe
C/C++
* */ PHP_METHOD(DateTimeZone, __wakeup) { zval *object = getThis(); php_timezone_obj *tzobj; HashTable *myht; tzobj = (php_timezone_obj *) zend_object_store_get_object(object TSRMLS_CC); myht = Z_OBJPROP_P(object); if(php_date_timezone_initialize_from_hash(&return_value, &tzobj, myht TSRML...
vuln
Safe
Unknown
void CLASS parse_exif (int base) { unsigned kodak, entries, tag, type, len, save, c; double expo,ape; kodak = !strncmp(make,"EASTMAN",7) && tiff_nifds < 3; entries = get2(); if(!strncmp(make,"Hasselblad",10) && (tiff_nifds > 3) && (entries > 512)) return; #ifdef LIBRAW_LIBRARY_BUILD INT64 fsize = ifp->size...
vuln
Safe
Unknown
expand_string_integer(uschar *string, BOOL isplus) { int_eximarith_t value; uschar *s = expand_string(string); uschar *msg = US"invalid integer \"%s\""; uschar *endptr; /* If expansion failed, expand_string_message will be set. */ if (s == NULL) return -1; /* On an overflow, strtol() returns LONG_MAX or LONG_MIN,...
vuln
Vulnerable
C/C++
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may n...
vuln
Vulnerable
Java
package envoyconfig import ( "encoding/json" "fmt" "net/url" "sort" envoy_config_core_v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" envoy_config_route_v3 "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" envoy_type_matcher_v3 "github.com/envoyproxy/go-control-plane/envoy/type/ma...
vuln
Vulnerable
Go
var S=document.createElement("tbody"),Q=(new Date).toDateString();null!=b.currentPage&&null!=b.pages&&(e=mxUtils.indexOf(b.pages,b.currentPage));for(p=f.length-1;0<=p;p--){var P=function(T){var X=new Date(T.modifiedDate),ba=null;if(0<=X.getTime()){var ja=function(ka){v.stop();E.innerText="";var da=mxUtils.parseXml(ka),...
vuln
Safe
JavaScript
mp_err mp_init_size(mp_int *a, int size) { if (size < 0) { return MP_VAL; } size = MP_MAX(MP_MIN_PREC, size); /* alloc mem */ a->dp = (mp_digit *) MP_CALLOC((size_t)size, sizeof(mp_digit)); if (a->dp == NULL) { return MP_MEM; } /* set the members */ a->used = 0; a->alloc =...
vuln
Safe
C/C++
byte ctMaskSel(byte m, byte a, byte b) { return (b & ((byte)~(word32)m)) | (a & m); }
vuln
Safe
C/C++
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or a...
vuln
Vulnerable
Python
private int getHeldItemCount(boolean holdingBow) { ItemStack currentItem = mc.thePlayer.inventory.getCurrentItem(); if (currentItem == null) return 0; int id = Item.getIdFromItem(currentItem.getItem()); int data = currentItem.getItemDamage(); int count = 0; if (holdingB...
vuln
Vulnerable
Java
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* indices = GetInput(context, node, kIndices); const TfLiteTensor* updates = GetInput(context, node, kUpdates); const TfLiteTensor* shape = GetInput(context, node, kShape); TfLiteTensor* output = GetOutput(context, node, kOutputTens...
vuln
Vulnerable
C/C++
public static GameMode getGameMode(PlayerEntity player) { PlayerListEntry playerListEntry = mc.getNetworkHandler().getPlayerListEntry(player.getUuid()); if (playerListEntry == null) return null; return playerListEntry.getGameMode(); }
vuln
Vulnerable
Java
public static CloseResponseHandle getContext(String uri, String method, HttpServletRequest request, boolean disableRedirect) throws IOException, InstantiationException { String pluginServerHttp = Constants.pluginServer; CloseableHttpResponse httpResponse; CloseResponseHandle handle = new CloseRe...
vuln
Vulnerable
Java
static int ogg_read_page(AVFormatContext *s, int *sid) { AVIOContext *bc = s->pb; struct ogg *ogg = s->priv_data; struct ogg_stream *os; int ret, i = 0; int flags, nsegs; uint64_t gp; uint32_t serial; int size, idx; uint8_t sync[4]; int sp = 0; ret = avio_read(bc, sync, 4); ...
vuln
Safe
C/C++
protected void handleRequestInternal(ServerHttpRequest request, ServerHttpResponse response, AbstractHttpSockJsSession sockJsSession) throws SockJsException { if (sockJsSession.isNew()) { if (logger.isDebugEnabled()) { logger.debug(request.getMethod() + " " + request.getURI()); } sockJsSession.handle...
vuln
Vulnerable
Java
public void readMap(DataTypeProvider provider) { int mapId = provider.readVarInt(); this.updatedSince.add(mapId); if (mapId > maxMapId) { maxMapId = mapId; } PlayerMap map = maps.computeIfAbsent(mapId, PlayerMap::getVersioned); map.parse(provider); }
vuln
Vulnerable
Java
static ssize_t stellaris_enet_receive(NetClientState *nc, const uint8_t *buf, size_t size) { stellaris_enet_state *s = qemu_get_nic_opaque(nc); int n; uint8_t *p; uint32_t crc; if ((s->rctl & SE_RCTL_RXEN) == 0) return -1; if (s->np >= 31) { return 0; } DPRINTF("Received ...
vuln
Vulnerable
C/C++
ews_config_lookup_worker_run (EConfigLookupWorker *lookup_worker, EConfigLookup *config_lookup, const ENamedParameters *params, ENamedParameters **out_restart_params, GCancellable *cancellable, GError **error) { CamelEwsSettings *ews_settings = NULL; ESource *source; cons...
vuln
Vulnerable
Unknown
package typesystem import ( "fmt" "reflect" "github.com/go-errors/errors" openfgapb "go.buf.build/openfga/go/openfga/api/openfga/v1" ) const ( SchemaVersion1_0 = "1.0" SchemaVersion1_1 = "1.1" ) var ( ErrDuplicateTypes = errors.New("an authorization model cannot contain duplicate types") ErrInvalidSch...
vuln
Safe
Go
#define pr_fmt(fmt) "SVM: " fmt #include <linux/kvm_host.h> #include "irq.h" #include "mmu.h" #include "kvm_cache_regs.h" #include "x86.h" #include "cpuid.h" #include "pmu.h" #include <linux/module.h> #include <linux/mod_devicetable.h> #include <linux/kernel.h> #include <linux/vmalloc.h> #include <linux/highmem.h> #...
vuln
Vulnerable
C/C++
static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *str, size_t str_nbytes, const char *enc, const char **next_pos, int mode) { php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS; iconv_t cd = (iconv_t)(-1), cd_pl = (iconv_t)(-1); const char *p1; size_t str_left; unsigned int scan_stat = 0; c...
vuln
Vulnerable
C/C++
private void removeGnssStatusListener() { if (locationManager == null) { Timber.e("The location manager is null. Unable to unregister a GNSS status listener"); return; } locationManager.unregisterGnssStatusCallback(gnssStatusListener); locationManage...
vuln
Safe
Java
void helper_retry(void) { trap_state* tsptr = cpu_tsptr(env); env->pc = tsptr->tpc; env->npc = tsptr->tnpc; PUT_CCR(env, tsptr->tstate >> 32); env->asi = (tsptr->tstate >> 24) & 0xff; change_pstate((tsptr->tstate >> 8) & 0xf3f); PUT_CWP64(env, tsptr->tstate & 0xff); env->tl--; }
vuln
Safe
C/C++
static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) { struct net *net = sock_net(skb->sk); struct net *tgt_net = net; int h, s_h; int idx = 0, s_idx; struct net_device *dev; struct hlist_head *head; struct nlattr *tb[IFLA_MAX+1]; u32 ext_filter_mask = 0; const struct rtnl_link_ops *ki...
vuln
Safe
Unknown
{% load i18n %} /* global inventreeLoad, inventreeSave, */ /* exported customGroupSorter, downloadTableData, reloadtable, renderLink, reloadTableFilters, */ /** * Reload a named table * @param table */ function reloadtable(table) { $(table).bootstrapTable('refresh'); } /** * Dow...
vuln
Safe
Python
export function isOriginPotentiallyTrustworthy(url) { // 1. If origin is an opaque origin, return "Not Trustworthy". // Not applicable // 2. Assert: origin is a tuple origin. // Not for implementations // 3. If origin's scheme is either "https" or "wss", return "Potentially Trustworthy". if (/^(http|ws)s:$/.tes...
vuln
Safe
JavaScript
BlockDriverState *bdrv_new(void) { BlockDriverState *bs; int i; bs = g_new0(BlockDriverState, 1); QLIST_INIT(&bs->dirty_bitmaps); for (i = 0; i < BLOCK_OP_TYPE_MAX; i++) { QLIST_INIT(&bs->op_blockers[i]); } notifier_with_return_list_init(&bs->before_write_notifiers); bs->refcnt =...
vuln
Vulnerable
C/C++
static uint32_t m5206_mbar_readl(void *opaque, target_phys_addr_t offset) { m5206_mbar_state *s = (m5206_mbar_state *)opaque; int width; offset &= 0x3ff; if (offset > 0x200) { hw_error("Bad MBAR read offset 0x%x", (int)offset); } width = m5206_mbar_width[offset >> 2]; if (width < 4) ...
vuln
Vulnerable
C/C++
/** * Freshdesk ticket plugin. Drag tickets into the diagram. Tickets are * updated on file open, page select and via Extras, Update Tickets. * * Drag freshdesk tickets into the diagram. Domain must match deskDomain.freshdesk.com. * * Use #C to configure the client as follows: * * https://www.draw.io/?p=tick...
vuln
Safe
JavaScript
@Override public Statement visitGrantRoleToUser(IoTDBSqlParser.GrantRoleToUserContext ctx) { AuthorStatement authorStatement = new AuthorStatement(AuthorOperator.AuthorType.GRANT_ROLE_TO_USER); authorStatement.setRoleName(parseIdentifier(ctx.roleName.getText())); authorStatement.setUserName(parseI...
vuln
Vulnerable
Java
VLANClientState *qemu_new_vlan_client(VLANState *vlan, IOReadHandler *fd_read, void *opaque) { VLANClientState *vc, **pvc; vc = qemu_mallocz(sizeof(VLANClientState)); if (!vc) return NULL; vc->fd_read = fd_read; vc->opaque = opaque; vc->vlan = vlan; ...
vuln
Vulnerable
C/C++
static void n_hdlc_send_frames(struct n_hdlc *n_hdlc, struct tty_struct *tty) { register int actual; unsigned long flags; struct n_hdlc_buf *tbuf; if (debuglevel >= DEBUG_LEVEL_INFO) printk("%s(%d)n_hdlc_send_frames() called\n",__FILE__,__LINE__); check_again: spin_lock_irqsave(&n_hdlc->tx_buf_list.spinlo...
vuln
Vulnerable
Unknown
static int virtio_rng_device_exit(DeviceState *qdev) { VirtIORNG *vrng = VIRTIO_RNG(qdev); VirtIODevice *vdev = VIRTIO_DEVICE(qdev); timer_del(vrng->rate_limit_timer); timer_free(vrng->rate_limit_timer); unregister_savevm(qdev, "virtio-rng", vrng); virtio_cleanup(vdev); return 0; }
vuln
Vulnerable
C/C++
static int analyze_chunk(AVFormatContext *s, const uint8_t *chunk) { TYDemuxContext *ty = s->priv_data; int num_recs, i; TyRecHdr *hdrs; int num_6e0, num_be0, num_9c0, num_3c0; if (AV_RB32(&chunk[0]) == TIVO_PES_FILEID) return 0; num_recs = chunk[0]; if (num_recs < 5) { ...
vuln
Vulnerable
C/C++
@Override public boolean startBackgroundScan() { if (!RadioServiceUserController.isCurrentOrSystemUser()) { Slogf.w(TAG, "Cannot start background scan on HAL 1.x client from non-current user"); return false; } synchronized (mLock) { che...
vuln
Safe
Java
public String createAuthCertSignRequest() { if (selectedCaId != 0) { FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put("selectedCaName", caidtonamemap.get(selectedCaId)); FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put("selectedCaId", s...
vuln
Vulnerable
Java
xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) { const xmlChar *name; xmlEntityPtr entity = NULL; xmlParserInputPtr input; if (RAW != '%') return; switch(ctxt->instate) { case XML_PARSER_CDATA_SECTION: return; case XML_PARSER_COMMENT: return; case XML_PARSER_START_TAG: r...
vuln
Safe
Unknown
static int handle_cmd(AHCIState *s, int port, int slot) { IDEState *ide_state; uint32_t opts; uint64_t tbl_addr; AHCICmdHdr *cmd; uint8_t *cmd_fis; dma_addr_t cmd_len; if (s->dev[port].port.ifs[0].status & (BUSY_STAT|DRQ_STAT)) { DPRINTF(port, "engine busy\n"); retur...
vuln
Safe
C/C++
'use strict'; // @ts-check // ================================================================================== // internet.js // ---------------------------------------------------------------------------------- // Description: System Information - library // for Node.js // Copyright: (c) 2014 - ...
vuln
Vulnerable
JavaScript
def get_absolute_path(path): import os script_dir = os.path.dirname(__file__) # <-- absolute dir the script is in rel_path = path abs_file_path = os.path.join(script_dir, rel_path) return abs_file_path
vuln
Vulnerable
Python
@Override protected void onExecuted(Bundle args, long[] ids) { DB db = DB.getInstance(context); LiveData<Integer> ld = db.message().liveRaw(ids); ld.observe(getViewLifecycleOwner(), new Observer<Integer>() { @Override pu...
vuln
Safe
Java
double av_get_double(void *obj, const char *name, const AVOption **o_out) { int64_t intnum=1; double num=1; int den=1; if (av_get_number(obj, name, o_out, &num, &den, &intnum) < 0) return -1; return num*intnum/den; }
vuln
Safe
C/C++
int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) { int ret; sigset_t sigsaved; /* Make sure they initialize the vcpu with KVM_ARM_VCPU_INIT */ if (unlikely(vcpu->arch.target < 0)) return -ENOEXEC; ret = kvm_vcpu_first_run_init(vcpu); if (ret) return ret; if (run->exit_reason == KVM_...
vuln
Vulnerable
C/C++
public void clearResourceLostListener() { synchronized (mOnResourceLostListenerLock) { mOnResourceLostListener = null; mOnResourceLostListenerExecutor = null; } }
vuln
Safe
Java
static void emulate_spapr_hypercall(PPCVirtualHypervisor *vhyp, PowerPCCPU *cpu) { CPUPPCState *env = &cpu->env; if (msr_pr) { hcall_dprintf("Hypercall made with MSR[PR]=1\n"); env->gpr[3] = H_PRIVILEGE; } else { env->gpr[3] = spapr_hypercall(cpu, ...
vuln
Vulnerable
C/C++
void WebContentsImpl::CreateNewWindow( RenderFrameHost* opener, int32_t render_view_route_id, int32_t main_frame_route_id, int32_t main_frame_widget_route_id, const mojom::CreateNewWindowParams& params, SessionStorageNamespace* session_storage_namespace) { DCHECK_EQ((render_view_route_id == MS...
vuln
Vulnerable
C/C++
import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import j...
vuln
Safe
Java
static int on_frame_recv(nghttp2_session *session, const nghttp2_frame *frame, void *user_data) { int rv; ogs_sbi_session_t *sbi_sess = user_data; ogs_sbi_server_t *server = NULL; ogs_sbi_stream_t *stream = NULL; ogs_sbi_request_t *request = NULL; ogs_assert(sbi_sess);...
vuln
Safe
C/C++
static int mmap_frag(abi_ulong real_start, abi_ulong start, abi_ulong end, int prot, int flags, int fd, abi_ulong offset) { abi_ulong real_end, addr; void *host_start; int prot1, prot_new; real_end = real_start + qemu_host_page_size; host_start = g2h(real_st...
vuln
Safe
C/C++
static struct bpf_verifier_state *push_stack(struct bpf_verifier_env *env, int insn_idx, int prev_insn_idx) { struct bpf_verifier_state *cur = env->cur_state; struct bpf_verifier_stack_elem *elem; int err; elem = kzalloc(sizeof(struct bpf_verifier_stack_elem), GFP_KERNEL); if (!elem) goto err; elem-...
vuln
Vulnerable
Unknown
public int detectCrasher(MethodNode node) { int curLine = -1; try { for (AbstractInsnNode abstractInsnNode : node.instructions.toArray()) { if (abstractInsnNode instanceof MethodInsnNode) { MethodInsnNode methodInsnNode = (MethodInsnNode) abstractInsnNode; // Variant A ...
vuln
Vulnerable
Java
private boolean setLockCredentialInternal(LockscreenCredential credential, LockscreenCredential savedCredential, int userId, boolean isLockTiedToParent) { Objects.requireNonNull(credential); Objects.requireNonNull(savedCredential); if (DEBUG) Slog.d(TAG, "setLockCredentialInternal: u...
vuln
Safe
Java
static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus, const char *name, int devfn) { PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(pci_dev); PCIConfigReadFunc *config_read = pc->config_read; PCIConfigWriteFunc *config_write = pc->config_write; Add...
vuln
Safe
C/C++
int PipeSocketHandler::connect(const SocketEndpoint& endpoint) { lock_guard<std::recursive_mutex> mutexGuard(globalMutex); string pipePath = endpoint.name(); sockaddr_un remote; int sockFd = ::socket(AF_UNIX, SOCK_STREAM, 0); FATAL_FAIL(sockFd); initSocket(sockFd); remote.sun_family = AF_UNIX; strcpy(...
vuln
Vulnerable
C/C++
void kvm_arch_update_guest_debug(CPUState *env, struct kvm_guest_debug *dbg) { const uint8_t type_code[] = { [GDB_BREAKPOINT_HW] = 0x0, [GDB_WATCHPOINT_WRITE] = 0x1, [GDB_WATCHPOINT_ACCESS] = 0x3 }; const uint8_t len_code[] = { [1] = 0x0, [2] = 0x1, [4] = 0x3, [8] = 0x2 }...
vuln
Safe
C/C++
def build_task_instance_run_id(dag_id, task_id, execution_date, try_number): return str( uuid.uuid3( uuid.NAMESPACE_URL, f"{_DAG_NAMESPACE}.{dag_id}.{task_id}.{execution_date}.{try_number}", ) )
vuln
Safe
Python