code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
gdImagePtr gdImageRotateInterpolated(const gdImagePtr src, const float angle, int bgcolor) { const int angle_rounded = (int)floor(angle * 100); if (bgcolor < 0 || (!src->trueColor && bgcolor >= gdMaxColors)) { return NULL; } /* impact perf a bit, but not that much. Implementation for palette images can be d...
cwe
CWE-119
Unknown
static int decode_slice_header(H264Context *h, H264Context *h0) { unsigned int first_mb_in_slice; unsigned int pps_id; int ret; unsigned int slice_type, tmp, i, j; int last_pic_structure, last_pic_droppable; int must_reinit; int needs_reinit = 0; int field_pic_flag, bottom_field_flag; ...
cwe
CWE-703
Unknown
# -*- coding: utf-8 -*- # Copyright 2014 OpenMarket Ltd # # 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 l...
cwe
CWE-20
Python
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, void *yyscanner, HEX_LEX_ENVIRONMENT *lex_env) { YYUSE (yyvaluep); YYUSE (yyscanner); YYUSE (lex_env); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN switch (yyt...
cwe
CWE-674
C/C++
/* =========================================================================== Return to Castle Wolfenstein single player GPL Source Code Copyright (C) 1999-2010 id Software LLC, a ZeniMax Media company. This file is part of the Return to Castle Wolfenstein single player GPL Source Code (“RTCW SP Source Code”). R...
cwe
CWE-404
C/C++
/* $OpenBSD: x509_verify.c,v 1.53 2021/11/14 08:21:47 jsing Exp $ */ /* * Copyright (c) 2020-2021 Bob Beck <beck@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 not...
cwe
CWE-295
C/C++
/* * message printing * * Copyright (C) 2001-2003 FhG Fokus * * This file is part of Kamailio, a free SIP server. * * Kamailio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the L...
cwe
CWE-120
C/C++
function initUpgradeModal() { var $info = initModal( '#frm_upgrade_modal' ); if ( $info === false ) { return; } jQuery( document ).on( 'click', '[data-upgrade]', function( event ) { event.preventDefault(); jQuery( '#frm_upgrade_modal .frm_lock_icon' ).removeClass( 'frm_lock_open_icon' ); jQuery( '#...
cwe
CWE-352
JavaScript
# -*- 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
u32 gf_base64_encode(const u8 *_in, u32 inSize, u8 *_out, u32 outSize) { s32 padding; u32 i = 0, j = 0; unsigned char *in = (unsigned char *)_in; unsigned char *out = (unsigned char *)_out; if (outSize < (inSize * 4 / 3)) return 0; while (i < inSize) { padding = 3 - (inSize - i); if (padding == 2) { out[...
cwe
CWE-787
Unknown
mxResources.get("containsValidationErrors"),mxResources.get("ok"));else if(B&&b.hideDialog(),O=!y.model.contains(A),!B||O||I!=q){I=Graph.compress(I);y.getModel().beginUpdate();try{if(O){var t=b.editor.graph.getFreeInsertPoint();A.geometry.x=t.x;A.geometry.y=t.y;y.addCell(A)}y.setCellStyles(mxConstants.STYLE_SHAPE,"sten...
cwe
CWE-20
JavaScript
ebb_ews_connect_sync (EBookMetaBackend *meta_backend, const ENamedParameters *credentials, ESourceAuthenticationResult *out_auth_result, gchar **out_certificate_pem, GTlsCertificateFlags *out_certificate_errors, GCancellable *cancellable, GError **error) { EBookBackendEw...
cwe
CWE-295
Unknown
nm_connection_list_new (GType def_type) { NMConnectionList *list; DBusGConnection *dbus_connection; GError *error = NULL; list = g_object_new (NM_TYPE_CONNECTION_LIST, NULL); if (!list) return NULL; /* load GUI */ list->gui = glade_xml_new (GLADEDIR "/nm-connection-editor.glade", "NMConnectionList", NULL); ...
cwe
CWE-200
Unknown
# -*- coding: utf-8 -*- from django.shortcuts import render, redirect from django.contrib import messages from django.utils.translation import gettext as _ from django.contrib.auth import get_user_model import spirit import django from spirit.category.models import Category from spirit.comment.flag.models import Comm...
cwe
CWE-601
Python
# Line too long - pylint: disable=C0301 # Copyright (c) Greenplum Inc 2011. All Rights Reserved. from contextlib import closing import os import platform import shutil import sys import tarfile try: from gppylib import gplog from gppylib.commands import gp from gppylib.commands.base import Command, REMOTE...
cwe
CWE-22
Python
"""Admin API.""" from django import http from django.contrib.contenttypes.models import ContentType from django.utils.translation import ugettext as _ from django_filters import rest_framework as dj_filters from drf_spectacular.utils import extend_schema, extend_schema_view from rest_framework import filters, rendere...
cwe
CWE-305
Python
l2tp_proxy_auth_id_print(netdissect_options *ndo, const u_char *dat) { const uint16_t *ptr = (const uint16_t *)dat; ND_PRINT((ndo, "%u", EXTRACT_16BITS(ptr) & L2TP_PROXY_AUTH_ID_MASK)); }
cwe
CWE-125
C/C++
void *zcalloc(size_t size) { void *ptr = calloc(1, size+PREFIX_SIZE); if (!ptr) zmalloc_oom_handler(size); #ifdef HAVE_MALLOC_SIZE update_zmalloc_stat_alloc(zmalloc_size(ptr)); return ptr; #else *((size_t*)ptr) = size; update_zmalloc_stat_alloc(size+PREFIX_SIZE); return (char*)ptr+PREFIX_SI...
cwe
CWE-190
Unknown
static bool parseOperands(char* str, ArmOp *op) { char *t = strdup (str); int operand = 0; char *token = t; char *x; int imm_count = 0; int mem_opt = 0; if (!token) { return false; } while (token) { char *next = strchr (token, ','); if (next) { *next++ = 0; } while (token[0] == ' ') { token++;...
cwe
CWE-125
C/C++
ast_type_reduce(PyObject *self, PyObject *unused) { PyObject *res; _Py_IDENTIFIER(__dict__); PyObject *dict = _PyObject_GetAttrId(self, &PyId___dict__); if (dict == NULL) { if (PyErr_ExceptionMatches(PyExc_AttributeError)) PyErr_Clear(); else return NULL; } ...
cwe
CWE-125
C/C++
static Image *ReadPICTImage(const ImageInfo *image_info, ExceptionInfo *exception) { #define ThrowPICTException(exception,message) \ { \ if (tile_image != (Image *) NULL) \ tile_image=DestroyImage(tile_image); \ if (read_info != (ImageInfo *) NULL) \ read_info=DestroyImageInfo(read_info); \ ThrowReaderE...
cwe
CWE-20
C/C++
/** * <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-91
Java
############################################################################## # # Copyright (c) 2004 Zope Foundation and Contributors. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS I...
cwe
CWE-200
Python
/* * Copyright (c) 2009-2012, Salvatore Sanfilippo <antirez at gmail dot com> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above co...
cwe
CWE-125
C/C++
package graph import ( "fmt" v0 "github.com/authzed/authzed-go/proto/authzed/api/v0" ) func Simplify(node *v0.RelationTupleTreeNode) []*v0.User { switch typed := node.NodeType.(type) { case *v0.RelationTupleTreeNode_IntermediateNode: switch typed.IntermediateNode.Operation { case v0.SetOperationUserset_UNION...
cwe
CWE-20
Go
BufCompressedFill (BufFilePtr f) { CompressedFile *file; register char_type *stackp, *de_stack; register char_type finchar; register code_int code, oldcode, incode; BufChar *buf, *bufend; file = (CompressedFile *) f->private; buf = f->buffer; bufend = buf + BUFFILESIZE; stackp...
cwe
CWE-119
Unknown
/** * $Id: ProxyServlet.java,v 1.4 2013/12/13 13:18:11 david Exp $ * Copyright (c) 2011-2012, JGraph Ltd */ package com.mxgraph.online; import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java....
cwe
CWE-918
Java
public static function get_param($key = NULL) { $info = [ 'stype' => htmlentities(self::$search_type), 'stext' => htmlentities(self::$search_text), 'method' => htmlentities(self::$search_method), 'datelimit' => self::$search_date_limit, ...
cwe
CWE-79
PHP
void HTMLDocument::removeItemFromMap(HashCountedSet<StringImpl*>& map, const AtomicString& name) { if (name.isEmpty()) return; map.remove(name.impl()); if (Frame* f = frame()) f->script()->namedItemRemoved(this, name); }
cwe
CWE-399
C/C++
njs_module_path(njs_vm_t *vm, const njs_str_t *dir, njs_module_info_t *info) { char *p; size_t length; njs_bool_t trail; char src[NJS_MAX_PATH + 1]; trail = 0; length = info->name.length; if (dir != NULL) { length = dir->length; if (length == 0) { ...
cwe
CWE-787
C/C++
# -*- coding: utf-8 -*- # Copyright 2018 New Vector Ltd # # 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 l...
cwe
CWE-918
Python
foreach ($criteria as $criterion) { // recursive call if (isset($criterion['criteria'])) { return $check_criteria($criterion['criteria']); } if (!isset($criterion['field']) || !isset($criterion['searchtype']) || !isset($cr...
cwe
CWE-89
PHP
static int do_new_mount(struct path *path, const char *fstype, int flags, int mnt_flags, const char *name, void *data) { struct file_system_type *type; struct user_namespace *user_ns = current->nsproxy->mnt_ns->user_ns; struct vfsmount *mnt; int err; if (!fstype) return -EINVAL; type = get_fs_type(fstype);...
cwe
CWE-269
C/C++
action:"size_"+file.size})}catch(m){}};EditorUi.prototype.isResampleImageSize=function(c,e){e=null!=e?e:this.resampleThreshold;return c>e};EditorUi.prototype.resizeImage=function(c,e,g,k,m,q,v){m=null!=m?m:this.maxImageSize;var x=Math.max(1,c.width),A=Math.max(1,c.height);if(k&&this.isResampleImageSize(null!=v?v:e.leng...
cwe
CWE-20
JavaScript
entityValueInitProcessor(XML_Parser parser, const char *s, const char *end, const char **nextPtr) { int tok; const char *start = s; const char *next = start; eventPtr = start; for (;;) { tok = XmlPrologTok(encoding, start, end, &n...
cwe
CWE-611
C/C++
static int sctp_setsockopt_auth_key(struct sock *sk, char __user *optval, int optlen) { struct sctp_authkey *authkey; struct sctp_association *asoc; int ret; if (!sctp_auth_enable) return -EACCES; if (optlen <= sizeof(struct sctp_authkey)) return -EINVAL; authkey = kmalloc(optlen, GFP_KERNE...
cwe
CWE-189
Unknown
/* 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-400
C/C++
static int run_post_create(const char *dirname) { /* If doesn't start with "g_settings_dump_location/"... */ if (!dir_is_in_dump_location(dirname)) { /* Then refuse to operate on it (someone is attacking us??) */ error_msg("Bad problem directory name '%s', should start with: '%s'", dirname,...
cwe
CWE-200
C/C++
icmp6_rrenum_print(netdissect_options *ndo, const u_char *bp, const u_char *ep) { const struct icmp6_router_renum *rr6; const char *cp; const struct rr_pco_match *match; const struct rr_pco_use *use; char hbuf[NI_MAXHOST]; int n; if (ep < bp) return; rr6 = (const struct icmp6_router_renum *)bp; cp = (const ...
cwe
CWE-125
C/C++
def _find_host_exhaustive(self, connector, hosts): for host in hosts: ssh_cmd = 'svcinfo lshost -delim ! %s' % host out, err = self._run_ssh(ssh_cmd) self._assert_ssh_return(len(out.strip()), '_find_host_exhaustive', ...
cwe
CWE-78
Python
void luaV_execute (lua_State *L, CallInfo *ci) { LClosure *cl; TValue *k; StkId base; const Instruction *pc; int trap; #if LUA_USE_JUMPTABLE #include "ljumptab.h" #endif tailcall: trap = L->hookmask; cl = clLvalue(s2v(ci->func)); k = cl->p->k; pc = ci->u.l.savedpc; if (trap) { if (cl->p->is_var...
cwe
CWE-416
Unknown
ZlibOutStream::ZlibOutStream(OutStream* os, int bufSize_, int compressLevel) : underlying(os), compressionLevel(compressLevel), newLevel(compressLevel), bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0) { zs = new z_stream; zs->zalloc = Z_NULL; zs->zfree = Z_NULL; zs->opaque = Z_NULL; ...
cwe
CWE-122
C/C++
// // 数据库驱动::PHP // 支持数据库:mysql,mssql,oracle,informix // const LANG = antSword['language']['database']; const LANG_T = antSword['language']['toastr']; const dialog = antSword.remote.dialog; const fs = require('fs'); const Decodes = antSword.Decodes; class PHP { constructor(opt) { this.opt = opt; this.core ...
cwe
CWE-79
JavaScript
def get_json(self, uri): """Make a GET request to an endpoint returning JSON and parse result :param uri: The URI to make a GET request to. :type uri: unicode :return: A deferred containing JSON parsed into a Python object. :rtype: twisted.internet.defer.Deferred[dict[any, any]...
cwe
CWE-20
Python
static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info, int *need_next_header, int *new_frame_start) { GetBitContext bits; AACADTSHeaderInfo hdr; int size; union { uint64_t u64; uint8_t u8[8]; } tmp; tmp.u64 = av_be2ne64(state); init_get_bits(&bits, ...
cwe
CWE-125
C/C++
/* Package echo implements high performance, minimalist Go web framework. Example: package main import ( "net/http" "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" ) // Handler func hello(c echo.Context) error { return c.String(http.StatusOK, "Hello, World!") } ...
cwe
CWE-22
Go
void server_process_native_message( Server *s, const void *buffer, size_t buffer_size, struct ucred *ucred, struct timeval *tv, const char *label, size_t label_len) { struct iovec *iovec = NULL; unsigned n = 0, m = 0, j, tn...
cwe
CWE-190
C/C++
@Override protected void configure(HttpSecurity http) throws Exception { String[] patterns = new String[] {"/index.html", "/home.html", "/login1.html", "/xss2.html", "/", "/xss", "/login", "/xss1.html", "/resource", "/postcustomer", "/getallcustomer", "/getinfo", "/postxss"}; ...
cwe
CWE-352
Java
upgrade_deploy_data (GBytes *deploy_data, GFile *deploy_dir, FlatpakDecomposed *ref, OstreeRepo *repo, GCancellable *cancellable, GError **error) { VarDeployDataR...
cwe
CWE-276
C/C++
/* * Copyright (C) 2016 Southern Storm Software, Pty Ltd. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, ...
cwe
CWE-119
Java
package org.hswebframework.web.workflow.web; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; import io.swagger.annotations.Api; import io....
cwe
CWE-79
Java
def update_sources(conn, sqlite, k10plus, ai): """ Update the source table. """ current_sources = get_all_current_sources(k10plus, ai) old_sources = get_all_old_sources(conn, sqlite) # Check if the source table is allready filled and this is not the first checkup source_table_is_filled = le...
cwe
CWE-89
Python
public int decryptWithAd(byte[] ad, byte[] ciphertext, int ciphertextOffset, byte[] plaintext, int plaintextOffset, int length) throws ShortBufferException, BadPaddingException { int space; if (ciphertextOffset > ciphertext.length) space = 0; else space = ciphertext.length - ciphertextOffset; if (le...
cwe
CWE-787
Java
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or a...
cwe
CWE-476
C/C++
int main(int argc, char *argv[]) { libettercap_init(); ef_globals_alloc(); select_text_interface(); libettercap_ui_init(); /* etterfilter copyright */ fprintf(stdout, "\n" EC_COLOR_BOLD "%s %s" EC_COLOR_END " copyright %s %s\n\n", PROGRAM, EC_VERSION, EC_COPYRIGHT, EC_AUTHORS); ...
cwe
CWE-125
Unknown
virtual void scheduleBeginFrameAndCommit() { CCMainThread::postTask(m_proxy->createBeginFrameAndCommitTaskOnCCThread()); }
cwe
CWE-119
C/C++
BlobStorageContext::BlobFlattener::BlobFlattener( const BlobDataBuilder& input_builder, BlobEntry* output_blob, BlobStorageRegistry* registry) { const std::string& uuid = input_builder.uuid_; std::set<std::string> dependent_blob_uuids; size_t num_files_with_unknown_size = 0; size_t num_building_dep...
cwe
CWE-119
C/C++
RList *r_bin_ne_get_segments(r_bin_ne_obj_t *bin) { int i; if (!bin) { return NULL; } RList *segments = r_list_newf (free); for (i = 0; i < bin->ne_header->SegCount; i++) { RBinSection *bs = R_NEW0 (RBinSection); if (!bs) { return segments; } NE_image_segment_entry *se = &bin->segment_entries[i]; bs...
cwe
CWE-476
Unknown
def read_checksums gem Gem.load_yaml @checksums = gem.seek 'checksums.yaml.gz' do |entry| Zlib::GzipReader.wrap entry do |gz_io| YAML.load gz_io.read end end end
cwe
CWE-502
Ruby
TfLiteStatus NotEqualEval(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1); const TfLiteTensor* input2 = GetInput(context, node, kInputTensor2); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); bool requires_broadcast = !HaveSameShape...
cwe
CWE-787
C/C++
int slap_parse_user( struct berval *id, struct berval *user, struct berval *realm, struct berval *mech ) { char u; assert( id != NULL ); assert( !BER_BVISNULL( id ) ); assert( user != NULL ); assert( realm != NULL ); assert( mech != NULL ); u = id->bv_val[ 0 ]; if ( u != 'u' && u != 'U' ) { /* called w...
cwe
CWE-763
C/C++
void LosslessScan::ParseMCU(struct Line **prev,struct Line **top) { #if ACCUSOFT_CODE UBYTE i; // // Parse a single MCU, which is now a group of pixels. for(i = 0;i < m_ucCount;i++) { class HuffmanDecoder *dc = m_pDCDecoder[i]; struct Line *line = top[i]; struct Line *pline= prev[i]; UBYTE ym =...
cwe
CWE-119
Unknown
int ecc_map(ecc_point* P, mp_int* modulus, mp_digit mp) { #ifndef WOLFSSL_SP_MATH #ifdef WOLFSSL_SMALL_STACK mp_int* t1 = NULL; mp_int* t2 = NULL; #ifdef ALT_ECC_SIZE mp_int* rx = NULL; mp_int* ry = NULL; mp_int* rz = NULL; #endif #else mp_int t1[1], t2[1]; #ifdef ALT_ECC_SIZE mp_int rx[1], ry[1]...
cwe
CWE-203
Unknown
QUInt8() {}
cwe
CWE-908
C/C++
async function gitMtime(path) { const { stdout } = await execFilePromise('git', ['log', '-1', '--format="%at"', '--', path]); return parseInt(stdout.trim().replace('"', '').trim(), 10); }
cwe
CWE-116
JavaScript
new mxPoint(l,v),new mxPoint(0,v)],this.isRounded,A,!0);c.end()};mxCellRenderer.registerShape("corner",Ka);mxUtils.extend(bb,mxActor);bb.prototype.redrawPath=function(c,l,x,p,v){c.moveTo(0,0);c.lineTo(0,v);c.end();c.moveTo(p,0);c.lineTo(p,v);c.end();c.moveTo(0,v/2);c.lineTo(p,v/2);c.end()};mxCellRenderer.registerShape(...
cwe
CWE-20
JavaScript
static void diff_index_show_file(struct rev_info *revs, const char *prefix, struct cache_entry *ce, const unsigned char *sha1, unsigned int mode) { diff_addremove(&revs->diffopt, prefix[0], mode, sha1, ce->name, NULL); }
cwe
CWE-119
Unknown
/////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2006, Industrial Light & Magic, a division of Lucas // Digital Ltd. LLC // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the f...
cwe
CWE-787
Java
public function delete() { return $this->filesystem->deleteDir($this->path); }
cwe
CWE-89
JavaScript
/* * Unsquash a squashfs filesystem. This is a highly compressed read only * filesystem. * * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2019, 2021 * Phillip Lougher <phillip@squashfs.org.uk> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public...
cwe
CWE-22
C/C++
static void append_options(DBusMessageIter *iter, void *user_data) { struct pending_op *op = user_data; const char *path = device_get_path(op->device); struct bt_gatt_server *server; const char *link; uint16_t mtu; switch (op->link_type) { case BT_ATT_BREDR: link = "BR/EDR"; break; case BT_ATT_LE: link =...
cwe
CWE-416
Unknown
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { auto* params = reinterpret_cast<TfLiteSVDFParams*>(node->builtin_data); OpData* op_data = reinterpret_cast<OpData*>(node->user_data); const TfLiteTensor* input; TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, kInputTensor, &input)); const T...
cwe
CWE-369
Unknown
status_t GraphicBuffer::unflatten( void const*& buffer, size_t& size, int const*& fds, size_t& count) { if (size < 8*sizeof(int)) return NO_MEMORY; int const* buf = static_cast<int const*>(buffer); if (buf[0] != 'GBFR') return BAD_TYPE; const size_t numFds = buf[8]; const size_t numInts = buf[9]; ...
cwe
CWE-189
C/C++
void Compute(OpKernelContext* ctx) override { Buffer* buf = nullptr; OP_REQUIRES_OK(ctx, GetBuffer(ctx, def(), &buf)); core::ScopedUnref scope(buf); Buffer::Tuple tuple; std::size_t index = ctx->input(0).scalar<int>()(); OP_REQUIRES_OK(ctx, buf->Peek(index, &tuple)); OP_REQUIRES( ...
cwe
CWE-20
Unknown
import { mainPage } from "../../support/page_objects/mainPage"; import { isTestSuiteActive, isXcdb, getProjectString, } from "../../support/page_objects/projectConstants"; export const genTest = (apiType, dbType) => { if (!isTestSuiteActive(apiType, dbType)) return; describe(`${apiType.toUpperCase...
cwe
CWE-400
JavaScript
/* Copyright 2008-2017 LibRaw LLC (info@libraw.org) LibRaw is free software; you can redistribute it and/or modify it under the terms of the one of two licenses as you choose: 1. GNU LESSER GENERAL PUBLIC LICENSE version 2.1 (See file LICENSE.LGPL provided in LibRaw distribution archive for details). 2. COMMON...
cwe
CWE-125
C/C++
void RemoveProcessIdFromGlobalMap(int32_t process_id) { DCHECK_CURRENTLY_ON(BrowserThread::UI); GetProcessIdToFilterMap()->erase(process_id); }
cwe
CWE-787
C/C++
def update_cluster_settings(params, request, session) properties = params['config'] to_update = [] current = getAllSettings(session) # We need to be able to set cluster properties also from older version GUI. # This code handles proper processing of checkboxes. # === backward compatibility layer start === ...
cwe
CWE-384
Ruby
xfs_attr_leaf_addname(xfs_da_args_t *args) { xfs_inode_t *dp; struct xfs_buf *bp; int retval, error, committed, forkoff; trace_xfs_attr_leaf_addname(args); /* * Read the (only) block in the attribute list in. */ dp = args->dp; args->blkno = 0; error = xfs_attr3_leaf_read(args->trans, args->dp, args->blkno...
cwe
CWE-19
C/C++
static gint conv_sjistoeuc(gchar *outbuf, gint outlen, const gchar *inbuf) { const guchar *in = inbuf; guchar *out = outbuf; while (*in != '\0') { if (IS_ASCII(*in)) { *out++ = *in++; } else if (issjiskanji1(*in)) { if (issjiskanji2(*(in + 1))) { guchar out1 = *in; guchar out2 = *(in + 1); guc...
cwe
CWE-119
Unknown
package controller import ( "github.com/answerdev/answer/internal/base/handler" "github.com/answerdev/answer/internal/base/middleware" "github.com/answerdev/answer/internal/base/reason" "github.com/answerdev/answer/internal/base/translator" "github.com/answerdev/answer/internal/base/validator" "github.com/answer...
cwe
CWE-203
Go
it "sets the generation time" do time = Time.at((Time.now.utc - 64800).to_i).utc Moped::BSON::ObjectId.new(nil, time).generation_time.should == time end
cwe
CWE-20
Ruby
package org.jboss.resteasy.reactive.server.vertx; import io.netty.buffer.Unpooled; import io.netty.channel.EventLoop; import io.netty.handler.codec.http.HttpHeaderNames; import io.netty.util.concurrent.ScheduledFuture; import io.vertx.core.AsyncResult; import io.vertx.core.Handler; import io.vertx.core.Vertx; import i...
cwe
CWE-863
Java
PrintingContextCairo::PrintingContextCairo(const std::string& app_locale) #if defined(OS_CHROMEOS) : PrintingContext(app_locale) { #else : PrintingContext(app_locale), print_dialog_(NULL) { #endif } PrintingContextCairo::~PrintingContextCairo() { ReleaseContext(); #if !defined(OS_CHROMEOS) if (print...
cwe
CWE-416
C/C++
def get(image_file, domain, title, singer, album): import ast import base64 import json import os from html import unescape import requests api = f"http://{domain}:7873/bGVhdmVfcmlnaHRfbm93" with open(image_file, "rb") as f: im_bytes = f.read() f.close() im_b64 = b...
cwe
CWE-78
Python
import namedavatar from 'namedavatar' import { QuillDeltaToHtmlConverter } from 'quill-delta-to-html' import './projectchart.html' import Projects, { ProjectStats } from '../../api/projects/projects.js' import projectUsers from '../../api/users/users.js' import { getUserSetting, getUserTimeUnitVerbose } from '../../uti...
cwe
CWE-79
JavaScript
static int i2c_ddc_rx(I2CSlave *i2c) { I2CDDCState *s = I2CDDC(i2c); int value; value = s->edid_blob[s->reg]; s->reg++; return value; }
cwe
CWE-125
C/C++
// Copyright 2014 Manu Martinez-Almeida. All rights reserved. // Use of this source code is governed by a MIT style // license that can be found in the LICENSE file. package gin import ( "fmt" "html/template" "net" "net/http" "net/url" "os" "path" "strings" "sync" "github.com/gin-gonic/gin/internal/bytesco...
cwe
CWE-20
Go
def activity_user user = current_user.pref[:activity_user] if user && user != "all_users" user = if user =~ /@/ # email User.where(:email => user).first else # first_name middle_name last_name any_name name_query = if user.include?(" ") user.name_permutations.map{ |...
cwe
CWE-89
Ruby
void Document::finishedParsing() { ASSERT(!scriptableDocumentParser() || !m_parser->isParsing()); ASSERT(!scriptableDocumentParser() || m_readyState != Loading); setParsingState(InDOMContentLoaded); if (!m_documentTiming.domContentLoadedEventStart()) m_documentTiming.setDomContentLoadedEventSta...
cwe
CWE-254
C/C++
req_get_traps( sockaddr_u *srcadr, endpt *inter, struct req_pkt *inpkt ) { struct info_trap *it; struct ctl_trap *tr; size_t i; if (num_ctl_traps == 0) { req_ack(srcadr, inter, inpkt, INFO_ERR_NODATA); return; } it = (struct info_trap *)prepare_pkt(srcadr, inter, inpkt, v6sizeof(struct info_trap));...
cwe
CWE-476
Unknown
package org.platformlambda.automation.services; import org.platformlambda.automation.config.RoutingEntry; import org.platformlambda.automation.models.AsyncContextHolder; import org.platformlambda.automation.models.HeaderInfo; import org.platformlambda.automation.util.SimpleHttpUtility; import org.platformlambda.core.a...
cwe
CWE-611
Java
static ssize_t show_crash_notes(struct device *dev, struct device_attribute *attr, char *buf) { struct cpu *cpu = container_of(dev, struct cpu, dev); ssize_t rc; unsigned long long addr; int cpunum; cpunum = cpu->dev.id; /* * Might be reading other cpu's data based on which cpu read thread * has been sc...
cwe
CWE-787
Unknown
int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, version, stream_size) z_streamp strm; int level; int method; int windowBits; int memLevel; int strategy; const char *version; int stream_size; { deflate_state *s; int wrap = 1; ...
cwe
CWE-787
Unknown
static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, int closing, int tx_ring) { struct pgv *pg_vec = NULL; struct packet_sock *po = pkt_sk(sk); unsigned long *rx_owner_map = NULL; int was_running, order = 0; struct packet_ring_buffer *rb; struct sk_buff_head *rb_queue; __be16 num; int err;...
cwe
CWE-415
Unknown
static int mem_read(jas_stream_obj_t *obj, char *buf, int cnt) { int n; assert(cnt >= 0); assert(buf); JAS_DBGLOG(100, ("mem_read(%p, %p, %d)\n", obj, buf, cnt)); jas_stream_memobj_t *m = (jas_stream_memobj_t *)obj; n = m->len_ - m->pos_; cnt = JAS_MIN(n, cnt); memcpy(buf, &m->buf_[m->pos_], cnt); m->pos_ += ...
cwe
CWE-369
Unknown
TfLiteStatus Subgraph::Invoke() { if (!consistent_) { ReportError("Invoke called on model that is not consistent."); return kTfLiteError; } TfLiteStatus status = kTfLiteOk; if (state_ == kStateUninvokable) { ReportError("Invoke called on model that is not ready."); return kTfLiteError; } else...
cwe
CWE-835
Unknown
PredictorEncodeTile(TIFF* tif, uint8* bp0, tmsize_t cc0, uint16 s) { static const char module[] = "PredictorEncodeTile"; TIFFPredictorState *sp = PredictorState(tif); uint8 *working_copy; tmsize_t cc = cc0, rowsize; unsigned char* bp; int result_code; assert(sp != NULL); assert(sp->encodepfunc !=...
cwe
CWE-119
Unknown
accept_xsmp_connection (SmsConn sms_conn, GsmXsmpServer *server, unsigned long *mask_ret, SmsCallbacks *callbacks_ret, char **failure_reason_ret) { IceConn ice_conn; GsmXSMPClient *clie...
cwe
CWE-835
C/C++
/* * Copyright (c) 2001 The Regents of the University of Michigan. * All rights reserved. * * Kendrick Smith <kmsmith@umich.edu> * Andy Adamson <kandros@umich.edu> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met...
cwe
CWE-404
C/C++