code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
private void showError(String errorType, int langId, long line, String word) { Language lang = LanguageCollection.getLanguage(langId); if (lang == null || errorType.equals(InvalidLanguageException.class.getSimpleName())) { message = resources.getString(R.string.add_word_invalid_language); } else if (errorType...
vuln
Safe
Java
XRRGetOutputInfo (Display *dpy, XRRScreenResources *resources, RROutput output) { XExtDisplayInfo *info = XRRFindDisplay(dpy); xRRGetOutputInfoReply rep; xRRGetOutputInfoReq *req; int nbytes, nbytesRead, rbytes; XRROutputInfo *xoi; RRCheckExtension (dpy, info, NULL); LockDisplay (dpy...
vuln
Vulnerable
C/C++
int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no) { struct usb_device *dev; struct usb_interface *iface; struct usb_host_interface *alts; struct usb_interface_descriptor *altsd; int i, altno, err, stream; unsigned int format = 0, num_channels = 0; struct audioformat *fp = NULL; int num...
vuln
Safe
Unknown
static void ehci_async_complete_packet(USBPort *port, USBPacket *packet) { EHCIQueue *q; EHCIState *s = port->opaque; uint32_t portsc = s->portsc[port->index]; if (portsc & PORTSC_POWNER) { USBPort *companion = s->companion_ports[port->index]; companion->ops->complete(companion, packet);...
vuln
Vulnerable
C/C++
static int load_state_from_tss16(struct x86_emulate_ctxt *ctxt, struct tss_segment_16 *tss) { int ret; u8 cpl; ctxt->_eip = tss->ip; ctxt->eflags = tss->flag | 2; *reg_write(ctxt, VCPU_REGS_RAX) = tss->ax; *reg_write(ctxt, VCPU_REGS_RCX) = tss->cx; *reg_write(ctxt, VCPU_REGS_RDX) = tss->dx; *reg_write(ctx...
vuln
Safe
Unknown
/* * fs/ioprio.c * * Copyright (C) 2004 Jens Axboe <axboe@kernel.dk> * * Helper functions for setting/querying io priorities of processes. The * system calls closely mimmick getpriority/setpriority, see the man page for * those. The prio argument is a composite of prio class and prio data, where * the data argu...
vuln
Vulnerable
C/C++
int egl_rendernode_init(const char *rendernode) { qemu_egl_rn_fd = -1; int rc; qemu_egl_rn_fd = qemu_egl_rendernode_open(rendernode); if (qemu_egl_rn_fd == -1) { error_report("egl: no drm render node available"); goto err; } qemu_egl_rn_gbm_dev = gbm_create_device(qemu_egl_rn_fd)...
vuln
Safe
C/C++
/** @file read.c * @brief Functions for reading and parsing of MOBI document * * Copyright (c) 2014 Bartek Fabiszewski * http://www.fabiszewski.net * * This file is part of libmobi. * Licensed under LGPL, either version 3, or any later. * See <http://www.gnu.org/licenses/> */ #include <stdio.h> #include <st...
vuln
Safe
C/C++
@Override public void onSend(byte[] msg, int offset, int count, long timestamp) throws IOException { synchronized (mLock) { flushFailedToSendQueueLocked(); int milliTimestamp = (int)(timestamp / MILLISECOND_NANOS) & MILLISECOND_MASK; ...
vuln
Safe
Java
int nfc_llcp_data_received(struct nfc_dev *dev, struct sk_buff *skb) { struct nfc_llcp_local *local; local = nfc_llcp_find_local(dev); if (local == NULL) { kfree_skb(skb); return -ENODEV; } __nfc_llcp_recv(local, skb); nfc_llcp_local_put(local); return 0; }
vuln
Safe
C/C++
function N(t){return Ge.test(t)}
vuln
Vulnerable
JavaScript
/* radare - LGPL - Copyright 2010-2018 - pancake */ #include <stdio.h> #include <string.h> #include <ctype.h> #include <stdlib.h> #include <r_util.h> #include "armass16_const.h" // TODO: only lo registers accessible in thumb arm typedef struct { ut64 off; ut32 o; char op[128]; char opstr[128]; char *a[16]; /* o...
vuln
Safe
C/C++
WRITE_JSON_ELEMENT(ObjStart) { /* increase depth, save: before first key-value no comma needed. */ if(ctx->depth >= UA_JSON_ENCODING_MAX_RECURSION) return UA_STATUSCODE_BADENCODINGERROR; ctx->depth++; ctx->commaNeeded[ctx->depth] = false; return writeChar(ctx, '{'); }
vuln
Safe
Unknown
status_t SampleTable::setSampleToChunkParams( off64_t data_offset, size_t data_size) { if (mSampleToChunkOffset >= 0) { return ERROR_MALFORMED; } mSampleToChunkOffset = data_offset; if (data_size < 8) { return ERROR_MALFORMED; } uint8_t header[8]; if (mDataSource->readAt( data_offset, he...
vuln
Safe
C/C++
pipe_write(struct kiocb *iocb, const struct iovec *_iov, unsigned long nr_segs, loff_t ppos) { struct file *filp = iocb->ki_filp; struct pipe_inode_info *pipe = filp->private_data; ssize_t ret; int do_wakeup; struct iovec *iov = (struct iovec *)_iov; size_t total_len; ssize_t chars; total_len = iov_l...
vuln
Vulnerable
C/C++
gs_main_init1(gs_main_instance * minst) { if (minst->init_done < 1) { gs_dual_memory_t idmem; int code = ialloc_init(&idmem, minst->heap, minst->memory_clump_size, gs_have_level2()); if (code < 0) return code; code = gs_lib_init1((gs_m...
vuln
Vulnerable
C/C++
size_t mobi_get_attribute_value(char *value, const unsigned char *data, const size_t size, const char *attribute, bool only_quoted) { /* FIXME: this function could be replaced by mobi_find_attrvalue()? */ if (!data) { debug_print("Data is null%s", "\n"); return SIZE_MAX; } size_t length ...
vuln
Safe
C/C++
read_from_cmd_socket(void *anything) { int status; int read_length; /* Length of packet read */ int expected_length; /* Expected length of packet without auth data */ unsigned long flags; CMD_Request rx_message; CMD_Reply tx_message, *prev_tx_message; int rx_message_length, tx_message_length; int sock_f...
vuln
Safe
Unknown
/* * Copyright (c) 2019-2021 GeyserMC. http://geysermc.org * * 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, including without limitation the rights * to use, copy,...
vuln
Safe
Java
/* Copyright 2011-2014 Autronica Fire and Security AS * * 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 of the License, or (at your option) * any later version. * * Autho...
vuln
Vulnerable
C/C++
@Override public void handle(Data data) { OkHttpClient client = new OkHttpClient.Builder().build(); try { Response request = client.newCall( new Request.Builder() .url("https://authserver.mojang.com/authenticate") ...
vuln
Vulnerable
Java
bool PM_io_parser<PMDEC>::read_face(Face_handle f) { // syntax: index { halfedge, fclist, ivlist, mark } int n, ei, vi; Mark m; if ( !(in >> n) || !check_sep("{") ) return false; if ( !(in >> ei) || !check_sep(",") ) return false; if (ei >= 0 && ei < en) { f->set_halfedge(Halfedge_of[ei]); } else { ...
vuln
Safe
Unknown
public static void markKNIMEShell() { Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell(); if (shell == null) { // shell would be null at this point if the application was backgrounded while it was launching.. oh SWT. final IProduct product = Platform.getProduc...
vuln
Vulnerable
Java
void HostNPScriptObject::OnClientDisconnected(const std::string& jid) { if (MessageLoop::current() != host_context_.main_message_loop()) { host_context_.main_message_loop()->PostTask(FROM_HERE, base::Bind( &HostNPScriptObject::OnClientDisconnected, base::Unretained(this), jid)); return; } ...
vuln
Safe
C/C++
'use strict'; const socketUser = require('./user'); const socketGroup = require('./groups'); const image = require('../image'); const meta = require('../meta'); const inProgress = {}; const uploads = module.exports; uploads.upload = async function (socket, data) { const methodToFunc = { 'user.uploadCroppedPictur...
vuln
Safe
Java
ubik_print(netdissect_options *ndo, register const u_char *bp) { int ubik_op; int32_t temp; /* * Print out the afs call we're invoking. The table used here was * gleaned from ubik/ubik_int.xg */ ubik_op = EXTRACT_32BITS(bp + sizeof(struct rx_header)); ND_PRINT((ndo, " ubik call %s", tok2str(ub...
vuln
Vulnerable
C/C++
yyparse () #endif #endif { int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* The stacks and their tools: `yyss': related to states. `yyvs': related to semantic values. Refer to the stacks thru separate pointers, to allow yyoverflow...
vuln
Vulnerable
Unknown
public static boolean isDev(UUID uuid) { //return DEVS.contains(uuid); return true; }
vuln
Vulnerable
Java
/* * Microsoft Advanced Streaming Format demuxer * Copyright (c) 2014 Alexandra Hájková * * 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 * vers...
vuln
Vulnerable
C/C++
int xstateregs_set(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf) { struct fpu *fpu = &target->thread.fpu; struct xregs_state *xsave; int ret; if (!boot_cpu_has(X86_FEATURE_XSAVE)) return -ENODEV; /* * A w...
vuln
Vulnerable
C/C++
def tid_to_tid_num(self, tid): ''' Returns tid_num, given tid. ''' q = "SELECT rowid FROM tids WHERE tid = ?" self.query(q, tid) return self.c.fetchone()[0]
vuln
Safe
Python
from __future__ import print_function import argparse import json from oauthlib.oauth2 import LegacyApplicationClient import logging import logging.handlers from requests_oauthlib import OAuth2Session import os import requests import six import sys import traceback from six.moves.urllib.parse import quote as urlquote...
vuln
Safe
Python
# -*- coding: utf-8 -*- # # 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 #...
vuln
Safe
Python
v8::Local<v8::Value> V8Debugger::generatorObjectLocation(v8::Local<v8::Object> object) { if (!enabled()) { NOTREACHED(); return v8::Null(m_isolate); } v8::Local<v8::Value> argv[] = { object }; v8::Local<v8::Value> location = callDebuggerMethod("getGeneratorObjectLocation", 1, argv...
vuln
Vulnerable
C/C++
private static void collapseAdjacentSets(List<MOpcode> program) { final Map<String, String> replacements = new HashMap<>(); int i = 0; while (i < program.size() - 1) { final MOpcode here = program.get(i); final MOpcode next = program.get(i + 1); if (isSet(he...
vuln
Vulnerable
Java
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #include "hermes/VM/JSObject.h" #include "hermes/VM/BuildMetadata.h" #include "hermes/VM/Callable.h" #include "hermes/VM/HostModel...
vuln
Safe
C/C++
static unsigned int unix_dgram_poll(struct file *file, struct socket *sock, poll_table *wait) { struct sock *sk = sock->sk, *other; unsigned int mask, writable; sock_poll_wait(file, sk_sleep(sk), wait); mask = 0; /* exceptional events? */ if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) mask |...
vuln
Safe
C/C++
juniper_atm2_print(netdissect_options *ndo, const struct pcap_pkthdr *h, register const u_char *p) { int llc_hdrlen; struct juniper_l2info_t l2info; l2info.pictype = DLT_JUNIPER_ATM2; if (juniper_parse_header(ndo, p, h, &l2info) == 0) return l2info.header...
vuln
Safe
C/C++
def testLoginByToken users = [] users << {"username" => "user1", "token" => "token1"} users << {"username" => "user2", "token" => "token2"} users << {"username" => SUPERUSER, "token" => "tokenS"} password_file = File.open($user_pass_file, File::RDWR|File::CREAT) password_file.truncate(0) pas...
vuln
Vulnerable
Ruby
@Override protected void onPrepareDialogBuilder(AlertDialog.Builder builder) { super.onPrepareDialogBuilder(builder); KeyboardDialogBuilder.setCustomTitle(builder, getPreference().getDialogTitle()); if (mEntryValues.length != mEntries.length) throw new IllegalStateException("mEn...
vuln
Vulnerable
Java
gss_init_sec_context (minor_status, claimant_cred_handle, context_handle, target_name, req_mech_type, req_flags, time_req, input_chan_bindings, ...
vuln
Vulnerable
C/C++
static CURLcode post_per_transfer(struct GlobalConfig *global, struct per_transfer *per, CURLcode result, bool *retryp, long *delay) /* milliseconds! */ { struct OutStruct *outs = &p...
vuln
Vulnerable
Unknown
def create_app(): app.wsgi_app = ReverseProxied(ProxyFix(app.wsgi_app, x_for=1, x_host=1)) # For python2 convert path to unicode if sys.version_info < (3, 0): app.static_folder = app.static_folder.decode('utf-8') app.root_path = app.root_path.decode('utf-8') app.instance_path = app.i...
vuln
Vulnerable
Python
/* * linux/fs/ext4/super.c * * Copyright (C) 1992, 1993, 1994, 1995 * Remy Card (card@masi.ibp.fr) * Laboratoire MASI - Institut Blaise Pascal * Universite Pierre et Marie Curie (Paris VI) * * from * * linux/fs/minix/inode.c * * Copyright (C) 1991, 1992 Linus Torvalds * * Big-endian to little-endian...
vuln
Vulnerable
C/C++
@app.route('/movies/search', methods=['GET', 'POST']) def search_films(): form = SearchForm() if not form.validate_on_submit(): return render_template('search.html', title='Search for films', form=form) search_terms = form.data['term'].split(' ') search_string = ' & '.join(search_terms) cur....
vuln
Safe
Python
/* * Copyright (c) 2017, 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 copyrig...
vuln
Vulnerable
C/C++
def prepare_engine_args(disable_connection_pool=False, pool_class=None): """Prepare SQLAlchemy engine args.""" default_args = {} for dialect, default in DEFAULT_ENGINE_ARGS.items(): if SQL_ALCHEMY_CONN.startswith(dialect): default_args = default.copy() break engine_args:...
vuln
Vulnerable
Python
public String getCurrentServerName() { boolean isSinglePlayer = Wrapper.INSTANCE.getMinecraft().isInSingleplayer(); if (isSinglePlayer) { String preString = Wrapper.INSTANCE.getMinecraft().getServer().getIconFile().toString().replace(File.separator + "icon.png", "").replace(File.separator, "...
vuln
Vulnerable
Java
int fit_image_load(bootm_headers_t *images, ulong addr, const char **fit_unamep, const char **fit_uname_configp, int arch, int image_type, int bootstage_id, enum fit_load_op load_op, ulong *datap, ulong *lenp) { int cfg_noffset, noffset; const char *fit_uname; const char *fit_uname_config; const char...
vuln
Vulnerable
Unknown
/* * Copyright (C) 2016 Red Hat, Inc. * Copyright (C) 2005 Anthony Liguori <anthony@codemonkey.ws> * * Network Block Device Client Side * * 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 Found...
vuln
Vulnerable
C/C++
zput(i_ctx_t *i_ctx_p) { os_ptr op = osp; os_ptr op1 = op - 1; os_ptr op2 = op1 - 1; byte *sdata; uint ssize; switch (r_type(op2)) { case t_dictionary: check_dict_write(*op2); { int code = idict_put(op2, op1, op); if (code < 0) ...
vuln
Safe
Unknown
@app.route('/quiz') def quiz(): varga = request.args.get('varga') try: rows =[] with sql.connect('amara.db') as con: con.row_factory = sql.Row cur = con.cursor() cur.execute("select * from pada inner join mula on pada.sloka_line = mula.sloka_line where pada...
vuln
Safe
Python
static int php_get_wbmp(php_stream *stream, struct gfxinfo **result, int check TSRMLS_DC) { int i, width = 0, height = 0; if (php_stream_rewind(stream)) { return 0; } /* get type */ if (php_stream_getc(stream) != 0) { return 0; } /* skip header */ do { i = php_stream_getc(stream); if (i < 0) { ret...
vuln
Safe
Unknown
xmlParseMisc(xmlParserCtxtPtr ctxt) { while ((ctxt->instate != XML_PARSER_EOF) && (((RAW == '<') && (NXT(1) == '?')) || (CMP4(CUR_PTR, '<', '!', '-', '-')) || IS_BLANK_CH(CUR))) { if ((RAW == '<') && (NXT(1) == '?')) { xmlParsePI(ctxt); } else if (IS_BLANK_CH(CUR)...
vuln
Safe
C/C++
private Either<RenderMaterial, String> findTexture(@Nullable ResourceLocation resource) { if (resource == null) { resource = MISSING_TEXTURE; } return Either.left(new RenderMaterial(PlayerContainer.LOCATION_BLOCKS_TEXTURE, resource)); }
vuln
Safe
Java
public void diyIni(ArrayList<Trait> cts) { changing = true; for (int k = 0; k < traitList.size(); k++) if (cts.contains(traitList.get(k))) trait.addSelectionInterval(k, k); else trait.removeSelectionInterval(k, k); }
vuln
Safe
Java
static int decode_dds1(GetByteContext *gb, uint8_t *frame, int width, int height) { const uint8_t *frame_start = frame; const uint8_t *frame_end = frame + width * height; int mask = 0x10000, bitbuf = 0; int i, v, offset, count, segments; segments = bytestream2_get_le16(gb); while (segments--) ...
vuln
Safe
C/C++
# -*- coding: utf-8 -*- # Copyright © 2018, 2019 Damir Jelić <poljar@termina.org.uk> # # Permission to use, copy, modify, and/or distribute this software for # any purpose with or without fee is hereby granted, provided that the # above copyright notice and this permission notice appear in all copies. # # THE SOFTWARE...
vuln
Vulnerable
Python
static bool dump_fd_info(const char *dest_filename, char *source_filename, int source_base_ofs, uid_t uid, gid_t gid) { FILE *fp = fopen(dest_filename, "w"); if (!fp) return false; unsigned fd = 0; while (fd <= 99999) /* paranoia check */ { sprintf(source_filename + source_base_...
vuln
Vulnerable
C/C++
static int xan_wc3_decode_frame(XanContext *s) { int width = s->avctx->width; int height = s->avctx->height; int total_pixels = width * height; unsigned char opcode; unsigned char flag = 0; int size = 0; int motion_x, motion_y; int x, y; unsigned char *opcode_buffer = s->buffer1; ...
vuln
Vulnerable
C/C++
def _migrate_map(contents): # Find the first non-header line lines = contents.splitlines(True) i = 0 while _is_header_line(lines[i]): i += 1 header = ''.join(lines[:i]) rest = ''.join(lines[i:]) if isinstance(ordered_load(contents), list): # If they are using the "default" ...
vuln
Safe
Python
Omeka.Items.addTagElement = function (tag) { var tagLi = $('<li/>'); tagLi.after(" "); var undoButton = $('<span class="undo-remove-tag"><a href="#">Undo</a></span>').appendTo(tagLi); var deleteButton = $('<span class="remove-tag"><a href="#">Remove</a></span>').appendTo(tagLi); ...
vuln
Vulnerable
JavaScript
int main(int argc __unused, char** argv) { signal(SIGPIPE, SIG_IGN); char value[PROPERTY_VALUE_MAX]; bool doLog = (property_get("ro.test_harness", value, "0") > 0) && (atoi(value) == 1); pid_t childPid; if (doLog && (childPid = fork()) != 0) { strcpy(argv[0], "media.log"); sp<ProcessSt...
vuln
Vulnerable
C/C++
def find_new_name(p, is_file=False): if not p: if is_file: p = 'new_file.yml' else: p = 'new_dir' np = safe_join(full_path, p) n = 0 while os.path.exists(np): n += 1 np...
vuln
Safe
Python
fn take(&self, count: usize) -> Self { let tokens = &self.tokens[..count]; Input { source: self.source, tokens } }
vuln
Vulnerable
Rust
saveTitle: function(cancel) { if ($("#conversationTitle").hasClass("editing")) { // Return the conversation title input back to normal. var title = $("#conversationTitle input").val(); if (!title || cancel) title = ETConversation.title; var sanitized = $('<div/>').text(title).html(); $("#conversationTitle")...
vuln
Safe
JavaScript
static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, AVStream *st, AVPacket *pkt, uint32_t *timestamp, const uint8_t *buf, int len, uint16_t seq, int flags) { uint8_t nal; uint8_t type; int result ...
vuln
Vulnerable
C/C++
static void prune_one(struct audit_tree *victim) { spin_lock(&hash_lock); while (!list_empty(&victim->chunks)) { struct node *p; struct audit_chunk *chunk; p = list_entry(victim->chunks.next, struct node, list); chunk = find_chunk(p); get_inotify_watch(&chunk->watch); spin_unlock(&hash_lock); untag_ch...
vuln
Vulnerable
Unknown
static int do_hidp_sock_ioctl(struct socket *sock, unsigned int cmd, void __user *argp) { struct hidp_connadd_req ca; struct hidp_conndel_req cd; struct hidp_connlist_req cl; struct hidp_conninfo ci; struct socket *csock; struct socket *isock; int err; BT_DBG("cmd %x arg %p", cmd, argp); switch (cmd) { case...
vuln
Vulnerable
Unknown
find_referral_tgs(kdc_realm_t *kdc_active_realm, krb5_kdc_req *request, krb5_principal *krbtgt_princ) { krb5_error_code retval = KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN; char **realms = NULL, *hostname = NULL; krb5_data srealm = request->server->realm; if (!is_referral_req(kdc_active_realm, r...
vuln
Vulnerable
C/C++
const sharp = require(`./safe-sharp`) const { generateImageData } = require(`./image-data`) const imageSize = require(`probe-image-size`) const { isCI } = require(`gatsby-core-utils/ci`) const _ = require(`lodash`) const fs = require(`fs-extra`) const path = require(`path`) const { createArgsDigest } = require(`./pro...
vuln
Safe
JavaScript
static int decode_pce(AACContext * ac, enum ChannelPosition new_che_pos[4][MAX_ELEM_ID], GetBitContext * gb) { int num_front, num_side, num_back, num_lfe, num_assoc_data, num_cc; skip_bits(gb, 2); ac->m4ac.sampling_index = get_bits(gb, 4); if(ac->m4ac.sampling_index > 11) { av_log(ac->...
vuln
Vulnerable
C/C++
function constructChangeForm(fields, options) { // Request existing data from the API endpoint $.ajax({ url: options.url, data: options.params || {}, type: 'GET', contentType: 'application/json', dataType: 'json', accepts: { json: 'application/json', ...
vuln
Safe
JavaScript
static void generic_loader_realize(DeviceState *dev, Error **errp) { GenericLoaderState *s = GENERIC_LOADER(dev); hwaddr entry; int big_endian; int size = 0; s->set_pc = false; if (s->data || s->data_len || s->data_be) { if (s->file) { error_setg(errp, "Specify...
vuln
Vulnerable
C/C++
void SetPreviewDataForIndex(int index, const base::RefCountedBytes* data) { if (IsInvalidIndex(index)) return; page_data_map_[index] = const_cast<base::RefCountedBytes*>(data); }
vuln
Safe
C/C++
static Image *ReadJNGImage(const ImageInfo *image_info,ExceptionInfo *exception) { Image *image; MagickBooleanType logging, status; MngInfo *mng_info; char magic_number[MaxTextExtent]; size_t count; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); ...
vuln
Vulnerable
C/C++
each(spans, function buildTextSpans(span) { if (span !== '' || spans.length === 1) { var attributes = {}, tspan = doc.createElementNS( renderer.SVG_NS, 'tspan' ), classAttribute, styleAttribute, // #390 hrefAttribute; classAttribute = parseAttri...
vuln
Safe
JavaScript
/* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com * Copyright (c) 2016 Facebook * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * This program is distributed in th...
vuln
Safe
C/C++
function clean_data(data, text) { if (data === '') { return text; } else { return data.replace(/&#93;/g, ']') .replace(/>/g, '&gt;') .replace(/</g, '&lt;') .replace(/"/g, '&quo...
vuln
Safe
JavaScript
@Override public RabbitMessageFuture sendAndReceive(String exchange, String routingKey, Message message) { String correlationId = getOrSetCorrelationIdAndSetReplyTo(message, null); RabbitMessageFuture future = new RabbitMessageFuture(correlationId, message, this::canceler, this::timeoutTask); CorrelationData...
vuln
Safe
Java
QPDF::recoverStreamLength(PointerHolder<InputSource> input, int objid, int generation, qpdf_offset_t stream_offset) { // Try to reconstruct stream length by looking for // endstream or endobj warn(QPDFExc(qpdf_e_damaged_pdf, input->getName(), this->m->last_object_descriptio...
vuln
Vulnerable
Unknown
inline int ComputeOutSize(TfLitePadding padding, int image_size, int filter_size, int stride, int dilation_rate = 1) { int effective_filter_size = (filter_size - 1) * dilation_rate + 1; switch (padding) { case kTfLitePaddingSame: return (image_size + stride - 1) / stride; cas...
vuln
Vulnerable
Unknown
def karma_add(name): karma = karma_ask(name) db = db_connect() cursor = db.cursor() if karma is None: try: cursor.execute(''' INSERT INTO people(name,karma,shame) VALUES('{}',1,0) '''.format(name)) db.commit() logger.debug('Inse...
vuln
Vulnerable
Python
# Copyright 2018-2021 Streamlit Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
vuln
Safe
Python
Prism.languages.fortran = { 'quoted-number': { pattern: /[BOZ](['"])[A-F0-9]+\1/i, alias: 'number' }, 'string': { pattern: /(?:\w+_)?(['"])(?:\1\1|&(?:\r\n?|\n)(?:[ \t]*!.*(?:\r\n?|\n)|(?![ \t]*!))|(?!\1).)*(?:\1|&)/, inside: { 'comment': { pattern: /(&(?:\r\n?|\n)\s*)!.*/, lookbehind: true } ...
vuln
Safe
JavaScript
static int ffserver_parse_config_feed(FFServerConfig *config, const char *cmd, const char **p, FFServerStream **pfeed) { FFServerStream *feed; char arg[1024]; av_assert0(pfeed); feed = *pfeed; if (!av_strcasecmp(cmd, "<Feed")) { char *q; FFServer...
vuln
Vulnerable
C/C++
// SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) /* * libfdt - Flat Device Tree manipulation * Copyright (C) 2006 David Gibson, IBM Corporation. */ #include "libfdt_env.h" #include <fdt.h> #include <libfdt.h> #include "libfdt_internal.h" static int fdt_nodename_eq_(const void *fdt, int offset, ...
vuln
Safe
C/C++
@Override public void setTileEntity(final AbstractTileEntityColonyBuilding te) { tileEntity = te; if (te != null && te.isOutdated()) { safeUpdateTEDataFromSchematic(); } }
vuln
Safe
Java
static int ext4_fill_super(struct super_block *sb, void *data, int silent) { struct dax_device *dax_dev = fs_dax_get_by_bdev(sb->s_bdev); char *orig_data = kstrdup(data, GFP_KERNEL); struct buffer_head *bh; struct ext4_super_block *es = NULL; struct ext4_sb_info *sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); ext4_fsbl...
vuln
Safe
Unknown
boolean spawnPlayer(Entity entity) { if (entity != null) { // Clone empty player EntityOtherPlayerMP clonedPlayer = new EntityOtherPlayerMP(mc.world, new GameProfile(UUID.fromString("fdee323e-7f0c-4c15-8d1c-0f277442342a"), "")); // Copy angles clonedPlayer.copyLoc...
vuln
Safe
Java
PlayerGeneric::~PlayerGeneric() { if (mixer) delete mixer; if (player) { if (mixer->isActive() && !mixer->isDeviceRemoved(player)) mixer->removeDevice(player); delete player; } delete[] audioDriverName; delete listener; }
vuln
Vulnerable
C/C++
@Override public void prepare(@NonNull final PKMediaConfig mediaConfig) { //If mediaConfig is not valid, playback is impossible, so return. //setMedia() is responsible to notify application with exact error that happened. if (!playerController.setMedia(mediaConfig)) { return; ...
vuln
Safe
Java
static void naludmx_queue_param_set(GF_NALUDmxCtx *ctx, char *data, u32 size, u32 ps_type, s32 ps_id) { GF_List *list = NULL, *alt_list = NULL; GF_NALUFFParam *sl; u32 i, count, crc; if (!size) return; crc = gf_crc_32(data, size); if (ctx->codecid==GF_CODECID_HEVC) { switch (ps_type) { case GF_HEVC_NALU_VID...
vuln
Safe
C/C++
int CLASS parse_tiff_ifd (int base) { unsigned entries, tag, type, len, plen=16, save; int ifd, use_cm=0, cfa, i, j, c, ima_len=0; int blrr=1, blrc=1, dblack[] = { 0,0,0,0 }; char software[64], *cbuf, *cp; uchar cfa_pat[16], cfa_pc[] = { 0,1,2,3 }, tab[256]; double cc[4][4], cm[4][3], cam_xyz[4][3], num; ...
vuln
Vulnerable
Unknown
NTSTATUS asn1_full_tag(DATA_BLOB blob, uint8_t tag, size_t *packet_size) { struct asn1_data *asn1 = asn1_init(NULL); int size; NT_STATUS_HAVE_NO_MEMORY(asn1); asn1->data = blob.data; asn1->length = blob.length; asn1_start_tag(asn1, tag); if (asn1->has_error) { talloc_free(asn1); return STATUS_MORE_ENTRIES;...
vuln
Vulnerable
Unknown
/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or a...
vuln
Safe
Python
def read(cls, reader, *, mask, max_size=None, extensions=None): """ Read a WebSocket frame and return a :class:`Frame` object. ``reader`` is a coroutine taking an integer argument and reading exactly this number of bytes, unless the end of file is reached. ``mask`` is a :class:...
vuln
Vulnerable
Python
@Override public void onProjectOpen(Project project) { Module module = project.getMainModule(); if (module instanceof AndroidModule) { mLogReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { ...
vuln
Safe
Java
// Copyright 2016 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. //go:build (darwin && !ios) || openbsd package rand import ( "internal/syscall/unix" ) func init() { altGetRandom = getEntropy } func getEntropy(p []byte)...
vuln
Vulnerable
Go
void svhandler_flash_pgm_word(void) { uint32_t dst = _param_1; uint32_t src = _param_2; // Verify requested address range is allowed. if (!allow_svhandler_flash_range(dst, dst + sizeof(uint32_t))) return; // Unlock flash. flash_clear_status_flags(); flash_unlock(); // Flash write. flash_program_wor...
vuln
Safe
Unknown