code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
static bool getCoverageFormat12(vector<uint32_t>& coverage, const uint8_t* data, size_t size) {
const size_t kNGroupsOffset = 12;
const size_t kFirstGroupOffset = 16;
const size_t kGroupSize = 12;
const size_t kStartCharCodeOffset = 0;
const size_t kEndCharCodeOffset = 4;
if (kFirstGroupOffset > ... | cwe | CWE-19 | C/C++ |
public void onHeadersRead(ChannelHandlerContext ctx, int streamId, Http2Headers headers, int streamDependency,
short weight, boolean exclusive, int padding, boolean endOfStream) throws Http2Exception {
Http2Stream stream = connection.stream(streamId);
boolean allowHalfClosedRemot... | cwe | CWE-444 | Java |
function writeCommentDate(comment, dateDiv)
{
dateDiv.innerHTML = '';
var ts = new Date(comment.modifiedDate);
var str = editorUi.timeSince(ts);
if (str == null)
{
str = mxResources.get('lessThanAMinute');
}
mxUtils.write(dateDiv, mxResources.get('timeAgo', [str], '{1} ago'));
dateDiv.setAttri... | cwe | CWE-94 | JavaScript |
function H(){var b,c,d,e,f,h,i,j;if(Bc++,b=vc,c=R(),c!==X){for(d=[],e=S();e!==X;)d.push(e),e=S();d!==X?(wc=b,c=Db(c,d),b=c):(vc=b,b=aa)}else vc=b,b=aa;if(b===X){if(b=vc,c=[],d=vc,e=vc,Bc++,f=M(),Bc--,f===X?e=da:(vc=e,e=aa),e!==X?(f=vc,Bc++,h=K(),Bc--,h===X?f=da:(vc=f,f=aa),f!==X?(h=vc,Bc++,i=L(),Bc--,i===X?h=da:(vc=h,h... | cwe | CWE-1321 | JavaScript |
int RGWGetObj_ObjStore_S3::send_response_data(bufferlist& bl, off_t bl_ofs,
off_t bl_len)
{
const char *content_type = NULL;
string content_type_str;
map<string, string> response_attrs;
map<string, string>::iterator riter;
bufferlist metadata_bl;
string expires = get_s3_expiration_header(s, last... | cwe | CWE-79 | C/C++ |
server_input_global_request(int type, u_int32_t seq, void *ctxt)
{
char *rtype;
int want_reply;
int r, success = 0, allocated_listen_port = 0;
struct sshbuf *resp = NULL;
rtype = packet_get_string(NULL);
want_reply = packet_get_char();
debug("server_input_global_request: rtype %s want_reply %d", rtype, want_rep... | cwe | CWE-264 | C/C++ |
void sock_release(struct socket *sock)
{
if (sock->ops) {
struct module *owner = sock->ops->owner;
sock->ops->release(sock);
sock->ops = NULL;
module_put(owner);
}
if (rcu_dereference_protected(sock->wq, 1)->fasync_list)
pr_err("%s: fasync list not empty!\n", __func__);
if (!sock->file) {
iput(SOCK_I... | cwe | CWE-362 | Unknown |
copyString(const XML_Char *s, const XML_Memory_Handling_Suite *memsuite) {
int charsRequired = 0;
XML_Char *result;
/* First determine how long the string is */
while (s[charsRequired] != 0) {
charsRequired++;
}
/* Include the terminator */
charsRequired++;
/* Now allocate space for the copy */
... | cwe | CWE-787 | Unknown |
EditorUi.prototype.updateCssForMarker=function(b,e,k,n,D){b.style.verticalAlign="top";b.style.height="21px";b.style.width="21px";b.innerHTML="";"flexArrow"==k?b.className=null!=n&&n!=mxConstants.NONE?"geSprite geSprite-"+e+"blocktrans":"geSprite geSprite-noarrow":(k=this.getImageForMarker(n,D),null!=k?(n=document.creat... | cwe | CWE-94 | JavaScript |
decode_multicast_vpn(netdissect_options *ndo,
const u_char *pptr, char *buf, u_int buflen)
{
uint8_t route_type, route_length, addr_length, sg_length;
u_int offset;
ND_TCHECK2(pptr[0], 2);
route_type = *pptr++;
route_length = *pptr++;
snprintf(buf, buflen,... | cwe | CWE-125 | C/C++ |
void audit_put_chunk(struct audit_chunk *chunk)
{
put_inotify_watch(&chunk->watch);
} | cwe | CWE-362 | Unknown |
static int alloc_refcount_block(BlockDriverState *bs,
int64_t cluster_index, uint16_t **refcount_block)
{
BDRVQcowState *s = bs->opaque;
unsigned int refcount_table_index;
int ret;
BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC);
/* Find the refcount block for the given cluster */
refcount_t... | cwe | CWE-190 | Unknown |
def _get_shared_models(self, args: "DictConfig") -> Dict[str, dict]:
with open(args.blueprint.model_opt_path) as f:
all_model_opts = yaml.load(f.read())
active_model_opts = {
model: opt
for model, opt in all_model_opts.items()
if self.conversations_needed[... | cwe | CWE-502 | Python |
/**
* Copyright (c) 2006-2012, JGraph Ltd
*/
// Workaround for handling named HTML entities in mxUtils.parseXml
// LATER: How to configure DOMParser to just ignore all entities?
(function()
{
var entities = [
['nbsp', '160'],
['shy', '173']
];
var parseXml = mxUtils.parseXml;
mxUtils.parseXml = function... | cwe | CWE-20 | JavaScript |
static inline void tcp_check_send_head(struct sock *sk, struct sk_buff *skb_unlinked)
{
if (sk->sk_send_head == skb_unlinked)
sk->sk_send_head = NULL;
} | cwe | CWE-269 | C/C++ |
skip_expr_concatenate(
char_u **arg,
char_u **start,
char_u **end,
evalarg_T *evalarg)
{
typval_T rettv;
int res;
int vim9script = in_vim9script();
garray_T *gap = evalarg == NULL ? NULL : &evalarg->eval_ga;
garray_T *freegap = evalarg == NULL ? NULL : &evalarg->eval_freega... | cwe | CWE-416 | C/C++ |
httpHdrContRangeParseInit(HttpHdrContRange * range, const char *str)
{
const char *p;
assert(range && str);
debugs(68, 8, "parsing content-range field: '" << str << "'");
/* check range type */
if (strncasecmp(str, "bytes ", 6))
return 0;
str += 6;
/* split */
if (!(p = strchr... | cwe | CWE-20 | Unknown |
otError Commissioner::AddJoiner(const Mac::ExtAddress *aEui64, const char *aPskd, uint32_t aTimeout)
{
otError error = OT_ERROR_NO_BUFS;
VerifyOrExit(mState == OT_COMMISSIONER_STATE_ACTIVE, error = OT_ERROR_INVALID_STATE);
VerifyOrExit(strlen(aPskd) <= Dtls::kPskMaxLength, error = OT_ERROR_INVALID_ARGS);
... | cwe | CWE-787 | C/C++ |
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | cwe | CWE-787 | C/C++ |
do_setup_env(Session *s, const char *shell)
{
struct ssh *ssh = active_state; /* XXX */
char buf[256];
u_int i, envsize;
char **env, *laddr;
struct passwd *pw = s->pw;
#if !defined (HAVE_LOGIN_CAP) && !defined (HAVE_CYGWIN)
char *path = NULL;
#endif
/* Initialize the environment. */
envsize = 100;
env = xcall... | cwe | CWE-264 | C/C++ |
b64enc_write (struct b64state *state, const void *buffer, size_t nbytes)
{
unsigned char radbuf[4];
int idx, quad_count;
const unsigned char *p;
if (state->lasterr)
return state->lasterr;
if (!nbytes)
{
if (buffer)
if (state->stream? es_fflush (state->stream) : fflush (state->fp))
... | cwe | CWE-20 | Unknown |
package com.salesmanager.core.business.services.order;
import java.io.ByteArrayOutputStream;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.Instant;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.Date;
impo... | cwe | CWE-639 | Java |
package io.hawt.web;
import java.io.IOException;
import java.io.PrintWriter;
import java.security.AccessControlContext;
import java.security.AccessController;
import java.security.Principal;
import java.util.ArrayList;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.uti... | cwe | CWE-352 | Java |
@api.route('/items/<int:item_id>', methods=['GET'])
def get_item(item_id):
sql = '''SELECT id, name_enus FROM tblDBCItem WHERE id = {} AND auctionable = true;'''.format(item_id)
cursor = mysql.connection.cursor()
cursor.execute(sql)
data = cursor.fetchone()
if data:
item = {}
for tu... | cwe | CWE-89 | Python |
int fscrypt_get_crypt_info(struct inode *inode)
{
struct fscrypt_info *crypt_info;
struct fscrypt_context ctx;
struct crypto_skcipher *ctfm;
const char *cipher_str;
int keysize;
u8 *raw_key = NULL;
int res;
res = fscrypt_initialize(inode->i_sb->s_cop->flags);
if (res)
return res;
if (!inode->i_... | cwe | CWE-416 | C/C++ |
static int decode_hextile(VmncContext *c, uint8_t* dst, GetByteContext *gb,
int w, int h, int stride)
{
int i, j, k;
int bg = 0, fg = 0, rects, color, flags, xy, wh;
const int bpp = c->bpp2;
uint8_t *dst2;
int bw = 16, bh = 16;
for (j = 0; j < h; j += 16) {
dst... | cwe | CWE-703 | Unknown |
var formatValue = function (name, value) {
if (name == 'user_host') {
return value.replace(/(\[.*?\])+/g, '');
}
return value;
}; | cwe | CWE-79 | JavaScript |
backsql_process_sub_filter( backsql_srch_info *bsi, Filter *f,
backsql_at_map_rec *at )
{
backsql_info *bi = (backsql_info *)bsi->bsi_op->o_bd->be_private;
int i;
int casefold = 0;
if ( !f ) {
return 0;
}
/* always uppercase strings by now */
#ifdef BACKSQL_UPPERCASE_FILTER
if ( f->f_sub_desc->ad_type-... | cwe | CWE-89 | Unknown |
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException
{
// GAE can't serve dot prefixed folders
String uri = request.getRequestURI().replace("/.", "/");
if (uri.toLowerCase().contains(".json"))
{
response.setCont... | cwe | CWE-22 | Java |
///////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2009-2014 DreamWorks Animation LLC.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
// * ... | cwe | CWE-400 | C/C++ |
static MagickBooleanType WritePNMImage(const ImageInfo *image_info,Image *image)
{
char
buffer[MaxTextExtent],
format,
magick[MaxTextExtent];
const char
*value;
IndexPacket
index;
MagickBooleanType
status;
MagickOffsetType
scene;
QuantumAny
pixel;
QuantumInfo
*qua... | cwe | CWE-119 | Unknown |
dophn_core(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
int num, size_t size, off_t fsize, int *flags)
{
Elf32_Phdr ph32;
Elf64_Phdr ph64;
size_t offset, len;
unsigned char nbuf[BUFSIZ];
ssize_t bufsize;
if (size != xph_sizeof) {
if (file_printf(ms, ", corrupted program header size") == -1... | cwe | CWE-20 | C/C++ |
$json_response = ['status' => 'error', 'message' => $e->getMessage()]; | cwe | CWE-79 | PHP |
usage(int iExitCode)
{
char word[32];
sprintf( word, getJobActionString(mode) );
fprintf( stderr, "Usage: %s [options] [constraints]\n", MyName );
fprintf( stderr, " where [options] is zero or more of:\n" );
fprintf( stderr, " -help Display this message and exit\n"... | cwe | CWE-134 | C/C++ |
package com.salesmanager.shop.admin.model.content;
public class ProductImages extends ContentFiles {
/**
*
*/
private static final long serialVersionUID = 7732719188032287938L;
private long productId;
public long getProductId() {
return productId;
}
public void setProductId(long productId) {
this.pr... | cwe | CWE-639 | Java |
bool Smb4KMountJob::fillArgs(Smb4KShare *share, QMap<QString, QVariant>& map)
{
// Find the mount program.
QString mount;
QStringList paths;
paths << "/bin";
paths << "/sbin";
paths << "/usr/bin";
paths << "/usr/sbin";
paths << "/usr/local/bin";
paths << "/usr/local/sbin";
for (int i = 0; i < paths... | cwe | CWE-20 | Unknown |
def get_cib(params, request, session)
if not allowed_for_local_cluster(session, Permissions::READ)
return 403, 'Permission denied'
end
cib, stderr, retval = run_cmd(session, CIBADMIN, "-Ql")
if retval != 0
if not pacemaker_running?
return [400, '{"pacemaker_not_running":true}']
end
return ... | cwe | CWE-384 | Ruby |
public ProductServletConfigurator(ServerConfig serverConfig, ShiroFilter shiroFilter, GitFilter gitFilter,
GitPreReceiveCallback preReceiveServlet, GitPostReceiveCallback postReceiveServlet,
WicketServlet wicketServlet, WebSocketManager webSocketManager,
AttachmentUploadServlet attachmentUploadServlet, Serv... | cwe | CWE-74 | JavaScript |
WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation(
WebFrame* frame, const WebURLRequest& request, WebNavigationType type,
const WebNode&, WebNavigationPolicy default_policy, bool is_redirect) {
if (request.url() != GURL(kSwappedOutURL) &&
GetContentClient()->renderer()->HandleNavigation(fram... | cwe | CWE-264 | C/C++ |
/*!
* defaults-deep <https://github.com/jonschlinkert/defaults-deep>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
'use strict';
var lazy = require('lazy-cache')(require);
lazy('is-extendable', 'isObject');
lazy('for-own', 'forOwn');
function defaultsDeep(target, objects) {
... | cwe | CWE-20 | JavaScript |
int sandbox(void* sandbox_arg) {
// Get rid of unused parameter warning
(void)sandbox_arg;
pid_t child_pid = getpid();
if (arg_debug)
printf("Initializing child process\n");
// close each end of the unused pipes
close(parent_to_child_fds[1]);
close(child_to_parent_fds[0]);
// wait for parent to do base... | cwe | CWE-284 | Unknown |
edit_done_cb (NMConnectionEditor *editor, gint response, GError *error, gpointer user_data)
{
EditConnectionInfo *info = (EditConnectionInfo *) user_data;
const char *message = _("An unknown error ocurred.");
g_hash_table_remove (info->list->editors, info->original_connection);
if (response == GTK_RESPONSE_NONE) ... | cwe | CWE-310 | Unknown |
download::DownloadItemImpl* DownloadManagerImpl::CreateActiveItem(
uint32_t id,
const download::DownloadCreateInfo& info) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(!base::ContainsKey(downloads_, id));
download::DownloadItemImpl* download =
item_factory_->CreateActiveItem(this, id, info);... | cwe | CWE-190 | C/C++ |
void sum_init(int csum_type, int seed)
{
char s[4];
if (csum_type < 0)
csum_type = parse_csum_name(NULL, 0);
cursum_type = csum_type;
switch (csum_type) {
case CSUM_MD5:
md5_begin(&md);
break;
case CSUM_MD4:
mdfour_begin(&md);
sumresidue = 0;
break;
case CSUM_MD4_OLD:
case CSUM_MD4_BUSTED:... | cwe | CWE-354 | Unknown |
""" what are we here for if not for posting """
import re
import logging
from urllib.parse import urlparse
from django.contrib.auth.decorators import login_required
from django.core.validators import URLValidator
from django.core.exceptions import ValidationError
from django.http import HttpResponse, HttpResponseBadRe... | cwe | CWE-79 | Python |
BOOL SQLWriteFileDSN( LPCSTR pszFileName,
LPCSTR pszAppName,
LPCSTR pszKeyName,
LPCSTR pszString )
{
HINI hIni;
char szFileName[ODBC_FILENAME_MAX+1];
if ( pszFileName[0] == '/' )
{
strncpy( szFileName, sizeof(szFileName) - 5, pszFileName );
}
else
{
char szPath[ODBC_FILENAME_MAX+1... | cwe | CWE-119 | C/C++ |
setup_seccomp (FlatpakBwrap *bwrap,
const char *arch,
gulong allowed_personality,
FlatpakRunFlags run_flags,
GError **error)
{
gboolean multiarch = (run_flags & FLATPAK_RUN_FLAG_MULTIARCH) != 0;
gboolean devel = (run_flags & FLATPAK_R... | cwe | CWE-20 | C/C++ |
PHP_FUNCTION(locale_get_display_name)
{
get_icu_disp_value_src_php( DISP_NAME , INTERNAL_FUNCTION_PARAM_PASSTHRU );
} | cwe | CWE-125 | C/C++ |
bool asn1_read_OctetString(struct asn1_data *data, TALLOC_CTX *mem_ctx, DATA_BLOB *blob)
{
int len;
ZERO_STRUCTP(blob);
if (!asn1_start_tag(data, ASN1_OCTET_STRING)) return false;
len = asn1_tag_remaining(data);
if (len < 0) {
data->has_error = true;
return false;
}
*blob = data_blob_talloc(mem_ctx, NULL, le... | cwe | CWE-399 | Unknown |
void HeaderMapImpl::removePrefix(const LowerCaseString& prefix) {
headers_.remove_if([&](const HeaderEntryImpl& entry) {
bool to_remove = absl::StartsWith(entry.key().getStringView(), prefix.get());
if (to_remove) {
// If this header should be removed, make sure any references in the
// static loo... | cwe | CWE-400 | C/C++ |
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* th... | cwe | CWE-79 | Java |
constructor (range, options) {
options = parseOptions(options)
if (range instanceof Range) {
if (
range.loose === !!options.loose &&
range.includePrerelease === !!options.includePrerelease
) {
return range
} else {
return new Range(range.raw, options)
}
... | cwe | CWE-1333 | JavaScript |
'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-732 | JavaScript |
// SPDX-License-Identifier: GPL-2.0
/*
* linux/fs/pipe.c
*
* Copyright (C) 1991, 1992, 1999 Linus Torvalds
*/
#include <linux/mm.h>
#include <linux/file.h>
#include <linux/poll.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/log2.h>
#include <li... | cwe | CWE-667 | C/C++ |
import loadScript from "discourse/lib/load-script";
import { apiInitializer } from "discourse/lib/api";
import discourseDebounce from "discourse-common/lib/debounce";
async function applyMermaid(element, key = "composer") {
const mermaids = element.querySelectorAll("pre[data-code-wrap=mermaid]");
if (!mermaids.le... | cwe | CWE-79 | JavaScript |
PHP_FUNCTION(imageconvolution)
{
zval *SIM, *hash_matrix;
zval **var = NULL, **var2 = NULL;
gdImagePtr im_src = NULL;
double div, offset;
int nelem, i, j, res;
float matrix[3][3] = {{0,0,0}, {0,0,0}, {0,0,0}};
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "radd", &SIM, &hash_matrix, &div, &offset) == FAI... | cwe | CWE-703 | Unknown |
# Copyright 2020 Planet Labs, Inc.
# Copyright 2022 Planet Labs PBC.
#
# 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 a... | cwe | CWE-732 | Python |
void PrintWebViewHelper::PrintNode(const WebKit::WebNode& node) {
if (node.isNull() || !node.document().frame()) {
return;
}
if (is_preview_enabled_) {
print_preview_context_.InitWithNode(node);
RequestPrintPreview(PRINT_PREVIEW_USER_INITIATED_CONTEXT_NODE);
} else {
WebKit::WebNode duplic... | cwe | CWE-399 | C/C++ |
int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp)
{
int pad = 0, ret, i, neg;
unsigned char *p, *n, pb = 0;
if (a == NULL)
return (0);
neg = a->type & V_ASN1_NEG;
if (a->length == 0)
ret = 1;
else {
ret = a->length;
i = a->data[0];
if (!neg && (i ... | cwe | CWE-119 | Unknown |
static bool rb_per_cpu_empty(struct ring_buffer_per_cpu *cpu_buffer)
{
struct buffer_page *reader = cpu_buffer->reader_page;
struct buffer_page *head = rb_set_head_page(cpu_buffer);
struct buffer_page *commit = cpu_buffer->commit_page;
/* In case of error, head will be NULL */
if (unlikely(!head))
return true;
... | cwe | CWE-835 | Unknown |
/*
* Copyright (c) 1999-2000 Image Power, Inc. and the University of
* British Columbia.
* Copyright (c) 2001-2003 Michael David Adams.
* All rights reserved.
*/
/* __START_OF_JASPER_LICENSE__
*
* JasPer License Version 2.0
*
* Copyright (c) 2001-2006 Michael David Adams
* Copyright (c) 1999-2000 Image P... | cwe | CWE-770 | C/C++ |
// various tools by Adrien Joly
// tests: tests/tess-snips.js
var fs = require('fs');
var urlModule = require('url');
var http = require('http');
var https = require('https');
var querystring = require('querystring');
var firstWeek = new Date('Monday January 3, 2011 08:00'); // week #1 = 1st of january 2010
// priva... | cwe | CWE-285 | JavaScript |
UWORD16 impeg2d_get_mb_addr_incr(stream_t *ps_stream)
{
UWORD16 u2_mb_addr_incr = 0;
while (impeg2d_bit_stream_nxt(ps_stream,MB_ESCAPE_CODE_LEN) == MB_ESCAPE_CODE)
{
impeg2d_bit_stream_flush(ps_stream,MB_ESCAPE_CODE_LEN);
u2_mb_addr_incr += 33;
}
u2_mb_addr_incr += impeg2d_dec_vld_... | cwe | CWE-254 | C/C++ |
function ri(e,t,n){return o(this,void 0,void 0,(function(){var r;return i(this,(function(o){switch(o.label){case 0:return r=ei.post(e),t.forEach((function(e){var t=e.key,n=e.value;r=r.field(t,n)})),r.attach("file",n,{contentType:"application/octet-stream"}),[4,r];case 1:return[2,o.sent()]}}))}))} | cwe | CWE-331 | JavaScript |
'use strict'
// npm install <pkg> <pkg> <pkg>
//
// See doc/cli/npm-install.md for more description
//
// Managing contexts...
// there's a lot of state associated with an "install" operation, including
// packages that are already installed, parent packages, current shrinkwrap, and
// so on. We maintain this state in ... | cwe | CWE-732 | JavaScript |
gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
{
TIFF* tif = img->tif;
tileContigRoutine put = img->put.contig;
uint32 row, y, nrow, nrowsub, rowstoread;
tmsize_t pos;
unsigned char* buf = NULL;
uint32 rowsperstrip;
uint16 subsamplinghor,subsamplingver;
uint32 imagewidth = img->width;
tm... | cwe | CWE-190 | C/C++ |
static int pn533_usb_probe(struct usb_interface *interface,
const struct usb_device_id *id)
{
struct pn533 *priv;
struct pn533_usb_phy *phy;
struct usb_host_interface *iface_desc;
struct usb_endpoint_descriptor *endpoint;
int in_endpoint = 0;
int out_endpoint = 0;
int rc = -ENOMEM;
int i;
u32 protocols;
en... | cwe | CWE-416 | C/C++ |
package io.dataease.dto.datasource;
import io.dataease.plugins.datasource.entity.JdbcConfiguration;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;
@Getter
@Setter
public class MysqlConfiguration extends JdbcConfiguration {
private String driver = "com.mysql.jdbc.Driver";... | cwe | CWE-502 | Java |
function getGoogleAnalyticsScript(tagId) {
let escapedTagId = jsesc(tagId, { isScriptContext: true });
if (escapedTagId) {
escapedTagId = escapedTagId.trim();
}
return `
<script async src="https://www.googletagmanager.com/gtag/js?id=${escapedTagId}"></script>
<script>window.dat... | cwe | CWE-79 | JavaScript |
TPMA_ALGORITHM_Unmarshal(TPMA_ALGORITHM *target, BYTE **buffer, INT32 *size)
{
TPM_RC rc = TPM_RC_SUCCESS;
if (rc == TPM_RC_SUCCESS) {
rc = UINT32_Unmarshal((UINT32 *)target, buffer, size); /* libtpms changed */
}
if (rc == TPM_RC_SUCCESS) {
if (*target & TPMA_ALGORITHM_reserved) {
rc = TPM_RC_R... | cwe | CWE-787 | Unknown |
/******************************************************************************
* bwm-ng handle cmdline and config file options *
* *
* for more info read README. *
... | cwe | CWE-476 | C/C++ |
TfLiteStatus NonMaxSuppressionSingleClassHelper(
TfLiteContext* context, TfLiteNode* node, OpData* op_data,
const std::vector<float>& scores, std::vector<int>* selected,
int max_detections) {
const TfLiteTensor* input_box_encodings =
GetInput(context, node, kInputTensorBoxEncodings);
const TfLiteT... | cwe | CWE-125 | C/C++ |
public VFSLeaf createChildLeaf(String name) {
File fNewFile = new File(getBasefile(), name);
try {
if(!fNewFile.getParentFile().exists()) {
fNewFile.getParentFile().mkdirs();
}
if (!fNewFile.createNewFile()) {
log.warn("Could not create a new leaf::" + name + " in container::" + getBasefile().getAb... | cwe | CWE-23 | Java |
status_t MPEG4Source::fragmentedRead(
MediaBuffer **out, const ReadOptions *options) {
ALOGV("MPEG4Source::fragmentedRead");
CHECK(mStarted);
*out = NULL;
int64_t targetSampleTimeUs = -1;
int64_t seekTimeUs;
ReadOptions::SeekMode mode;
if (options && options->getSeekTo(&seekTimeUs, &mode)) {
int nu... | cwe | CWE-20 | C/C++ |
/*
* 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 n... | cwe | CWE-668 | Java |
int ssl3_get_client_key_exchange(SSL *s)
{
int i, al, ok;
long n;
unsigned long alg_k;
unsigned char *p;
#ifndef OPENSSL_NO_RSA
RSA *rsa = NULL;
EVP_PKEY *pkey = NULL;
#endif
#ifndef OPENSSL_NO_DH
BIGNUM *pub = NULL;
DH *dh_srvr, *dh_clnt = NULL;
#endif
#ifndef OPENSSL_NO_KRB5
KSSL_E... | cwe | CWE-20 | Unknown |
static void exif_process_CME (image_info_type *image_info, char *value, size_t length)
{
if (length>3) {
switch(value[2]) {
case 0:
exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_UNDEFINED, length, value);
break;
case 1:
exif_iif_add_tag(image_info, SECTION_COM... | cwe | CWE-125 | Unknown |
/* radare - LGPL - Copyright 2010-2021 - nibble, mrmacete, pancake */
#include <stdio.h>
#include <r_types.h>
#include <r_util.h>
#include "mach0.h"
#include <r_hash.h>
// TODO: deprecate bprintf and use Eprintf (bin->self)
#define bprintf if (bin->verbose) eprintf
#define Eprintf if (mo->verbose) eprintf
#define IS... | cwe | CWE-122 | C/C++ |
int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
const struct tcphdr *th, unsigned int len)
{
struct tcp_sock *tp = tcp_sk(sk);
struct inet_connection_sock *icsk = inet_csk(sk);
int queued = 0;
int res;
tp->rx_opt.saw_tstamp = 0;
switch (sk->sk_state) {
case TCP_CLOSE:
goto discard;
cas... | cwe | CWE-400 | C/C++ |
// ximainfo.cpp : main attributes
/* 03/10/2004 v1.00 - Davide Pizzolato - www.xdp.it
* CxImage version 7.0.2 07/Feb/2011
*/
#include "ximage.h"
#if defined(_LINUX) || defined(__APPLE__)
#ifdef UNICODE
#define _tcsnicmp(a,b,c) wcscasecmp(a,b)
#else
#define _tcsnicmp(a,b,c) strcasecmp(a,b)
... | cwe | CWE-787 | C/C++ |
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <endian.h>
#include <netdb.h>
#include <poll.h>
#include <pthread.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <unistd.h>
#include "sd-bus.h"
#include "alloc-util.h"
#include "bus-container.h"
#... | cwe | CWE-416 | C/C++ |
def get_requested_month_for_inverter(self, inverter_serial, date):
data = dict()
month_start, month_end = self.get_epoch_month(date)
data['interval'] = {'from': self.convert_local_ts_to_utc(month_start, self.local_timezone), 'to': self.convert_local_ts_to_utc(month_end, self.local_timezone)}
... | cwe | CWE-89 | Python |
static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no, OPJ_BOOL isEncoder, OPJ_FLOAT32 fraction, OPJ_SIZE_T sizeof_block, opj_event_mgr_t* manager)
{
OPJ_UINT32 (*l_gain_ptr)(OPJ_UINT32) = 00;
OPJ_UINT32 compno, resno, bandno, precno, cblkno;
opj_tcp_t * l_tcp = 00;
opj_cp_t * l_cp = 00;
... | cwe | CWE-119 | Unknown |
static int jas_icccurv_input(jas_iccattrval_t *attrval, jas_stream_t *in,
int cnt)
{
jas_icccurv_t *curv = &attrval->data.curv;
unsigned int i;
curv->numents = 0;
curv->ents = 0;
if (jas_iccgetuint32(in, &curv->numents))
goto error;
if (!(curv->ents = jas_malloc(curv->numents * sizeof(jas_iccuint16_t))))
... | cwe | CWE-189 | Unknown |
static int netlink_dump(struct sock *sk)
{
struct netlink_sock *nlk = nlk_sk(sk);
struct netlink_callback *cb;
struct sk_buff *skb = NULL;
struct nlmsghdr *nlh;
int len, err = -ENOBUFS;
int alloc_min_size;
int alloc_size;
mutex_lock(nlk->cb_mutex);
if (!nlk->cb_running) {
err = -EINVAL;
goto errout_... | cwe | CWE-415 | C/C++ |
static void p54u_load_firmware_cb(const struct firmware *firmware,
void *context)
{
struct p54u_priv *priv = context;
struct usb_device *udev = priv->udev;
int err;
complete(&priv->fw_wait_load);
if (firmware) {
priv->fw = firmware;
err = p54u_start_ops(priv);
} else {
err = -ENOENT;
dev_err(&udev-... | cwe | CWE-416 | Unknown |
// SPDX-License-Identifier: BSD-2-Clause
/*
Copyright (c) 2012-2016, Matthias Schiffer <mschiffer@universe-factory.net>
All rights reserved.
*/
/**
\file
Functions for receiving and handling packets
*/
#include "fastd.h"
#include "handshake.h"
#include "hash.h"
#include "peer.h"
#include "peer_hashtable.h... | cwe | CWE-119 | C/C++ |
/*
* Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd.
*
* Author: zccrs <zccrs@live.com>
*
* Maintainer: zccrs <zhangjide@deepin.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foun... | cwe | CWE-59 | C/C++ |
compat_check_calc_match(struct ipt_entry_match *m,
const char *name,
const struct ipt_ip *ip,
unsigned int hookmask,
int *size, int *i)
{
struct ipt_match *match;
match = try_then_request_module(xt_find_match(AF_INET, m->u.user.name,
m->u.user.revision),
"ipt_%s", m->u.user.name);
... | cwe | CWE-787 | Unknown |
static int http_proxy_open(URLContext *h, const char *uri, int flags)
{
HTTPContext *s = h->priv_data;
char hostname[1024], hoststr[1024];
char auth[1024], pathbuf[1024], *path;
char lower_url[100];
int port, ret = 0, attempts = 0;
HTTPAuthType cur_auth_type;
char *authstr;
int new_loc;
... | cwe | CWE-119 | Unknown |
l2tp_accm_print(netdissect_options *ndo, const u_char *dat)
{
const uint16_t *ptr = (const uint16_t *)dat;
uint16_t val_h, val_l;
ptr++; /* skip "Reserved" */
val_h = EXTRACT_16BITS(ptr); ptr++;
val_l = EXTRACT_16BITS(ptr); ptr++;
ND_PRINT((ndo, "send=%08x ", (val_h<<16) + val_l));
val_h = EXTRACT_1... | cwe | CWE-125 | C/C++ |
/* 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-20 | Python |
void fs_rebuild_etc(void) {
int have_dhcp = 1;
if (cfg.dns1 == NULL && !any_dhcp())
have_dhcp = 0;
if (arg_debug)
printf("rebuilding /etc directory\n");
if (mkdir(RUN_DNS_ETC, 0755))
errExit("mkdir");
selinux_relabel_path(RUN_DNS_ETC, "/etc");
fs_logger("tmpfs /etc");
DIR *dir = opendir("/etc");
if (!di... | cwe | CWE-269 | Unknown |
package io.swagger.client;
import org.threeten.bp.*;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule;
import java.text.DateFormat;
import javax.ws.rs.ext.ContextResolver;
public class JSON implements ContextResolver... | cwe | CWE-200 | Java |
static int uECC_sign_with_k(const uint8_t *private_key,
const uint8_t *message_hash,
unsigned hash_size,
uECC_word_t *k,
uint8_t *signature,
uECC_Curve curve) {
uECC_word_t tm... | cwe | CWE-415 | C/C++ |
static void jpeg_term_destination(j_compress_ptr cinfo)
{
VncState *vs = cinfo->client_data;
Buffer *buffer = &vs->tight.jpeg;
buffer->offset = buffer->capacity - cinfo->dest->free_in_buffer;
} | cwe | CWE-401 | Unknown |
PackLinuxElf64::invert_pt_dynamic(Elf64_Dyn const *dynp)
{
if (dt_table[Elf64_Dyn::DT_NULL]) {
return; // not 1st time; do not change upx_dt_init
}
Elf64_Dyn const *const dynp0 = dynp;
unsigned ndx = 1+ 0;
if (dynp)
for (; ; ++ndx, ++dynp) {
upx_uint64_t const d_tag = get_te64(&... | cwe | CWE-190 | Unknown |
push_symbol(Str str, char symbol, int width, int n)
{
char buf[2], *p;
int i;
#ifdef USE_M17N
if (width == 2)
p = alt2_symbol[(int)symbol];
else
#endif
p = alt_symbol[(int)symbol];
for (i = 0; i < 2 && *p; i++, p++)
buf[i] = (*p == ' ') ? NBSP_CODE : *p;
Strcat(str, Sprintf("<_SYMBOL TYPE=%... | cwe | CWE-119 | Unknown |
static int mem_cgroup_move_charge_pte_range(pmd_t *pmd,
unsigned long addr, unsigned long end,
struct mm_walk *walk)
{
int ret = 0;
struct vm_area_struct *vma = walk->private;
pte_t *pte;
spinlock_t *ptl;
split_huge_page_pmd(walk->mm, pmd);
retry:
pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &pt... | cwe | CWE-264 | C/C++ |
package dtls
import (
"crypto"
"crypto/ecdsa"
"crypto/rand"
"crypto/x509"
"fmt"
"math"
"net"
"sync"
"sync/atomic"
"time"
"github.com/pion/logging"
)
const (
initialTickerInterval = time.Second
cookieLength = 20
defaultNamedCurve = namedCurveX25519
inboundBufferSize = 8192
)
var inval... | cwe | CWE-287 | Go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.