code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
PredictorDecodeRow(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s) { TIFFPredictorState *sp = PredictorState(tif); assert(sp != NULL); assert(sp->decoderow != NULL); assert(sp->decodepfunc != NULL); if ((*sp->decoderow)(tif, op0, occ0, s)) { (*sp->decodepfunc)(tif, op0, occ0); return 1; } else return 0;...
cwe
CWE-119
Unknown
/** * Copyright (c) 2006-2012, JGraph Ltd */ /** * Constructs a new graph editor */ Menus = function(editorUi) { this.editorUi = editorUi; this.menus = new Object(); this.init(); // Pre-fetches checkmark image if (!mxClient.IS_SVG) { new Image().src = this.checkmarkImage; } }; /** * Sets the default fo...
cwe
CWE-94
JavaScript
public function attorn(){ $login_user = $this->checkLogin(); $this->checkAdmin(); $username = I("username"); $item_id = I("item_id/d"); $item = D("Item")->where("item_id = '$item_id' ")->find(); $member = D("User")->where(" username = '%s' ",array($username))->find();...
cwe
CWE-352
PHP
def delete(request, pk): favorite = get_object_or_404(TopicFavorite, pk=pk, user=request.user) favorite.delete() return redirect(request.POST.get('next', favorite.topic.get_absolute_url()))
cwe
CWE-601
Python
static int do_remount(struct path *path, int flags, int mnt_flags, void *data) { int err; struct super_block *sb = path->mnt->mnt_sb; struct mount *mnt = real_mount(path->mnt); if (!check_mnt(mnt)) return -EINVAL; if (path->dentry != path->mnt->mnt_root) return -EINVAL; /* Don't allow changing of l...
cwe
CWE-269
C/C++
package pluginproxy import ( "bytes" "errors" "fmt" "io/ioutil" "net/http" "net/url" "strconv" "strings" "time" "go.opentelemetry.io/otel/attribute" "github.com/grafana/grafana/pkg/api/datasource" "github.com/grafana/grafana/pkg/infra/httpclient" glog "github.com/grafana/grafana/pkg/infra/log" "github....
cwe
CWE-200
Go
parse_char_class(Node** np, OnigToken* tok, UChar** src, UChar* end, ScanEnv* env) { int r, neg, len, fetched, and_start; OnigCodePoint v, vs; UChar *p; Node* node; CClassNode *cc, *prev_cc; CClassNode work_cc; enum CCSTATE state; enum CCVALTYPE val_type, in_type; int val_israw, in_israw; *np =...
cwe
CWE-787
C/C++
/* p_mach.cpp -- pack Mach Object executable This file is part of the UPX executable compressor. Copyright (C) 2004-2021 John Reiser All Rights Reserved. UPX and the UCL library are free software; you can redistribute them and/or modify them under the terms of the GNU General Public License as publ...
cwe
CWE-20
C/C++
jpc_mqdec_t *jpc_mqdec_create(int maxctxs, jas_stream_t *in) { jpc_mqdec_t *mqdec; /* There must be at least one context. */ assert(maxctxs > 0); /* Allocate memory for the MQ decoder. */ if (!(mqdec = jas_malloc(sizeof(jpc_mqdec_t)))) { goto error; } mqdec->in = in; mqdec->maxctxs = maxctxs; /* Allocate m...
cwe
CWE-189
Unknown
for(var I=0;I<X.length;I++)if("label"!=X[I].nodeName){var T=mxUtils.trim(X[I].nodeValue.replace(/[\x00-\x1F\x7F-\x9F]|\s+/g," ")).toLowerCase();if(null==V&&(C&&0<=T.indexOf(p)||!C&&T.substring(0,p.length)===p)||null!=V&&V.test(T))return!0}}return!1}function c(){v&&K.value?(S.removeAttribute("disabled"),U.removeAttribut...
cwe
CWE-20
JavaScript
/** * Copyright (c) 2006-2017, JGraph Ltd * Copyright (c) 2006-2017, Gaudenz Alder */ (function() { /** * Version */ EditorUi.VERSION = '@DRAWIO-VERSION@'; /** * Overrides compact UI setting. */ EditorUi.compactUi = uiTheme != 'atlas'; /** * Overrides default grid color for dark mode */ if (Edit...
cwe
CWE-78
JavaScript
/* 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...
cwe
CWE-190
Python
TfLiteStatus GreaterEval(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1); const TfLiteTensor* input2 = GetInput(context, node, kInputTensor2); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); bool requires_broadcast = !HaveSameShapes...
cwe
CWE-787
C/C++
void btrfs_trans_release_chunk_metadata(struct btrfs_trans_handle *trans) { struct btrfs_fs_info *fs_info = trans->fs_info; struct btrfs_transaction *cur_trans = trans->transaction; if (!trans->chunk_bytes_reserved) return; WARN_ON_ONCE(!list_empty(&trans->new_bgs)); btrfs_block_rsv_release(fs_info, &fs_info-...
cwe
CWE-667
Unknown
struct nfs_server *nfs_clone_server(struct nfs_server *source, struct nfs_fh *fh, struct nfs_fattr *fattr) { struct nfs_server *server; struct nfs_fattr fattr_fsinfo; int error; dprintk("--> nfs_clone_server(,%llx:%llx,)\n", (unsigned long long) fattr->fsid.major, (unsigned long long) fattr->fs...
cwe
CWE-20
Unknown
int digest_generic_verify(struct digest *d, const unsigned char *md) { int ret; int len = digest_length(d); unsigned char *tmp; tmp = xmalloc(len); ret = digest_final(d, tmp); if (ret) goto end; ret = memcmp(md, tmp, len); ret = ret ? -EINVAL : 0; end: free(tmp); return ret; }
cwe
CWE-200
C/C++
/* * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * * Author: zccrs <zccrs@live.com> * * Maintainer: zccrs <zhangjide@deepin.com> * * 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 Foun...
cwe
CWE-59
C/C++
# -*- coding: utf-8 -*- # This file is part of Shuup. # # Copyright (c) 2012-2021, Shuup Commerce Inc. All rights reserved. # # This source code is licensed under the OSL-3.0 license found in the # LICENSE file in the root directory of this source tree. from __future__ import unicode_literals import six from django.co...
cwe
CWE-79
Python
/* * Fast and scalable bitmap tagging variant. Uses sparser bitmaps spread * over multiple cachelines to avoid ping-pong between multiple submitters * or submitter and completer. Uses rolling wakeups to avoid falling of * the scaling cliff when we run out of tags and have to start putting * submitters to sleep. *...
cwe
CWE-362
C/C++
z(this.textarea,this.textarea.cloneNode(!0));window.setTimeout(mxUtils.bind(this,function(){null!=this.textarea&&(0<=this.textarea.innerHTML.indexOf("<o:OfficeDocumentSettings>")||0<=this.textarea.innerHTML.indexOf("\x3c!--[if !mso]>")?B(this.textarea,M):Graph.removePasteFormatting(this.textarea))}),0)}))};mxCellEditor...
cwe
CWE-94
JavaScript
void operator()(OpKernelContext* ctx, const CPUDevice& d, const T* rate_flat, int num_rate, int num_samples, const random::PhiloxRandom& rng, U* samples_flat) { // Two different algorithms are employed, depending on the size of // rate. // If rate < 10, we use an algorith...
cwe
CWE-703
Unknown
static int ehci_execute(EHCIPacket *p, const char *action) { USBEndpoint *ep; int endp; bool spd; assert(p->async == EHCI_ASYNC_NONE || p->async == EHCI_ASYNC_INITIALIZED); if (!(p->qtd.token & QTD_TOKEN_ACTIVE)) { fprintf(stderr, "Attempting to execute inactive qtd\n"); ...
cwe
CWE-617
Unknown
static bool load_buffer(RBinFile *bf, void **bin_obj, RBuffer *buf, ut64 loadaddr, Sdb *sdb) { QnxObj *qo = R_NEW0 (QnxObj); if (!qo) { return false; } lmf_record lrec; lmf_resource lres; lmf_data ldata; ut64 offset = QNX_RECORD_SIZE; RList *sections = NULL; RList *fixups = NULL; if (!qo) { goto beach; ...
cwe
CWE-400
C/C++
static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile, AVFrame *picture) { int compno, reslevelno, bandno; int x, y; uint8_t *line; Jpeg2000T1Context t1; /* Loop on tile components */ for (compno = 0; compno < s->ncomponents; compno++) { ...
cwe
CWE-119
C/C++
// Sandstorm - Personal Cloud Sandbox // Copyright (c) 2014 Sandstorm Development Group, Inc. and contributors // 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 // /...
cwe
CWE-918
JavaScript
static int mpeg4_decode_studio_block(MpegEncContext *s, int32_t block[64], int n) { Mpeg4DecContext *ctx = s->avctx->priv_data; int cc, dct_dc_size, dct_diff, code, j, idx = 1, group = 0, run = 0, additional_code_len, sign, mismatch; VLC *cur_vlc = &ctx->studio_intra_tab[0]; uint8_t *const scan...
cwe
CWE-125
C/C++
static void rf_host_ver(void) { char *buf = (char *)cur_slot->readbuf; int major = 3, minor = 3; int remote_major, remote_minor; char ver_msg[12]; if ( strncmp(buf, "RFB ", 4) != 0 || !isdigit(buf[4]) || !isdigit(buf[4]) || !isdigit(buf[5]) || !isdigit(buf[6]) || buf[7] != '.' || !isdigit(buf[8...
cwe
CWE-787
C/C++
public Controller execute(FolderComponent folderComponent, UserRequest ureq, WindowControl wControl, Translator trans) { VFSContainer currentContainer = folderComponent.getCurrentContainer(); status = FolderCommandHelper.sanityCheck(wControl, folderComponent); if(status == FolderCommandStatus.STATUS_FAILED) { ...
cwe
CWE-22
Java
public function providesExceptionData() { $notFoundEnvMessage = 'Not found in env'; $notFoundEnvException = new NotFoundEnvException($notFoundEnvMessage); $notFoundEnvStatus = Http::STATUS_NOT_FOUND; $notFoundServiceMessage = 'Not found in service'; $notFoundServiceException = new NotFoundServiceException($n...
cwe
CWE-79
PHP
bool PermissionsData::CanRunOnPage(const Extension* extension, const GURL& document_url, const GURL& top_frame_url, int tab_id, int process_id, c...
cwe
CWE-264
C/C++
static int register_queue_kobjects(struct net_device *dev) { int error = 0, txq = 0, rxq = 0, real_rx = 0, real_tx = 0; #ifdef CONFIG_SYSFS dev->queues_kset = kset_create_and_add("queues", NULL, &dev->dev.kobj); if (!dev->queues_kset) return -ENOMEM; real_rx = dev->real_num_rx_queues; #endif real_tx...
cwe
CWE-401
Unknown
# -*- coding: utf-8 -*- # rdiffweb, A web interface to rdiff-backup repositories # Copyright (C) 2012-2021 rdiffweb contributors # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
cwe
CWE-770
Python
static void SVGEndElement(void *context,const xmlChar *name) { SVGInfo *svg_info; /* Called when the end of an element has been detected. */ (void) LogMagickEvent(CoderEvent,GetMagickModule(), " SAX.endElement(%s)",name); svg_info=(SVGInfo *) context; if (strchr((char *) name,':') != (char *) ...
cwe
CWE-401
C/C++
TPMA_NV_Unmarshal(TPMA_NV *target, BYTE **buffer, INT32 *size) { TPM_RC rc = TPM_RC_SUCCESS; if (rc == TPM_RC_SUCCESS) { rc = UINT32_Unmarshal((UINT32 *)target, buffer, size); /* libtpms changed */ } if (rc == TPM_RC_SUCCESS) { if (*target & TPMA_NV_RESERVED) { rc = TPM_RC_RESERVED_BITS; } ...
cwe
CWE-787
Unknown
import discourseComputed, { on } from "discourse-common/utils/decorators"; import { NotificationLevels } from "discourse/lib/notification-levels"; import PermissionType from "discourse/models/permission-type"; import RestModel from "discourse/models/rest"; import Site from "discourse/models/site"; import User from "dis...
cwe
CWE-276
JavaScript
// Copyright 2018 The Nakama 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 ...
cwe
CWE-307
Go
TfLiteStatus EvalHybridPerChannel(TfLiteContext* context, TfLiteNode* node, TfLiteDepthwiseConvParams* params, OpData* data, const TfLiteTensor* input, const TfLiteTensor* filter, cons...
cwe
CWE-787
C/C++
#include <uwsgi.h> extern struct uwsgi_server uwsgi; #ifdef __BIG_ENDIAN__ uint16_t uwsgi_swap16(uint16_t x) { return (uint16_t) ((x & 0xff) << 8 | (x & 0xff00) >> 8); } uint32_t uwsgi_swap32(uint32_t x) { x = ((x << 8) & 0xFF00FF00) | ((x >> 8) & 0x00FF00FF); return (x >> 16) | (x << 16); } // thanks to ffmpeg...
cwe
CWE-787
Python
static int check_input_term(struct mixer_build *state, int id, struct usb_audio_term *term) { int protocol = state->mixer->protocol; int err; void *p1; memset(term, 0, sizeof(*term)); while ((p1 = find_audio_control_unit(state, id)) != NULL) { unsigned char *hdr = p1; term->id = id; if (protocol == ...
cwe
CWE-674
Unknown
pcsc_get_status_wrapped (int slot, unsigned int *status) { long err; reader_table_t slotp; size_t len, full_len; int i, n; unsigned char msgbuf[9]; unsigned char buffer[16]; int sw = SW_HOST_CARD_IO_ERROR; slotp = reader_table + slot; if (slotp->pcsc.req_fd == -1 || slotp->pcsc.rsp_fd == -1 ...
cwe
CWE-20
Unknown
i_alloc_struct_array(gs_memory_t * mem, uint num_elements, gs_memory_type_ptr_t pstype, client_name_t cname) { gs_ref_memory_t * const imem = (gs_ref_memory_t *)mem; obj_header_t *obj; #ifdef MEMENTO if (Memento_failThisEvent()) return NULL; #endif ALLOC_CHECK_SIZE(mem,pst...
cwe
CWE-190
Unknown
ja.isResolved));F||ja.isLocked||0!=V||R(ja.isResolved?mxResources.get("reopen"):mxResources.get("resolve"),function(T){function Q(){var Z=T.target;Z.innerHTML="";ja.isResolved=!ja.isResolved;mxUtils.write(Z,ja.isResolved?mxResources.get("reopen"):mxResources.get("resolve"));for(var na=ja.isResolved?"none":"",va=ia(ja)....
cwe
CWE-94
JavaScript
CImg<T>& _load_bmp(std::FILE *const file, const char *const filename) { if (!file && !filename) throw CImgArgumentException(_cimg_instance "load_bmp(): Specified filename is (null).", cimg_instance); std::FILE *const nfile = fi...
cwe
CWE-125
Unknown
int imap_open_connection(struct ImapAccountData *adata) { if (mutt_socket_open(adata->conn) < 0) return -1; adata->state = IMAP_CONNECTED; if (imap_cmd_step(adata) != IMAP_RES_OK) { imap_close_connection(adata); return -1; } if (mutt_str_startswith(adata->buf, "* OK", CASE_IGNORE)) { if...
cwe
CWE-94
Unknown
xcf_load_layer_props (XcfInfo *info, GimpImage *image, GimpLayer **layer, GList **item_path, gboolean *apply_mask, gboolean *edit_mask, gboolean *show_mask, ...
cwe
CWE-416
Unknown
AP4_DataAtom::AP4_DataAtom(AP4_UI32 size, AP4_ByteStream& stream) : AP4_Atom(AP4_ATOM_TYPE_DATA, size) { if (size < AP4_ATOM_HEADER_SIZE+8) return; AP4_UI32 i; stream.ReadUI32(i); m_DataType = (DataType)i; stream.ReadUI32(i); m_DataLang = (DataLang)i; // the stream for the data is a substream ...
cwe
CWE-476
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 / ISOBMFF reader filter * * GPAC is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser Genera...
cwe
CWE-835
C/C++
{% load i18n %} /* global inventreeLoad, inventreeSave, */ /* exported customGroupSorter, downloadTableData, reloadtable, renderLink, reloadTableFilters, */ /** * Reload a named table * @param table */ function reloadtable(table) { $(table).bootstrapTable('refresh'); } /** * Dow...
cwe
CWE-79
Python
/* * Copyright (C) the libgit2 contributors. All rights reserved. * * This file is part of libgit2, distributed under the GNU GPL v2 with * a Linking Exception. For full terms see the included COPYING file. */ #include "path.h" #include "posix.h" #include "repository.h" #ifdef GIT_WIN32 #include "win32/posix.h" ...
cwe
CWE-20
C/C++
status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) { ALOGV("entering parseChunk %lld/%d", *offset, depth); uint32_t hdr[2]; if (mDataSource->readAt(*offset, hdr, 8) < 8) { return ERROR_IO; } uint64_t chunk_size = ntohl(hdr[0]); uint32_t chunk_type = ntohl(hdr[1]); off64_t data_offset = *offset +...
cwe
CWE-189
Unknown
MagickExport MagickBooleanType ContrastStretchImage(Image *image, const double black_point,const double white_point,ExceptionInfo *exception) { #define MaxRange(color) ((double) ScaleQuantumToMap((Quantum) (color))) #define ContrastStretchImageTag "ContrastStretch/Image" CacheView *image_view; double ...
cwe
CWE-125
C/C++
/** @file buffer.c * @brief Functions to read/write raw big endian data * * 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 <stdlib.h> #include <string....
cwe
CWE-787
C/C++
this.editingHandler);L=this.graph.getLinkForCell(this.state.cell);M=this.graph.getLinksForState(this.state);this.updateLinkHint(L,M);if(null!=L||null!=M&&0<M.length)z=!0;z&&this.redrawHandles()};mxVertexHandler.prototype.updateLinkHint=function(z,L){try{if(null==z&&(null==L||0==L.length)||1<this.graph.getSelectionCount...
cwe
CWE-918
JavaScript
/* * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * th...
cwe
CWE-79
Java
// --- BEGIN COPYRIGHT BLOCK --- // 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; version 2 of the License. // // This program is distributed in the hope that it will be useful, // but WITHOUT...
cwe
CWE-79
C/C++
void dofile(char *fname) { unsigned long p; int i, num_pages; int fd; unsigned char *map; off_t fsize; if(notregular(fname)) return; printf("%s: ",fname); fflush(stdout); if((fd=open(fname,O_RDONLY,0))<0) { error("%s\n",strerror(errno)); return; } fsize=filesize(fd); p=(unsigned long)mmap(0, ...
cwe
CWE-190
C/C++
xmlSchemaFormatNodeForError(xmlChar ** msg, xmlSchemaAbstractCtxtPtr actxt, xmlNodePtr node) { xmlChar *str = NULL; *msg = NULL; if ((node != NULL) && (node->type != XML_ELEMENT_NODE) && (node->type != XML_ATTRIBUTE_NODE)) { /* * Don't try to format other nodes than element and * att...
cwe
CWE-134
Unknown
static int cloop_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVCloopState *s = bs->opaque; uint32_t offsets_size, max_compressed_block_size = 1, i; int ret; bs->read_only = 1; /* read header */ ret = bdrv_pread(bs->file, 128, &s->block_size, 4)...
cwe
CWE-20
C/C++
func (ctx *cbcAEAD) Open(dst, nonce, ciphertext, data []byte) ([]byte, error) { if len(ciphertext) < ctx.authtagBytes { return nil, errors.New("square/go-jose: invalid ciphertext (too short)") } offset := len(ciphertext) - ctx.authtagBytes expectedTag := ctx.computeAuthTag(data, nonce, ciphertext[:offset]) matc...
cwe
CWE-190
Go
InputSource::findFirst(char const* start_chars, qpdf_offset_t offset, size_t len, Finder& finder) { // Basic approach: search for the first character of start_chars // starting from offset but not going past len (if len != 0). Once // the first character is foun...
cwe
CWE-787
Unknown
/* MIT License Copyright (c) 2021 Yansong Li 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, modify, merge, publ...
cwe
CWE-125
C/C++
/* Copyright The Helm 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, software distrib...
cwe
CWE-74
Go
package archiver import ( "bytes" "fmt" "io" "os" "path/filepath" "strings" "github.com/nwaples/rardecode" ) // Rar is for RAR archive format var Rar rarFormat func init() { RegisterFormat("Rar", Rar) } type rarFormat struct{} func (rarFormat) Match(filename string) bool { return strings.HasSuffix(string...
cwe
CWE-22
Go
/******************************************************************************* * This file is part of OpenNMS(R). * * Copyright (C) 2002-2014 The OpenNMS Group, Inc. * OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * * OpenNMS(...
cwe
CWE-79
Java
/* * GPAC - Multimedia Framework C SDK * * Authors: Jean Le Feuvre * Copyright (c) Telecom ParisTech 2000-2022 * All rights reserved * * This file is part of GPAC / AAC ADTS reframer filter * * GPAC is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser Gen...
cwe
CWE-122
C/C++
/* * GPAC - Multimedia Framework C SDK * * Authors: Jean Le Feuvre * Copyright (c) Telecom ParisTech 2000-2012 * All rights reserved * * This file is part of GPAC / MPEG-4 ObjectDescriptor sub-project * * GPAC is free software; you can redistribute it and/or modify * it under the terms of the GNU...
cwe
CWE-415
C/C++
// SPDX-License-Identifier: MIT #include <linux/pagemap.h> #include <linux/slab.h> #include "nouveau_drv.h" #include "nouveau_mem.h" #include "nouveau_ttm.h" struct nouveau_sgdma_be { /* this has to be the first field so populate/unpopulated in * nouve_bo.c works properly, otherwise have to move them here */ st...
cwe
CWE-416
C/C++
/* * AC-3 parser * Copyright (c) 2003 Fabrice Bellard * Copyright (c) 2003 Michael Niedermayer * * 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...
cwe
CWE-476
C/C++
static bool parse_reconnect(struct pool *pool, json_t *val) { char *sockaddr_url, *stratum_port, *tmp; char *url, *port, address[256]; memset(address, 0, 255); url = (char *)json_string_value(json_array_get(val, 0)); if (!url) url = pool->sockaddr_url; else { char *dot_pool, *dot_reconnect; dot_pool = strc...
cwe
CWE-119
C/C++
GnashImage::GnashImage(size_t width, size_t height, ImageType type, ImageLocation location) : _type(type), _location(location), _width(width), _height(height) { const size_t max = std::numeric_limits<boost::int32_t>::max(); if (size() > max) { throw std::bad_alloc(); } ...
cwe
CWE-189
Unknown
process_with_aes(std::string const& key, bool encrypt, std::string const& data, size_t outlength = 0, unsigned int repetitions = 1, unsigned char const* iv = 0, size_t iv_length = 0) { Pl_Buffer buffer("buffer"); ...
cwe
CWE-787
Unknown
static bool net_tx_pkt_do_sw_fragmentation(struct NetTxPkt *pkt, NetClientState *nc) { struct iovec fragment[NET_MAX_FRAG_SG_LIST]; size_t fragment_len = 0; bool more_frags = false; /* some pointers for shorter code */ void *l2_iov_base, *l3_iov_base; size_t l2_iov_len, l3_iov_len; int ...
cwe
CWE-120
C/C++
private void renderState(FacesContext context) throws IOException { // Get the view state and write it to the response.. PartialViewContext pvc = context.getPartialViewContext(); PartialResponseWriter writer = pvc.getPartialResponseWriter(); String viewStateId = Util.getViewStateId(conte...
cwe
CWE-79
Java
/* * mms_file_service.c * * Copyright 2013-2018 Michael Zillgith * * This file is part of libIEC61850. * * libIEC61850 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 3 of the Lic...
cwe
CWE-22
Go
/* * Copyright (C) 2001-2003 FhG Fokus * * This file is part of opensips, a free SIP server. * * opensips 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 ...
cwe
CWE-190
C/C++
private static function _aesEncrypt($data, $secret) { if (!is_string($data)) { throw new \InvalidArgumentException('Input parameter "$data" must be a string.'); } if (!function_exists("openssl_encrypt")) { throw new \SimpleSAML_Error_Exception('The openssl PHP module...
cwe
CWE-326
PHP
def transvision(request): """Get Mozilla translations from Transvision service.""" try: text = request.GET['text'] locale = request.GET['locale'] except MultiValueDictKeyError as e: return HttpResponseBadRequest('Bad Request: {error}'.format(error=e)) try: text = quote(t...
cwe
CWE-79
Python
TfLiteRegistration GetPassthroughOpRegistration() { TfLiteRegistration reg = {nullptr, nullptr, nullptr, nullptr}; reg.init = [](TfLiteContext* context, const char*, size_t) -> void* { auto* first_new_tensor = new int; context->AddTensors(context, 2, first_new_tensor); return first_new_tensor; }; re...
cwe
CWE-125
C/C++
static int validate_user_key(struct fscrypt_info *crypt_info, struct fscrypt_context *ctx, u8 *raw_key, const char *prefix) { char *description; struct key *keyring_key; struct fscrypt_key *master_key; const struct user_key_payload *ukp; int res; description = kasprintf(GFP_NOFS, "%s%*phN", prefix, FS_...
cwe
CWE-476
Unknown
static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc, unsigned int *rsize) { struct lg_drv_data *drv_data = hid_get_drvdata(hdev); struct usb_device_descriptor *udesc; __u16 bcdDevice, rev_maj, rev_min; if ((drv_data->quirks & LG_RDESC) && *rsize >= 90 && rdesc[83] == 0x26 && rdesc[84] == 0x8c &&...
cwe
CWE-119
C/C++
static bool vmxnet_tx_pkt_parse_headers(struct VmxnetTxPkt *pkt) { struct iovec *l2_hdr, *l3_hdr; size_t bytes_read; size_t full_ip6hdr_len; uint16_t l3_proto; assert(pkt); l2_hdr = &pkt->vec[VMXNET_TX_PKT_L2HDR_FRAG]; l3_hdr = &pkt->vec[VMXNET_TX_PKT_L3HDR_FRAG]; bytes_read = iov_to_...
cwe
CWE-119
Unknown
do_uncompress( compress_filter_context_t *zfx, z_stream *zs, IOBUF a, size_t *ret_len ) { int zrc; int rc=0; size_t n; int nread, count; int refill = !zs->avail_in; if( DBG_FILTER ) log_debug("begin inflate: avail_in=%u, avail_out=%u, inbuf=%u\n", (unsigned)zs->avail_in, (unsigned)zs...
cwe
CWE-20
Unknown
void Transform::interpolate_bilinear( RawTile& in, unsigned int resampled_width, unsigned int resampled_height ){ // Pointer to input buffer unsigned char *input = (unsigned char*) in.data; int channels = in.channels; unsigned int width = in.width; unsigned int height = in.height; // Define a max index p...
cwe
CWE-190
C/C++
Classifier (const char *&ptr, int size) { if (size <= 0) throw IEX_NAMESPACE::InputExc("Error uncompressing DWA data" " (truncated rule)."); { char suffix[Name::SIZE]; memset (suffix, 0, Name::SIZE); Xdr::r...
cwe
CWE-125
Unknown
TPM2B_PRIVATE_KEY_RSA_Marshal(TPM2B_PRIVATE_KEY_RSA *source, BYTE **buffer, INT32 *size) { UINT16 written = 0; written += TPM2B_Marshal(&source->b, buffer, size); return written; }
cwe
CWE-787
Unknown
// Package contexthandler contains the ContextHandler service. package contexthandler import ( "context" "errors" "net/http" "net/url" "strconv" "strings" "time" "github.com/grafana/grafana/pkg/components/apikeygen" "github.com/grafana/grafana/pkg/infra/log" "github.com/grafana/grafana/pkg/infra/network" "...
cwe
CWE-200
Go
int WavpackPackInit (WavpackContext *wpc) { if (wpc->metabytes > 16384) // 16384 bytes still leaves plenty of room for audio write_metadata_block (wpc); // in this block (otherwise write a special one) // The default block size is a compromise. Longer blocks provide better encoding...
cwe
CWE-787
Unknown
def login(self): """Login endpoint for the API returns a JWT and optionally a refresh token --- post: description: >- Authenticate and get a JWT access and refresh token requestBody: required: true content: application/json: ...
cwe
CWE-287
Python
static void vapic_exit(struct kvm_vcpu *vcpu) { struct kvm_lapic *apic = vcpu->arch.apic; int idx; if (!apic || !apic->vapic_addr) return; idx = srcu_read_lock(&vcpu->kvm->srcu); kvm_release_page_dirty(apic->vapic_page); mark_page_dirty(vcpu->kvm, apic->vapic_addr >> PAGE_SHIFT); srcu_read_unlock(&vcpu->kvm->s...
cwe
CWE-20
C/C++
static int xenvif_poll(struct napi_struct *napi, int budget) { struct xenvif *vif = container_of(napi, struct xenvif, napi); int work_done; work_done = xenvif_tx_action(vif, budget); if (work_done < budget) { int more_to_do = 0; unsigned long flags; /* It is necessary to disable IRQ before calling * RIN...
cwe
CWE-399
Unknown
protected function getBodyTagAttributes() { $formEngineParameters = []; $parameters = parent::getBodyTagAttributes(); $formEngineParameters['fieldChangeFunc'] = $this->parameters['fieldChangeFunc']; $formEngineParameters['fieldChangeFuncHash'] = GeneralUtility::hmac(serialize($this-...
cwe
CWE-327
PHP
static Image *ReadTXTImage(const ImageInfo *image_info,ExceptionInfo *exception) { char colorspace[MagickPathExtent], text[MagickPathExtent]; double max_value, x_offset, y_offset; Image *image; PixelInfo pixel; MagickBooleanType status; QuantumAny range; register ...
cwe
CWE-190
C/C++
int main(int argc, char *argv[]) { int option; int passlen=0; FILE *outfp = NULL; char outfile[1024]; unsigned char pass[MAX_PASSWD_BUF]; int file_count = 0; unsigned char bom[2]; int password_acquired = 0; while ((option = getopt(argc, argv, "vhg:p:o:")) != -1) { switch...
cwe
CWE-120
C/C++
import CoreUtils from '../CoreUtils' import Dimensions from '../dimensions/Dimensions' import Graphics from '../Graphics' import Series from '../Series' import Utils from '../../utils/Utils' import Helpers from './Helpers' /** * ApexCharts Legend Class to draw legend. * * @module Legend **/ class Legend { const...
cwe
CWE-79
JavaScript
package org.pac4j.core.util; import org.pac4j.core.exception.TechnicalException; import java.io.UnsupportedEncodingException; import java.net.*; import java.nio.charset.StandardCharsets; import java.util.Collection; import java.util.Date; /** * This class gathers all the utilities methods. * * @author Jerome Lele...
cwe
CWE-338
Java
ssize_t device_show_int(struct device *dev, struct device_attribute *attr, char *buf) { struct dev_ext_attribute *ea = to_ext_attr(attr); return snprintf(buf, PAGE_SIZE, "%d\n", *(int *)(ea->var)); }
cwe
CWE-787
Unknown
public function deleteByName(){ $item_id = I("item_id/d"); $env_id = I("env_id/d"); $var_name = I("var_name"); $login_user = $this->checkLogin(); $uid = $login_user['uid'] ; if(!$this->checkItemEdit($uid , $item_id)){ $this->sendError(10303); ...
cwe
CWE-352
PHP
/** * FreeRDP: A Remote Desktop Protocol Implementation * Update Data PDUs * * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com> * Copyright 2016 Armin Novak <armin.novak@thincast.com> * Copyright 2016 Thincast Technologies GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * ...
cwe
CWE-119
C/C++
private void newRequest(ChannelHandlerContext ctx, HttpRequest nettyRequest) throws Exception { if (!nettyRequest.decoderResult().isSuccess()) { LOGGER.debug("Failed to decode HTTP request.", nettyRequest.decoderResult().cause()); sendError(ctx, HttpResponseStatus.BAD_REQUEST); return; } ...
cwe
CWE-74
Java
/* Copyright 2020 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...
cwe
CWE-770
C/C++