code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
/* * FFV1 decoder * * Copyright (c) 2003-2013 Michael Niedermayer <michaelni@gmx.at> * * 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 * versio...
vuln
Vulnerable
Python
static int rtsx_usb_ms_drv_remove(struct platform_device *pdev) { struct rtsx_usb_ms *host = platform_get_drvdata(pdev); struct memstick_host *msh = host->msh; int err; host->eject = true; cancel_work_sync(&host->handle_req); mutex_lock(&host->host_mutex); if (host->req) { dev_dbg(ms_dev(host), "%s: Contr...
vuln
Safe
C/C++
/* radare - LGPL - Copyright 2010-2021 - nibble, mrmacete, pancake */ #include <stdio.h> #include <r_types.h> #include <r_util.h> #include "mach0.h" #include <r_hash.h> // TODO: deprecate bprintf and use Eprintf (bin->self) #define bprintf if (bin->verbose) eprintf #define Eprintf if (mo->verbose) eprintf #define IS...
vuln
Vulnerable
C/C++
static Image *ReadMATImage(const ImageInfo *image_info,ExceptionInfo *exception) { Image *image, *image2=NULL, *rotated_image; PixelPacket *q; unsigned int status; MATHeader MATLAB_HDR; size_t size; size_t CellType; QuantumInfo *quantum_info; ImageInfo *clone_info; int i; ssize_t ldblk; unsign...
vuln
Vulnerable
Unknown
/* * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ #inc...
vuln
Safe
C/C++
int ff_h264_fill_default_ref_list(H264Context *h, H264SliceContext *sl) { int i, len; if (sl->slice_type_nos == AV_PICTURE_TYPE_B) { H264Picture *sorted[32]; int cur_poc, list; int lens[2]; if (FIELD_PICTURE(h)) cur_poc = h->cur_pic_ptr->field_poc[h->picture_structure...
vuln
Safe
C/C++
@Override public CoreEvent process(CoreEvent event) throws MuleException { Optional<Exception> exceptionSeen = empty(); String messageId = null; try { messageId = getIdForEvent(event); } catch (ExpressionRuntimeException e) { if (LOGGER.isDebugEnabled()) { // Logs the details of t...
vuln
Safe
Java
public static float getEstimatedHealthIncrement(int foodLevel, float saturationLevel, float exhaustionLevel) { float health = 0; if (!Float.isFinite(exhaustionLevel) || !Float.isFinite(saturationLevel)) return 0; while (foodLevel >= 18) { while (exhaustionLevel > MAX_EXHAUSTION) { exhaustionLeve...
vuln
Safe
Java
static inline uint32_t mipsdsp_sub32(int32_t a, int32_t b, CPUMIPSState *env) { int32_t temp; temp = a - b; if (MIPSDSP_OVERFLOW_SUB(a, b, temp, 0x80000000)) { set_DSPControl_overflow_flag(1, 20, env); } return temp; }
vuln
Safe
C/C++
@Nullable @ParametersAreNonnullByDefault private MachineRecipe disenchant(BlockMenu menu, ItemStack item, ItemStack book) { Map<Enchantment, Integer> enchantments = new HashMap<>(); // Find enchantments for (Map.Entry<Enchantment, Integer> entry : item.getEnchantments().entrySet()) { ...
vuln
Vulnerable
Java
/* 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
Safe
Python
static av_cold int mss2_decode_init(AVCodecContext *avctx) { MSS2Context * const ctx = avctx->priv_data; MSS12Context *c = &ctx->c; int ret; c->avctx = avctx; avctx->coded_frame = &ctx->pic; if (ret = ff_mss12_decode_init(c, 1, &ctx->sc[0], &ctx->sc[1])) return ret; c->pal_stride =...
vuln
Safe
C/C++
absl::optional<CelValue> operator[](CelValue key) const override { if (value_ == nullptr || !key.IsString()) { return {}; } auto str = std::string(key.StringOrDie().value()); if (!Http::validHeaderString(str)) { // Reject key if it is an invalid header string return {}; } auto ...
vuln
Vulnerable
Unknown
njs_iterator_to_array(njs_vm_t *vm, njs_value_t *iterator) { int64_t length; njs_int_t ret; njs_iterator_args_t args; njs_memzero(&args, sizeof(njs_iterator_args_t)); ret = njs_object_length(vm, iterator, &length); if (njs_slow_path(ret != NJS_OK)) { return NUL...
vuln
Safe
Unknown
static int __perf_event_overflow(struct perf_event *event, int nmi, int throttle, struct perf_sample_data *data, struct pt_regs *regs) { int events = atomic_read(&event->event_limit); struct hw_perf_event *hwc = &event->hw; int ret = 0; /* * Non-sampling counters might still use the PMI to fold ...
vuln
Vulnerable
C/C++
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { auto* params = reinterpret_cast<TfLiteAudioSpectrogramParams*>(node->user_data); const TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); TF_LITE_ENSURE(context, params...
vuln
Vulnerable
C/C++
copy_move_file (CopyMoveJob *copy_job, GFile *src, GFile *dest_dir, gboolean same_fs, gboolean unique_names, char **dest_fs_type, SourceInfo *source_info, TransferInfo...
vuln
Vulnerable
C/C++
static inline int onenand_load_main(OneNANDState *s, int sec, int secn, void *dest) { assert(UINT32_MAX >> BDRV_SECTOR_BITS > sec); assert(UINT32_MAX >> BDRV_SECTOR_BITS > secn); if (s->blk_cur) { return blk_pread(s->blk_cur, sec << BDRV_SECTOR_BITS, dest, se...
vuln
Safe
C/C++
public void attackWithFleet(ShipFleet fl, StarSystem target, float amount, boolean includeScouts, boolean includeFighters, boolean includeBombers, boolean includeColonizer, float needToKeep, boolean splitBySpeed) { /*if(fl.system() != null) System.out.print("\n"+empire.name()+" fleet at "+fl.sys...
vuln
Vulnerable
Java
void CoreAuthHandler::onReadyRead() { if (socket()->bytesAvailable() < 4) return; // once we have selected a peer, we certainly don't want to read more data! if (_peer) return; if (!_magicReceived) { quint32 magic; socket()->peek((char*)&magic, 4); magic = qFrom...
vuln
Safe
Unknown
int MonClient::handle_auth_request( Connection *con, AuthConnectionMeta *auth_meta, bool more, uint32_t auth_method, const ceph::buffer::list& payload, ceph::buffer::list *reply) { if (payload.length() == 0) { // for some channels prior to nautilus (osd heartbeat), we // tolerate the lack of an au...
vuln
Vulnerable
Unknown
xmit_seg(E1000State *s) { uint16_t len, *sp; unsigned int frames = s->tx.tso_frames, css, sofar, n; struct e1000_tx *tp = &s->tx; if (tp->tse && tp->cptse) { css = tp->ipcss; DBGOUT(TXSUM, "frames %d size %d ipcss %d\n", frames, tp->size, css); if (tp->ip) { ...
vuln
Vulnerable
C/C++
@Override public boolean canAlterPermission(final Rank actor, final Rank rank, @NotNull final Action action) { if (rank == getRankOwner() && actor != getRankOwner()) { return false; } return hasPermission(actor, Action.EDIT_PERMISSIONS) && (actor != rank || action !=...
vuln
Safe
Java
struct snd_seq_client_port *snd_seq_create_port(struct snd_seq_client *client, int port) { unsigned long flags; struct snd_seq_client_port *new_port, *p; int num = -1; /* sanity check */ if (snd_BUG_ON(!client)) return NULL; if (client->num_ports >= SNDRV_SEQ_MAX_PORTS) { pr_warn("ALSA: seq: too ma...
vuln
Vulnerable
C/C++
fribidi_get_par_embedding_levels_ex ( /* input */ const FriBidiCharType *bidi_types, const FriBidiBracketType *bracket_types, const FriBidiStrIndex len, /* input and output */ FriBidiParType *pbase_dir, /* output */ FriBidiLevel *embedding_levels ) { FriBidiLevel base_level_per_iso_level[FRIBIDI_BIDI_...
vuln
Safe
C/C++
AMediaCodecCryptoInfo *AMediaCodecCryptoInfo_new( int numsubsamples, uint8_t key[16], uint8_t iv[16], cryptoinfo_mode_t mode, size_t *clearbytes, size_t *encryptedbytes) { size_t cryptosize = sizeof(AMediaCodecCryptoInfo) + sizeof(size_t) * numsubsamples * 2; AMediaCodecCryptoInfo *ret = (AMed...
vuln
Vulnerable
C/C++
int av_grow_packet(AVPacket *pkt, int grow_by) { int new_size; av_assert0((unsigned)pkt->size <= INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE); if ((unsigned)grow_by > INT_MAX - (pkt->size + AV_INPUT_BUFFER_PADDING_SIZE)) return -1; new_size = pkt->size + grow_by + AV_INPUT_BUFFER_PADDING_SIZE...
vuln
Vulnerable
C/C++
addCard(hash, text, translation, asked = 0, answered = 0) { this.getUser(hash, user => { try { if (isNaN(user) || user % 1 !== 0) throw `user (${user}) must be an int`; if (typeof text != 'string' || typeof translation != 'string') throw 'text and translation must be...
vuln
Vulnerable
JavaScript
RemoteDevicePropertiesWidget::RemoteDevicePropertiesWidget(QWidget *parent) : QWidget(parent) , modified(false) , saveable(false) { setupUi(this); if (qobject_cast<QTabWidget *>(parent)) { verticalLayout->setMargin(4); } type->addItem(tr("Samba Share"), (int)Type_Samba); type->ad...
vuln
Vulnerable
Unknown
function attachedPublicKey( contactDetailsModel, keyCache, keysModel, autoPinPrimaryKeys, sendPreferences, publicKeyStore, AttachmentLoader, contactEmails, Contact, networkActivityTracker ) { /** * Extact and clean the new email * Format: * - XXXX <xxx@xxxx...
vuln
Safe
JavaScript
func (s *Shm) MarkDestroyed() { s.mu.Lock() defer s.mu.Unlock() // Prevent the segment from being found in the registry. s.key = linux.IPC_PRIVATE // Only drop the segment's self-reference once, when destruction is // requested. Otherwise, repeated calls shmctl(IPC_RMID) would force a // segment to be destroye...
vuln
Safe
Go
static int sony_init_ff(struct sony_sc *sc) { struct hid_input *hidinput; struct input_dev *input_dev; if (list_empty(&sc->hdev->inputs)) { hid_err(sc->hdev, "no inputs found\n"); return -ENODEV; } hidinput = list_entry(sc->hdev->inputs.next, struct hid_input, list); input_dev = hidinput->input; input_set_...
vuln
Safe
C/C++
def save_accepted_transaction(self, user_id, project_id, money): self.cursor.execute("update users set money = money - %s where id = %s", (money, user_id)) self.cursor.execute("update projects set money = money + %s where id = %s", (money, project_id)) self.cursor.execute("insert into transactio...
vuln
Safe
Python
# This is purely the result of trial and error. import sys from setuptools import setup, find_packages import httpie # Note: keep requirements here to ease distributions packaging tests_require = [ 'pytest', 'pytest-httpbin>=0.0.6', 'responses', ] dev_require = [ *tests_require, 'flake8', '...
vuln
Vulnerable
Python
int ssl2_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p) { long l; if (p != NULL) { l=c->id; if ((l & 0xff000000) != 0x02000000 && l != SSL3_CK_FALLBACK_SCSV) return(0); p[0]=((unsigned char)(l>>16L))&0xFF; p[1]=((unsigned char)(l>> 8L))&0xFF; p[2]=((unsigned char)(l ))&0xFF; } return(3...
vuln
Safe
Unknown
psutil_per_cpu_times(PyObject *self, PyObject *args) { natural_t cpu_count; natural_t i; processor_info_array_t info_array; mach_msg_type_number_t info_count; kern_return_t error; processor_cpu_load_info_data_t *cpu_load_info = NULL; int ret; PyObject *py_retlist = PyList_New(0); PyO...
vuln
Safe
Unknown
bool DebuggerFunction::InitTabContents() { Value* debuggee; EXTENSION_FUNCTION_VALIDATE(args_->Get(0, &debuggee)); DictionaryValue* dict = static_cast<DictionaryValue*>(debuggee); EXTENSION_FUNCTION_VALIDATE(dict->GetInteger(keys::kTabIdKey, &tab_id_)); contents_ = NULL; TabContentsWrapper* wrapper = NULL...
vuln
Vulnerable
C/C++
TfLiteStatus LeakyReluEval(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input; TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, 0, &input)); TfLiteTensor* output; TF_LITE_ENSURE_OK(context, GetOutputSafe(context, node, 0, &output)); const auto* params = reinterpret_cast<TfLiteLe...
vuln
Safe
C/C++
_PUBLIC_ size_t strlen_m_ext_handle(struct smb_iconv_handle *ic, const char *s, charset_t src_charset, charset_t dst_charset) { size_t count = 0; #ifdef DEVELOPER switch (dst_charset) { case CH_DOS: case CH_UNIX: smb_panic("cannot call strlen_m_ext() with a variable dest charset (must be UTF16* or UTF8)"...
vuln
Vulnerable
Unknown
static void i6300esb_restart_timer(I6300State *d, int stage) { int64_t timeout; if (!d->enabled) return; d->stage = stage; if (d->stage <= 1) timeout = d->timer1_preload; else timeout = d->timer2_preload; if (d->clock_scale == CLOCK_SCALE_1KHZ) timeout <<= 15; ...
vuln
Safe
C/C++
@SubscribeEvent public static void onEntityJoinWorld(EntityJoinWorldEvent event) { Entity entity = event.getEntity(); if (entity instanceof IEggLayingEntity && entity instanceof AnimalEntity) { AnimalEntity eggLayer = (AnimalEntity) entity; if (eggLayer.goalSelector.availableGoals.stream().noneMatch((goal) -...
vuln
Safe
Java
static int raw_cmd_copyout(int cmd, void __user *param, struct floppy_raw_cmd *ptr) { int ret; while (ptr) { struct floppy_raw_cmd cmd = *ptr; cmd.next = NULL; cmd.kernel_data = NULL; ret = copy_to_user(param, &cmd, sizeof(cmd)); if (ret) return -EFAULT; param += sizeof(struct floppy_raw_cmd); ...
vuln
Safe
C/C++
static int svq1_decode_delta_block(AVCodecContext *avctx, DSPContext *dsp, GetBitContext *bitbuf, uint8_t *current, uint8_t *previous, int pitch, svq1_pmv *motion, int x, int y) { uint32_t block_type; int re...
vuln
Vulnerable
C/C++
void wait_for_receiver(void) { if (!iobuf.raw_input_ends_before) read_a_msg(); if (iobuf.raw_input_ends_before) { int ndx = read_int(iobuf.in_fd); if (ndx < 0) { switch (ndx) { case NDX_FLIST_EOF: flist_eof = 1; if (DEBUG_GTE(FLIST, 3)) rprintf(FINFO, "[%s] flist_eof=1\n", who_am_i()); b...
vuln
Safe
Unknown
/************************************************************ * Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, and distribute this * software and its documentation for any purpose and without * fee is hereby granted, provided that the above copyright * notice ap...
vuln
Safe
C/C++
static int rv10_decode_picture_header(MpegEncContext *s) { int mb_count, pb_frame, marker, h, full_frame; h = get_bits(&s->gb, 8); if ((h & 0xc0) == 0xc0) { int len, pos; full_frame = 1; len = get_num(&s->gb); pos = get_num(&s->gb); } else { int seq, fra...
vuln
Vulnerable
C/C++
@Override boolean verify(final char[] guess) throws InvalidKeyException { byte[] guessAsBytes = getNormalizedPasswordBytes(guess); byte[] test; try { test = encode(guessAsBytes, getSalt()); } catch (NoSuchAlgorithmException e) { throw log.invalidKeyCannotVerif...
vuln
Safe
Java
/* 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
bgp_log_error(struct bgp_proto *p, u8 class, char *msg, unsigned code, unsigned subcode, byte *data, unsigned len) { byte argbuf[256], *t = argbuf; unsigned i; /* Don't report Cease messages generated by myself */ if (code == 6 && class == BE_BGP_TX) return; /* Reset shutdown message */ if ((code == 6...
vuln
Vulnerable
Unknown
static int nut_write_trailer(AVFormatContext *s) { NUTContext *nut = s->priv_data; AVIOContext *bc = s->pb, *dyn_bc; int i, ret; while (nut->header_count < 3) write_headers(s, bc); ret = avio_open_dyn_buf(&dyn_bc); if (ret >= 0 && nut->sp_count) { av_assert1(nut->write_index); ...
vuln
Vulnerable
C/C++
static void virgl_cmd_get_capset(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd) { struct virtio_gpu_get_capset gc; struct virtio_gpu_resp_capset *resp; uint32_t max_ver, max_size; VIRTIO_GPU_FILL_CMD(gc); virgl_renderer_get_cap_set(gc.capset_id, &max_ver, ...
vuln
Safe
C/C++
static int nbd_co_send_request(BlockDriverState *bs, struct nbd_request *request, QEMUIOVector *qiov, int offset) { NbdClientSession *s = nbd_get_client_session(bs); AioContext *aio_context; int rc, ret, i; qemu_co_mutex_lock(&s->send_mutex);...
vuln
Safe
C/C++
package server import ( "encoding/json" "fmt" "io" "net/http" "net/url" "strconv" "time" "github.com/usememos/memos/api" "github.com/usememos/memos/common" metric "github.com/usememos/memos/plugin/metrics" "github.com/labstack/echo/v4" ) const ( // The max file size is 32MB. maxFileSize = (32 * 8) << 2...
vuln
Safe
Go
obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena) { int isinstance; PyObject *tmp = NULL; if (obj == Py_None) { *out = NULL; return 0; } isinstance = PyObject_IsInstance(obj, (PyObject*)Module_type); if (isinstance == -1) { return 1; } if (isinstance) { ...
vuln
Vulnerable
C/C++
int escc_init(target_phys_addr_t base, qemu_irq irqA, qemu_irq irqB, CharDriverState *chrA, CharDriverState *chrB, int clock, int it_shift) { DeviceState *dev; SysBusDevice *s; SerialState *d; dev = qdev_create(NULL, "escc"); qdev_prop_set_uint32(dev, "disabled", 0); ...
vuln
Safe
C/C++
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); mPackageName = getCallingPackage(); IBinder b = ServiceManager.getService(MEDIA_PROJECTION_SERVICE); mService = IMediaProjectionManager.Stub.asInterface(b); if (mPackageName == null) { finis...
vuln
Vulnerable
Java
void qbus_free(BusState *bus) { DeviceState *dev; while ((dev = QLIST_FIRST(&bus->children)) != NULL) { qdev_free(dev); } if (bus->parent) { QLIST_REMOVE(bus, sibling); bus->parent->num_child_bus--; } qemu_free((void*)bus->name); if (bus->qdev_allocated) { qem...
vuln
Safe
C/C++
public static void startTaskNotificationAlarm(Context context) { AlarmManager alarmMgr = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(context, TaskNotificationService.class); PendingIntent alarmIntent = PendingIntent.getService(context, 1414, intent, 0); // setRep...
vuln
Vulnerable
Java
static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, int oldproglen, struct jit_context *ctx, bool jmp_padding) { bool tail_call_reachable = bpf_prog->aux->tail_call_reachable; struct bpf_insn *insn = bpf_prog->insnsi; bool callee_regs_used[4] = {}; int insn_cnt = bpf_prog->len; bool tail_call_s...
vuln
Vulnerable
C/C++
/* * . .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
file_copy_fallback (GFile *source, GFile *destination, GFileCopyFlags flags, GCancellable *cancellable, GFileProgressCallback progress_callback, gpointer ...
vuln
Vulnerable
C/C++
static int hevc_decode_nal_units(const uint8_t *buf, int buf_size, HEVCParamSets *ps, int is_nalff, int nal_length_size, int err_recognition, void *logctx) { int i; int ret = 0; H2645Packet pkt = { 0 }; ret = ff_h2645_packet_split(&pkt, b...
vuln
Safe
C/C++
private Collection<String> getRoles(UserDetails user) { return user.getAuthorities().stream().filter(authority -> authority.getAuthority().startsWith(ROLE_PREFIX)) .map((authority) -> authority.getAuthority().substring(ROLE_PREFIX.length())) .collect(Collectors.toUnmodifiableSet()); }
vuln
Vulnerable
Java
ATAddForeignKeyConstraint(AlteredTableInfo *tab, Relation rel, Constraint *fkconstraint, LOCKMODE lockmode) { Relation pkrel; int16 pkattnum[INDEX_MAX_KEYS]; int16 fkattnum[INDEX_MAX_KEYS]; Oid pktypoid[INDEX_MAX_KEYS]; Oid fktypoid[INDEX_MAX_KEYS]; Oid opclasses[INDEX_MAX_KEYS]; Oid pfeqoperat...
vuln
Vulnerable
Unknown
public static void ringBell(World world, @Nullable PlayerEntity player) { if (!world.isRemote) { Optional<TotemTileEntity> tile = getTotemNearPos(((ServerWorld) world), player.getPosition(), false); tile.ifPresent(s -> s.ringBell(player)); } }
vuln
Vulnerable
Java
@Override public void callSessionInitiated(ImsCallProfile profile) { if (mListener != null) { TelephonyUtils.runWithCleanCallingIdentity(()-> mListener.callSessionStarted( ImsCallSession.this, profile), mListenerExecutor); } }
vuln
Vulnerable
Java
AvahiSAddressResolver *avahi_s_address_resolver_new( AvahiServer *server, AvahiIfIndex interface, AvahiProtocol protocol, const AvahiAddress *address, AvahiLookupFlags flags, AvahiSAddressResolverCallback callback, void* userdata) { AvahiSAddressResolver *b; b = avahi_s_addr...
vuln
Vulnerable
Unknown
void ImageCapture::SetMediaTrackConstraints( ScriptPromiseResolver* resolver, const HeapVector<MediaTrackConstraintSet>& constraints_vector) { DCHECK_GT(constraints_vector.size(), 0u); if (!service_) { resolver->Reject(DOMException::Create(kNotFoundError, kNoServiceError)); return; } auto constr...
vuln
Safe
C/C++
private void updateCheckpoints( final MutableStore store, final Checkpoint justifiedCheckpoint, final Checkpoint finalizedCheckpoint, final boolean isBlockOptimistic) { if (specConfig.getProgressiveBalancesMode().isFull()) { if (justifiedCheckpoint.getEpoch().isGreaterThan(store.getJus...
vuln
Safe
Java
package server import ( "encoding/json" "fmt" "io" "net/http" "net/url" "strconv" "time" "github.com/pkg/errors" "github.com/usememos/memos/api" "github.com/usememos/memos/common" metric "github.com/usememos/memos/plugin/metrics" "github.com/labstack/echo/v4" ) const ( // The max file size is 32MB. ma...
vuln
Vulnerable
Go
void ComputeEasyCases(OpKernelContext* context, bool* done, std::vector<Tlen>* split_sizes_vec) { const int32_t num_split = context->num_outputs(); const Tensor& input = context->input(0); const TensorShape& input_shape = input.shape(); const Tensor& split_tensor = context->input...
vuln
Vulnerable
C/C++
BOOL SQLWriteFileDSN( LPCSTR pszFileName, LPCSTR pszAppName, LPCSTR pszKeyName, LPCSTR pszString ) { HINI hIni; char szFileName[ODBC_FILENAME_MAX+1]; if ( pszFileName[0] == '/' ) { strncpy( szFileName, pszFileName, sizeof(szFileName) - 5 ); } else { char szPath[ODBC_FILENAME_MAX+1...
vuln
Safe
C/C++
xsltParseStylesheetImport(xsltStylesheetPtr style, xmlNodePtr cur) { int ret = -1; xmlDocPtr import = NULL; xmlChar *base = NULL; xmlChar *uriRef = NULL; xmlChar *URI = NULL; xsltStylesheetPtr res; xsltSecurityPrefsPtr sec; if ((cur == NULL) || (style == NULL)) return (ret); uriRe...
vuln
Safe
Unknown
RenderProcessHost* RenderProcessHostImpl::GetProcessHostForSite( BrowserContext* browser_context, const GURL& url) { SiteProcessMap* map = GetSiteProcessMapForBrowserContext(browser_context); std::string site = SiteInstance::GetSiteForURL(browser_context, url) .possibly_invalid_spec(); r...
vuln
Vulnerable
C/C++
static js_Ast *shift(js_State *J) { js_Ast *a = additive(J); loop: if (jsP_accept(J, TK_SHL)) { a = EXP2(SHL, a, additive(J)); goto loop; } if (jsP_accept(J, TK_SHR)) { a = EXP2(SHR, a, additive(J)); goto loop; } if (jsP_accept(J, TK_USHR)) { a = EXP2(USHR, a, additive(J)); goto loop; } return a; }
vuln
Vulnerable
Unknown
void showProgress(boolean willShow) { if (willShow) { mProgressIndicator.show(); } else { mProgressIndicator.hide(); } }
vuln
Vulnerable
Java
static int read_packet(AVFormatContext *s, AVPacket *pkt) { MmDemuxContext *mm = s->priv_data; AVIOContext *pb = s->pb; unsigned char preamble[MM_PREAMBLE_SIZE]; unsigned int type, length; while(1) { if (avio_read(pb, preamble, MM_PREAMBLE_SIZE) != MM_PREAMBLE_SIZE...
vuln
Safe
C/C++
void ChromotingHost::Shutdown(const base::Closure& shutdown_task) { if (!context_->network_message_loop()->BelongsToCurrentThread()) { context_->network_message_loop()->PostTask( FROM_HERE, base::Bind(&ChromotingHost::Shutdown, this, shutdown_task)); return; } if (state_ == kInitial || state_ ...
vuln
Safe
C/C++
static void disas_uncond_b_reg(DisasContext *s, uint32_t insn) { unsigned int opc, op2, op3, rn, op4; opc = extract32(insn, 21, 4); op2 = extract32(insn, 16, 5); op3 = extract32(insn, 10, 6); rn = extract32(insn, 5, 5); op4 = extract32(insn, 0, 5); if (op4 != 0x0 || op3 != 0x0 || op2 != 0x1f...
vuln
Safe
C/C++
sp<VBRISeeker> VBRISeeker::CreateFromSource( const sp<DataSource> &source, off64_t post_id3_pos) { off64_t pos = post_id3_pos; uint8_t header[4]; ssize_t n = source->readAt(pos, header, sizeof(header)); if (n < (ssize_t)sizeof(header)) { return NULL; } uint32_t tmp = U32_AT(&header[0]); size_t frameSize; in...
vuln
Vulnerable
C/C++
/* * GPAC - Multimedia Framework C SDK * * Authors: Jean Le Feuvre * Copyright (c) Telecom ParisTech 2000-2021 * All rights reserved * * This file is part of GPAC / MPEG-1/2/4(Part2) video reframer filter * * GPAC is free software; you can redistribute it and/or modify * it under the terms of the...
vuln
Safe
C/C++
static void pmac_ide_atapi_transfer_cb(void *opaque, int ret) { DBDMA_io *io = opaque; MACIOIDEState *m = io->opaque; IDEState *s = idebus_active_if(&m->bus); int64_t offset; MACIO_DPRINTF("pmac_ide_atapi_transfer_cb\n"); if (ret < 0) { MACIO_DPRINTF("DMA error: %d\n", ret); ide_...
vuln
Safe
C/C++
static int jas_cmpxformseq_resize(jas_cmpxformseq_t *pxformseq, int n) { jas_cmpxform_t **p; assert(n >= pxformseq->numpxforms); p = (!pxformseq->pxforms) ? jas_alloc2(n, sizeof(jas_cmpxform_t *)) : jas_realloc2(pxformseq->pxforms, n, sizeof(jas_cmpxform_t *)); if (!p) { return -1; } pxformseq->pxforms = p; ...
vuln
Safe
Unknown
static int coroutine_fn bdrv_co_do_write_zeroes(BlockDriverState *bs, int64_t sector_num, int nb_sectors, BdrvRequestFlags flags) { BlockDriver *drv = bs->drv; QEMUIOVector qiov; struct iovec iov = {0}; int ret = 0; int max_write_zeroes = bs->bl.max_write_zeroes ? bs->...
vuln
Vulnerable
C/C++
void rgb16tobgr16(const uint8_t *src, uint8_t *dst, unsigned int src_size) { unsigned i; unsigned num_pixels = src_size >> 1; for(i=0; i<num_pixels; i++) { unsigned b,g,r; register uint16_t rgb; rgb = src[2*i]; r = rgb&0x1F; g = (rgb&0x7E0)>>5; b = (rgb&0xF800)>>11; dst[2*i] = (...
vuln
Vulnerable
C/C++
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { OpData* data = reinterpret_cast<OpData*>(node->user_data); TF_LITE_ENSURE_EQ(context, NumInputs(node), 2); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1); const TfLiteTensor...
vuln
Vulnerable
C/C++
process_tx_desc(E1000State *s, struct e1000_tx_desc *dp) { PCIDevice *d = PCI_DEVICE(s); uint32_t txd_lower = le32_to_cpu(dp->lower.data); uint32_t dtype = txd_lower & (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D); unsigned int split_size = txd_lower & 0xffff, bytes, sz; unsigned int msh = 0xfffff; ui...
vuln
Vulnerable
C/C++
/* * GPAC - Multimedia Framework C SDK * * Authors: Jean Le Feuvre * Copyright (c) Telecom ParisTech 2005-2012 * * This file is part of GPAC / MPEG2-TS sub-project * * GPAC is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as publishe...
vuln
Vulnerable
C/C++
static void setAppDefaults() { app->company = stok(slower(ME_COMPANY), " ", NULL); app->serviceProgram = sclone(SERVICE_PROGRAM); app->serviceName = sclone(SERVICE_NAME); app->serviceHome = mprGetNativePath(SERVICE_HOME); app->retries = RESTART_MAX; app->signal = SIGTERM; app->logSpec = sclo...
vuln
Vulnerable
C/C++
private static Stream<Arguments> provideFilesAndExpectedExceptionType() { return Stream.of( Arguments.of("abnormal/corrupt-header.rar", CorruptHeaderException.class), Arguments.of("abnormal/mainHeaderNull.rar", BadRarArchiveException.class) ); }
vuln
Vulnerable
Java
ftc_snode_load( FTC_SNode snode, FTC_Manager manager, FT_UInt gindex, FT_ULong *asize ) { FT_Error error; FTC_GNode gnode = FTC_GNODE( snode ); FTC_Family family = gnode->family; FT_Memory memory = manag...
vuln
Vulnerable
C/C++
void OffscreenCanvas::Dispose() { // We need to drop frame dispatcher, to prevent mojo calls from completing. frame_dispatcher_ = nullptr; if (context_) { context_->DetachHost(); context_ = nullptr; } if (HasPlaceholderCanvas() && GetTopExecutionContext() && GetTopExecutionContext()->IsWork...
vuln
Safe
C/C++
/* Copyright 2015 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
vuln
Vulnerable
Go
static u32 crc32sum(u32 crc, u8 * RESTRICT buf, size_t size) { // Test endianness. The code needs to be different for LE and BE systems. u32 test = 1; if (*(u8 *) &test) { while (size--) crc = crc32Table[(crc ^ *(buf++)) & 0xff] ^ (crc >> 8); return crc; } else { while (size--) c...
vuln
Safe
C/C++
exsltDynMapFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlChar *str = NULL; xmlNodeSetPtr nodeset = NULL; xsltTransformContextPtr tctxt; xmlXPathCompExprPtr comp = NULL; xmlXPathObjectPtr ret = NULL; xmlDocPtr oldDoc, container = NULL; xmlNodePtr oldNode; int oldContextSize; ...
vuln
Vulnerable
C/C++
Aml *aml_buffer(int buffer_size, uint8_t *byte_list) { int i; Aml *var = aml_bundle(0x11 , AML_BUFFER); for (i = 0; i < buffer_size; i++) { if (byte_list == NULL) { build_append_byte(var->buf, 0x0); } else { build_append_byte(var->buf, byte_list[i]); } } ...
vuln
Safe
C/C++
def reportMatch(winner, loser): """Records the outcome of a single match between two players. Args: winner: the id number of the player who won loser: the id number of the player who lost """ conn = connect() cursor = conn.cursor() cursor.execute("INSERT INTO playsRecord (winner, ...
vuln
Vulnerable
Python
int tls1_enc(SSL *s, int send) { SSL3_RECORD *rec; EVP_CIPHER_CTX *ds; unsigned long l; int bs, i, j, k, pad = 0, ret, mac_size = 0; const EVP_CIPHER *enc; if (send) { if (EVP_MD_CTX_md(s->write_hash)) { int n = EVP_MD_CTX_size(s->write_hash); OPENSSL_assert(n >=...
vuln
Safe
Unknown
@NonNull @Override public View getView(int position, View convertView, @NonNull ViewGroup parent) { // Recycle ViewHolder's items MusicHolder holder; if (convertView == null) { convertView = inflater.inflate(mLayoutId, parent, false); holder = new MusicHolder(conv...
vuln
Vulnerable
Java
from django.urls import path, include from rest_framework.routers import DefaultRouter from authentication import views router = DefaultRouter() router.register(r'', views.InviteViewSet, basename='invites') urlpatterns = [ path('login/', views.LoginView.as_view(), name='login'), path('register/', views.Regis...
vuln
Vulnerable
Python