code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
static int pn_recvmsg(struct kiocb *iocb, struct sock *sk,
struct msghdr *msg, size_t len, int noblock,
int flags, int *addr_len)
{
struct sk_buff *skb = NULL;
struct sockaddr_pn sa;
int rval = -EOPNOTSUPP;
int copylen;
if (flags & ~(MSG_PEEK|MSG_TRUNC|MSG_DONTWAIT|MSG_NOSIGNAL|
MSG_CMSG_COMPAT))
got... | cwe | CWE-200 | C/C++ |
$json_response = ['status' => 'error', 'message' => $e->getMessage()]; | cwe | CWE-79 | PHP |
const _ = require('lodash');
const bookshelf = require('bookshelf');
const ObjectId = require('bson-objectid').default;
const plugins = require('@tryghost/bookshelf-plugins');
const db = require('../../data/db');
// ### ghostBookshelf
// Initializes a new Bookshelf instance called ghostBookshelf, for reference elsewh... | cwe | CWE-284 | JavaScript |
write_file(tree_t *t, /* I - Tree entry */
FILE *fp, /* I - File to write to */
int col) /* I - Current column */
{
int i; /* Looping var */
uchar *ptr; /* Character pointer */
while (t != NULL)
{
if (t->markup == MARKUP_NONE)
{
if (t->preformatted)
{
... | cwe | CWE-787 | C/C++ |
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Windows Clipboard Redirection
*
* Copyright 2012 Jason Champion
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2015 Thincast Technologies GmbH
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* L... | cwe | CWE-20 | C/C++ |
TEE_Result syscall_cryp_derive_key(unsigned long state,
const struct utee_attribute *usr_params,
unsigned long param_count, unsigned long derived_key)
{
TEE_Result res = TEE_ERROR_NOT_SUPPORTED;
struct tee_ta_session *sess;
struct tee_obj *ko;
struct tee_obj *so;
struct tee_cryp_state *cs;
struct tee_cryp_o... | cwe | CWE-787 | C/C++ |
package middleware
import (
"context"
"github.com/openfga/openfga/pkg/logger"
serverErrors "github.com/openfga/openfga/server/errors"
"go.uber.org/zap"
"google.golang.org/grpc"
)
func NewErrorLoggingInterceptor(logger logger.Logger) grpc.UnaryServerInterceptor {
return func(ctx context.Context, req interface{}... | cwe | CWE-863 | Go |
import io
import os
import tempfile
from datetime import datetime
import requests
import webdav3.client as wc
from cookbook.models import Recipe, RecipeImport, SyncLog
from cookbook.provider.provider import Provider
from requests.auth import HTTPBasicAuth
from recipes.settings import DEBUG
class Nextcloud(Provider)... | cwe | CWE-918 | Python |
(H.geometry.height-V[1].geometry.height)/2:(P.y+P.height)/R-O.y+-I.y+10);return x.addCells(V,U)}finally{x.model.endUpdate()}}function m(H,S,U){H=x.getOutgoingTreeEdges(H);U=x.view.getState(U);var Q=[];if(null!=U&&null!=H){for(var W=0;W<H.length;W++){var V=x.view.getState(x.model.getTerminal(H[W],!1));null!=V&&(!S&&Math... | cwe | CWE-20 | JavaScript |
static inline ut16 r_read_at_le16(const void *src, size_t offset) {
const ut8 *s = (const ut8*)src + offset;
return r_read_le16 (s);
} | cwe | CWE-476 | Unknown |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | cwe | CWE-200 | Java |
cr_input_read_byte (CRInput * a_this, guchar * a_byte)
{
g_return_val_if_fail (a_this && PRIVATE (a_this)
&& a_byte, CR_BAD_PARAM_ERROR);
g_return_val_if_fail (PRIVATE (a_this)->next_byte_index <=
PRIVATE (a_this)->nb_bytes, CR_BAD_PARAM_ERROR... | cwe | CWE-125 | Unknown |
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <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 the
* <a href="http://www.apache... | cwe | CWE-22 | Java |
def _get_hostvdisk_mappings(self, host_name):
"""Return the defined storage mappings for a host."""
return_data = {}
ssh_cmd = 'svcinfo lshostvdiskmap -delim ! %s' % host_name
out, err = self._run_ssh(ssh_cmd)
mappings = out.strip().split('\n')
if len(mappings):
... | cwe | CWE-78 | Python |
QPDFWriter::disableIncompatibleEncryption(int major, int minor,
int extension_level)
{
if (! this->m->encrypted)
{
return;
}
bool disable = false;
if (compareVersions(major, minor, 1, 3) < 0)
{
disable = true;
}
else
{
int V = atoi(this->... | cwe | CWE-125 | Unknown |
function renderFile(file)
{
if (prevDiv == null)
{
return;
}
prevDiv.style.background = 'transparent';
prevDiv.innerHTML = '';
function showRenderMsg(msg)
{
prevDiv.style.background = 'transparent';
prevDiv.innerHTML = '';
var status = document.createElement('div');
status.classNa... | cwe | CWE-94 | JavaScript |
static void mcba_usb_disconnect(struct usb_interface *intf)
{
struct mcba_priv *priv = usb_get_intfdata(intf);
usb_set_intfdata(intf, NULL);
netdev_info(priv->netdev, "device disconnected\n");
unregister_candev(priv->netdev);
free_candev(priv->netdev);
mcba_urb_unlink(priv);
} | cwe | CWE-416 | C/C++ |
#include "extensions/filters/network/http_connection_manager/config.h"
#include <chrono>
#include <memory>
#include <string>
#include <vector>
#include "envoy/config/core/v3/base.pb.h"
#include "envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.pb.h"
#include "envoy/extensions/filter... | cwe | CWE-22 | C/C++ |
/*
** $Id: ldo.c $
** Stack and Call structure of Lua
** See Copyright Notice in lua.h
*/
#define ldo_c
#define LUA_CORE
#include "lprefix.h"
#include <setjmp.h>
#include <stdlib.h>
#include <string.h>
#include "lua.h"
#include "lapi.h"
#include "ldebug.h"
#include "ldo.h"
#include "lfunc.h"
#include "lgc.h"
#inc... | cwe | CWE-787 | C/C++ |
char *ad_get_entry(const struct adouble *ad, int eid)
{
off_t off = ad_getentryoff(ad, eid);
size_t len = ad_getentrylen(ad, eid);
if (off == 0 || len == 0) {
return NULL;
}
return ad->ad_data + off;
} | cwe | CWE-787 | Unknown |
vbf_stp_error(struct worker *wrk, struct busyobj *bo)
{
ssize_t l, ll, o;
double now;
uint8_t *ptr;
struct vsb *synth_body;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
CHECK_OBJ_NOTNULL(bo->fetch_objcore, OBJCORE_MAGIC);
AN(bo->fetch_objcore->flags & OC_F_BUSY);
assert(bo->dire... | cwe | CWE-119 | Unknown |
const exec = require('async-execute');
/**
* Reset current HEAD to the specified state
* @param {String|Number} destination
* @param {Boolean} options.hard
* @return {void}
*/
module.exports = async function(destination, { hard = true } = {}) {
if (destination && typeof destination === 'string') {
return aw... | cwe | CWE-88 | JavaScript |
prime_stub(struct module_qstate* qstate, struct iter_qstate* iq, int id,
uint8_t* qname, uint16_t qclass)
{
/* Lookup the stub hint. This will return null if the stub doesn't
* need to be re-primed. */
struct iter_hints_stub* stub;
struct delegpt* stub_dp;
struct module_qstate* subq;
if(!qname) return 0;
stu... | cwe | CWE-400 | Unknown |
xmlXPtrNewContext(xmlDocPtr doc, xmlNodePtr here, xmlNodePtr origin) {
xmlXPathContextPtr ret;
ret = xmlXPathNewContext(doc);
if (ret == NULL)
return(ret);
ret->xptr = 1;
ret->here = here;
ret->origin = origin;
xmlXPathRegisterFunc(ret, (xmlChar *)"range-to",
xmlXPtrRang... | cwe | CWE-416 | Unknown |
Cluster* Cluster::Create(Segment* pSegment, long idx, long long off)
{
assert(pSegment);
assert(off >= 0);
const long long element_start = pSegment->m_start + off;
Cluster* const pCluster = new Cluster(pSegment, idx, element_start);
assert(pCluster);
return pCluster;
} | cwe | CWE-20 | C/C++ |
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | cwe | CWE-617 | Python |
async function applyMermaid(element, key = "composer") {
const mermaids = element.querySelectorAll("pre[data-code-wrap=mermaid]");
if (!mermaids.length) {
return;
}
await loadScript(settings.theme_uploads_local.mermaid_js);
window.mermaid.initialize({
startOnLoad: false,
theme:
getCompute... | cwe | CWE-79 | JavaScript |
/*
* 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-377 | Java |
TfLiteStatus SigmoidPrepare(TfLiteContext* context, TfLiteNode* node) {
OpData* data = reinterpret_cast<OpData*>(node->user_data);
TF_LITE_ENSURE_EQ(context, NumInputs(node), 1);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
const TfLiteTensor* input = GetInput(context, node, 0);
TfLiteTensor* output = Ge... | cwe | CWE-787 | C/C++ |
int main(int argc, char *argv[])
{
#ifdef HAVE_GUSI_H
GUSISetup(GUSIwithSIOUXSockets);
GUSISetup(GUSIwithInternetSockets);
#endif
#ifdef HAVE_WINSOCK_H
WSAData winSockData;
/* we need at least version 1.1 */
WORD winSockVersionNeeded = MAKEWORD( 1, 1 );
WSAStartup(winSockVersionNeeded, &winSoc... | cwe | CWE-264 | C/C++ |
answer_norec_from_cache(struct worker* worker, struct query_info* qinfo,
uint16_t id, uint16_t flags, struct comm_reply* repinfo,
struct edns_data* edns)
{
/* for a nonrecursive query return either:
* o an error (servfail; we try to avoid this)
* o a delegation (closest we have; this routine tries that)
* ... | cwe | CWE-703 | Unknown |
/* 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-125 | Python |
/*
* GPAC - Multimedia Framework C SDK
*
* Authors: Jean Le Feuvre
* Copyright (c) Telecom ParisTech 2000-2021
* 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-787 | C/C++ |
module.exports = function (middleware, router, controllers) {
// Shorten Vars
const apiv2Auth = middleware.apiv2
const apiv2 = controllers.api.v2
const isAdmin = middleware.isAdmin
const isAgent = middleware.isAgent
const isAgentOrAdmin = middleware.isAgentOrAdmin
const canUser = middleware.canUser
// ... | cwe | CWE-269 | JavaScript |
// SPDX-License-Identifier: GPL-2.0-only
/*
* linux/fs/nfs/dir.c
*
* Copyright (C) 1992 Rick Sladkey
*
* nfs directory handling functions
*
* 10 Apr 1996 Added silly rename for unlink --okir
* 28 Sep 1996 Improved directory cache --okir
* 23 Aug 1997 Claus Heine claus@momo.math.rwth-aachen.de
* ... | cwe | CWE-909 | C/C++ |
constructor(provider, options) {
this[_provider] = provider;
this[_options] = Object.assign({}, options);
this[_destroyed] = false;
} | cwe | CWE-94 | JavaScript |
HandleUltraBPP (rfbClient* client, int rx, int ry, int rw, int rh)
{
rfbZlibHeader hdr;
int toRead=0;
int inflateResult=0;
lzo_uint uncompressedBytes = (( rw * rh ) * ( BPP / 8 ));
if (!ReadFromRFBServer(client, (char *)&hdr, sz_rfbZlibHeader))
return FALSE;
toRead = rfbClientSwap32IfLE(hdr.nBytes);
... | cwe | CWE-119 | Unknown |
static port::StatusOr<CudnnRnnSequenceTensorDescriptor> Create(
GpuExecutor* parent, int max_seq_length, int batch_size, int data_size,
const absl::Span<const int>& seq_lengths, bool time_major,
cudnnDataType_t data_type) {
CHECK_GT(max_seq_length, 0);
int dims[] = {batch_size, data_size, 1};
... | cwe | CWE-20 | 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 / ISO Media File Format sub-project
*
* GPAC is free software; you can redistribute it and/or modify
* it under the terms of the GNU L... | cwe | CWE-476 | C/C++ |
/*
* GPAC - Multimedia Framework C SDK
*
* Authors: Jean Le Feuvre
* Copyright (c) Telecom ParisTech 2005-2022
*
* This file is part of GPAC / MPEG2-TS sub-project
*
* GPAC is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as publishe... | cwe | CWE-787 | C/C++ |
archive_string_append_from_wcs(struct archive_string *as,
const wchar_t *w, size_t len)
{
/* We cannot use the standard wcstombs() here because it
* cannot tell us how big the output buffer should be. So
* I've built a loop around wcrtomb() or wctomb() that
* converts a character at a time and resizes the s... | cwe | CWE-787 | C/C++ |
private static boolean validateChainData(JsonNode data) throws Exception {
ECPublicKey lastKey = null;
boolean validChain = false;
for (JsonNode node : data) {
JWSObject jwt = JWSObject.parse(node.asText());
if (!validChain) {
validChain = EncryptionUtils... | cwe | CWE-287 | Java |
PHP_METHOD(Phar, buildFromDirectory)
{
char *dir, *error, *regex = NULL;
size_t dir_len, regex_len = 0;
zend_bool apply_reg = 0;
zval arg, arg2, iter, iteriter, regexiter;
struct _phar_t pass;
PHAR_ARCHIVE_OBJECT();
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_Unexpec... | cwe | CWE-20 | C/C++ |
function tt(t){return X(t)||q(t)||J(t)||$(t)||Q(t)} | cwe | CWE-1333 | JavaScript |
def getKey(client):
"""Retrieves the specified key for the specified client
Returns an error if the key doesn't exist, obviously.
"""
global SERVER_JWT_PRIVATE_KEY
global BAD_REQUEST
validateClient(client)
client_pub_key = loadClientRSAKey(client)
token_data = decodeRequestToken(request.data, client_pub_key)
... | cwe | CWE-22 | Python |
/**
* This Module manages all /minified/* requests. It controls the
* minification && compression of Javascript and CSS.
*/
/*
* 2011 Peter 'Pita' Martischka (Primary Technology Ltd)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the ... | cwe | CWE-22 | JavaScript |
void CompileFromResponseCallback(
const v8::FunctionCallbackInfo<v8::Value>& args) {
ExceptionState exception_state(args.GetIsolate(),
ExceptionState::kExecutionContext,
"WebAssembly", "compile");
ExceptionToRejectPromiseScope reject_promise_sc... | cwe | CWE-79 | C/C++ |
@staticmethod
def _check_camera_tags(tags):
"""
Function that convert stupid code name of a smartphone or camera
from EXIF to meaningful one by looking a collation in a special MySQL
table For example instead of just Nikon there can be
NIKON CORPORATION in EXIF
:para... | cwe | CWE-89 | Python |
'use strict';
// @ts-check
// ==================================================================================
// utils.js
// ----------------------------------------------------------------------------------
// Description: System Information - library
// for Node.js
// Copyright: (c) 2014 - 202... | cwe | CWE-77 | JavaScript |
int read_escaped_char(
yyscan_t yyscanner,
uint8_t* escaped_char)
{
char text[4] = {0, 0, 0, 0};
text[0] = '\\';
text[1] = RE_YY_INPUT(yyscanner);
if (text[1] == EOF)
return 0;
if (text[1] == 'x')
{
text[2] = RE_YY_INPUT(yyscanner);
if (text[2] == EOF)
return 0;
... | cwe | CWE-476 | Unknown |
ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
{
php_stream *tmpstream = NULL;
databuf_t *data = NULL;
char *ptr;
int ch, lastch;
size_t size, rcvd;
size_t lines;
char **ret = NULL;
char **entry;
char *text;
if ((tmpstream = php_stream_fopen_tmpfile()) == NULL) {
php_error_... | cwe | CWE-189 | C/C++ |
@$listener = DevblocksPlatform::importGPC($_POST['a']); // listener
}
if(!empty($listener)) $parts[] = DevblocksPlatform::strAlphaNum($listener, '\_');
}
// Controller XSS security (alphanum+under only)
if(isset($parts[0])) {
$parts[0] = DevblocksPlatform::strAlphaNum($parts[0], '\_\-\.');
}
// Res... | cwe | CWE-352 | PHP |
jbig2_end_of_stripe(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data)
{
Jbig2Page page = ctx->pages[ctx->current_page];
int end_row;
end_row = jbig2_get_int32(segment_data);
if (end_row < page.end_row) {
jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number,
... | cwe | CWE-190 | C/C++ |
void vnc_tight_clear(VncState *vs)
{
int i;
for (i=0; i<ARRAY_SIZE(vs->tight.stream); i++) {
if (vs->tight.stream[i].opaque) {
deflateEnd(&vs->tight.stream[i]);
}
}
buffer_free(&vs->tight.tight);
buffer_free(&vs->tight.zlib);
buffer_free(&vs->tight.gradient);
#ifdef ... | cwe | CWE-401 | Unknown |
static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in,
long len, const ASN1_ITEM *it,
int tag, int aclass, char opt, ASN1_TLC *ctx)
{
const ASN1_TEMPLATE *tt, *errtt = NULL;
const ASN1_EXTERN_FUNCS *ef;
const ASN1_AUX *aux = ... | cwe | CWE-787 | Unknown |
public function LoadHashPaths($tree)
{
if (!$tree)
return;
$treePaths = array();
$blobPaths = array();
$args = array();
$args[] = '--full-name';
$args[] = '-r';
$args[] = '-t';
$args[] = $tree->GetHash();
$lines = explode("\n", $this->exe->Execute($tree->GetProject()->GetPath(), GIT_LS_TREE, $a... | cwe | CWE-78 | PHP |
void protocol_print_filter(pid_t pid) {
EUID_ASSERT();
(void) pid;
#ifdef SYS_socket
// in case the pid is that of a firejail process, use the pid of the first child process
pid = switch_to_child(pid);
// exit if no permission to join the sandbox
check_join_permission(pid);
// find the seccomp filter
EUID_RO... | cwe | CWE-94 | Unknown |
void CLASS parse_exif (int base)
{
unsigned kodak, entries, tag, type, len, save, c;
double expo,ape;
kodak = !strncmp(make,"EASTMAN",7) && tiff_nifds < 3;
entries = get2();
if(!strncmp(make,"Hasselblad",10) && (tiff_nifds > 3) && (entries > 512)) return;
#ifdef LIBRAW_LIBRARY_BUILD
INT64 fsize = ifp->size... | cwe | CWE-125 | Unknown |
clone (gitUrl, options, callback) {
if (typeof options === "function") {
callback = options;
options = "";
}
return this.exec("clone " + gitUrl + " " + options, callback);
} | cwe | CWE-77 | JavaScript |
package org.jolokia.jvmagent.handler;
/*
* Copyright 2009-2013 Roland Huss
*
* 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
*
* U... | cwe | CWE-79 | Java |
def __init__(self, *args, **kwargs):
yaml.Loader.__init__(self, *args, **kwargs)
self.add_constructor(u'tag:yaml.org,2002:map', type(self).construct_yaml_map)
self.add_constructor(u'tag:yaml.org,2002:omap', type(self).construct_yaml_map) | cwe | CWE-502 | Python |
# Copyright (c) 2021-2022, NVIDIA CORPORATION. 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 ... | cwe | CWE-502 | Python |
static int r_cmd_java_call(void *user, const char *input) {
RCore *core = (RCore *) user;
int res = false;
ut32 i = 0;
if (strncmp (input, "java", 4)) {
return false;
}
if (input[4] != ' ') {
return r_cmd_java_handle_help (core, input);
}
for (; i < END_CMDS; i++) {
//IFDBG r_cons_printf ("Checking cmd: %... | cwe | CWE-703 | C/C++ |
/**
* File: WebP IO
*
* Read and write WebP images.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include "gd.h"
#include "gd_errors.h"
#include "gdhelpers.h"
#ifdef HAVE_LIBWEBP
#include "webp/decode.h"
#incl... | cwe | CWE-125 | C/C++ |
HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
{
char *p, *q, *r;
int i, w, x, y, z, count, width;
struct readbuffer *obuf = h_env->obuf;
struct environment *envs = h_env->envs;
Str tmp;
int hseq;
int cmd;
#ifdef ID_EXT
char *id = NULL;
#endif /* ID_EXT */
... | cwe | CWE-119 | C/C++ |
bool RenderFrameDevToolsAgentHost::AttachSession(DevToolsSession* session,
TargetRegistry* registry) {
if (!ShouldAllowSession(session))
return false;
protocol::EmulationHandler* emulation_handler =
new protocol::EmulationHandler();
session->AddHandler(b... | cwe | CWE-269 | C/C++ |
int cli_scanpe(cli_ctx *ctx)
{
uint16_t e_magic; /* DOS signature ("MZ") */
uint16_t nsections;
uint32_t e_lfanew; /* address of new exe header */
uint32_t ep, vep; /* entry point (raw, virtual) */
uint8_t polipos = 0;
time_t timestamp;
struct pe_image_file_hdr file_hdr;
union {
struct pe_image_optional_hd... | cwe | CWE-703 | C/C++ |
void swiotlb_sync_single_for_device(struct device *dev, phys_addr_t tlb_addr,
size_t size, enum dma_data_direction dir)
{
if (dir == DMA_TO_DEVICE || dir == DMA_BIDIRECTIONAL)
swiotlb_bounce(dev, tlb_addr, size, DMA_TO_DEVICE);
else
BUG_ON(dir != DMA_FROM_DEVICE);
} | cwe | CWE-401 | Unknown |
public void requestDestroyed(HttpServletRequest request) {
if (isRequestDestroyed(request)) {
return;
}
if (nestedInvocationGuardEnabled) {
Counter counter = nestedInvocationGuard.get();
if (counter != null) {
counter.value--;
i... | cwe | CWE-362 | Java |
#include <qpdf/Pl_Count.hh>
#include <qpdf/QIntC.hh>
Pl_Count::Members::Members() :
count(0),
last_char('\0')
{
}
Pl_Count::Members::~Members()
{
}
Pl_Count::Pl_Count(char const* identifier, Pipeline* next) :
Pipeline(identifier, next),
m(new Members())
{
}
Pl_Count::~Pl_Count()
{
}
void
Pl_Count::... | cwe | CWE-787 | C/C++ |
static void snd_timer_check_master(struct snd_timer_instance *master)
{
struct snd_timer_instance *slave, *tmp;
/* check all pending slaves */
list_for_each_entry_safe(slave, tmp, &snd_timer_slave_list, open_list) {
if (slave->slave_class == master->slave_class &&
slave->slave_id == master->slave_id) {
... | cwe | CWE-20 | C/C++ |
static int iccompareproc(i_ctx_t *i_ctx_p, ref *space, ref *testspace)
{
int code1, code2;
ref ICCdict1, ICCdict2, *tempref1, *tempref2;
int buff_size;
code1 = array_get(imemory, space, 1, &ICCdict1);
if (code1 < 0)
return 0;
code2 = array_get(imemory, testspace, 1, &ICCdict2);
if (... | cwe | CWE-704 | Unknown |
function ecsign(d, z) {
while (true) {
const k = rnd(P)
const R = mulG(k)
if (R[0] == 0) continue
const s = mulmod(invmod(k, N), addmod(z, mulmod(R[0], d, N), N), N)
if (s == 0) continue
//FIXME: why do I need this
if (s.testn(2... | cwe | CWE-347 | JavaScript |
function updateLabel()
{
label.innerHTML = '';
label.style.cursor = 'pointer';
label.style.whiteSpace = 'nowrap';
label.style.textOverflow = 'ellipsis';
mxUtils.write(label, (entry.title != null && entry.title.length > 0) ?
entry.title : mxResources.get('untitled'));
... | cwe | CWE-94 | JavaScript |
SPL_METHOD(SplObjectStorage, unserialize)
{
spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(getThis());
char *buf;
size_t buf_len;
const unsigned char *p, *s;
php_unserialize_data_t var_hash;
zval entry, inf;
zval *pcount, *pmembers;
spl_SplObjectStorageElement *element;
zend_long count;
if (zend_parse_par... | cwe | CWE-119 | C/C++ |
transform_chain_param(struct rte_crypto_sym_xform *xforms,
VhostUserCryptoSessionParam *param)
{
struct rte_crypto_sym_xform *xform_cipher, *xform_auth;
int ret;
switch (param->chaining_dir) {
case VIRTIO_CRYPTO_SYM_ALG_CHAIN_ORDER_HASH_THEN_CIPHER:
xform_auth = xforms;
xform_cipher = xforms->next;
xform_c... | cwe | CWE-125 | Unknown |
static bool dump_fd_info(const char *dest_filename, char *source_filename, int source_base_ofs, uid_t uid, gid_t gid)
{
FILE *fp = fopen(dest_filename, "w");
if (!fp)
return false;
unsigned fd = 0;
while (fd <= 99999) /* paranoia check */
{
sprintf(source_filename + source_base_... | cwe | CWE-59 | C/C++ |
convert_to_decimal (mpn_t a, size_t extra_zeroes)
{
mp_limb_t *a_ptr = a.limbs;
size_t a_len = a.nlimbs;
/* 0.03345 is slightly larger than log(2)/(9*log(10)). */
size_t c_len = 9 * ((size_t)(a_len * (GMP_LIMB_BITS * 0.03345f)) + 1);
char *c_ptr = (char *) malloc (xsum (c_len, extra_zeroes));
if (c_ptr... | cwe | CWE-119 | C/C++ |
function getEspeakCmdWithArgs(fields) {
var text = fields.textToSpeech,
language = fields.language,
voiceCode = '+f4',
speed = Math.floor(fields.speed * 150),
pitch = '70',
cmd = 'espeak' + ' -v' + language + voiceCode + ' -s ' + speed + ' -p ' + pitch + ' \"' + text + '\"';
return cmd;
} | cwe | CWE-78 | JavaScript |
App.Actions.WEB.update_ftp_username_hint = function(elm, hint) {
if (hint.trim() == '') {
$(elm).parent().find('.hint').html('');
}
hint = hint.replace(/[^\w\d]/gi, '');
$(elm).parent().find('.v-ftp-user').val(hint);
$(elm).parent().find('.hint').text(GLOBAL.FTP_USER_PREFIX + hint);
} | cwe | CWE-79 | JavaScript |
IHEVCD_ERROR_T ihevcd_parse_sps(codec_t *ps_codec)
{
IHEVCD_ERROR_T ret = (IHEVCD_ERROR_T)IHEVCD_SUCCESS;
WORD32 value;
WORD32 i;
WORD32 vps_id;
WORD32 sps_max_sub_layers;
WORD32 sps_id;
WORD32 sps_temporal_id_nesting_flag;
sps_t *ps_sps;
profile_tier_lvl_info_t s_ptl;
bitstrm_t *ps_bits... | cwe | CWE-119 | Unknown |
_fr_window_ask_overwrite_dialog (OverwriteData *odata)
{
if ((odata->edata->overwrite == FR_OVERWRITE_ASK) && (odata->current_file != NULL)) {
const char *base_name;
GFile *destination;
base_name = _g_path_get_relative_basename ((char *) odata->current_file->data, odata->edata->base_dir, odata->edata->junk... | cwe | CWE-22 | Unknown |
bool_t xdr_nullstring(XDR *xdrs, char **objp)
{
u_int size;
if (xdrs->x_op == XDR_ENCODE) {
if (*objp == NULL)
size = 0;
else
size = strlen(*objp) + 1;
}
if (! xdr_u_int(xdrs, &size)) {
return FALSE;
}
switch (xdrs->x_op) {
case XDR_DECODE:
if (size == 0) {
... | cwe | CWE-119 | C/C++ |
static char* allocFromUTF16(const char16_t* in, size_t len)
{
if (len == 0) return getEmptyString();
const ssize_t bytes = utf16_to_utf8_length(in, len);
if (bytes < 0) {
return getEmptyString();
}
SharedBuffer* buf = SharedBuffer::alloc(bytes+1);
ALOG_ASSERT(buf, "Unable to al... | cwe | CWE-264 | C/C++ |
TPMI_DH_SAVED_Unmarshal(TPMI_DH_SAVED *target, BYTE **buffer, INT32 *size, BOOL allowNull)
{
TPM_RC rc = TPM_RC_SUCCESS;
allowNull = allowNull;
if (rc == TPM_RC_SUCCESS) {
rc = TPM_HANDLE_Unmarshal(target, buffer, size);
}
if (rc == TPM_RC_SUCCESS) {
BOOL isNotHmacSession = (*target < HMAC_SESS... | cwe | CWE-787 | Unknown |
void AudioRendererHost::OnCreateStream(
int stream_id, const media::AudioParameters& params, int input_channels) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK(LookupById(stream_id) == NULL);
media::AudioParameters audio_params(params);
uint32 buffer_size = media::AudioBus::CalculateMe... | cwe | CWE-189 | C/C++ |
package io.onedev.server.web.page.project.blob;
import static org.apache.wicket.ajax.attributes.CallbackParameter.explicit;
import java.io.IOException;
import java.io.Serializable;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.H... | cwe | CWE-434 | Java |
static void perf_syscall_exit(void *ignore, struct pt_regs *regs, long ret)
{
struct syscall_metadata *sys_data;
struct syscall_trace_exit *rec;
struct hlist_head *head;
int syscall_nr;
int rctx;
int size;
syscall_nr = trace_get_syscall_nr(current, regs);
if (syscall_nr < 0)
return;
if (!test_bit(syscall_nr... | cwe | CWE-125 | Unknown |
static int ehci_process_itd(EHCIState *ehci,
EHCIitd *itd,
uint32_t addr)
{
USBDevice *dev;
USBEndpoint *ep;
uint32_t i, len, pid, dir, devaddr, endp;
uint32_t pg, off, ptr1, ptr2, max, mult;
ehci->periodic_sched_active = PERIODIC_ACTIVE;
... | cwe | CWE-617 | Unknown |
TfLiteStatus EluPrepare(TfLiteContext* context, TfLiteNode* node) {
const TfLiteTensor* input = GetInput(context, node, 0);
TfLiteTensor* output = GetOutput(context, node, 0);
OpData* data = reinterpret_cast<OpData*>(node->user_data);
// Use LUT to handle quantized elu path.
if (input->type == kTfLiteInt8) {... | cwe | CWE-787 | C/C++ |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | cwe | CWE-79 | Python |
int expand_stack(struct vm_area_struct *vma, unsigned long address)
{
struct vm_area_struct *prev;
address &= PAGE_MASK;
prev = vma->vm_prev;
if (prev && prev->vm_end == address) {
if (!(prev->vm_flags & VM_GROWSDOWN))
return -ENOMEM;
}
return expand_downwards(vma, address);
} | cwe | CWE-119 | Unknown |
protected function get_remote_contents(&$url, $timeout = 30, $redirect_max = 5, $ua = 'Mozilla/5.0', $fp = null)
{
if (preg_match('~^(?:ht|f)tps?://[-_.!\~*\'()a-z0-9;/?:\@&=+\$,%#\*\[\]]+~i', $url)) {
$info = parse_url($url);
$host = strtolower($info['host']);
// do not ... | cwe | CWE-918 | PHP |
void NuPlayer::GenericSource::notifyPreparedAndCleanup(status_t err) {
if (err != OK) {
mMetaDataSize = -1ll;
mContentType = "";
mSniffedMIME = "";
{
sp<DataSource> dataSource = mDataSource;
sp<NuCachedSource2> cachedSource = mCachedSource;
sp<DataSource> ht... | cwe | CWE-119 | Unknown |
TfLiteStatus SelectEval(TfLiteContext* context, TfLiteNode* node) {
OpData* data = reinterpret_cast<OpData*>(node->user_data);
const TfLiteTensor* input_condition =
GetInput(context, node, kInputTensorCondition);
const TfLiteTensor* input_x = GetInput(context, node, kInputTensorX);
const TfLiteTensor* inp... | cwe | CWE-125 | C/C++ |
QInt16() {} | cwe | CWE-908 | C/C++ |
long FrameSequenceState_gif::drawFrame(int frameNr,
Color8888* outputPtr, int outputPixelStride, int previousFrameNr) {
GifFileType* gif = mFrameSequence.getGif();
if (!gif) {
ALOGD("Cannot drawFrame, mGif is NULL");
return -1;
}
#if GIF_DEBUG
ALOGD(" drawFrame on %p nr %d on addr %p, previous f... | cwe | CWE-20 | Unknown |
static inline int can_merge(struct ext4_system_zone *entry1,
struct ext4_system_zone *entry2)
{
if ((entry1->start_blk + entry1->count) == entry2->start_blk)
return 1;
return 0;
} | cwe | CWE-703 | Unknown |
static int virtnet_probe(struct virtio_device *vdev)
{
int i, err;
struct net_device *dev;
struct virtnet_info *vi;
u16 max_queue_pairs;
if (!vdev->config->get) {
dev_err(&vdev->dev, "%s failure: config access disabled\n",
__func__);
return -EINVAL;
}
if (!virtnet_validate_features(vdev))
return -EINV... | cwe | CWE-119 | C/C++ |
/* Copyright (c) 2017 - 2021 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_malo.c -- malo allocator implementation.
*
* The malo allocator is a pool of objects of fixed size. It tries to
* allocate and deallocate objects as fast as possible. To do so, it
* does the following:
*
* 1. Allocations occ... | cwe | CWE-476 | C/C++ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.