instruction
stringclasses
1 value
input
stringlengths
56
241k
output
int64
0
1
__index_level_0__
int64
0
175k
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: hash_free( hashtable* ht, FT_Memory memory ) { if ( ht != 0 ) { int i, sz = ht->size; hashnode* bp = ht->table; for ( i = 0; i < sz; i++, bp++ ) FT_FREE( *bp ); FT_FREE( ht->table ); } } Commit Message: CWE ID: CWE-119
0
6,525
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: MagickExport MagickBooleanType GetImageMean(const Image *image,double *mean, double *standard_deviation,ExceptionInfo *exception) { MagickBooleanType status; status=GetImageChannelMean(image,CompositeChannels,mean,standard_deviation, exception); return(status); } Commit Message: https://github.c...
0
88,936
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int jas_image_encode(jas_image_t *image, jas_stream_t *out, int fmt, char *optstr) { jas_image_fmtinfo_t *fmtinfo; if (!(fmtinfo = jas_image_lookupfmtbyid(fmt))) { return -1; } return (fmtinfo->ops.encode) ? (*fmtinfo->ops.encode)(image, out, optstr) : (-1); } Commit Message: The generation of the confi...
0
72,769
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void net_dec_egress_queue(void) { static_key_slow_dec(&egress_needed); } Commit Message: tunnels: Don't apply GRO to multiple layers of encapsulation. When drivers express support for TSO of encapsulated packets, they only mean that they can do it for one layer of encapsulation. Supporting additional levels wo...
0
48,845
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void ReportPageHistogramAfterSave( ClientPolicyController* policy_controller_, const std::map<int64_t, OfflinePageItem>& offline_pages, const OfflinePageItem& offline_page, const base::Time& save_time) { DCHECK(policy_controller_); base::HistogramBase* histogram = base::Histogram::FactoryTimeG...
0
155,919
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool Smb4KGlobal::removeWorkgroup( Smb4KWorkgroup *workgroup ) { Q_ASSERT( workgroup ); bool removed = false; mutex.lock(); int index = p->workgroupsList.indexOf( workgroup ); if ( index != -1 ) { delete p->workgroupsList.takeAt( index ); removed = true; } else { Smb4KWorkgroup *...
0
6,577
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void HTMLMediaElement::SizeChanged() { BLINK_MEDIA_LOG << "sizeChanged(" << (void*)this << ")"; DCHECK(HasVideo()); // "resize" makes no sense in absence of video. if (ready_state_ > kHaveNothing && IsHTMLVideoElement()) ScheduleEvent(EventTypeNames::resize); if (GetLayoutObject()) GetLayoutObj...
0
144,589
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: rend_authorized_client_free(rend_authorized_client_t *client) { if (!client) return; if (client->client_key) crypto_pk_free(client->client_key); if (client->client_name) memwipe(client->client_name, 0, strlen(client->client_name)); tor_free(client->client_name); memwipe(client->descriptor_co...
0
69,590
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool HFSBTreeIterator::SeekToNode(uint32_t node_id) { if (node_id >= header_.totalNodes) return false; size_t offset = node_id * header_.nodeSize; if (stream_->Seek(offset, SEEK_SET) != -1) { current_leaf_number_ = node_id; return true; } return false; } Commit Message: Add the SandboxedDMG...
0
123,809
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static inline unsigned long __user *__fetch_reg_addr_user(unsigned int reg, struct pt_regs *regs) { BUG_ON(reg < 16); BUG_ON(regs->tstate & TSTATE_PRIV); if (test_thread_flag(TIF_32BIT)) { struct reg_window32 __user *win32; win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[...
0
25,708
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: version( void ) { printf( "%s\n%s\n", CondorVersion(), CondorPlatform() ); exit( 0 ); } Commit Message: CWE ID: CWE-134
0
16,309
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void kvm_destroy_dirty_bitmap(struct kvm_memory_slot *memslot) { if (!memslot->dirty_bitmap) return; kvm_kvfree(memslot->dirty_bitmap); memslot->dirty_bitmap = NULL; } Commit Message: KVM: perform an invalid memslot step for gpa base change PPC must flush all translations before the new memory slot...
0
29,073
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void PersistentHistogramAllocator::FinalizeHistogram(Reference ref, bool registered) { if (registered) { memory_allocator_->MakeIterable(ref); } else { memory_allocator_->ChangeType(ref, 0, PersistentHistogramData::...
0
131,116
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: mcs_out_domain_params(STREAM s, int max_channels, int max_users, int max_tokens, int max_pdusize) { ber_out_header(s, MCS_TAG_DOMAIN_PARAMS, 32); ber_out_integer(s, max_channels); ber_out_integer(s, max_users); ber_out_integer(s, max_tokens); ber_out_integer(s, 1); /* num_priorities */ ber_out_integer(s, 0)...
0
92,946
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void Editor::ReplaceSelection(const String& text) { DCHECK(!GetFrame().GetDocument()->NeedsLayoutTreeUpdate()); bool select_replacement = Behavior().ShouldSelectReplacement(); bool smart_replace = true; ReplaceSelectionWithText(text, select_replacement, smart_replace, InputEvent...
0
124,718
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *info) { int minor_version = server->nfs_client->cl_minorversion; int status = nfs4_lookup_root(server, fhandle, info); if ((status == -NFS4ERR_WRONGSEC) && !(server->flags & NFS_MOUNT_SECFLAVOUR)) /* ...
0
19,968
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void ServiceWorkerContextCore::PerformStorageCleanup( base::OnceClosure callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); storage()->PerformStorageCleanup(std::move(callback)); } Commit Message: Convert FrameHostMsg_DidAddMessageToConsole to Mojo. Note: Since this required changing the test RenderView...
0
139,480
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int vp7_fade_frame(VP8Context *s, VP56RangeCoder *c) { int alpha = (int8_t) vp8_rac_get_uint(c, 8); int beta = (int8_t) vp8_rac_get_uint(c, 8); int ret; if (!s->keyframe && (alpha || beta)) { int width = s->mb_width * 16; int height = s->mb_height * 16; AVFrame *s...
0
63,997
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionStrictFunction(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwVMTypeError(exec); JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(thisValue)); ASSERT_GC_OBJECT...
1
170,609
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int mcryptd_enqueue_request(struct mcryptd_queue *queue, struct crypto_async_request *request, struct mcryptd_hash_request_ctx *rctx) { int cpu, err; struct mcryptd_cpu_queue *cpu_queue; cpu = get_cpu(); cpu_queue = this_cpu_ptr(queue->cpu_queue); rctx->tag.cpu = cpu; err = crypto_enque...
0
45,821
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: connect_socket(struct mg_context *ctx /* may be NULL */, const char *host, int port, int use_ssl, char *ebuf, size_t ebuf_len, SOCKET *sock /* output: socket, must not be NULL */, union usa *sa /* output: sock...
0
81,639
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void vhost_vq_reset_user_be(struct vhost_virtqueue *vq) { } Commit Message: vhost: actually track log eventfd file While reviewing vhost log code, I found out that log_file is never set. Note: I haven't tested the change (QEMU doesn't use LOG_FD yet). Cc: stable@vger.kernel.org Signed-off-by: Marc-André...
0
42,242
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: hook_timer_exec () { struct timeval tv_time; struct t_hook *ptr_hook, *next_hook; hook_timer_check_system_clock (); gettimeofday (&tv_time, NULL); hook_exec_start (); ptr_hook = weechat_hooks[HOOK_TYPE_TIMER]; while (ptr_hook) { next_hook = ptr_hook->nex...
0
3,445
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: String HTMLFormElement::action() const { Document& document = GetDocument(); KURL action_url = document.CompleteURL(attributes_.Action().IsEmpty() ? document.Url().GetString() : attributes_.Action()); return action_url...
0
152,244
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: ZEND_API zval* ZEND_FASTCALL _zend_hash_str_add_new(HashTable *ht, const char *str, size_t len, zval *pData ZEND_FILE_LINE_DC) { zend_string *key = zend_string_init(str, len, ht->u.flags & HASH_FLAG_PERSISTENT); zval *ret = _zend_hash_add_or_update_i(ht, key, pData, HASH_ADD_NEW ZEND_FILE_LINE_RELAY_CC); zend_...
0
69,147
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: MagickExport Image *RollImage(const Image *image,const ssize_t x_offset, const ssize_t y_offset,ExceptionInfo *exception) { #define RollImageTag "Roll/Image" Image *roll_image; MagickStatusType status; RectangleInfo offset; /* Initialize roll image attributes. */ assert(image !=...
0
74,024
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void usb_kick_hub_wq(struct usb_device *hdev) { struct usb_hub *hub = usb_hub_to_struct_hub(hdev); if (hub) kick_hub_wq(hub); } Commit Message: USB: fix invalid memory access in hub_activate() Commit 8520f38099cc ("USB: change hub initialization sleeps to delayed_work") changed the hub_activate() routine t...
0
56,819
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static long pmcraid_ioctl_driver( struct pmcraid_instance *pinstance, unsigned int cmd, unsigned int buflen, void __user *user_buffer ) { int rc = -ENOSYS; if (!access_ok(VERIFY_READ, user_buffer, _IOC_SIZE(cmd))) { pmcraid_err("ioctl_driver: access fault in request buffer\n"); return -EFAULT; } swi...
0
26,469
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static bool sock_needs_netstamp(const struct sock *sk) { switch (sk->sk_family) { case AF_UNSPEC: case AF_UNIX: return false; default: return true; } } Commit Message: net: avoid signed overflows for SO_{SND|RCV}BUFFORCE CAP_NET_ADMIN users should not be allowed to set negative sk_sndbuf or sk_rcvbuf v...
0
47,906
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: V8Proxy* V8Proxy::retrieve() { DOMWindow* window = retrieveWindow(currentContext()); ASSERT(window); return retrieve(window->frame()); } Commit Message: [V8] Pass Isolate to throwNotEnoughArgumentsError() https://bugs.webkit.org/show_bug.cgi?id=86983 Reviewed by Adam Barth. The objective is to pass...
0
109,751
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: X509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc) { return X509at_get_attr(req->req_info->attributes, loc); } Commit Message: CWE ID:
0
6,204
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: HeadlessWebContents::Builder& HeadlessWebContents::Builder::SetInitialURL( const GURL& initial_url) { initial_url_ = initial_url; return *this; } Commit Message: Use pdf compositor service for printing when OOPIF is enabled When OOPIF is enabled (by site-per-process flag or top-document-isolation featur...
0
126,881
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int do_last(struct nameidata *nd, struct path *path, struct file *file, const struct open_flags *op, int *opened, struct filename *name) { struct dentry *dir = nd->path.dentry; int open_flag = op->open_flag; bool will_truncate = (open_flag & O_TRUNC) != 0; bool got_write = false; int acc_mod...
0
42,315
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: _archive_write_disk_free(struct archive *_a) { struct archive_write_disk *a; int ret; if (_a == NULL) return (ARCHIVE_OK); archive_check_magic(_a, ARCHIVE_WRITE_DISK_MAGIC, ARCHIVE_STATE_ANY | ARCHIVE_STATE_FATAL, "archive_write_disk_free"); a = (struct archive_write_disk *)_a; ret = _archive_write_d...
0
43,891
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: LUALIB_API int luaopen_struct (lua_State *L) { luaL_register(L, "struct", thislib); return 1; } Commit Message: Security: fix Lua struct package offset handling. After the first fix to the struct package I found another similar problem, which is fixed by this patch. It could be reproduced easily by running ...
0
83,044
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void PromoResourceService::RegisterPrefs(PrefService* local_state) { local_state->RegisterIntegerPref(prefs::kNtpPromoVersion, 0); local_state->RegisterStringPref(prefs::kNtpPromoLocale, std::string()); } Commit Message: Refresh promo notifications as they're fetched The "guard" existed for notification sch...
0
104,796
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void ChromePaymentRequestDelegate::ShowErrorMessage() { if (dialog_) dialog_->ShowErrorMessage(); } Commit Message: [Payments] Prohibit opening payments UI in background tab. Before this patch, calling PaymentRequest.show() would bring the background window to the foreground, which allows a page to open a...
0
138,962
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void setJSTestSerializedScriptValueInterfaceCachedValue(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestSerializedScriptValueInterface* castedThis = jsCast<JSTestSerializedScriptValueInterface*>(thisObject); TestSerializedScriptValueInterface* impl = static_cast<TestSerializedScriptValueInte...
0
101,403
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: const Extension* ExtensionService::LoadComponentExtension( const ComponentExtensionInfo &info) { JSONStringValueSerializer serializer(info.manifest); scoped_ptr<Value> manifest(serializer.Deserialize(NULL, NULL)); if (!manifest.get()) { DLOG(ERROR) << "Failed to parse manifest for extension"; re...
0
99,931
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: u32 hid_field_extract(const struct hid_device *hid, u8 *report, unsigned offset, unsigned n) { if (n > 32) { hid_warn(hid, "hid_field_extract() called with n (%d) > 32! (%s)\n", n, current->comm); n = 32; } return __extract(report, offset, n); } Commit Message: HID: core: prevent out-of-bound read...
0
49,491
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: dump_var_hash_as_event(gpointer k, gpointer v, gpointer ud) { (void) ud; uzbl_cmdprop *c = v; GString *msg; if(!c->dump) return; /* check for the variable type */ msg = g_string_new((char *)k); if (c->type == TYPE_STR) { g_string_append_printf(msg, " str %s", *c->ptr....
0
18,345
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool RenderWidgetHostImpl::KeyPressListenersHandleEvent( const NativeWebKeyboardEvent& event) { if (event.skip_in_browser || event.type != WebKeyboardEvent::RawKeyDown) return false; for (size_t i = 0; i < key_press_event_callbacks_.size(); i++) { size_t original_size = key_press_event_callbacks_...
0
130,974
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: exsltDateFormatDate (const exsltDateValDatePtr dt) { xmlChar buf[100], *cur = buf; if ((dt == NULL) || !VALID_DATETIME(dt)) return NULL; FORMAT_DATE(dt, cur); if (dt->tz_flag || (dt->tzo != 0)) { FORMAT_TZ(dt->tzo, cur); } *cur = 0; return xmlStrdup(buf); } Commit Message: Roll l...
0
156,608
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int aio_ring_mmap(struct file *file, struct vm_area_struct *vma) { vma->vm_ops = &generic_file_vm_ops; return 0; } Commit Message: aio: fix kernel memory disclosure in io_getevents() introduced in v3.10 A kernel memory disclosure was introduced in aio_read_events_ring() in v3.10 by commit a31ad380bed81...
0
39,596
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: OVS_EXCLUDED(ofproto_mutex) { struct rule **orig_rules = rules; if (*rules) { struct ofproto *ofproto = rules[0]->ofproto; unsigned long tables[BITMAP_N_LONGS(256)]; struct rule *rule; size_t table_id; memset(tables, 0, sizeof tables); ovs_mutex_lock(...
0
77,118
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static_track_group_handler(vector_t *strvec) { element e; static_track_group_t *tg; char* gname; if (!strvec) return; if (vector_count(strvec) != 2) { report_config_error(CONFIG_GENERAL_ERROR, "track_group must have a name - skipping"); skip_block(true); return; } gname = strvec_slot(strvec, 1);...
0
75,985
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: SWFInput_getUInt32(SWFInput input) { unsigned long num = SWFInput_getChar(input); num += SWFInput_getChar(input) << 8; num += SWFInput_getChar(input) << 16; num += SWFInput_getChar(input) << 24; return num; } Commit Message: Fix left shift of a negative value in SWFInput_readSBits. Check for number before b...
0
89,559
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int kvm_sn2_setup_mappings(struct kvm_vcpu *vcpu) { unsigned long pte, rtc_phys_addr, map_addr; int slot; map_addr = KVM_VMM_BASE + (1UL << KVM_VMM_SHIFT); rtc_phys_addr = LOCAL_MMR_OFFSET | SH_RTC; pte = pte_val(mk_pte_phys(rtc_phys_addr, PAGE_KERNEL_UC)); slot = ia64_itr_entry(0x3, map_addr, pte, ...
0
20,634
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: TT_MulFix14_arm( FT_Int32 a, FT_Int b ) { FT_Int32 t, t2; #if defined( __CC_ARM ) || defined( __ARMCC__ ) __asm { smull t2, t, b, a /* (lo=t2,hi=t) = a*b */ mov a, t, asr #31 /* a = (hi >> 31) */ add a, a, #0x2000 /...
0
10,720
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int tls12_get_pkey_idx(unsigned char sig_alg) { switch (sig_alg) { #ifndef OPENSSL_NO_RSA case TLSEXT_signature_rsa: return SSL_PKEY_RSA_SIGN; #endif #ifndef OPENSSL_NO_DSA case TLSEXT_signature_dsa: return SSL_PKEY_DSA_SIGN; #endif #ifndef OPENSSL_NO_EC case TLSEXT_signatur...
0
9,445
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int srpt_check_stop_free(struct se_cmd *cmd) { struct srpt_send_ioctx *ioctx = container_of(cmd, struct srpt_send_ioctx, cmd); return target_put_sess_cmd(&ioctx->cmd); } Commit Message: IB/srpt: Simplify srpt_handle_tsk_mgmt() Let the target core check task existence instead of the SRP target driv...
0
50,632
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int BROTLI_NOINLINE SafeDecodeCommandBlockSwitch(BrotliState* s) { return DecodeCommandBlockSwitchInternal(1, s); } Commit Message: Cherry pick underflow fix. BUG=583607 Review URL: https://codereview.chromium.org/1662313002 Cr-Commit-Position: refs/heads/master@{#373736} CWE ID: CWE-119
0
133,129
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static av_cold int init(AVFilterContext *ctx) { FPSContext *s = ctx->priv; if (!(s->fifo = av_fifo_alloc(2*sizeof(AVFrame*)))) return AVERROR(ENOMEM); s->pts = AV_NOPTS_VALUE; s->first_pts = AV_NOPTS_VALUE; av_log(ctx, AV_LOG_VERBOSE, "fps=%d/%d\n", s->framerate.num, s->...
0
28,043
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool ImageLoader::HasPendingEvent() const { if (image_content_ && !image_complete_ && !loading_image_document_) return true; if (pending_load_event_.IsActive() || pending_error_event_.IsActive()) return true; return false; } Commit Message: service worker: Disable interception when OBJECT/EMBED u...
0
147,494
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static struct ucma_multicast* ucma_alloc_multicast(struct ucma_context *ctx) { struct ucma_multicast *mc; mc = kzalloc(sizeof(*mc), GFP_KERNEL); if (!mc) return NULL; mutex_lock(&mut); mc->id = idr_alloc(&multicast_idr, mc, 0, 0, GFP_KERNEL); mutex_unlock(&mut); if (mc->id < 0) goto error; mc...
1
169,109
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: mojo::ScopedSharedBufferHandle GamepadProvider::GetSharedBufferHandle() { base::SharedMemoryHandle handle = base::SharedMemory::DuplicateHandle( gamepad_shared_buffer_->shared_memory()->handle()); return mojo::WrapSharedMemoryHandle(handle, sizeof(GamepadHardwareBuffer), ...
1
172,867
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: AutofillManager::AutofillManager(TabContentsWrapper* tab_contents) : TabContentsObserver(tab_contents->tab_contents()), tab_contents_wrapper_(tab_contents), personal_data_(NULL), download_manager_(tab_contents->profile()), disable_download_manager_requests_(false), metric_logger_...
0
100,449
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int packet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { struct sock *sk = sock->sk; switch (cmd) { case SIOCOUTQ: { int amount = sk_wmem_alloc_get(sk); return put_user(amount, (int __user *)arg); } case SIOCINQ: { struct sk_buff *skb; int amount = 0; spin_lock_bh...
0
26,556
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool HistoryModelWorker::CurrentThreadIsWorkThread() { return true; } Commit Message: Enable HistoryModelWorker by default, now that bug 69561 is fixed. BUG=69561 TEST=Run sync manually and run integration tests, sync should not crash. Review URL: http://codereview.chromium.org/7016007 git-svn-id: svn://svn...
0
101,409
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int ipxitf_ioctl(unsigned int cmd, void __user *arg) { int rc = -EINVAL; struct ifreq ifr; int val; switch (cmd) { case SIOCSIFADDR: { struct sockaddr_ipx *sipx; struct ipx_interface_definition f; rc = -EFAULT; if (copy_from_user(&ifr, arg, sizeof(ifr))) break; sipx = (struct sockaddr_i...
0
40,461
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void TIFFSetEXIFProperties(TIFF *tiff,Image *image) { #if defined(MAGICKCORE_HAVE_TIFFREADEXIFDIRECTORY) const char *value; register ssize_t i; uint32 offset; /* Write EXIF properties. */ offset=0; (void) TIFFSetField(tiff,TIFFTAG_SUBIFD,1,&offset); for (i=0; exif_info[i]...
0
69,082
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void ChromotingInstance::OnConnectionState( protocol::ConnectionToHost::State state, protocol::ErrorCode error) { scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); data->SetString("state", ConnectionStateToString(state)); data->SetString("error", ConnectionErrorToString(error)); ...
0
102,344
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void SpeechRecognitionManagerImpl::SessionAbort(const Session& session) { if (primary_session_id_ == session.id) primary_session_id_ = kSessionIDInvalid; DCHECK(session.recognizer.get()); session.recognizer->AbortRecognition(); } Commit Message: Make MediaStreamDispatcherHost per-request instead of per...
0
153,319
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void dissect_hsdsch_common_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, struct fp_info *p_fp_info, void *data) { gboolean is_control_frame; guint16 header_crc = 0; proto_item * header_crc_p...
0
51,874
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: DevToolsWindow* DevToolsWindow::Create( Profile* profile, const GURL& frontend_url, content::WebContents* inspected_web_contents, bool shared_worker_frontend, bool v8_only_frontend, const std::string& remote_frontend, bool can_dock, const std::string& settings, const std::strin...
0
138,380
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: CustomButton* CustomButton::AsCustomButton(views::View* view) { if (view) { const char* classname = view->GetClassName(); if (!strcmp(classname, Checkbox::kViewClassName) || !strcmp(classname, CustomButton::kViewClassName) || !strcmp(classname, ImageButton::kViewClassName) || !st...
0
132,328
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: xsltGatherNamespaces(xsltStylesheetPtr style) { xmlNodePtr cur; const xmlChar *URI; if (style == NULL) return; /* * TODO: basically if the stylesheet uses the same prefix for different * patterns, well they may be in problem, hopefully they will get * a warning ...
0
156,901
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int btsock_thread_create(btsock_signaled_cb callback, btsock_cmd_cb cmd_callback) { asrt(callback || cmd_callback); pthread_mutex_lock(&thread_slot_lock); int h = alloc_thread_slot(); pthread_mutex_unlock(&thread_slot_lock); APPL_TRACE_DEBUG("alloc_thread_slot ret:%d", h); if(h >= 0) { ...
0
158,900
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int __btrfs_submit_bio_start(struct inode *inode, int rw, struct bio *bio, int mirror_num, unsigned long bio_flags, u64 bio_offset) { struct btrfs_root *root = BTRFS_I(inode)->root; int ret = 0; ret = btrfs_csum_one_bio(root, inode, bio, 0, 0); BUG_ON(ret); /* -ENOMEM */ retur...
0
34,267
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: ofputil_async_msg_type_to_string(enum ofputil_async_msg_type type) { switch (type) { case OAM_PACKET_IN: return "PACKET_IN"; case OAM_PORT_STATUS: return "PORT_STATUS"; case OAM_FLOW_REMOVED: return "FLOW_REMOVED"; case OAM_ROLE_STATUS: return "ROLE_STATUS"; case OAM_TABLE_STA...
0
77,478
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: MetricsLog::IndependentMetricsLoader::IndependentMetricsLoader( std::unique_ptr<MetricsLog> log) : log_(std::move(log)), flattener_(new IndependentFlattener(log_.get())), snapshot_manager_(new base::HistogramSnapshotManager(flattener_.get())) {} Commit Message: Add CPU metrics provider and Ad...
0
130,452
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: fmov_reg_dec(struct sh_fpu_soft_struct *fregs, struct pt_regs *regs, int m, int n) { if (FPSCR_SZ) { FMOV_EXT(m); Rn -= 8; WRITE(FRm, Rn + 4); m++; WRITE(FRm, Rn); } else { Rn -= 4; WRITE(FRm, Rn); } return 0; } Commit Message: perf: Remove the nmi parameter from the swevent and overflow...
0
25,602
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: remove_reserved_job(conn c, job j) { return remove_this_reserved_job(c, find_reserved_job_in_conn(c, j)); } Commit Message: Discard job body bytes if the job is too big. Previously, a malicious user could craft a job payload and inject beanstalk commands without the client application knowing. (An extra-car...
0
18,169
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void ContextState::RestoreUnpackState() const { api()->glPixelStoreiFn(GL_UNPACK_ALIGNMENT, unpack_alignment); if (bound_pixel_unpack_buffer.get()) { api()->glBindBufferFn(GL_PIXEL_UNPACK_BUFFER, GetBufferId(bound_pixel_unpack_buffer.get())); api()->glPixelStoreiFn(GL_UNPACK_...
0
150,007
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool RootWindowHostLinux::IsWindowManagerPresent() { return XGetSelectionOwner( xdisplay_, X11AtomCache::GetInstance()->GetAtom(ui::ATOM_WM_S0)) != None; } Commit Message: Introduce XGetImage() for GrabWindowSnapshot() in ChromeOS. BUG=119492 TEST=manually done Review URL: https://chromiumcoderev...
0
103,997
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: update_info_in_idle (Device *device) { UpdateInfoInIdleData *data; data = g_new0 (UpdateInfoInIdleData, 1); data->device = device; data->idle_id = g_idle_add_full (G_PRIORITY_HIGH_IDLE, update_info_in_idle_cb, data, ...
0
11,835
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void log_access(request * req) { if (!access_log_name) return; if (virtualhost) { printf("%s ", req->local_ip_addr); } else if (vhost_root) { printf("%s ", (req->host ? req->host : "(null)")); } print_remote_ip (req, stdout); printf(" - - %s\"%s\" %d %zu \"%s\" \"%...
0
91,842
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: OMX_ERRORTYPE SimpleSoftOMXComponent::internalGetParameter( OMX_INDEXTYPE index, OMX_PTR params) { switch (index) { case OMX_IndexParamPortDefinition: { OMX_PARAM_PORTDEFINITIONTYPE *defParams = (OMX_PARAM_PORTDEFINITIONTYPE *)params; if (defParams->nPortIn...
1
174,222
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: virtual void SetUp() { old_browser_client_ = content::GetContentClient()->browser(); content::GetContentClient()->set_browser(&browser_client_); url_util::AddStandardScheme(kPrivilegedScheme); url_util::AddStandardScheme(chrome::kChromeUIScheme); } Commit Message: Allow browser to handle ...
1
171,010
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int lua_access_checker_harness(request_rec *r) { return lua_request_rec_hook_harness(r, "access_checker", APR_HOOK_MIDDLE); } Commit Message: Merge r1642499 from trunk: *) SECURITY: CVE-2014-8109 (cve.mitre.org) mod_lua: Fix handling of the Require line when a LuaAuthzProvider is used in ...
0
35,686
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool SendAutomationJSONRequest(AutomationMessageSender* sender, const std::string& request, int timeout_ms, std::string* reply, bool* success) { return sender->Send(new AutomationMsg_SendJ...
0
100,658
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool HTMLMediaElement::IsMouseFocusable() const { return false; } Commit Message: Simplify "WouldTaintOrigin" concept in media/blink Currently WebMediaPlayer has three predicates: - DidGetOpaqueResponseFromServiceWorker - HasSingleSecurityOrigin - DidPassCORSAccessCheck . These are used to determine whethe...
0
144,563
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void __exit crypto_cmac_module_exit(void) { crypto_unregister_template(&crypto_cmac_tmpl); } Commit Message: crypto: include crypto- module prefix in template This adds the module loading prefix "crypto-" to the template lookup as well. For example, attempting to load 'vfat(blowfish)' via AF_ALG now co...
0
45,622
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata, fmode_t fmode, int flags, struct nfs_open_context *ctx) { struct nfs4_state_owner *sp = opendata->owner; struct nfs_server *server = sp->so_server; struct dentry *dentry; struct nfs4_state *state; unsigned int seq; int ret; seq = ra...
0
57,044
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int __hwahc_op_mmcie_rm(struct wusbhc *wusbhc, u8 handle) { struct hwahc *hwahc = container_of(wusbhc, struct hwahc, wusbhc); struct wahc *wa = &hwahc->wa; u8 iface_no = wa->usb_iface->cur_altsetting->desc.bInterfaceNumber; return usb_control_msg(wa->usb_dev, usb_sndctrlpipe(wa->usb_dev, 0), WUSB_RE...
0
75,574
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void PaintPatcher::RefPatch() { if (refcount_ == 0) { DCHECK(!begin_paint_.is_patched()); DCHECK(!end_paint_.is_patched()); begin_paint_.Patch(L"riched20.dll", "user32.dll", "BeginPaint", &BeginPaintIntercept); end_paint_.Patch(L"riched20.dll", "user32.dll", "EndPaint", ...
0
107,515
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void WebBluetoothServiceImpl::ScanningClient::RunRequestScanningStartCallback( blink::mojom::WebBluetoothResult result) { if (result == blink::mojom::WebBluetoothResult::SUCCESS) { auto scanning_result = blink::mojom::RequestScanningStartResult::NewOptions(options_.Clone()); std::move(callba...
0
138,153
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int PKCS7_type_is_other(PKCS7 *p7) { int isOther = 1; int nid = OBJ_obj2nid(p7->type); switch (nid) { case NID_pkcs7_data: case NID_pkcs7_signed: case NID_pkcs7_enveloped: case NID_pkcs7_signedAndEnveloped: case NID_pkcs7_digest: case NID_pkcs7_encrypted: isOth...
0
6,193
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void OfflinePageModelTaskified::AddObserver(Observer* observer) { observers_.AddObserver(observer); } Commit Message: Add the method to check if offline archive is in internal dir Bug: 758690 Change-Id: I8bb4283fc40a87fa7a87df2c7e513e2e16903290 Reviewed-on: https://chromium-review.googlesource.com/828049 Revi...
0
155,817
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void dumpInnerHTML(WebCore::HTMLElement* element) { printf("%s\n", element->innerHTML().ascii().data()); } Commit Message: There are too many poorly named functions to create a fragment from markup https://bugs.webkit.org/show_bug.cgi?id=87339 Reviewed by Eric Seidel. Source/WebCore: Moved all functions t...
0
100,368
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: ScriptValue WebGLRenderingContextBase::GetBooleanArrayParameter( ScriptState* script_state, GLenum pname) { if (pname != GL_COLOR_WRITEMASK) { NOTIMPLEMENTED(); return WebGLAny(script_state, 0, 0); } GLboolean value[4] = {0}; if (!isContextLost()) ContextGL()->GetBooleanv(pname, value)...
0
133,624
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: scoped_ptr<GDataEntryProtoVector> GDataDirectory::ToProtoVector() const { scoped_ptr<GDataEntryProtoVector> entries(new GDataEntryProtoVector); for (GDataFileCollection::const_iterator iter = child_files().begin(); iter != child_files().end(); ++iter) { GDataEntryProto proto; iter->second->ToPr...
0
117,121
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: GF_Err iSLT_dump(GF_Box *a, FILE * trace) { GF_ISMACrypSaltBox *p = (GF_ISMACrypSaltBox *)a; gf_isom_box_dump_start(a, "ISMACrypSaltBox", trace); fprintf(trace, "salt=\""LLU"\">\n", p->salt); gf_isom_box_dump_done("ISMACrypSaltBox", a, trace); return GF_OK; } Commit Message: fixed 2 possible heap overflows ...
0
80,764
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int qcow2_expand_zero_clusters(BlockDriverState *bs) { BDRVQcowState *s = bs->opaque; uint64_t *l1_table = NULL; uint64_t nb_clusters; uint8_t *expanded_clusters; int ret; int i, j; nb_clusters = size_to_clusters(s, bs->file->total_sectors * BDRV_SEC...
0
16,939
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: PHP_FUNCTION(nl_langinfo) { zend_long item; char *value; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &item) == FAILURE) { return; } switch(item) { /* {{{ */ #ifdef ABDAY_1 case ABDAY_1: case ABDAY_2: case ABDAY_3: case ABDAY_4: case ABDAY_5: case ABDAY_6: case ABDAY_7: #endif #ifdef DAY...
0
14,605
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: AppCacheHost::AppCacheHost(int host_id, AppCacheFrontend* frontend, AppCacheServiceImpl* service) : host_id_(host_id), spawning_host_id_(kAppCacheNoHostId), spawning_process_id_(0), parent_host_id_(kAppCacheNoHostId), parent_process_id_(0), pending_main_resource_ca...
0
124,189
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: PrepareFrameAndViewForPrint::CreateURLLoaderFactory() { return blink::Platform::Current()->CreateDefaultURLLoaderFactory(); } Commit Message: Correct mojo::WrapSharedMemoryHandle usage Fixes some incorrect uses of mojo::WrapSharedMemoryHandle which were assuming that the call actually has any control over the...
0
149,079
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: PrintWebViewHelperTestBase() {} Commit Message: Fix print preview workflow to reflect settings of selected printer. BUG=95110 TEST=none Review URL: http://codereview.chromium.org/7831041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102242 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-399
0
97,548
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void OmniboxViewViews::GetAccessibleNodeData(ui::AXNodeData* node_data) { node_data->role = ui::AX_ROLE_TEXT_FIELD; node_data->SetName(l10n_util::GetStringUTF8(IDS_ACCNAME_LOCATION)); node_data->SetValue(GetText()); node_data->html_attributes.push_back(std::make_pair("type", "url")); base::string16::si...
0
150,621
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static ssize_t push_ucs2(void *dest, const char *src, size_t dest_len, int flags) { size_t len=0; size_t src_len = strlen(src); size_t size = 0; bool ret; if (flags & STR_UPPER) { char *tmpbuf = strupper_talloc(NULL, src); ssize_t retval; if (tmpbuf == NULL) { return -1; } retval = push_ucs2(de...
0
2,298