instruction
stringclasses
1 value
input
stringlengths
64
129k
output
int64
0
1
__index_level_0__
int64
0
30k
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 HTMLSelectElement::lastSelectedListIndex() const { const Vector<HTMLElement*>& items = listItems(); for (size_t i = items.size(); i;) { HTMLElement* element = items[--i]; if (element->hasTagName(optionTag) && toHTMLOptionElement(element)->selected()) return i; } ret...
0
21,585
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: qreal OxideQQuickWebView::maximumZoomFactor() const { return oxide::qt::WebViewProxy::maximumZoomFactor(); } Commit Message: CWE ID: CWE-20
0
29,151
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 fill_skb_pool(rtl8150_t *dev) { struct sk_buff *skb; int i; for (i = 0; i < RX_SKB_POOL_SIZE; i++) { if (dev->rx_skb_pool[i]) continue; skb = dev_alloc_skb(RTL8150_MTU + 2); if (!skb) { return; } skb_reserve(skb, 2); dev->rx_skb_pool[i] = skb; } } Commit Message: rtl8150: Use h...
0
7,314
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: process_pa_data_to_md(krb5_context context, const krb5_creds *creds, const AS_REQ *a, krb5_get_init_creds_ctx *ctx, METHOD_DATA *in_md, METHOD_DATA **out_md, krb5_prompter_fct prompter, void *prompter_data) { krb5_error_code ret; ALLOC(*out_md, 1); ...
0
973
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 Launcher::UpdateBackground(int alpha) { ui::Layer* layer = widget_->GetNativeView()->layer(); layer->SetColor(SkColorSetARGB(alpha, 0, 0, 0)); } Commit Message: ash: Add launcher overflow bubble. - Host a LauncherView in bubble to display overflown items; - Mouse wheel and two-finger scroll to scroll t...
0
473
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: Xstrdup(const char *s) { if (s == NULL) return NULL; return strdup(s); } Commit Message: CWE ID: CWE-362
0
16,893
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 AutofillPopupViewNativeViews::OnSelectedRowChanged( base::Optional<int> previous_row_selection, base::Optional<int> current_row_selection) { if (previous_row_selection) { rows_[*previous_row_selection]->SetSelected(false); } if (current_row_selection) rows_[*current_row_selection]->Set...
0
21,412
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 set_voice_volume(int voice, int volume, int main_vol) { unsigned char vol1, vol2, vol3, vol4; struct sbi_instrument *instr; struct physical_voice_info *map; if (voice < 0 || voice >= devc->nr_voice) return; map = &pv_map[devc->lv_map[voice]]; instr = devc->act_i[voice]; if (!instr) instr...
0
11,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: static int ip_vs_svc_unhash(struct ip_vs_service *svc) { if (!(svc->flags & IP_VS_SVC_F_HASHED)) { pr_err("%s(): request for unhash flagged, called from %pF\n", __func__, __builtin_return_address(0)); return 0; } if (svc->fwmark == 0) { /* Remove it from the ip_vs_svc_table table */ list_del(...
0
9,534
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 stellaris_enet_update(stellaris_enet_state *s) { qemu_set_irq(s->irq, (s->ris & s->im) != 0); } Commit Message: CWE ID: CWE-20
0
20,436
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 Run(scoped_refptr<base::MessageLoopProxy> relay_proxy, const base::Callback<void(T1)>& callback, T1 arg1) { if (callback.is_null()) return; RunTaskOnThread(relay_proxy, base::Bind(callback, arg1)); } Commit Message: Remove parent* arg from GDataEn...
0
6,141
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 check_iov_bounds(struct vrend_resource *res, const struct vrend_transfer_info *info, struct iovec *iov, int num_iovs) { GLuint send_size; GLuint iovsize = vrend_get_iovec_size(iov, num_iovs); GLuint valid_stride, valid_layer_stride; ...
0
10,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: static void cm_reset_to_idle(struct cm_id_private *cm_id_priv) { unsigned long flags; cm_id_priv->id.state = IB_CM_IDLE; if (cm_id_priv->timewait_info) { spin_lock_irqsave(&cm.lock, flags); cm_cleanup_timewait(cm_id_priv->timewait_info); spin_unlock_irqrestore(&cm.lock, flags); kfree(cm_id_priv->timew...
0
11,407
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 DocumentLoader::FinishedLoading(TimeTicks finish_time) { DCHECK(frame_->Loader().StateMachine()->CreatingInitialEmptyDocument() || !frame_->GetPage()->Paused() || MainThreadDebugger::Instance()->IsPaused()); TimeTicks response_end_time = finish_time; if (response_end_time.is_null()) ...
0
20,780
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 br_multicast_stop(struct net_bridge *br) { struct net_bridge_mdb_htable *mdb; struct net_bridge_mdb_entry *mp; struct hlist_node *n; u32 ver; int i; del_timer_sync(&br->multicast_router_timer); del_timer_sync(&br->multicast_querier_timer); del_timer_sync(&br->multicast_query_timer); spin_lock_bh(&...
0
10,136
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: xfs_attr3_leaf_flipflags( struct xfs_da_args *args) { struct xfs_attr_leafblock *leaf1; struct xfs_attr_leafblock *leaf2; struct xfs_attr_leaf_entry *entry1; struct xfs_attr_leaf_entry *entry2; struct xfs_attr_leaf_name_remote *name_rmt; struct xfs_buf *bp1; struct xfs_buf *bp2; int error; #ifdef DEBUG...
0
9,312
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: conv_backslash_value(OnigCodePoint c, ScanEnv* env) { if (IS_SYNTAX_OP(env->syntax, ONIG_SYN_OP_ESC_CONTROL_CHARS)) { switch (c) { case 'n': return '\n'; case 't': return '\t'; case 'r': return '\r'; case 'f': return '\f'; case 'a': return '\007'; case 'b': return '\010'; case 'e...
0
8,155
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 empty(void) { } Commit Message: floppy: don't write kernel-only members to FDRAWCMD ioctl output Do not leak kernel-only floppy_raw_cmd structure members to userspace. This includes the linked-list pointer and the pointer to the allocated DMA space. Signed-off-by: Matthew Daley <mattd@bugfuzz.com> ...
0
14,600
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 migrate_prep_local(void) { lru_add_drain(); return 0; } Commit Message: mm: migrate dirty page without clear_page_dirty_for_io etc clear_page_dirty_for_io() has accumulated writeback and memcg subtleties since v2.6.16 first introduced page migration; and the set_page_dirty() which completed its migration...
0
16,693
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: explicit WorkerSharedTimer(WorkerThread* workerThread) : m_workerThread(workerThread) , m_running(false) { } Commit Message: Correctly keep track of isolates for microtask execution BUG=487155 R=haraken@chromium.org Review URL: https://codereview.chromium.org/1161823002 git-svn-id: svn...
0
4,447
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 btm_sec_init (UINT8 sec_mode) { #if 0 /* cleared in btm_init; put back in if calling from anywhere else! */ int i; memset (btm_cb.sec_serv_rec, 0, sizeof (btm_cb.sec_serv_rec)); memset (btm_cb.sec_dev_rec, 0, sizeof (btm_cb.sec_dev_rec)); memset (&btm_cb.pairing_tle, 0, sizeof(TIMER_LIST_ENT))...
0
888
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 RenderView::didReceiveTitle(WebFrame* frame, const WebString& title, WebTextDirection direction) { UpdateTitle(frame, title); UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); } Commit Message: DevTools: move DevToolsAgent/Client into content. BUG=84078 TEST...
0
11,815
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 ssl_check_ca_name(STACK_OF(X509_NAME) *names, X509 *x) { X509_NAME *nm; int i; nm = X509_get_issuer_name(x); for (i = 0; i < sk_X509_NAME_num(names); i++) { if (!X509_NAME_cmp(nm, sk_X509_NAME_value(names, i))) return 1; } return 0; } Commit Message: Don't c...
0
21,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: scoped_refptr<gpu::GpuChannelHost> RenderThreadImpl::EstablishGpuChannelSync( bool* connection_error) { TRACE_EVENT0("gpu", "RenderThreadImpl::EstablishGpuChannelSync"); if (gpu_channel_) { if (!gpu_channel_->IsLost()) return gpu_channel_; gpu_channel_->DestroyChannel(); gpu_channel_ =...
0
15,838
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: get_alloc_limit() { return alloc_limit; } Commit Message: Fix integer overflows and harden memory allocator. CWE ID: CWE-190
0
17,349
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 VoidMethodBooleanOrElementSequenceArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { ExceptionState exception_state(info.GetIsolate(), ExceptionState::kExecutionContext, "TestObject", "voidMethodBooleanOrElementSequenceArg"); TestObject* impl = V8TestObject::ToImpl(info.Holder()); if...
0
27,627
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 commit *one_relevant_parent(const struct rev_info *revs, struct commit_list *orig) { struct commit_list *list = orig; struct commit *relevant = NULL; if (!orig) return NULL; /* * For 1-parent commits, or if first-parent-only, then return that * first parent (even if not "relevant"...
0
12,460
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 MediaInterfaceProxy::CreateCdm( media::mojom::ContentDecryptionModuleRequest request) { DCHECK(thread_checker_.CalledOnValidThread()); GetMediaInterfaceFactory()->CreateCdm(std::move(request)); } Commit Message: media: Support hosting mojo CDM in a standalone service Currently when mojo CDM is ...
1
4,098
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 mov_write_avcc_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = avio_tell(pb); avio_wb32(pb, 0); ffio_wfourcc(pb, "avcC"); ff_isom_write_avcc(pb, track->vos_data, track->vos_len); return update_size(pb, pos); } Commit Message: avformat/movenc: Write version 2 of audio atom if...
0
16,541
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 ptrace_request(struct task_struct *child, long request, unsigned long addr, unsigned long data) { bool seized = child->ptrace & PT_SEIZED; int ret = -EIO; siginfo_t siginfo, *si; void __user *datavp = (void __user *) data; unsigned long __user *datalp = datavp; unsigned long flags; switch (reques...
0
3,087
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 GLES2DecoderImpl::WasContextLost() const { return context_was_lost_; } Commit Message: Add GL_PROGRAM_COMPLETION_QUERY_CHROMIUM This makes the query of GL_COMPLETION_STATUS_KHR to programs much cheaper by minimizing the round-trip to the GPU thread. Bug: 881152, 957001 Change-Id: Iadfa798af29225e752c710...
0
20,713
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 DevToolsSession::SendResponse( std::unique_ptr<base::DictionaryValue> response) { std::string json; base::JSONWriter::Write(*response.get(), &json); client_->DispatchProtocolMessage(agent_host_, json); } Commit Message: DevTools: speculative fix for crash in NetworkHandler::Disable This keeps Bro...
0
26,685
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: PageLoadType GetPageLoadType(ui::PageTransition transition) { if (transition & ui::PAGE_TRANSITION_FORWARD_BACK) { return LOAD_TYPE_FORWARD_BACK; } if (ui::PageTransitionCoreTypeIs(transition, ui::PAGE_TRANSITION_RELOAD)) { return LOAD_TYPE_RELOAD; } if (ui::PageTransitionIsNewNavigation(transit...
0
13,217
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: authentic_pin_verify(struct sc_card *card, struct sc_pin_cmd_data *pin_cmd) { struct sc_context *ctx = card->ctx; struct authentic_private_data *prv_data = (struct authentic_private_data *) card->drv_data; unsigned char pin_sha1[SHA_DIGEST_LENGTH]; int rv; LOG_FUNC_CALLED(ctx); sc_log(ctx, "PIN(type:%X,ref...
0
16,103
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: PHPAPI struct lconv *localeconv_r(struct lconv *out) { struct lconv *res; # ifdef ZTS tsrm_mutex_lock( locale_mutex ); # endif /* cur->locinfo is struct __crt_locale_info which implementation is hidden in vc14. TODO revisit this and check if a workaround available and needed. */ #if defined(PHP_WIN32) && _...
0
26,376
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: trace_options_core_write(struct file *filp, const char __user *ubuf, size_t cnt, loff_t *ppos) { void *tr_index = filp->private_data; struct trace_array *tr; unsigned int index; unsigned long val; int ret; get_tr_index(tr_index, &tr, &index); ret = kstrtoul_from_user(ubuf, cnt, 10, &val); if (ret) ...
0
10,601
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 Document::clearStyleResolver() { m_styleResolver.clear(); } Commit Message: Refactoring: Move m_mayDisplaySeamlesslyWithParent down to Document The member is used only in Document, thus no reason to stay in SecurityContext. TEST=none BUG=none R=haraken@chromium.org, abarth, haraken, hayato Review URL...
0
18,398
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 ext4_orphan_del(handle_t *handle, struct inode *inode) { struct list_head *prev; struct ext4_inode_info *ei = EXT4_I(inode); struct ext4_sb_info *sbi; __u32 ino_next; struct ext4_iloc iloc; int err = 0; if (!EXT4_SB(inode->i_sb)->s_journal) return 0; mutex_lock(&EXT4_SB(inode->i_sb)->s_orpha...
1
20,528
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: rdp_in_present(STREAM s, uint32 * present, uint8 flags, int size) { uint8 bits; int i; if (flags & RDP_ORDER_SMALL) { size--; } if (flags & RDP_ORDER_TINY) { if (size < 2) size = 0; else size -= 2; } *present = 0; for (i = 0; i < size; i++) { in_uint8(s, bits); *present |= bits << (i...
0
13,195
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 PreconnectManager::FinishPreresolveJob(PreresolveJobId job_id, bool success) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); PreresolveJob* job = preresolve_jobs_.Lookup(job_id); DCHECK(job); bool need_preconnect = success && job->need_preconnect(); i...
1
25,511
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 DevToolsWindow::OpenDevToolsWindow( scoped_refptr<content::DevToolsAgentHost> agent_host, Profile* profile) { if (!profile) profile = Profile::FromBrowserContext(agent_host->GetBrowserContext()); if (!profile) return; std::string type = agent_host->GetType(); bool is_worker = type =...
0
28,560
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 inotify_find_inode(const char __user *dirname, struct path *path, unsigned flags) { int error; error = user_path_at(AT_FDCWD, dirname, flags, path); if (error) return error; /* you can only watch an inode if you have read permissions on it */ error = inode_permission(path->dentry->d_inode, MAY_...
0
12,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: int copy_xattrs(const char *source, const char *dest) { ssize_t list_len, name_len; size_t datum_len; char *name, *ptr; #ifdef HAVE_LINUX_XATTRS int user_only = am_sender ? 0 : am_root <= 0; #endif /* This puts the name list into the "namebuf" buffer. */ if ((list_len = get_xattr_names(source)) < 0) retu...
0
15,790
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: irc_server_alloc (const char *name) { struct t_irc_server *new_server; int i, length; char *option_name; if (irc_server_search (name)) return NULL; /* alloc memory for new server */ new_server = malloc (sizeof (*new_server)); if (!new_server) { weechat_pri...
0
8,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: SessionCrashedInfoBarDelegate::SessionCrashedInfoBarDelegate( Profile* profile, InfoBarTabHelper* infobar_helper) : ConfirmInfoBarDelegate(infobar_helper), profile_(profile) { } Commit Message: chromeos: Move audio, power, and UI files into subdirs. This moves more files from chrome/browser/ch...
0
10,849
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 BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) { int i, j, bits, ret = 0, wstart, wend, window, wvalue; int start = 1; BIGNUM *d, *r; const BIGNUM *aa; /* Table of variables obtained from 'ctx' */ BI...
0
12,307
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 legitimize_mnt(struct vfsmount *bastard, unsigned seq) { int res = __legitimize_mnt(bastard, seq); if (likely(!res)) return true; if (unlikely(res < 0)) { rcu_read_unlock(); mntput(bastard); rcu_read_lock(); } return false; } Commit Message: mnt: Add a per mount namespace limit on the number of...
0
23,619
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 in_dump(const struct audio_stream *stream, int fd) { (void)stream; (void)fd; return 0; } Commit Message: Fix audio record pre-processing proc_buf_out consistently initialized. intermediate scratch buffers consistently initialized. prevent read failure from overwriting memory. Test: POC, CTS, cam...
0
4,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: bool can_do_mlock(void) { if (rlimit(RLIMIT_MEMLOCK) != 0) return true; if (capable(CAP_IPC_LOCK)) return true; return false; } Commit Message: mlock: fix mlock count can not decrease in race condition Kefeng reported that when running the follow test, the mlock count in meminfo will increase permanently...
0
23,896
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 entropy_decode_stereo_3860(APEContext *ctx, int blockstodecode) { int32_t *decoded0 = ctx->decoded[0]; int32_t *decoded1 = ctx->decoded[1]; int blocks = blockstodecode; while (blockstodecode--) *decoded0++ = ape_decode_value_3860(ctx, &ctx->gb, &ctx->riceY); while (blocks-...
0
19,938
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 IndexedDBDispatcher::RequestIDBDatabaseClose(int32 idb_database_id) { ResetCursorPrefetchCaches(); Send(new IndexedDBHostMsg_DatabaseClose(idb_database_id)); pending_database_callbacks_.Remove(idb_database_id); } Commit Message: Add DCHECK to ensure IndexedDBDispatcher doesn't get re-created. This co...
0
3,435
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: _tls_tl_close_sockinfo (struct _tls_stream *sockinfo) { if (sockinfo->socket > 0) { if (sockinfo->ssl_conn != NULL) { SSL_shutdown (sockinfo->ssl_conn); SSL_shutdown (sockinfo->ssl_conn); SSL_free (sockinfo->ssl_conn); } if (sockinfo->ssl_ctx != NULL) SSL_CTX_free (sockinfo->...
0
29,499
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: blink::WebMediaPlayer* RenderFrameImpl::createMediaPlayer( blink::WebLocalFrame* frame, const blink::WebURL& url, blink::WebMediaPlayerClient* client) { WebMediaPlayer* player = CreateWebMediaPlayerForMediaStream(url, client); if (player) return player; #if defined(OS_ANDROID) return Create...
0
16,497
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 push() { if (m_pushedStyleResolver) return; m_pushedStyleResolver = m_parent->document()->styleResolver(); m_pushedStyleResolver->pushParentElement(m_parent); } Commit Message: Set Attr.ownerDocument in Element#setAttributeNode() Attr objects can move across ...
0
9,747
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 char* malloc_readlink(const char *linkname) { char buf[PATH_MAX + 1]; int len; len = readlink(linkname, buf, sizeof(buf)-1); if (len >= 0) { buf[len] = '\0'; return xstrdup(buf); } return NULL; } Commit Message: ccpp: stop reading hs_error.log from /tmp The fi...
0
12,032
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: rdpTransport* transport_new(rdpSettings* settings) { rdpTransport* transport; transport = (rdpTransport*) malloc(sizeof(rdpTransport)); if (transport != NULL) { ZeroMemory(transport, sizeof(rdpTransport)); transport->TcpIn = tcp_new(settings); transport->settings = settings; /* a small 0.1ms dela...
0
20,214
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: LRESULT CALLBACK rpng2_win_wndproc(HWND hwnd, UINT iMsg, WPARAM wP, LPARAM lP) { HDC hdc; PAINTSTRUCT ps; int rc; switch (iMsg) { case WM_CREATE: /* one-time processing here, if any */ return 0; case WM_PAINT: hdc = BeginPaint(hwnd, &ps); rc = StretchDIBits(hdc, 0, ...
0
6,753
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: virDomainSetTime(virDomainPtr dom, long long seconds, unsigned int nseconds, unsigned int flags) { VIR_DOMAIN_DEBUG(dom, "seconds=%lld, nseconds=%u, flags=%x", seconds, nseconds, flags); virResetLastError(); virCheckDomainReturn...
0
29,067
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 ahci_cmd_done(IDEDMA *dma) { AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma); DPRINTF(ad->port_no, "cmd done\n"); /* update d2h status */ ahci_write_fis_d2h(ad); if (!ad->check_bh) { /* maybe we still have something to process, check later */ ad->check_bh = qemu...
0
11,716
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 DocumentThreadableLoader::loadResourceSynchronously(Document& document, const ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoaderOptions& options, const ResourceLoaderOptions& resourceLoaderOptions) { OwnPtr<DocumentThreadableLoader> loader = adoptPtr(new DocumentThreadableLo...
0
21,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: PHP_FUNCTION(imagetypes) { int ret=0; #ifdef HAVE_GD_GIF_CREATE ret = 1; #endif #ifdef HAVE_GD_JPG ret |= 2; #endif #ifdef HAVE_GD_PNG ret |= 4; #endif #ifdef HAVE_GD_WBMP ret |= 8; #endif #if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED) ret |= 16; #endif if (zend_parse_parameters_none() == FAILURE) {...
0
21,061
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 gdImageJpegCtx (gdImagePtr im, gdIOCtx * outfile, int quality) { struct jpeg_compress_struct cinfo; struct jpeg_error_mgr jerr; int i, j, jidx; /* volatile so we can gdFree it on return from longjmp */ volatile JSAMPROW row = 0; JSAMPROW rowptr[1]; jmpbuf_wrapper jmpbufw; JDIMENSION nlines; char...
1
15,243
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: explicit FakeDownloadItem() : state_(IN_PROGRESS) { } Commit Message: Fix OS_MACOS typos. Should be OS_MACOSX. BUG=163208 TEST=none Review URL: https://codereview.chromium.org/12829005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189130 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-264
0
2,465
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 regulator_register_notifier(struct regulator *regulator, struct notifier_block *nb) { return blocking_notifier_chain_register(&regulator->rdev->notifier, nb); } Commit Message: regulator: core: Fix regualtor_ena_gpio_free not to access pin after freeing After freeing pin from regulator_ena_g...
0
13,633
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: grub_disk_adjust_range (grub_disk_t disk, grub_disk_addr_t *sector, grub_off_t *offset, grub_size_t size) { *sector += *offset >> GRUB_DISK_SECTOR_BITS; *offset &= GRUB_DISK_SECTOR_SIZE - 1; /* grub_partition_t part; for (part = disk->partition; part; part = part->parent) { grub_disk_addr_t s...
0
15,210
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: BSON_ASSERT_BSON_EQUAL_FILE (const bson_t *b, const char *filename) { bson_t *b2 = get_bson (filename); BSON_ASSERT_BSON_EQUAL (b, b2); bson_destroy (b2); } Commit Message: Fix for CVE-2018-16790 -- Verify bounds before binary length read. As reported here: https://jira.mongodb.org/browse/CDRIVER-2819,...
0
2,221
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: WebUIBindings* RenderView::GetWebUIBindings() { if (!web_ui_bindings_.get()) { web_ui_bindings_.reset(new WebUIBindings()); } return web_ui_bindings_.get(); } Commit Message: DevTools: move DevToolsAgent/Client into content. BUG=84078 TEST= Review URL: http://codereview.chromium.org/7461019 git-svn-...
0
28,586
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 *skcipher_bind(const char *name, u32 type, u32 mask) { return crypto_alloc_skcipher(name, type, mask); } Commit Message: crypto: algif_skcipher - Require setkey before accept(2) Some cipher implementations will crash if you try to use them without calling setkey first. This patch adds a check s...
1
23,603
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 tls1_set_ec_id(unsigned char *curve_id, unsigned char *comp_id, EC_KEY *ec) { int is_prime, id; const EC_GROUP *grp; const EC_METHOD *meth; if (!ec) return 0; /* Determine if it is a prime field */ grp = EC_KEY_get0_group(ec); if (!grp) ...
0
15,194
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 usb_xhci_init(XHCIState *xhci) { DeviceState *dev = DEVICE(xhci); XHCIPort *port; int i, usbports, speedmask; xhci->usbsts = USBSTS_HCH; if (xhci->numports_2 > MAXPORTS_2) { xhci->numports_2 = MAXPORTS_2; } if (xhci->numports_3 > MAXPORTS_3) { xhci->numpor...
0
25,076
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 Gfx::drawAnnot(Object *str, AnnotBorder *border, AnnotColor *aColor, double xMin, double yMin, double xMax, double yMax) { Dict *dict, *resDict; Object matrixObj, bboxObj, resObj; Object obj1; double m[6], bbox[4], ictm[6]; double *ctm; double formX0, formY0, formX1, formY1; double annotX...
0
6,539
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: map_components_to_colorants(const frac * pcc, const gs_devicen_color_map * pcolor_component_map, frac * plist) { int i = pcolor_component_map->num_colorants - 1; int pos; /* Clear all output colorants first */ for (; i >= 0; i--) { plist[i] = frac_0; } /* Map color compone...
0
2,646
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 sd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg) { struct gendisk *disk = bdev->bd_disk; struct scsi_disk *sdkp = scsi_disk(disk); struct scsi_device *sdp = sdkp->device; void __user *p = (void __user *)arg; int error; SCSI_LOG_IOCTL(1, sd_printk(...
1
13,815
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 unsigned int index_merge_mode( git_index *index, git_index_entry *existing, unsigned int mode) { if (index->no_symlinks && S_ISREG(mode) && existing && S_ISLNK(existing->mode)) return existing->mode; if (index->distrust_filemode && S_ISREG(mode)) return (existing && S_ISREG(existing->mode)) ? ...
0
6,987
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 GLES2DecoderImpl::CopySubTextureHelper(const char* function_name, GLuint source_id, GLint source_level, GLenum dest_target, GLuint de...
0
26,706
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 set_auto_rts(struct sb_uart_port *port, int status) { int atr_status = 0; #if 0 int efr_status = 0; efr_status = sb1054_get_register(port, PAGE_3, SB105X_EFR); if(status == ENABLE) efr_status |= SB105X_EFR_ARTS; else efr_status &= ~SB105X_EFR_ARTS; sb1054_set_register(port,PAGE_3,SB105X_EFR...
0
655
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 RenderWidgetHostViewAura::SetHasHorizontalScrollbar( bool has_horizontal_scrollbar) { } Commit Message: Implement TextureImageTransportSurface using texture mailbox This has a couple of advantages: - allow tearing down and recreating the UI parent context without losing the renderer contexts - do not r...
0
23,308
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 WebRuntimeFeatures::EnableOrientationEvent(bool enable) { RuntimeEnabledFeatures::SetOrientationEventEnabled(enable); } Commit Message: Remove RequireCSSExtensionForFile runtime enabled flag. The feature has long since been stable (since M64) and doesn't seem to be a need for this flag. BUG=788936 Chan...
0
277
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 put_ctx(struct perf_event_context *ctx) { if (atomic_dec_and_test(&ctx->refcount)) { if (ctx->parent_ctx) put_ctx(ctx->parent_ctx); if (ctx->task) put_task_struct(ctx->task); kfree_rcu(ctx, rcu_head); } } Commit Message: perf: Fix event->ctx locking There have been a few reported iss...
0
24,850
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 CameraSource::ProxyListener::dataCallbackTimestamp( nsecs_t timestamp, int32_t msgType, const sp<IMemory>& dataPtr) { mSource->dataCallbackTimestamp(timestamp / 1000, msgType, dataPtr); } Commit Message: DO NOT MERGE: Camera: Adjust pointers to ANW buffers to avoid infoleak Subtract address of a rando...
0
6,178
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 btrfs_readpage(struct file *file, struct page *page) { struct extent_io_tree *tree; tree = &BTRFS_I(page->mapping->host)->io_tree; return extent_read_full_page(tree, page, btrfs_get_extent, 0); } Commit Message: Btrfs: fix hash overflow handling The handling for directory crc hash overflows was fairly ob...
0
784
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 nl80211_valid_cipher_suite(u32 cipher) { return cipher == WLAN_CIPHER_SUITE_WEP40 || cipher == WLAN_CIPHER_SUITE_WEP104 || cipher == WLAN_CIPHER_SUITE_TKIP || cipher == WLAN_CIPHER_SUITE_CCMP || cipher == WLAN_CIPHER_SUITE_AES_CMAC; } Commit Message: nl80211: fix check for valid SSID size in...
0
20,036
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 CopyDoubleToObjectElements(FixedArrayBase* from_base, uint32_t from_start, FixedArrayBase* to_base, uint32_t to_start, int raw_copy_size) { int copy_size = raw_copy_size; if (raw_copy_size < 0) { DisallowHeapAllocation no_allocation; DCHECK(raw_copy_size == ElementsAccessor::kCopyToEnd || ...
0
22,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 void encrypt_callback(void *priv, u8 *srcdst, unsigned int nbytes) { const unsigned int bsize = SERPENT_BLOCK_SIZE; struct crypt_priv *ctx = priv; int i; ctx->fpu_enabled = serpent_fpu_begin(ctx->fpu_enabled, nbytes); if (nbytes == bsize * SERPENT_PARALLEL_BLOCKS) { serpent_enc_blk_xway(ctx->ctx, ...
0
23,954
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 RenderViewImpl::DidFocus(blink::WebLocalFrame* calling_frame) { if (WebUserGestureIndicator::IsProcessingUserGesture(calling_frame) && !RenderThreadImpl::current()->layout_test_mode()) { Send(new ViewHostMsg_Focus(GetRoutingID())); RenderFrameImpl* calling_render_frame = RenderFrameI...
0
18,270
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 PDFiumEngine::OnKeyUp(const pp::KeyboardInputEvent& event) { if (last_page_mouse_down_ == -1) return false; return !!FORM_OnKeyUp( form_, pages_[last_page_mouse_down_]->GetPage(), event.GetKeyCode(), event.GetModifiers()); } Commit Message: [pdf] Defer page unloading in JS callback. On...
0
16,377
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: kuid_t sock_i_uid(struct sock *sk) { kuid_t uid; read_lock_bh(&sk->sk_callback_lock); uid = sk->sk_socket ? SOCK_INODE(sk->sk_socket)->i_uid : GLOBAL_ROOT_UID; read_unlock_bh(&sk->sk_callback_lock); return uid; } Commit Message: net: avoid signed overflows for SO_{SND|RCV}BUFFORCE CAP_NET_ADMIN users shou...
0
18,182
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: MediaQueryMatcher* Document::mediaQueryMatcher() { if (!m_mediaQueryMatcher) m_mediaQueryMatcher = MediaQueryMatcher::create(this); return m_mediaQueryMatcher.get(); } Commit Message: Refactoring: Move m_mayDisplaySeamlesslyWithParent down to Document The member is used only in Document, thus no...
0
4,668
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 kiocb_batch_init(struct kiocb_batch *batch, long total) { INIT_LIST_HEAD(&batch->head); batch->count = total; } Commit Message: Unused iocbs in a batch should not be accounted as active. commit 69e4747ee9727d660b88d7e1efe0f4afcb35db1b upstream. Since commit 080d676de095 ("aio: allocate kiocbs i...
0
24,824
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: INST_HANDLER (inc) { // INC Rd int d = ((buf[0] >> 4) & 0xf) | ((buf[1] & 0x1) << 4); ESIL_A ("1,r%d,+,", d); // ++Rd ESIL_A ("0,RPICK,0x80,==,vf,=,"); // V ESIL_A ("0,RPICK,0x80,&,!,!,nf,=,"); // N ESIL_A ("0,RPICK,!,zf,=,"); // Z ESIL_A ("vf,nf,^,sf,=,"); // S ESIL_A ("r%d,=,", d); // R...
0
22,203
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 ahci_start_transfer(IDEDMA *dma) { AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma); IDEState *s = &ad->port.ifs[0]; uint32_t size = (uint32_t)(s->data_end - s->data_ptr); /* write == ram -> device */ uint32_t opts = le32_to_cpu(ad->cur_cmd->opts); int is_write = opts & AHCI_CMD...
0
12,732
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: PermissionsBubbleDialogDelegateView::PermissionsBubbleDialogDelegateView( PermissionPromptImpl* owner, const std::vector<PermissionRequest*>& requests) : owner_(owner), persist_checkbox_(nullptr) { DCHECK(!requests.empty()); set_close_on_deactivate(false); set_arrow(kPermissionAnchorArrow); #i...
0
824
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 encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg *readdir, struct rpc_rqst *req) { uint32_t attrs[2] = { FATTR4_WORD0_RDATTR_ERROR|FATTR4_WORD0_FILEID, FATTR4_WORD1_MOUNTED_ON_FILEID, }; __be32 *p; RESERVE_SPACE(12+NFS4_VERIFIER_SIZE+20); WRITE32(OP_READDIR); WRITE64(read...
0
11,765
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 PasswordAutofillAgent::TextDidChangeInTextField( const blink::WebInputElement& element) { blink::WebInputElement mutable_element = element; // We need a non-const. mutable_element.setAutofilled(false); WebInputToPasswordInfoMap::iterator iter = web_input_to_password_info_.find(element); i...
0
25,218
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 __cleanup_sighand(struct sighand_struct *sighand) { if (atomic_dec_and_test(&sighand->count)) { signalfd_cleanup(sighand); /* * sighand_cachep is SLAB_TYPESAFE_BY_RCU so we can free it * without an RCU grace period, see __lock_task_sighand(). */ kmem_cache_free(sighand_cachep, sighand); } } ...
0
1,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: PHP_FUNCTION(mkdir) { char *dir; int dir_len; zval *zcontext = NULL; long mode = 0777; zend_bool recursive = 0; php_stream_context *context; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|lbr", &dir, &dir_len, &mode, &recursive, &zcontext) == FAILURE) { RETURN_FALSE; } context = php_stream_c...
0
14,298
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 br_multicast_port_group_query_expired(unsigned long data) { struct net_bridge_port_group *pg = (void *)data; struct net_bridge_port *port = pg->port; struct net_bridge *br = port->br; spin_lock(&br->multicast_lock); if (!netif_running(br->dev) || hlist_unhashed(&pg->mglist) || pg->queries_s...
0
18,020
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 snd_compr_open(struct inode *inode, struct file *f) { struct snd_compr *compr; struct snd_compr_file *data; struct snd_compr_runtime *runtime; enum snd_compr_direction dirn; int maj = imajor(inode); int ret; if ((f->f_flags & O_ACCMODE) == O_WRONLY) dirn = SND_COMPRESS_PLAYBACK; else if ((f-...
0
6,923
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: std::string MakeMediaAccessRequest(int index) { const int render_process_id = 1; const int render_frame_id = 1; const int page_request_id = 1; const url::Origin security_origin; MediaStreamManager::MediaAccessRequestCallback callback = base::BindOnce(&MediaStreamManagerTest::R...
1
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: static void withScriptStateAttributeRaisesAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) { TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); TestObjectV8Internal::withScriptStateAttributeRaisesAttributeSetter(jsValue, info); ...
0
15,332