code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
/*
* Copyright 2016 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* 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.apach... | cwe | CWE-22 | Java |
/*
* Copyright (C) 2006, 2007, 2009 Rusty Russell, IBM Corporation
* Copyright (C) 2009, 2010, 2011 Red Hat, Inc.
* Copyright (C) 2009, 2010, 2011 Amit Shah <amit.shah@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as pub... | cwe | CWE-119 | C/C++ |
connection_exit_begin_conn(cell_t *cell, circuit_t *circ)
{
edge_connection_t *n_stream;
relay_header_t rh;
char *address = NULL;
uint16_t port = 0;
or_circuit_t *or_circ = NULL;
const or_options_t *options = get_options();
begin_cell_t bcell;
int rv;
uint8_t end_reason=0;
assert_circuit_ok(circ);
... | cwe | CWE-617 | C/C++ |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Felix Fontein <felix@fontein.de>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = r'''
---
module: x509_c... | cwe | CWE-116 | C/C++ |
TfLiteStatus ResizeOutput(TfLiteContext* context, const TfLiteTensor* input,
const TfLiteTensor* axis, TfLiteTensor* output) {
int axis_value;
// Retrive all 8 bytes when axis type is kTfLiteInt64 to avoid data loss.
if (axis->type == kTfLiteInt64) {
axis_value = static_cast<int>(*Ge... | cwe | CWE-787 | C/C++ |
TfLiteStatus ReverseSequenceHelper(TfLiteContext* context, TfLiteNode* node) {
const TfLiteTensor* seq_lengths_tensor =
GetInput(context, node, kSeqLengthsTensor);
switch (seq_lengths_tensor->type) {
case kTfLiteInt32: {
return ReverseSequenceImpl<T, int32_t>(context, node);
}
case kTfLiteIn... | cwe | CWE-787 | C/C++ |
// 处理页面数据相关的逻辑
// 定义一个html反转义的函数
const unescapeHTML = str =>
str.replace(
/&|<|>|'|"/g,
tag =>
({
'&': '&',
'<': '<',
'>': '>',
''': "'",
'"': '"'
}[tag] || tag)
)
// 渲染来自runapi的文档
const rederPageContent = (page_cont... | cwe | CWE-79 | JavaScript |
const booleanOptions = [
{ checked: true, unchecked: false },
{ x: true, '': false },
{ yes: true, no: false },
{ y: true, n: false },
{ 1: true, 0: false },
{ '[x]': true, '[]': false, '[ ]': false },
{ '☑': true, '': false },
{ '✅': true, '': false },
{ '✓': true, '': false },
{ '✔': true, '': fal... | cwe | CWE-400 | JavaScript |
/*-
* Copyright 2014 Square Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... | cwe | CWE-284 | Go |
null);mxEvent.consume(G)})))}if(null!=z)for(B=0;B<z.length;B++){var D=document.createElement("div");D.style.marginTop=null!=t||0<B?"6px":"0px";D.appendChild(this.graph.createLinkForHint(z[B].getAttribute("href"),mxUtils.getTextContent(z[B])));this.linkHint.appendChild(D)}}}catch(G){}};mxEdgeHandler.prototype.updateLink... | cwe | CWE-918 | JavaScript |
poppler_document_get_attachments (PopplerDocument *document)
{
Catalog *catalog;
int n_files, i;
GList *retval = nullptr;
g_return_val_if_fail (POPPLER_IS_DOCUMENT (document), NULL);
catalog = document->doc->getCatalog ();
if (catalog == nullptr || ! catalog->isOk ())
return nullptr;
n_files = cata... | cwe | CWE-476 | Unknown |
static bool disconnect_cb(struct io *io, void *user_data)
{
struct bt_att_chan *chan = user_data;
struct bt_att *att = chan->att;
int err;
socklen_t len;
len = sizeof(err);
if (getsockopt(chan->fd, SOL_SOCKET, SO_ERROR, &err, &len) < 0) {
util_debug(chan->att->debug_callback, chan->att->debug_data,
"(cha... | cwe | CWE-415 | C/C++ |
function currentPoll(secretPoll) {
check(secretPoll, Boolean);
const tokenValidation = AuthTokenValidation.findOne({
connectionId: this.connection.id,
});
if (
!tokenValidation
|| tokenValidation.validationStatus !== ValidationStates.VALIDATED
) {
Logger.warn(
`Publishing Polls was requ... | cwe | CWE-918 | JavaScript |
ReceiveCopyBegin(CopyState cstate)
{
if (PG_PROTOCOL_MAJOR(FrontendProtocol) >= 3)
{
/* new way */
StringInfoData buf;
int natts = list_length(cstate->attnumlist);
int16 format = (cstate->binary ? 1 : 0);
int i;
pq_beginmessage(&buf, 'G');
pq_sendbyte(&buf, format); /* overall format */
pq_send... | cwe | CWE-89 | Unknown |
/***************************************************************************************************
Zyan Disassembler Library (Zydis)
Original Author : Florian Bernd, Joel Hoener
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation file... | cwe | CWE-122 | C/C++ |
const crypto = require('crypto')
module.exports = {
/**
* Generate unique hash from page
*/
generateHash(assetPath) {
return crypto.createHash('sha1').update(assetPath).digest('hex')
}
}
| cwe | CWE-79 | JavaScript |
/* $OpenBSD: ca.c,v 1.64 2020/07/15 14:45:15 tobhe Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
*
* 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 ... | cwe | CWE-639 | C/C++ |
bool HexInStream::hexStrToBin(const char* s, char** data, int* length) {
int l=strlen(s);
if ((l % 2) == 0) {
delete [] *data;
*data = 0; *length = 0;
if (l == 0)
return true;
*data = new char[l/2];
*length = l/2;
for(int i=0;i<l;i+=2) {
int byte = 0;
if (!readHexAndShift(s... | cwe | CWE-122 | C/C++ |
int wc_SignatureGenerate(
enum wc_HashType hash_type, enum wc_SignatureType sig_type,
const byte* data, word32 data_len,
byte* sig, word32 *sig_len,
const void* key, word32 key_len, WC_RNG* rng)
{
int ret;
word32 hash_len, hash_enc_len;
#ifdef WOLFSSL_SMALL_STACK
byte *hash_data;
#else
b... | cwe | CWE-327 | Unknown |
find_file_in_path_option(
char_u *ptr, // file name
int len, // length of file name
int options,
int first, // use count'th matching file name
char_u *path_option, // p_path or p_cdpath
int find_what, // FINDFILE_FILE, _DIR or _BOTH
char_u *rel_fname, // file name we are looking relat... | cwe | CWE-122 | Unknown |
void SetUpFontconfig() {
std::unique_ptr<Environment> env = Environment::Create();
if (!env->HasVar("FONTCONFIG_FILE")) {
FilePath dir_module;
PathService::Get(DIR_MODULE, &dir_module);
FilePath font_cache = dir_module.Append("fontconfig_caches");
FilePath test_fonts = dir_module.Append("test_fonts"... | cwe | CWE-254 | Unknown |
static int remove_bond(const bt_bdaddr_t *bd_addr)
{
/* sanity check */
if (interface_ready() == FALSE)
return BT_STATUS_NOT_READY;
return btif_dm_remove_bond(bd_addr);
} | cwe | CWE-20 | C/C++ |
int cipso_v4_sock_getattr(struct sock *sk, struct netlbl_lsm_secattr *secattr)
{
struct ip_options *opt;
opt = inet_sk(sk)->opt;
if (opt == NULL || opt->cipso == 0)
return -ENOMSG;
return cipso_v4_getattr(opt->__data + opt->cipso - sizeof(struct iphdr),
secattr);
} | cwe | CWE-362 | Unknown |
StringVal EncryptionFunctions::from_base64(FunctionContext* ctx, const StringVal& src) {
if (src.len == 0 || src.is_null) {
return StringVal::null();
}
int cipher_len = src.len;
std::unique_ptr<char[]> p;
p.reset(new char[cipher_len]);
int ret_code = base64_decode((const char*)src.ptr,... | cwe | CWE-200 | Unknown |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ldap
import (
"errors"
"gopkg.in/asn1-ber.v1"
)
// SimpleBindRequest represents a username/password bind operation
type SimpleBindRequest struct {
... | cwe | CWE-287 | Go |
dissect_ac_if_hdr_body(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_,
proto_tree *tree, usb_conv_info_t *usb_conv_info)
{
gint offset_start;
guint16 bcdADC;
guint8 ver_major;
double ver;
guint8 if_in_collection, i;
audio_conv_info_t *audio_conv_info;
offset_start = ... | cwe | CWE-476 | Unknown |
function headerValueNormalize (potentialValue) {
// To normalize a byte sequence potentialValue, remove
// any leading and trailing HTTP whitespace bytes from
// potentialValue.
return potentialValue.replace(
/^[\r\n\t ]+|[\r\n\t ]+$/g,
''
)
} | cwe | CWE-20 | JavaScript |
slide: slide_cb(),
stop: stop_cb(),
}).data('channel-idx', i);
};
for (i=channels.length-1; i>=0; i--) {
var btnClass = channels[i].active?'pressed':'';
if (OME.isDark(channels[i].color)) {
btnClass += " fontWhite";
}
... | cwe | CWE-79 | JavaScript |
void impeg2d_dec_hdr(void *pv_dec,impeg2d_video_decode_ip_t *ps_ip,
impeg2d_video_decode_op_t *ps_op)
{
UWORD32 u4_bits_read;
dec_state_t *ps_dec;
UWORD32 u4_size = ps_ip->s_ivd_video_decode_ip_t.u4_num_Bytes;
ps_dec = (dec_state_t *)pv_dec;
ps_op->s_ivd_video_decode_op_t.u4_error_code = 0;
if (u4_... | cwe | CWE-787 | C/C++ |
static int parse_config(const char *var, const char *value, void *data)
{
struct parse_config_parameter *me = data;
struct submodule *submodule;
struct strbuf name = STRBUF_INIT, item = STRBUF_INIT;
int ret = 0;
/* this also ensures that we only parse submodule entries */
if (!name_and_item_from_var(var, &name, ... | cwe | CWE-78 | C/C++ |
TPMI_ALG_SYM_Unmarshal(TPMI_ALG_SYM *target, BYTE **buffer, INT32 *size, BOOL allowNull)
{
TPM_RC rc = TPM_RC_SUCCESS;
if (rc == TPM_RC_SUCCESS) {
rc = TPM_ALG_ID_Unmarshal(target, buffer, size);
}
if (rc == TPM_RC_SUCCESS) {
switch (*target) {
#if ALG_AES
case TPM_ALG_AES:
#endif
#if ALG_SM4
... | cwe | CWE-787 | Unknown |
ArgParser::argOiMinHeight(char* parameter)
{
o.oi_min_height = QUtil::string_to_int(parameter);
} | cwe | CWE-787 | Unknown |
# ##############################################################################
# Author: echel0n <echel0n@sickrage.ca>
# URL: https://sickrage.ca/
# Git: https://git.sickrage.ca/SiCKRAGE/sickrage.git
# -
# This file is part of SiCKRAGE.
# -
# SiCKRAGE is free software: you can redistribute it and/or modify
# ... | cwe | CWE-79 | Python |
unzzip_list (int argc, char ** argv, int verbose)
{
int argn;
ZZIP_MEM_DISK* disk;
if (argc == 1)
{
printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n");
return EXIT_OK; /* better provide an archive argument */
}
disk = zzip_mem_disk_open (argv[1]);
if (! dis... | cwe | CWE-772 | Unknown |
/* 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://mozilla.org/MPL/2.0/. */
#ifdef FREEBL_NO_DEPEND
#include "stubs.h"
#endif
#include <string.h>
#include <stdio.h>
#include "seccomon.h"
#... | cwe | CWE-125 | C/C++ |
void rfbScaledScreenUpdateRect(rfbScreenInfoPtr screen, rfbScreenInfoPtr ptr, int x0, int y0, int w0, int h0)
{
int x,y,w,v,z;
int x1, y1, w1, h1;
int bitsPerPixel, bytesPerPixel, bytesPerLine, areaX, areaY, area2;
unsigned char *srcptr, *dstptr;
/* Nothing to do!!! */
if (screen==ptr) return;
... | cwe | CWE-787 | C/C++ |
/*
* (c) Copyright Ascensio System SIA 2010-2019
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its ... | cwe | CWE-770 | C/C++ |
#!/usr/bin/env python3
# -*-coding:UTF-8 -*
"""
The ZMQ_Feed_Q Module
=====================
This module is consuming the Redis-list created by the ZMQ_Feed_Q Module,
And save the paste on disk to allow others modules to work on them.
..todo:: Be able to choose to delete or not the saved paste after processing.
..todo... | cwe | CWE-22 | Python |
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound
from models import Record,Store
from django.db import connection
from recordstoreapp.forms import RecordForm,StoreForm
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
... | cwe | CWE-89 | Python |
String string_chunk_split(const char *src, int srclen, const char *end,
int endlen, int chunklen) {
int chunks = srclen / chunklen; // complete chunks!
int restlen = srclen - chunks * chunklen; /* srclen % chunklen */
int out_len = (chunks + 1) * endlen + srclen;
String ret(out_len, R... | cwe | CWE-189 | C/C++ |
int sc_file_set_sec_attr(sc_file_t *file, const u8 *sec_attr,
size_t sec_attr_len)
{
u8 *tmp;
if (!sc_file_valid(file)) {
return SC_ERROR_INVALID_ARGUMENTS;
}
if (sec_attr == NULL) {
if (file->sec_attr != NULL)
free(file->sec_attr);
file->sec_attr = NULL;
file->sec_attr_len = 0;
return 0;
}
tmp... | cwe | CWE-415 | Unknown |
/*
* Copyright 2019 Red Hat, Inc. and/or its affiliates.
*
* 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 ap... | cwe | CWE-20 | Java |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package terminal
import (
"bytes"
"io"
"runtime"
"strconv"
"sync"
"unicode/utf8"
)
// EscapeCodes contains escape sequences that can be written to the t... | cwe | CWE-287 | Go |
BitStream::reset()
{
p = start;
bit_offset = 7;
if (static_cast<unsigned int>(nbytes) > static_cast<unsigned int>(-1) / 8)
{
throw std::runtime_error("array too large for bitstream");
}
bits_available = 8 * nbytes;
} | cwe | CWE-787 | Unknown |
Track::~Track()
{
Info& info = const_cast<Info&>(m_info);
info.Clear();
ContentEncoding** i = content_encoding_entries_;
ContentEncoding** const j = content_encoding_entries_end_;
while (i != j) {
ContentEncoding* const encoding = *i++;
delete encoding;
}
delete [] cont... | cwe | CWE-119 | C/C++ |
atol8(const char *p, size_t char_cnt)
{
int64_t l;
int digit;
l = 0;
while (char_cnt-- > 0) {
if (*p >= '0' && *p <= '7')
digit = *p - '0';
else
break;
p++;
l <<= 3;
l |= digit;
}
return (l);
} | cwe | CWE-125 | C/C++ |
void gdImageWebpCtx (gdImagePtr im, gdIOCtx * outfile, int quantization)
{
uint8_t *argb;
int x, y;
uint8_t *p;
uint8_t *out;
size_t out_size;
if (im == NULL) {
return;
}
if (!gdImageTrueColor(im)) {
zend_error(E_ERROR, "Paletter image not supported by webp");
return;
}
if (quantization == -1) {
q... | cwe | CWE-190 | C/C++ |
/*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
| Copyrigh... | cwe | CWE-22 | C/C++ |
package com.salesmanager.core.business.repositories.catalog.product.attribute;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import com.salesmanager.core.model.catalog.product.attribute.ProductAttribute;
public interface Pr... | cwe | CWE-639 | Java |
if (typeof content === 'string') {
return renderHTML(content);
} | cwe | CWE-79 | JavaScript |
void PermissionsRequestFunction::InstallUIAbort(bool user_initiated) {
results_ = Request::Results::Create(false);
SendResponse(true);
Release(); // Balanced in RunImpl().
} | cwe | CWE-264 | C/C++ |
mp_capable_print(netdissect_options *ndo,
const u_char *opt, u_int opt_len, u_char flags)
{
const struct mp_capable *mpc = (const struct mp_capable *) opt;
if (!(opt_len == 12 && flags & TH_SYN) &&
!(opt_len == 20 && (flags & (TH_SYN | TH_ACK)) == TH_ACK))
r... | cwe | CWE-125 | Unknown |
/* Copyright 2018 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-787 | C/C++ |
OMX_ERRORTYPE SoftAACEncoder::internalGetParameter(
OMX_INDEXTYPE index, OMX_PTR params) {
switch (index) {
case OMX_IndexParamAudioPortFormat:
{
OMX_AUDIO_PARAM_PORTFORMATTYPE *formatParams =
(OMX_AUDIO_PARAM_PORTFORMATTYPE *)params;
if (formatParams->nPortIndex... | cwe | CWE-119 | C/C++ |
function checkAndSetValidation(container)
{
var issue_els = [];
$("input, select, textarea", container).each(function(){
if($(this).prop('required') && (!$.trim($(this).val()) || (Array.isArray($(this).val()) && $(this).val().length==0) ) ){
issue_els.push($(this));
}
})
// I... | cwe | CWE-79 | JavaScript |
def __init__(self,
sess,
dump_root=None,
log_usage=True,
ui_type="curses",
thread_name_filter=None,
config_file_path=False):
"""Constructor of LocalCLIDebugWrapperSession.
Args:
sess: The TensorFlow `Session` object... | cwe | CWE-377 | Python |
iasecc_get_serialnr(struct sc_card *card, struct sc_serial_number *serial)
{
struct sc_context *ctx = card->ctx;
struct sc_iin *iin = &card->serialnr.iin;
struct sc_apdu apdu;
unsigned char rbuf[0xC0];
size_t ii, offs;
int rv;
LOG_FUNC_CALLED(ctx);
if (card->serialnr.len)
goto end;
memset(&card->serialnr, ... | cwe | CWE-125 | C/C++ |
static int init_die(RzBinDwarfDie *die, ut64 abbr_code, ut64 attr_count) {
if (!die) {
return -1;
}
die->attr_values = calloc(sizeof(RzBinDwarfAttrValue), attr_count);
if (!die->attr_values) {
return -1;
}
die->abbrev_code = abbr_code;
die->capacity = attr_count;
die->count = 0;
return 0;
} | cwe | CWE-787 | Unknown |
public ResetPasswordRequestResponse requestResetPassword(UserReference userReference) throws ResetPasswordException
{
this.checkUserReference(userReference);
UserProperties userProperties = this.userPropertiesResolver.resolve(userReference);
InternetAddress email = userProperties.getEmail()... | cwe | CWE-200 | Java |
void EvalHybrid(TfLiteContext* context, TfLiteNode* node,
TfLiteConvParams* params, OpData* data,
const TfLiteTensor* input, const TfLiteTensor* filter,
const TfLiteTensor* bias, TfLiteTensor* im2col,
TfLiteTensor* accum_scratch, TfLiteTensor* output) {
... | cwe | CWE-787 | C/C++ |
static char *dmi_memory_device_size_str(u16 code)
{
static char size[8];
if (code == 0)
strcpy(size, "Empty");
else if (code == 0xFFFF)
strcpy(size, "Unknown");
else
{
if (code & 0x8000)
sprintf(size, "%u kB", code & 0x7FFF);
else
sprintf(size, "%u MB", code);
}
return size;
} | cwe | CWE-787 | C/C++ |
'use strict'
const path = require('path')
const fs = require('graceful-fs')
const Bluebird = require('bluebird')
const rimraf = Bluebird.promisify(require('rimraf'))
const lstat = Bluebird.promisify(fs.lstat)
const readdir = Bluebird.promisify(fs.readdir)
const symlink = Bluebird.promisify(fs.symlink)
const gentlyRm = ... | cwe | CWE-284 | JavaScript |
function shave(target, maxHeight) {
var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
if (!maxHeight) throw Error('maxHeight is required');
var els = typeof target === 'string' ? document.querySelectorAll(target) : target;
if (!els) return;
var character = opts.chara... | cwe | CWE-79 | JavaScript |
bool DoCanonicalizePathURL(const URLComponentSource<CHAR>& source,
const Parsed& parsed,
CanonOutput* output,
Parsed* new_parsed) {
bool success = CanonicalizeScheme(source.scheme, parsed.scheme,
outpu... | cwe | CWE-20 | C/C++ |
/*****************************************************************
|
| AP4 - stsz Atoms
|
| Copyright 2002-2008 Axiomatic Systems, LLC
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|G... | cwe | CWE-119 | C/C++ |
/*
* Copyright © 2015-2018 Aeneas Rekkas <aeneas+oss@aeneas.io>
*
* 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... | cwe | CWE-754 | Go |
'use strict';
const assert = require('assert');
const renderer = require('./renderer');
const chromeLauncher = require('chrome-launcher');
const express = require('express');
const fs = require('fs');
const compression = require('compression');
const path = require('path');
const https = require('https');
const app = ... | cwe | CWE-79 | JavaScript |
psutil_disk_io_counters(PyObject *self, PyObject *args) {
kstat_ctl_t *kc;
kstat_t *ksp;
kstat_io_t kio;
PyObject *py_retdict = PyDict_New();
PyObject *py_disk_info = NULL;
if (py_retdict == NULL)
return NULL;
kc = kstat_open();
if (kc == NULL) {
PyErr_SetFromErrno(PyExc... | cwe | CWE-415 | Unknown |
static inline void tss_invalidate_io_bitmap(struct tss_struct *tss)
{
/*
* Invalidate the I/O bitmap by moving io_bitmap_base outside the
* TSS limit so any subsequent I/O access from user space will
* trigger a #GP.
*
* This is correct even when VMEXIT rewrites the TSS limit
* to 0x67 as the only requirem... | cwe | CWE-276 | C/C++ |
static jas_image_cmpt_t *jas_image_cmpt_create(int_fast32_t tlx,
int_fast32_t tly, int_fast32_t hstep, int_fast32_t vstep,
int_fast32_t width, int_fast32_t height, uint_fast16_t depth, bool sgnd,
uint_fast32_t inmem)
{
jas_image_cmpt_t *cmpt;
size_t size;
cmpt = 0;
if (width < 0 || height < 0 || hstep <= 0 |... | cwe | CWE-369 | Unknown |
void Inspect::operator()(Complex_Selector_Ptr c)
{
Compound_Selector_Obj head = c->head();
Complex_Selector_Obj tail = c->tail();
Complex_Selector::Combinator comb = c->combinator();
if (comb == Complex_Selector::ANCESTOR_OF && (!head || head->empty())) {
if (tail) tail->perform... | cwe | CWE-476 | C/C++ |
package com.salesmanager.shop.admin.controller.merchant;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.annotation.Resource;
import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.Htt... | cwe | CWE-639 | Java |
function reducer(result, arg)
{
arg = arg.split('=')
// Get key node
const keypath = arg.shift().split('.')
let key = keypath.shift()
let node = result
while(keypath.length)
{
node[key] = node[key] || {}
node = node[key]
key = keypath.shift()
}
// Get value
let val = true
if(arg.l... | cwe | CWE-20 | JavaScript |
/*
* Copyright (C) 1995 Linus Torvalds
*
* Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
*
* Memory region support
* David Parsons <orc@pell.chi.il.us>, July-August 1999
*
* Added E820 sanitization routine (removes overlapping memory regions);
* Brian Moyle <bmoyle@mvista.com>, Februa... | cwe | CWE-264 | C/C++ |
static async getAsset(assetPath, res) {
try {
const fileHash = assetHelper.generateHash(assetPath)
const cachePath = path.resolve(WIKI.ROOTPATH, WIKI.config.dataPath, `cache/${fileHash}.dat`)
if (await WIKI.models.assets.getAssetFromCache(assetPath, cachePath, res)) {
return
}
... | cwe | CWE-79 | JavaScript |
int wolfSSH_SFTP_RecvOpenDir(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
#ifndef USE_WINDOWS_API
{
WDIR ctx;
word32 sz;
char* dir;
word32 idx = 0;
int ret = WS_SUCCESS;
word32 outSz = sizeof(word32)*2 + WOLFSSH_SFTP_HEADER + UINT32_SZ;
byte* out = NULL;
word32 id[2];
byt... | cwe | CWE-190 | Unknown |
/*
* Copyright (c) 2013, Dustin Lundquist <dustin@null-ptr.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,... | cwe | CWE-120 | C/C++ |
void PrintPreviewMessageHandler::OnDidPreviewPage(
const PrintHostMsg_DidPreviewPage_Params& params) {
int page_number = params.page_number;
if (page_number < FIRST_PAGE_INDEX || !params.data_size)
return;
PrintPreviewUI* print_preview_ui = GetPrintPreviewUI();
if (!print_preview_ui)
return;
... | cwe | CWE-254 | C/C++ |
HttpHeader::operator =(const HttpHeader &other)
{
if (this != &other) {
// we do not really care, but the caller probably does
assert(owner == other.owner);
clean();
update(&other); // will update the mask as well
len = other.len;
conflictingContentLength_ = other.con... | cwe | CWE-444 | Unknown |
// SPDX-License-Identifier: GPL-2.0-only
/*
* KVM Microsoft Hyper-V emulation
*
* derived from arch/x86/kvm/x86.c
*
* Copyright (C) 2006 Qumranet, Inc.
* Copyright (C) 2008 Qumranet, Inc.
* Copyright IBM Corporation, 2008
* Copyright 2010 Red Hat, Inc. and/or its affiliates.
* Copyright (C) 2015 Andrey Smetani... | cwe | CWE-476 | C/C++ |
static int logi_dj_raw_event(struct hid_device *hdev,
struct hid_report *report, u8 *data,
int size)
{
struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev);
struct dj_report *dj_report = (struct dj_report *) data;
unsigned long flags;
bool report_processed = false;
dbg_hid("%s, size:%d\n", __... | cwe | CWE-119 | C/C++ |
TIFFSeek(TIFF* tif, uint32 row, uint16 sample )
{
register TIFFDirectory *td = &tif->tif_dir;
uint32 strip;
int whole_strip;
tmsize_t read_ahead = 0;
/*
** Establish what strip we are working from.
*/
if (row >= td->td_imagelength) { /* out of range */
TIFFErrorExt(tif->tif_cli... | cwe | CWE-787 | C/C++ |
static void _slurm_rpc_job_will_run(slurm_msg_t * msg)
{
/* init */
DEF_TIMERS;
int error_code = SLURM_SUCCESS;
struct job_record *job_ptr = NULL;
job_desc_msg_t *job_desc_msg = (job_desc_msg_t *) msg->data;
/* Locks: Read config, read job, read node, read partition */
slurmctld_lock_t job_read_lock = {
READ_L... | cwe | CWE-20 | Unknown |
/*
===========================================================================
Copyright (C) 1999 - 2005, Id Software, Inc.
Copyright (C) 2000 - 2013, Raven Software, Inc.
Copyright (C) 2001 - 2013, Activision, Inc.
Copyright (C) 2005 - 2015, ioquake3 contributors
Copyright (C) 2013 - 2015, OpenJK contributors
This fi... | cwe | CWE-269 | C/C++ |
int main(int argc, char **argv)
{
int fmtid;
int id;
char *infile;
jas_stream_t *instream;
jas_image_t *image;
int width;
int height;
int depth;
int numcmpts;
int verbose;
char *fmtname;
int debug;
size_t max_mem;
if (jas_init()) {
abort();
}
cmdname = argv[0];
infile = 0;
verbose = 0;
debug = 0... | cwe | CWE-20 | C/C++ |
ErrorCode HTTP2Codec::checkNewStream(uint32_t streamId, bool trailersAllowed) {
if (streamId == 0) {
goawayErrorMessage_ = folly::to<string>(
"GOAWAY error: received streamID=", streamId,
" as invalid new stream for lastStreamID_=", lastStreamID_);
VLOG(4) << goawayErrorMessage_;
return Er... | cwe | CWE-20 | C/C++ |
static ssize_t cgroup_release_agent_write(struct kernfs_open_file *of,
char *buf, size_t nbytes, loff_t off)
{
struct cgroup *cgrp;
BUILD_BUG_ON(sizeof(cgrp->root->release_agent_path) < PATH_MAX);
cgrp = cgroup_kn_lock_live(of->kn, false);
if (!cgrp)
return -ENODEV;
spin_lock(&release_agent_path_lock);
... | cwe | CWE-269 | C/C++ |
document.addEventListener('DOMContentLoaded', function(event) {
var settings = {
activeSignatures: [],
burger: document.getElementById('burger'),
connectionStats: document.getElementById('connection-status'),
matchesCount: document.getElementById('matches-count').getElementsByTagName... | cwe | CWE-79 | Go |
/* Copyright 2018 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-824 | Python |
/*
* Copyright (C) 2017 The Android Open Source Project
*
* 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 app... | cwe | CWE-200 | Java |
static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, char *offset_base, size_t IFDlength, size_t displacement, int section_index TSRMLS_DC)
{
int de;
int NumDirEntries;
int NextDirOffset;
#ifdef EXIF_DEBUG
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Process %s (x%04X(=%d))"... | cwe | CWE-119 | C/C++ |
this.menus.findWindow&&this.menus.findWindow.window.setVisible(!1),null!=this.menus.findReplaceWindow&&this.menus.findReplaceWindow.window.setVisible(!1))};EditorUi.prototype.initializeEmbedMode=function(){this.setGraphEnabled(!1);if((window.opener||window.parent)!=window&&("1"!=urlParams.spin||this.spinner.spin(docume... | cwe | CWE-20 | JavaScript |
/*
* Copyright (C) 2001, 2002 Sistina Software (UK) Limited.
* Copyright (C) 2004 - 2006 Red Hat, Inc. All rights reserved.
*
* This file is released under the GPL.
*/
#include "dm-core.h"
#include <linux/module.h>
#include <linux/vmalloc.h>
#include <linux/miscdevice.h>
#include <linux/sched/mm.h>
#include <lin... | cwe | CWE-787 | C/C++ |
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% ... | cwe | CWE-119 | C/C++ |
# -*- 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-613 | Python |
int sctp_verify_asconf(const struct sctp_association *asoc,
struct sctp_paramhdr *param_hdr, void *chunk_end,
struct sctp_paramhdr **errp) {
sctp_addip_param_t *asconf_param;
union sctp_params param;
int length, plen;
param.v = (sctp_paramhdr_t *) param_hdr;
while (param.v <= chunk_end - sizeof(... | cwe | CWE-20 | C/C++ |
void BrowserContextDestroyer::FinishDestroyContext() {
DCHECK_EQ(pending_hosts_, 0U);
delete context_;
context_ = nullptr;
delete this;
} | cwe | CWE-20 | C/C++ |
int libevt_record_values_read_event(
libevt_record_values_t *record_values,
uint8_t *record_data,
size_t record_data_size,
uint8_t strict_mode,
libcerror_error_t **error )
{
static char *function = "libevt_record_values_read_event";
size_t record_data_offset = 0;
size_t strings_data_of... | cwe | CWE-125 | Unknown |
let nanoid = (size = 21) => {
fillPool(size)
let id = ''
// We are reading directly from the random pool to avoid creating new array
for (let i = poolOffset - size; i < poolOffset; i++) {
// It is incorrect to use bytes exceeding the alphabet size.
// The following mask reduces the random byte in the 0-... | cwe | CWE-704 | JavaScript |
static int selinux_setprocattr(struct task_struct *p,
char *name, void *value, size_t size)
{
struct task_security_struct *tsec;
struct cred *new;
u32 sid = 0, ptsid;
int error;
char *str = value;
if (current != p) {
/* SELinux only allows a process to change its own
security attributes. */
re... | cwe | CWE-682 | Unknown |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.