code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
TEST_F(QuantizedConv2DTest, OddPaddingBatch) {
const int stride = 2;
TF_ASSERT_OK(NodeDefBuilder("quantized_conv_op", "QuantizedConv2D")
.Input(FakeInput(DT_QUINT8))
.Input(FakeInput(DT_QUINT8))
.Input(FakeInput(DT_FLOAT))
.Input(FakeInput(... | cwe | CWE-20 | Unknown |
enlist (char **cpp, char *new, size_t len)
{
int i, j;
if (cpp == NULL)
return NULL;
if ((new = icpyalloc(new)) == NULL)
{
freelist(cpp);
return NULL;
}
new[len] = '\0';
/* Is there already something in the list that's new (or longer)? */
for (i = 0; cpp[i] != NULL; ++i)
if (ist... | cwe | CWE-189 | Unknown |
protected function signDocument(\DOMDocument $document, $node)
{
$this->add509Cert($this->getCertificate()->getPublicKey()->getX509Certificate());
$this->setCanonicalMethod(XMLSecurityDSig::EXC_C14N);
$this->addReference($document->documentElement, XMLSecurityDSig::SHA1, array('http://www.w3... | cwe | CWE-347 | PHP |
static void v9fs_read(void *opaque)
{
int32_t fid;
uint64_t off;
ssize_t err = 0;
int32_t count = 0;
size_t offset = 7;
uint32_t max_count;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
err = pdu_unmarshal(pdu, offset, "dqd", &fid, &off, &max_count);
if (... | cwe | CWE-772 | C/C++ |
void Compute(OpKernelContext* const context) override {
core::RefCountPtr<BoostedTreesEnsembleResource> resource;
// Get the resource.
OP_REQUIRES_OK(context, LookupResource(context, HandleFromInput(context, 0),
&resource));
// Get the inputs.
OpInputList ... | cwe | CWE-703 | Unknown |
const renderContent = (content: string | any) => {
if (typeof content === 'string') {
return renderHTML(content);
}
return content;
}; | cwe | CWE-79 | JavaScript |
function c(H,F,J,R){function W(){F.removeChild(U);F.removeChild(Y);V.style.display="block";O.style.display="block"}z={div:F,comment:H,saveCallback:J,deleteOnCancel:R};var O=F.querySelector(".geCommentTxt"),V=F.querySelector(".geCommentActionsList"),U=document.createElement("textarea");U.className=
"geCommentEditTxtArea... | cwe | CWE-94 | JavaScript |
void* TFE_HandleToDLPack(TFE_TensorHandle* h, TF_Status* status) {
const Tensor* tensor = GetTensorFromHandle(h, status);
TF_DataType data_type = static_cast<TF_DataType>(tensor->dtype());
TensorReference tensor_ref(*tensor); // This will call buf_->Ref()
auto* tf_dlm_tensor_ctx = new TfDlManagedTensorCtx(ten... | cwe | CWE-252 | C/C++ |
local block_state deflate_slow(s, flush)
deflate_state *s;
int flush;
{
IPos hash_head; /* head of hash chain */
int bflush; /* set if current block must be flushed */
/* Process the input block. */
for (;;) {
/* Make sure that we always have enough lookahead, exce... | cwe | CWE-787 | Unknown |
static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
char
cache_filename[MagickPathExtent],
id[MagickPathExtent],
keyword[MagickPathExtent],
*options;
const unsigned char
*p;
GeometryInfo
geometry_info;
Image
*image;
int
c;
LinkedListInfo
... | cwe | CWE-401 | C/C++ |
def get_cms_details(url):
# this function will fetch cms details using cms_detector
response = {}
cms_detector_command = 'python3 /usr/src/github/CMSeeK/cmseek.py -u {} --random-agent --batch --follow-redirect'.format(url)
os.system(cms_detector_command)
response['status'] = False
response['mes... | cwe | CWE-78 | Python |
static int build_open_gop_key_points(AVStream *st)
{
int k;
int sample_id = 0;
uint32_t cra_index;
MOVStreamContext *sc = st->priv_data;
if (st->codecpar->codec_id != AV_CODEC_ID_HEVC || !sc->sync_group_count)
return 0;
/* Build an unrolled index of the samples */
sc->sample_offset... | cwe | CWE-703 | Unknown |
void BaseRenderingContext2D::setFillStyle(
const StringOrCanvasGradientOrCanvasPattern& style) {
DCHECK(!style.IsNull());
ValidateStateStack();
String color_string;
CanvasStyle* canvas_style = nullptr;
if (style.IsString()) {
color_string = style.GetAsString();
if (color_string == GetState().Unpar... | cwe | CWE-200 | C/C++ |
static void recalculate_apic_map(struct kvm *kvm)
{
struct kvm_apic_map *new, *old = NULL;
struct kvm_vcpu *vcpu;
int i;
new = kzalloc(sizeof(struct kvm_apic_map), GFP_KERNEL);
mutex_lock(&kvm->arch.apic_map_lock);
if (!new)
goto out;
new->ldr_bits = 8;
/* flat mode is default */
new->cid_shift = 8;
n... | cwe | CWE-189 | C/C++ |
var create_html = function() {
var html = "";
for (var id in all_tags) {
var tag = all_tags[id];
if (tag && !(id in child_tags)) {
html += create_tag_html(tag.t, tag.d, owners[tag.o], tag.i,
null, tag.s !== 0);
... | cwe | CWE-79 | JavaScript |
void DisconnectWindowLinux::Hide() {
NOTIMPLEMENTED();
} | cwe | CWE-416 | C/C++ |
void WebURLLoaderImpl::Context::OnReceivedResponse(
const ResourceResponseInfo& info) {
if (!client_)
return;
WebURLResponse response;
response.initialize();
PopulateURLResponse(request_.url(), info, &response);
bool show_raw_listing = (GURL(request_.url()).query() == "raw");
if (info.mime_type =... | cwe | CWE-399 | C/C++ |
HandleFileDownloadCancelRequest(rfbClientPtr cl, rfbTightClientPtr rtcp)
{
int n = 0;
char *reason = NULL;
rfbClientToServerTightMsg msg;
memset(&msg, 0, sizeof(rfbClientToServerTightMsg));
if((n = rfbReadExact(cl, ((char *)&msg)+1, sz_rfbFileDownloadCancelMsg-1)) <= 0) {
if (n < 0)
rfbLog("File [%s]: M... | cwe | CWE-416 | Unknown |
PixarLogSetupDecode(TIFF* tif)
{
static const char module[] = "PixarLogSetupDecode";
TIFFDirectory *td = &tif->tif_dir;
PixarLogState* sp = DecoderState(tif);
tmsize_t tbuf_size;
assert(sp != NULL);
/* Make sure no byte swapping happens on the data
* after decompression. */
tif->tif_postdecode = _TIFFNoPostD... | cwe | CWE-787 | Unknown |
def process_as_reply(email_obj):
job_number = email_obj['subject'].split(': #')[1]
feedback = re.findall("^[\W]*([Oo\d]){1}(?=[\W]*)", email_obj['content'].replace('#','').replace('link', ''))[0]
feedback = int(0 if feedback == ('O' or 'o') else feedback)
dcn_key = re.findall('\w{8}-\w{4}-\w{4}-\w{4}-\w... | cwe | CWE-89 | Python |
QPDFWriter::writeHintStream(int hint_id)
{
PointerHolder<Buffer> hint_buffer;
int S = 0;
int O = 0;
QPDF::Writer::generateHintStream(
this->m->pdf, this->m->xref, this->m->lengths,
this->m->obj_renumber_no_gen,
hint_buffer, S, O);
openObject(hint_id);
setDataKey(hint_id)... | cwe | CWE-787 | Unknown |
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
TF_LITE_ENSURE_EQ(context, NumInputs(node), 2);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
const TfLiteTensor* input = GetInput(context, node, kInput);
const TfLiteTensor* axis = GetInput(context, node, kAxis);
TfLiteTensor* output = GetOu... | cwe | CWE-787 | C/C++ |
unsigned long insn_get_seg_base(struct pt_regs *regs, int seg_reg_idx)
{
struct desc_struct *desc;
short sel;
sel = get_segment_selector(regs, seg_reg_idx);
if (sel < 0)
return -1L;
if (v8086_mode(regs))
/*
* Base is simply the segment selector shifted 4
* bits to the right.
*/
return (unsigned lo... | cwe | CWE-416 | Unknown |
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
auto* params = reinterpret_cast<TfLiteSVDFParams*>(node->builtin_data);
OpData* op_data = reinterpret_cast<OpData*>(node->user_data);
const TfLiteTensor* input = GetInput(context, node, kInputTensor);
const TfLiteTensor* weights_feature =
GetI... | cwe | CWE-787 | C/C++ |
static void do_cmd(ESPState *s)
{
uint8_t busid = fifo8_pop(&s->cmdfifo);
s->cmdfifo_cdb_offset--;
/* Ignore extended messages for now */
if (s->cmdfifo_cdb_offset) {
esp_fifo_pop_buf(&s->cmdfifo, NULL, s->cmdfifo_cdb_offset);
s->cmdfifo_cdb_offset = 0;
}
do_busid_cmd(s, busid... | cwe | CWE-476 | Unknown |
rb_dir_s_empty_p(VALUE obj, VALUE dirname)
{
VALUE result, orig;
const char *path;
enum {false_on_notdir = 1};
GlobPathValue(dirname, FALSE);
orig = rb_str_dup_frozen(dirname);
dirname = rb_str_encode_ospath(dirname);
dirname = rb_str_dup_frozen(dirname);
path = RSTRING_PTR(dirname);
#... | cwe | CWE-22 | Unknown |
QPDFFormFieldObjectHelper::getQuadding()
{
int result = 0;
QPDFObjectHandle fv = getInheritableFieldValue("/Q");
if (fv.isInteger())
{
QTC::TC("qpdf", "QPDFFormFieldObjectHelper Q present");
result = static_cast<int>(fv.getIntValue());
}
return result;
} | cwe | CWE-787 | Unknown |
tbGetBuffer(unsigned size)
{
char *rtrn;
if (size >= BUFFER_SIZE)
return NULL;
if ((BUFFER_SIZE - tbNext) <= size)
tbNext = 0;
rtrn = &textBuffer[tbNext];
tbNext += size;
return rtrn;
} | cwe | CWE-119 | C/C++ |
def getResults(poll_name):
conn, c = connectDB()
req = "SELECT options from {} where name = '{}'".format(CFG("poll_table_name"), poll_name)
options_str = queryOne(c, req)
if not options_str:
raise LookupError("Poll '{}' not found in DB".format(poll_name))
total = 0
options = options_st... | cwe | CWE-89 | Python |
static int lmf_header_load(lmf_header *lmfh, RBuffer *buf, Sdb *db) {
if (r_buf_size (buf) < sizeof (lmf_header)) {
return false;
}
if (r_buf_fread_at (buf, QNX_HEADER_ADDR, (ut8 *) lmfh, "iiiiiiiicccciiiicc", 1) < QNX_HDR_SIZE) {
return false;
}
r_strf_buffer (32);
sdb_set (db, "qnx.version", r_strf ("0x%xH"... | cwe | CWE-400 | C/C++ |
/*
* SPDX-License-Identifier: ISC
*
* Copyright (c) 2004-2008, 2010-2020 Todd C. Miller <Todd.Miller@sudo.ws>
*
* Permission to use, copy, modify, and 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 ... | cwe | CWE-59 | C/C++ |
int HttpProxyClientSocket::DoReadHeadersComplete(int result) {
if (result < 0)
return result;
if (response_.headers->GetParsedHttpVersion() < HttpVersion(1, 0))
return ERR_TUNNEL_CONNECTION_FAILED;
net_log_.AddEvent(
NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS,
base::Bind(&Htt... | cwe | CWE-19 | C/C++ |
bool ExtensionService::IsDownloadFromGallery(const GURL& download_url,
const GURL& referrer_url) {
if (IsDownloadFromMiniGallery(download_url) &&
StartsWithASCII(referrer_url.spec(),
extension_urls::kMiniGalleryBrowsePrefix, false)) {
retur... | cwe | CWE-276 | C/C++ |
/*
* 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,... | cwe | CWE-287 | Java |
static int oidc_check_userid_openidc(request_rec *r, oidc_cfg *c) {
if (c->redirect_uri == NULL) {
oidc_error(r,
"configuration error: the authentication type is set to \"openid-connect\" but OIDCRedirectURI has not been set");
return HTTP_INTERNAL_SERVER_ERROR;
}
/* check if this is a sub-request or an in... | cwe | CWE-287 | Unknown |
"geTempDlgCreateBtn geTempDlgBtnDisabled")}function y(fa,ca){if(null!=I){var ba=function(oa){qa.isExternal?e(qa,function(na){ja(na,oa)},ia):qa.url?mxUtils.get(TEMPLATE_PATH+"/"+qa.url,mxUtils.bind(this,function(na){200<=na.getStatus()&&299>=na.getStatus()?ja(na.getText(),oa):ia()})):ja(b.emptyDiagramXml,oa)},ja=functio... | cwe | CWE-20 | JavaScript |
def fetch_issue(cursor, id):
"""
Fetch an issue by id along with its tags. Returns None if no issue
with the specified id exists in the database.
"""
cursor.execute(f"""
SELECT
issue.id,
issue.title,
issue.description,
tag.namespace,
... | cwe | CWE-89 | Python |
static int unix_stream_read_generic(struct unix_stream_read_state *state,
bool freezable)
{
struct scm_cookie scm;
struct socket *sock = state->socket;
struct sock *sk = sock->sk;
struct unix_sock *u = unix_sk(sk);
int copied = 0;
int flags = state->flags;
int noblock = flags & MSG_DONTWAIT;
bool check_... | cwe | CWE-362 | Unknown |
static int setup_frame(int sig, struct k_sigaction *ka,
sigset_t *set, struct pt_regs * regs)
{
void __user *restorer;
struct sigframe __user *frame;
int err = 0;
int usig;
frame = get_sigframe(ka, regs, sizeof(*frame));
if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
goto give_sigsegv;
usig =... | cwe | CWE-399 | Unknown |
openvpn_decrypt (struct buffer *buf, struct buffer work,
const struct crypto_options *opt,
const struct frame* frame)
{
static const char error_prefix[] = "Authenticate/Decrypt packet error";
struct gc_arena gc;
gc_init (&gc);
if (buf->len > 0 && opt->key_ctx_bi)
{
struct key_ctx *ctx = &opt->k... | cwe | CWE-200 | C/C++ |
static int nft_flush_table(struct nft_ctx *ctx)
{
int err;
struct nft_chain *chain, *nc;
struct nft_set *set, *ns;
list_for_each_entry_safe(chain, nc, &ctx->table->chains, list) {
ctx->chain = chain;
err = nft_delrule_by_chain(ctx);
if (err < 0)
goto out;
err = nft_delchain(ctx);
if (err < 0)
got... | cwe | CWE-19 | C/C++ |
ews_backend_constructed (GObject *object)
{
EBackend *backend;
ESource *source;
ESourceAuthentication *auth_extension;
const gchar *extension_name;
gchar *host = NULL;
guint16 port = 0;
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (e_ews_backend_parent_class)->constructed (object);
backend... | cwe | CWE-295 | Unknown |
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% ... | cwe | CWE-772 | C/C++ |
""" activitypub-aware django model fields """
from dataclasses import MISSING
import re
from uuid import uuid4
from urllib.parse import urljoin
import dateutil.parser
from dateutil.parser import ParserError
from django.contrib.postgres.fields import ArrayField as DjangoArrayField
from django.core.exceptions import Val... | cwe | CWE-79 | Python |
static PyObject *checkPassword(PyObject *self, PyObject *args)
{
const char *user = NULL;
const char *pswd = NULL;
const char *service = NULL;
const char *default_realm = NULL;
int result = 0;
if (!PyArg_ParseTuple(args, "ssss", &user, &pswd, &service, &default_realm))
return NULL;
... | cwe | CWE-287 | Unknown |
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'base/js/namespace',
'base/js/utils',
'base/js/i18n',
'base/js/dialog',
'base/js/events',
'base/js/keyboard',
'moment',
'bidi/bidi'
], function($, IPython, utils... | cwe | CWE-79 | Python |
this.init=function(){function G(H){if(null!=H){var R=H.getAttribute("background");if(null==R||""==R||R==mxConstants.NONE)R=Editor.isDarkMode()?"transparent":"#ffffff";A.style.backgroundColor=R;(new mxCodec(H.ownerDocument)).decode(H,L.getModel());L.maxFitScale=1;L.fit(8);L.center()}return H}function N(H){null!=H&&(H=G(... | cwe | CWE-94 | JavaScript |
static int raw_cmd_copyin(int cmd, void __user *param,
struct floppy_raw_cmd **rcmd)
{
struct floppy_raw_cmd *ptr;
int ret;
int i;
*rcmd = NULL;
loop:
ptr = kmalloc(sizeof(struct floppy_raw_cmd), GFP_USER);
if (!ptr)
return -ENOMEM;
*rcmd = ptr;
ret = copy_from_user(ptr, param, sizeof(*ptr));
if (ret)... | cwe | CWE-754 | C/C++ |
SessionManager.prototype.logIn = function(req, user, cb) {
var self = this;
this._serializeUser(user, req, function(err, obj) {
if (err) {
return cb(err);
}
// TODO: Error if session isn't available here.
if (!req.session) {
req.session = {};
}
if (!req.session[self._key]) {
... | cwe | CWE-384 | JavaScript |
.factory('Alert', ['$rootScope', function ($rootScope) {
return function (hdr, msg, cls, action, secondAlert, disableButtons, backdrop) {
var scope = $rootScope.$new(), alertClass, local_backdrop;
if (secondAlert) {
$('#alertHeader2').html(hdr);
$('#alert2-modal-msg').html(m... | cwe | CWE-79 | JavaScript |
/* Copyright (c) 2017 - 2021 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_send_ctl.c -- Logic for sending and sent packets
*/
#include <assert.h>
#include <errno.h>
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include <sys/queue.h>
#include <openssl/rand.h>
#include "lsquic_types.h"
#... | cwe | CWE-476 | C/C++ |
PHP_MINIT_FUNCTION(filter)
{
ZEND_INIT_MODULE_GLOBALS(filter, php_filter_init_globals, NULL);
REGISTER_INI_ENTRIES();
REGISTER_LONG_CONSTANT("INPUT_POST", PARSE_POST, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("INPUT_GET", PARSE_GET, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("INPUT_COOKIE... | cwe | CWE-190 | C/C++ |
int get_evtchn_to_irq(evtchn_port_t evtchn)
{
if (evtchn >= xen_evtchn_max_channels())
return -1;
if (evtchn_to_irq[EVTCHN_ROW(evtchn)] == NULL)
return -1;
return evtchn_to_irq[EVTCHN_ROW(evtchn)][EVTCHN_COL(evtchn)];
} | cwe | CWE-416 | C/C++ |
eb);this.updateSvgLinks(Da,ua,!0);this.addForeignObjectWarning(eb,Da);return Da}finally{Qa&&(this.useCssTransforms=!0,this.view.revalidate(),this.sizeDidChange())}};Graph.prototype.addForeignObjectWarning=function(z,L){if("0"!=urlParams["svg-warning"]&&0<L.getElementsByTagName("foreignObject").length){var M=z.createEle... | cwe | CWE-20 | JavaScript |
static void do_dma_pdma_cb(ESPState *s)
{
int to_device = ((s->rregs[ESP_RSTAT] & 7) == STAT_DO);
int len;
uint32_t n;
if (s->do_cmd) {
s->ti_size = 0;
s->do_cmd = 0;
do_cmd(s);
esp_lower_drq(s);
return;
}
if (!s->current_req) {
return;
}
... | cwe | CWE-476 | Unknown |
// Copyright 2009 Indeed
package com.indeed.util.varexport.servlet;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Joiner;
import com.google.common.base.Strings;
import com.google.common.collect.*;
import com.indeed.util.varexport.VarExporter;
import com.indeed.util.varexport.Var... | cwe | CWE-79 | Java |
function escape_command($command) {
return preg_replace("/(\\\$|`)/", "", $command);
} | cwe | CWE-89 | PHP |
package service
import (
"archive/zip"
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"os"
"runtime/pprof"
"strconv"
"strings"
"time"
"github.com/gogo/protobuf/types"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/pkg/errors"
"github.com/stackrox/rox/central/cluster/datastore"... | cwe | CWE-668 | Go |
function inetLatency(host, callback) {
// fallback - if only callback is given
if (util.isFunction(host) && !callback) {
callback = host;
host = '';
}
host = host || '8.8.8.8';
return new Promise((resolve) => {
process.nextTick(() => {
if (typeof host !== 'string') {
if (callback)... | cwe | CWE-78 | JavaScript |
void Compute(OpKernelContext* const context) override {
// node_id_range
const Tensor* node_id_range_t;
OP_REQUIRES_OK(context, context->input("node_id_range", &node_id_range_t));
OP_REQUIRES(
context, node_id_range_t->dims() == 1,
errors::InvalidArgument("node_id_range must be a rank 1 ... | cwe | CWE-476 | C/C++ |
/*
* 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,... | cwe | CWE-287 | Java |
/**
* Tags plugin.
*
* - Set tags via dialog
* - Toggle hidden tags
* - Stateless filter
*
* TODO:
*
* - Add hiddenTags to viewState of page
* - Export to PDF ignores current tags
* - Sync hiddenTags with removed tags
*/
Draw.loadPlugin(function(editorUi)
{
var div = document.createElement('div');
//... | cwe | CWE-94 | JavaScript |
/*
* INET An implementation of the TCP/IP protocol suite for the LINUX
* operating system. INET is implemented using the BSD Socket
* interface as the means of communication with the user level.
*
* Generic socket support routines. Memory allocators, socket lock/release
* handler for protocols to use and g... | cwe | CWE-119 | C/C++ |
MagickExport Image *ImplodeImage(const Image *image,const double amount,
const PixelInterpolateMethod method,ExceptionInfo *exception)
{
#define ImplodeImageTag "Implode/Image"
CacheView
*canvas_view,
*implode_view,
*interpolate_view;
double
radius;
Image
*canvas_image,
*implode_imag... | cwe | CWE-369 | C/C++ |
poly_in(PG_FUNCTION_ARGS)
{
char *str = PG_GETARG_CSTRING(0);
POLYGON *poly;
int npts;
int size;
int isopen;
char *s;
if ((npts = pair_count(str, ',')) <= 0)
ereport(ERROR,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("invalid input syntax for type polygon: \"%s\"", str)));
... | cwe | CWE-189 | C/C++ |
/*
* This file is part of Espruino, a JavaScript interpreter for Microcontrollers
*
* Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http... | cwe | CWE-125 | C/C++ |
func runUsingChrootMain() {
var options runUsingChrootSubprocOptions
runtime.LockOSThread()
// Set logging.
if level := os.Getenv("LOGLEVEL"); level != "" {
if ll, err := strconv.Atoi(level); err == nil {
logrus.SetLevel(logrus.Level(ll))
}
os.Unsetenv("LOGLEVEL")
}
// Unpack our configuration.
confP... | cwe | CWE-200 | Go |
from __future__ import absolute_import
import datetime
import logging
import os
import re
import socket
import warnings
from socket import error as SocketError
from socket import timeout as SocketTimeout
from .packages import six
from .packages.six.moves.http_client import HTTPConnection as _HTTPConnection
from .pack... | cwe | CWE-295 | Python |
/**
Onion HTTP server library
Copyright (C) 2010-2021 David Moreno Montero and others
This library is free software; you can redistribute it and/or
modify it under the terms of, at your choice:
a. the Apache License Version 2.0.
b. the GNU General Public License as published by the
Free Software Founda... | cwe | CWE-770 | C/C++ |
var I=z.div.querySelector(".geCommentEditTxtArea"),F=z.div.querySelector(".geCommentEditBtns");z.comment.content=I.value;I.parentNode.removeChild(I);F.parentNode.removeChild(F)}catch(H){b.handleError(H)}O.innerHTML='<div style="padding-top:10px;text-align:center;"><img src="'+IMAGE_PATH+'/spin.gif" valign="middle"> '+m... | cwe | CWE-94 | JavaScript |
package io.onedev.server.product;
import java.util.EnumSet;
import javax.inject.Inject;
import javax.servlet.DispatcherType;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
import org.apache.shiro.web.env.EnvironmentLoader;
import org.apache.shiro.web.env.EnvironmentLoaderL... | cwe | CWE-502 | Java |
static int irda_recvmsg_stream(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, size_t size, int flags)
{
struct sock *sk = sock->sk;
struct irda_sock *self = irda_sk(sk);
int noblock = flags & MSG_DONTWAIT;
size_t copied = 0;
int target, err;
long timeo;
IRDA_DEBUG(3, "%s()\n", __func__);... | cwe | CWE-20 | Unknown |
static ssize_t total_time_ms_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct wakeup_source *ws = dev_get_drvdata(dev);
ktime_t active_time;
ktime_t total_time = ws->total_time;
if (ws->active) {
active_time = ktime_sub(ktime_get(), ws->last_time);
total_time = ktime_add(total_... | cwe | CWE-787 | Unknown |
def initialize(image_path, colors=16, depth=8)
output = `convert #{image_path} -resize 400x400 -format %c -dither None -quantize YIQ -colors #{colors} -depth #{depth} histogram:info:-`
@lines = output.lines.sort.reverse.map(&:strip).reject(&:empty?)
end | cwe | CWE-77 | Ruby |
int snmp_helper(void *context, size_t hdrlen, unsigned char tag,
const void *data, size_t datalen)
{
struct snmp_ctx *ctx = (struct snmp_ctx *)context;
__be32 *pdata = (__be32 *)data;
if (*pdata == ctx->from) {
pr_debug("%s: %pI4 to %pI4\n", __func__,
(void *)&ctx->from, (void *)&ctx->to);
if (*ct... | cwe | CWE-129 | C/C++ |
int go7007_snd_init(struct go7007 *go)
{
static int dev;
struct go7007_snd *gosnd;
int ret;
if (dev >= SNDRV_CARDS)
return -ENODEV;
if (!enable[dev]) {
dev++;
return -ENOENT;
}
gosnd = kmalloc(sizeof(struct go7007_snd), GFP_KERNEL);
if (gosnd == NULL)
return -ENOMEM;
spin_lock_init(&gosnd->lock);
gos... | cwe | CWE-401 | C/C++ |
public int decryptWithAd(byte[] ad, byte[] ciphertext,
int ciphertextOffset, byte[] plaintext, int plaintextOffset,
int length) throws ShortBufferException, BadPaddingException {
int space;
if (ciphertextOffset > ciphertext.length)
space = 0;
else
space = ciphertext.length - ciphertextOffset;
if (le... | cwe | CWE-125 | Java |
update_connection (NMConnectionList *list,
NMConnectionEditor *editor,
NMExportedConnection *original,
NMConnection *modified,
ConnectionUpdatedFn callback,
gpointer user_data)
{
NMConnectionScope original_scope;
Connection... | cwe | CWE-310 | Unknown |
function execSync(cmd, opts, pipe) {
if (!common.config.execPath) {
common.error('Unable to find a path to the node binary. Please manually set config.execPath');
}
var tempDir = _tempDir();
var paramsFile = path.resolve(tempDir + '/' + common.randomFileName());
var stderrFile = path.resolve(tempDir + '/... | cwe | CWE-269 | JavaScript |
static int sysMapFD(int fd, MemMapping* pMap)
{
off_t start;
size_t length;
void* memPtr;
assert(pMap != NULL);
if (getFileStartAndLength(fd, &start, &length) < 0)
return -1;
memPtr = mmap(NULL, length, PROT_READ, MAP_PRIVATE, fd, start);
if (memPtr == MAP_FAILED) {
LOGW("mmap(%d, R, PRIVATE, %... | cwe | CWE-189 | C/C++ |
function createSearchBox(searchURL) {
var ds = new YAHOO.util.XHRDataSource(searchURL+"suggest");
ds.responseType = YAHOO.util.XHRDataSource.TYPE_JSON;
ds.responseSchema = {
resultsList: "suggestions",
fields: ["name"]
};
var ac = new YAHOO.widget.AutoComplete("search-box","search-bo... | cwe | CWE-79 | JavaScript |
print_prefix(netdissect_options *ndo, const u_char *prefix, u_int max_length)
{
int plenbytes;
char buf[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx::/128")];
if (prefix[0] >= 96 && max_length >= IPV4_MAPPED_HEADING_LEN + 1 &&
is_ipv4_mapped_address(&prefix[1])) {
struct in_addr addr;
... | cwe | CWE-125 | C/C++ |
void resetPasswordUnexistingUser() throws Exception
{
when(this.userReference.toString()).thenReturn("user:Foobar");
when(this.userManager.exists(this.userReference)).thenReturn(false);
String exceptionMessage = "User [user:Foobar] doesn't exist";
when(this.localizationManager.getTra... | cwe | CWE-640 | Java |
@bot.message_handler(func = lambda message: get_current_state(message.chat.id) == config.States.S_LOGIN.value)
def get_login2(message):
settings = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + "\\bases\\settings.db")
conn = settings.cursor()
if bases.createuserbase.check_username(message.text... | cwe | CWE-89 | Python |
/*!
Copyright (c) REBUILD <https://getrebuild.com/> and/or its owners. All rights reserved.
rebuild is dual-licensed under commercial and open source licenses (GPLv3).
See LICENSE and COMMERCIAL in the project root for license information.
*/
package com.rebuild.web.general;
import cn.devezhao.bizz.security.member.T... | cwe | CWE-89 | Java |
/*
* PgBouncer - Lightweight connection pooler for PostgreSQL.
*
* Copyright (c) 2007-2009 Marko Kreen, Skype Technologies OÜ
*
* 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 permissi... | cwe | CWE-89 | C/C++ |
/*
* Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
*
* 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 any later version.
*
* This progr... | cwe | CWE-203 | C/C++ |
int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *signature,
void *asn, EVP_PKEY *pkey)
{
EVP_MD_CTX ctx;
const EVP_MD *type;
unsigned char *buf_in=NULL;
int ret= -1,i,inl;
EVP_MD_CTX_init(&ctx);
i=OBJ_obj2nid(a->algorithm);
type=EVP_get_digestb... | cwe | CWE-310 | Unknown |
/*
* Copyright © 2001-2011 Stéphane Raimbault <stephane.raimbault@gmail.com>
*
* SPDX-License-Identifier: LGPL-2.1+
*
* This library implements the Modbus protocol.
* http://libmodbus.org/
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <errno.h>
#include <limits.h>
#i... | cwe | CWE-125 | C/C++ |
/**
* OLAT - Online Learning and Training<br>
* http://www.olat.org
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unl... | cwe | CWE-91 | Java |
latin_ptr2len(char_u *p)
{
return MB_BYTE2LEN(*p);
} | cwe | CWE-122 | Unknown |
mapi_attr_read (size_t len, unsigned char *buf)
{
size_t idx = 0;
uint32 i,j;
assert(len > 4);
uint32 num_properties = GETINT32(buf+idx);
MAPI_Attr** attrs = CHECKED_XMALLOC (MAPI_Attr*, (num_properties + 1));
idx += 4;
if (!attrs) return NULL;
for (i = 0; i < num_properties; i++... | cwe | CWE-125 | Unknown |
/*
* $LynxId: HTML.c,v 1.173 2017/07/04 20:05:01 tom Exp $
*
* Structured stream to Rich hypertext converter
* ============================================
*
* This generates a hypertext object. It converts from the
* structured stream interface of HTML events into the style-
* oriented interface of the HTex... | cwe | CWE-416 | C/C++ |
#!/usr/bin/env python
#
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import azure.functions as func
from onefuzztypes.responses import Info
from ..onefuzzlib.azure.creds import (
get_base_region,
get_base_resource_group,
get_insights_appid,
get_insights_instrumentation_key,... | cwe | CWE-863 | Python |
/*
* GeoTools - The Open Source Java GIS Toolkit
* http://geotools.org
*
* (C) 2001-2008, Open Source Geospatial Foundation (OSGeo)
*
* This library 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 ... | cwe | CWE-20 | Java |
success: function(data) {
var inst = $.jstree.reference('#dataTree');
var remove = data.update.remove;
var childless = data.update.childless;
var removalClosure = [];
var unremovedParentClosure;
var removeType = function(type, ids) {
... | cwe | CWE-116 | JavaScript |
package service
import (
"context"
"encoding/json"
"net/http"
"github.com/go-kit/kit/endpoint"
kitlog "github.com/go-kit/kit/log"
"github.com/igm/sockjs-go/v3/sockjs"
"github.com/fleetdm/fleet/server/contexts/viewer"
"github.com/fleetdm/fleet/server/kolide"
"github.com/fleetdm/fleet/server/websocket"
)
////... | cwe | CWE-400 | Go |
ipt_do_table(struct sk_buff *skb,
const struct nf_hook_state *state,
struct xt_table *table)
{
unsigned int hook = state->hook;
static const char nulldevname[IFNAMSIZ] __attribute__((aligned(sizeof(long))));
const struct iphdr *ip;
/* Initializing verdict to NF_DROP keeps gcc happy. */
unsigned int ver... | cwe | CWE-476 | C/C++ |
package main
import (
"fmt"
"net/http"
"os"
"strings"
)
// simple error checker
func checkY(err error) {
if err != nil {
fmt.Println(err)
os.Exit(1)
}
}
// will create a link into one level deeper
func linkDeeper(cwd string, link string, name string) string {
return "<a href=\"" + cwd + "/" + link + "\">"... | cwe | CWE-89 | Go |
"""
SVG colors.
"""
import re
COLORS = {
'aliceblue': (240 / 255, 248 / 255, 255 / 255, 1),
'antiquewhite': (250 / 255, 235 / 255, 215 / 255, 1),
'aqua': (0 / 255, 255 / 255, 255 / 255, 1),
'aquamarine': (127 / 255, 255 / 255, 212 / 255, 1),
'azure': (240 / 255, 255 / 255, 255 / 255, 1),
'bei... | cwe | CWE-400 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.