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: PHP_METHOD(Phar, running) { char *fname, *arch, *entry; int fname_len, arch_len, entry_len; zend_bool retphar = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &retphar) == FAILURE) { return; } fname = (char*)zend_get_executed_filename(TSRMLS_C); fname_len = strlen(fname); if (fname_len...
0
4,351
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 UDPSocketWin::AllowBroadcast() { DCHECK(CalledOnValidThread()); DCHECK(!is_connected()); socket_options_ |= SOCKET_OPTION_BROADCAST; } Commit Message: Map posix error codes in bind better, and fix one windows mapping. r=wtc BUG=330233 Review URL: https://codereview.chromium.org/101193008 git-svn-...
0
113,432
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_stream_display(jas_stream_t *stream, FILE *fp, int n) { unsigned char buf[16]; int i; int j; int m; int c; int display; int cnt; cnt = n - (n % 16); display = 1; for (i = 0; i < n; i += 16) { if (n > 16 && i > 0) { display = (i >= cnt) ? 1 : 0; } if (display) { fprintf(fp, "%08x:",...
0
72,793
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 comps_objmrtree_unset(COMPS_ObjMRTree * rt, const char * key) { COMPS_HSList * subnodes; COMPS_HSListItem * it; COMPS_ObjMRTreeData * rtdata; unsigned int offset, len, x; char found, ended; COMPS_HSList * path; struct Relation { COMPS_HSList * parent_nodes; COMPS_...
0
91,779
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 PaintPropertyTreeBuilderTest::LoadTestData(const char* file_name) { String full_path = test::BlinkRootDir(); full_path.append("/renderer/core/paint/test_data/"); full_path.append(file_name); const Vector<char> input_buffer = test::ReadFromFile(full_path)->Copy(); SetBodyInnerHTML(String(input_buffe...
0
125,482
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 ChromeContentBrowserClient::GetStoragePartitionConfigForSite( content::BrowserContext* browser_context, const GURL& site, bool can_be_default, std::string* partition_domain, std::string* partition_name, bool* in_memory) { partition_domain->clear(); partition_name->clear(); *in_m...
0
142,678
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: PluginModule* ResourceTracker::GetModule(PP_Module module) { DLOG_IF(ERROR, !CheckIdType(module, PP_ID_TYPE_MODULE)) << module << " is not a PP_Module."; ModuleMap::iterator found = module_map_.find(module); if (found == module_map_.end()) return NULL; return found->second; } Commit Message: Ma...
0
100,058
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: PPB_Widget_Impl* PPB_Widget_Impl::AsPPB_Widget_Impl() { return this; } Commit Message: Maintain a map of all resources in the resource tracker and clear instance back pointers when needed, BUG=85808 Review URL: http://codereview.chromium.org/7196001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89746 0...
0
100,034
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 atl2_intr_tx(struct atl2_adapter *adapter) { struct net_device *netdev = adapter->netdev; u32 txd_read_ptr; u32 txs_write_ptr; struct tx_pkt_status *txs; struct tx_pkt_header *txph; int free_hole = 0; do { txs_write_ptr = (u32) atomic_read(&adapter->txs_write_ptr); txs = adapter->txs_ring ...
0
55,313
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 dev_ifconf(struct net *net, char __user *arg) { struct ifconf ifc; struct net_device *dev; char __user *pos; int len; int total; int i; /* * Fetch the caller's info block. */ if (copy_from_user(&ifc, arg, sizeof(struct ifconf))) return -EFAULT; pos = ifc.ifc_buf; len = ifc.ifc_len; ...
0
32,120
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 void rb_event_discard(struct ring_buffer_event *event) { if (event->type_len == RINGBUF_TYPE_TIME_EXTEND) event = skip_time_extend(event); /* array[0] holds the actual length for the discarded event */ event->array[0] = rb_event_data_length(event) - RB_EVNT_HDR_SIZE; event->type_len = RINGBUF...
0
72,530
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: selftest_fips_192 (int extended, selftest_report_func_t report) { const char *what; const char *errtxt; (void)extended; /* No extended tests available. */ what = "low-level"; errtxt = selftest_basic_192 (); if (errtxt) goto failed; return 0; /* Succeeded. */ failed: if (report) repo...
0
96,777
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 ReleaseProcessIfNeeded() { content::UtilityThread::Get()->ReleaseProcessIfNeeded(); } Commit Message: Add the SandboxedDMGParser and wire it up to the DownloadProtectionService. BUG=496898,464083 R=isherman@chromium.org, kenrb@chromium.org, mattm@chromium.org, thestig@chromium.org Review URL: https://co...
0
123,779
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 QuicTransportHost::OnRemoteStopped() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); stream_hosts_.clear(); PostCrossThreadTask( *proxy_thread(), FROM_HERE, CrossThreadBind(&QuicTransportProxy::OnRemoteStopped, proxy_)); } Commit Message: P2PQuicStream write functionality. This adds the...
0
132,783
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: dns_stricmp(const char* str1, const char* str2) { char c1, c2; *----------------------------------------------------------------------------*/ /* DNS variables */ static struct udp_pcb *dns_pcb; static u8_t dns_seqno; static struct dns_table_entry dns_table[DNS_TABLE_SIZE]; stat...
1
165,048
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 get_debug_info(struct PE_(r_bin_pe_obj_t)* bin, PE_(image_debug_directory_entry)* dbg_dir_entry, ut8* dbg_data, int dbg_data_len, SDebugInfo* res) { #define SIZEOF_FILE_NAME 255 int i = 0; const char* basename; if (!dbg_data) { return 0; } switch (dbg_dir_entry->Type) { case IMAGE_DEBUG_TYPE_...
1
169,228
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: fm_mgr_config_get_error_map ( IN p_fm_config_conx_hdlt hdl, OUT fm_error_map_t *error_map ) { if(error_map){ memcpy(error_map,&hdl->error_map,sizeof(fm_error_map_t)); return FM_CONF_OK; } return FM_CONF_ERROR; } Commit Message: Fix scripts and code that use well-known tmp files. CWE ID: CWE-362
0
96,239
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: AppCacheDispatcherHost::AppCacheDispatcherHost( ChromeAppCacheService* appcache_service, int process_id) : BrowserMessageFilter(AppCacheMsgStart), appcache_service_(appcache_service), frontend_proxy_(this), process_id_(process_id) { } Commit Message: AppCache: Use WeakPtr<> to f...
1
171,744
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 proc_dointvec_ms_jiffies(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { return -ENOSYS; } Commit Message: sysctl: restrict write access to dmesg_restrict When dmesg_restrict is set to 1 CAP_SYS_ADMIN is needed to read the kernel ring buffer. But a root user ...
0
24,428
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 ChromeClientImpl::show(NavigationPolicy navigationPolicy) { if (!m_webView->client()) return; WebNavigationPolicy policy = static_cast<WebNavigationPolicy>(navigationPolicy); if (policy == WebNavigationPolicyIgnore) policy = getNavigationPolicy(); m_webView->client()->show(po...
0
118,667
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 abort_connection(struct iwch_ep *ep, struct sk_buff *skb, gfp_t gfp) { PDBG("%s ep %p\n", __FILE__, ep); state_set(&ep->com, ABORTING); send_abort(ep, skb, gfp); } Commit Message: iw_cxgb3: Fix incorrectly returning error on success The cxgb3_*_send() functions return NET_XMIT_ values, which are ...
0
56,847
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: uint32_t smb2cli_conn_cc_max_chunks(struct smbXcli_conn *conn) { return conn->smb2.cc_max_chunks; } Commit Message: CWE ID: CWE-20
0
2,429
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: WebRunnerBrowserMainParts::~WebRunnerBrowserMainParts() { display::Screen::SetScreenInstance(nullptr); } Commit Message: [fuchsia] Implement browser tests for WebRunner Context service. Tests may interact with the WebRunner FIDL services and the underlying browser objects for end to end testing of service and...
0
131,236
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 u8 bs_selector(int block_size) { switch (block_size) { case 512: return 0x1; case 520: return 0x2; case 4096: return 0x3; case 4160: return 0x4; case 1073741824: return 0x5; default: return 0; } } Commit Message: IB/mlx5: Fix leaking stack memory to userspace mlx5_ib_create...
0
92,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: PanoramiXRenderSetPictureFilter(ClientPtr client) { REQUEST(xRenderSetPictureFilterReq); int result = Success, j; PanoramiXRes *pict; REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq); VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess); FOR_NSCREENS_BACKWARD(j) { s...
0
17,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: int vrend_create_surface(struct vrend_context *ctx, uint32_t handle, uint32_t res_handle, uint32_t format, uint32_t val0, uint32_t val1) { struct vrend_surface *surf; struct vrend_resource *res; uint32_t ret_handle; if (format...
0
8,836
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_mkdir(struct inode *dir, struct dentry *dentry, struct iattr *sattr) { struct nfs4_createdata *data; int status = -ENOMEM; data = nfs4_alloc_createdata(dir, &dentry->d_name, sattr, NF4DIR); if (data == NULL) goto out; status = nfs4_do_create(dir, dentry, data); nfs4_free_created...
0
19,826
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: ~BrowserOpenedWithNewProfileNotificationObserver() { } Commit Message: Remove TabContents from TabStripModelObserver::TabDetachedAt. BUG=107201 TEST=no visible change Review URL: https://chromiumcodereview.appspot.com/11293205 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167122 0039d316-1c4b-4281-...
0
117,666
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: find_confirmed_client_by_name(struct xdr_netobj *name, struct nfsd_net *nn) { lockdep_assert_held(&nn->client_lock); return find_clp_in_name_tree(name, &nn->conf_name_tree); } Commit Message: Merge tag 'nfsd-4.12' of git://linux-nfs.org/~bfields/linux Pull nfsd updates from Bruce Fields: "Another RDMA update...
0
65,446
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 tun_get_iff(struct net *net, struct tun_struct *tun, struct ifreq *ifr) { tun_debug(KERN_INFO, tun, "tun_get_iff\n"); strcpy(ifr->ifr_name, tun->dev->name); ifr->ifr_flags = tun_flags(tun); } Commit Message: tun: call dev_get_valid_name() before register_netdevice() register_netdevice...
0
93,294
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::EnableAllowActivationDelegationAttr(bool enable) { RuntimeEnabledFeatures::SetAllowActivationDelegationAttrEnabled(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 th...
0
154,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: void bio_put(struct bio *bio) { if (!bio_flagged(bio, BIO_REFFED)) bio_free(bio); else { BIO_BUG_ON(!atomic_read(&bio->__bi_cnt)); /* * last put frees it */ if (atomic_dec_and_test(&bio->__bi_cnt)) bio_free(bio); } } Commit Message: fix unbalanced page refcounting in bio_map_user_iov bio_ma...
0
62,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: void RenderFrameDevToolsAgentHost::WasHidden() { #if defined(OS_ANDROID) GetWakeLock()->CancelWakeLock(); #endif } Commit Message: DevTools: speculative fix for crash in NetworkHandler::Disable This keeps BrowserContext* and StoragePartition* instead of RenderProcessHost* in an attemp to resolve UAF of Render...
0
148,707
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 WaitForExtensionViewsToLoad() { content::NotificationRegistrar registrar; registrar.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, content::NotificationService::AllSources()); base::CancelableClosure timeout( base::Bind(&TimeoutCallback, "Extension ho...
0
113,111
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: size_t ContentLayerCount() { return paint_artifact_compositor_->GetExtraDataForTesting() ->content_layers.size(); } Commit Message: Reland "[CI] Make paint property nodes non-ref-counted" This reverts commit 887383b30842d9d9006e11bb6932660a3cb5b1b7. Reason for revert: Retry in M69. Original ch...
0
125,547
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 free_playlist_list(HLSContext *c) { int i; for (i = 0; i < c->n_playlists; i++) { struct playlist *pls = c->playlists[i]; free_segment_list(pls); free_init_section_list(pls); av_freep(&pls->main_streams); av_freep(&pls->renditions); av_freep(&pls...
0
61,787
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); call_rcu(&ctx->rcu_head, free_ctx); } } Commit Message: perf: Fix race in swevent hash There's a race on CPU un...
0
56,144
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: do_local_notify(xmlNode * notify_src, const char *client_id, gboolean sync_reply, gboolean from_peer) { /* send callback to originating child */ cib_client_t *client_obj = NULL; int local_rc = pcmk_ok; if (client_id != NULL) { client_obj = g_hash_table_lookup(client_list, ...
1
166,145
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 vmw_legacy_srf_dma(struct vmw_resource *res, struct ttm_validate_buffer *val_buf, bool bind) { SVGAGuestPtr ptr; struct vmw_fence_obj *fence; uint32_t submit_size; struct vmw_surface *srf = vmw_res_to_srf(res); uint8_t *cmd; struct vmw_private *dev_priv = res->dev_priv; BUG_ON...
0
64,384
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 parse_sliteral(char **c, char **dst) { struct token t; char *s = *c; get_token(c, &t, L_SLITERAL); if (t.type != T_STRING) { printf("Expected string literal: %.*s\n", (int)(*c - s), s); return -EINVAL; } *dst = t.val; return 1; } Commit Message: Merge branch '2020-01-22-master-imports' ...
0
89,352
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: JsVarRef jsvGetPrevSibling(const JsVar *v) { return (JsVarRef)(v->varData.ref.prevSibling | (((v->varData.ref.pack >> (JSVARREF_PACKED_BITS*3))&JSVARREF_PACKED_BIT_MASK))<<8); } Commit Message: fix jsvGetString regression CWE ID: CWE-119
0
82,439
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 SafeSock::get_ptr(void *&ptr, char delim) { int size; while(!_msgReady) { if(_timeout > 0) { Selector selector; selector.set_timeout( _timeout ); selector.add_fd( _sock, Selector::IO_READ ); selector.execute(); if ( selector.timed_out() ) { return 0; } else if ( !selector.has_r...
0
16,280
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 AddAndroidAppStrings(content::WebUIDataSource* html_source) { LocalizedString localized_strings[] = { {"androidAppsPageTitle", arc::IsPlayStoreAvailable() ? IDS_SETTINGS_ANDROID_APPS_TITLE : IDS_SETTINGS_ANDROID_SETTINGS_TITLE}, ...
0
148,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: void WebPluginProxy::WillDestroyWindow(gfx::PluginWindowHandle window) { #if defined(OS_WIN) PluginThread::current()->Send( new PluginProcessHostMsg_PluginWindowDestroyed( window, ::GetParent(window))); #elif defined(USE_X11) #else NOTIMPLEMENTED(); #endif } Commit Message: Convert plugin and...
0
107,064
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 createCollation( sqlite3* db, const char *zName, u8 enc, void* pCtx, int(*xCompare)(void*,int,const void*,int,const void*), void(*xDel)(void*) ){ CollSeq *pColl; int enc2; assert( sqlite3_mutex_held(db->mutex) ); /* If SQLITE_UTF16 is specified as the encoding type, transform t...
0
136,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: bits_image_fetch_pixel_filtered (bits_image_t *image, pixman_fixed_t x, pixman_fixed_t y, get_pixel_t get_pixel) { switch (image->common.filter) { case PIXMAN_FILTER_NEAREST: case PIXMAN_FILTER_FAST: return bits_image_fetch_pixel_nearest (image, x, y, get_pixel); break; ca...
0
15,430
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 FakeCentral::SimulateGATTServicesChanged( const std::string& address, SimulateGATTServicesChangedCallback callback) { FakePeripheral* fake_peripheral = GetFakePeripheral(address); if (fake_peripheral == nullptr) { std::move(callback).Run(false); return; } std::move(callback).Run(true...
0
138,251
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 __forceinline void draw_line(float *output, int x0, int y0, int x1, int y1, int n) { int dy = y1 - y0; int adx = x1 - x0; int ady = abs(dy); int base; int x=x0,y=y0; int err = 0; int sy; #ifdef STB_VORBIS_DIVIDE_TABLE if (adx < DIVTAB_DENOM && ady < DIVTAB_NUMER) { if (dy < 0...
1
169,614
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 am_check_url(request_rec *r, const char *url) { const char *i; for (i = url; *i; i++) { if (*i >= 0 && *i < ' ') { /* Deny all control-characters. */ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, HTTP_BAD_REQUEST, r, "Control character detected in URL...
1
169,749
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: string16 ConfirmEmailDialogDelegate::GetLinkText() const { return l10n_util::GetStringUTF16(IDS_LEARN_MORE); } Commit Message: During redirects in the one click sign in flow, check the current URL instead of original URL to validate gaia http headers. BUG=307159 Review URL: https://codereview.chromium.org/77...
0
109,822
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 __fanout_unlink(struct sock *sk, struct packet_sock *po) { struct packet_fanout *f = po->fanout; int i; spin_lock(&f->lock); for (i = 0; i < f->num_members; i++) { if (f->arr[i] == sk) break; } BUG_ON(i >= f->num_members); f->arr[i] = f->arr[f->num_members - 1]; f->num_members--; spin_u...
0
40,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: static inline void clear_soft_dirty_pmd(struct vm_area_struct *vma, unsigned long addr, pmd_t *pmdp) { pmd_t pmd = *pmdp; pmd = pmd_wrprotect(pmd); pmd = pmd_clear_flags(pmd, _PAGE_SOFT_DIRTY); if (vma->vm_flags & VM_SOFTDIRTY) vma->vm_flags &= ~VM_SOFTDIRTY; set_pmd_at(vma->vm_mm, addr, pmdp, pmd); }...
0
55,789
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 Browser::ReplaceRestoredTab( const std::vector<TabNavigation>& navigations, int selected_navigation, bool from_last_session, const std::string& extension_app_id, SessionStorageNamespace* session_storage_namespace) { TabContentsWrapper* wrapper = TabContentsFactory(profile(), NULL, ...
0
98,302
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 int decode_asi(unsigned int insn, struct pt_regs *regs) { if (insn & 0x800000) { if (insn & 0x2000) return (unsigned char)(regs->tstate >> 24); /* %asi */ else return (unsigned char)(insn >> 5); /* imm_asi */ } else return ASI_P; } Commit Message: perf: Remove the nmi parameter from ...
0
25,697
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: donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size, int clazz, int swap, size_t align, int *flags, uint16_t *notecount, int fd, off_t ph_off, int ph_num, off_t fsize) { Elf32_Nhdr nh32; Elf64_Nhdr nh64; size_t noff, doff; uint32_t namesz, descsz; unsigned char *nbuf = CAST(unsigned c...
0
95,072
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: PlatformSensorProviderBase::~PlatformSensorProviderBase() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); } Commit Message: android: Fix sensors in device service. This patch fixes a bug that prevented more than one sensor data to be available at once when using the device motion/orientation API. The issue...
0
148,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: bool IsInBrowserThumbnailingEnabled() { #if defined(OS_LINUX) || defined(OS_CHROMEOS) return true; #else return CommandLine::ForCurrentProcess()->HasSwitch( kEnableInBrowserThumbnailing); #endif } Commit Message: DevTools: move DevToolsAgent/Client into content. BUG=84078 TEST= Review URL: http://cod...
0
98,759
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 writeWepKeyRid(struct airo_info *ai, WepKeyRid *wkr, int perm, int lock) { int rc; rc = PC4500_writerid(ai, RID_WEP_TEMP, wkr, sizeof(*wkr), lock); if (rc!=SUCCESS) airo_print_err(ai->dev->name, "WEP_TEMP set %x", rc); if (perm) { rc = PC4500_writerid(ai, RID_WEP_PERM, wkr, sizeof(*wkr), lock);...
0
24,094
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 v9fs_set_acl(struct p9_fid *fid, int type, struct posix_acl *acl) { int retval; char *name; size_t size; void *buffer; if (!acl) return 0; /* Set a setxattr request to server */ size = posix_acl_xattr_size(acl->a_count); buffer = kmalloc(size, GFP_KERNEL); if (!buffer) return -ENOMEM; re...
0
50,311
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 __noreturn do_exit(long code) { struct task_struct *tsk = current; int group_dead; TASKS_RCU(int tasks_rcu_i); profile_task_exit(tsk); kcov_task_exit(tsk); WARN_ON(blk_needs_flush_plug(tsk)); if (unlikely(in_interrupt())) panic("Aiee, killing interrupt handler!"); if (unlikely(!tsk->pid)) pani...
0
83,249
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: asmlinkage void do_mt(struct pt_regs *regs) { int subcode; subcode = (read_vpe_c0_vpecontrol() & VPECONTROL_EXCPT) >> VPECONTROL_EXCPT_SHIFT; switch (subcode) { case 0: printk(KERN_DEBUG "Thread Underflow\n"); break; case 1: printk(KERN_DEBUG "Thread Overflow\n"); break; case 2: printk(KERN_DE...
0
25,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: static inline int is_loop_device(struct file *file) { struct inode *i = file->f_mapping->host; return i && S_ISBLK(i->i_mode) && MAJOR(i->i_rdev) == LOOP_MAJOR; } Commit Message: loop: fix concurrent lo_open/lo_release 范龙飞 reports that KASAN can report a use-after-free in __lock_acquire. The reason is due to...
0
84,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: virtual bool IsHandledURL(const GURL& url) { return schemes_.find(url.scheme()) != schemes_.end(); } Commit Message: Apply missing kParentDirectory check BUG=161564 Review URL: https://chromiumcodereview.appspot.com/11414046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168692 0039d316-1c4b-4281...
0
102,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: void HTMLInputElement::EndColorChooser() { if (ColorChooserClient* client = input_type_->GetColorChooserClient()) client->DidEndChooser(); } Commit Message: MacViews: Enable secure text input for password Textfields. In Cocoa the NSTextInputContext automatically enables secure text input when activated an...
0
126,019
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 LocalFrame::CreateView(const IntSize& viewport_size, const Color& background_color) { DCHECK(this); DCHECK(GetPage()); bool is_local_root = this->IsLocalRoot(); if (is_local_root && View()) View()->SetParentVisible(false); SetView(nullptr); LocalFrameView* fram...
0
154,822
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 nfs_lseek(struct device_d *dev, FILE *file, loff_t pos) { struct file_priv *priv = file->priv; kfifo_reset(priv->fifo); return 0; } Commit Message: CWE ID: CWE-119
0
1,343
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 bool tun_legacy_is_little_endian(struct tun_struct *tun) { return tun->flags & TUN_VNET_BE ? false : virtio_legacy_is_little_endian(); } Commit Message: tun: call dev_get_valid_name() before register_netdevice() register_netdevice() could fail early when we have an invalid dev name, in which ca...
0
93,304
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 bad_flp_intr(void) { int err_count; if (probing) { DRS->probed_format++; if (!next_valid_format()) return; } err_count = ++(*errors); INFBOUND(DRWE->badness, err_count); if (err_count > DP->max_errors.abort) cont->done(0); if (err_count > DP->max_errors.reset) FDCS->reset = 1; else...
0
39,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: static int conf__parse_bool(char **token, const char *name, bool *value, char *saveptr) { *token = strtok_r(NULL, " ", &saveptr); if(*token){ if(!strcmp(*token, "false") || !strcmp(*token, "0")){ *value = false; }else if(!strcmp(*token, "true") || !strcmp(*token, "1")){ *value = true; }else{ log_...
0
75,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: gfx::Image GetTabAlertIndicatorImage(TabAlertState alert_state, SkColor button_color) { const gfx::VectorIcon* icon = nullptr; switch (alert_state) { case TabAlertState::AUDIO_PLAYING: icon = &kTabAudioIcon; break; case TabAlertState::AUDIO_MUTING: ...
0
126,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 virtio_gpu_object_wait(struct virtio_gpu_object *bo, bool no_wait) { int r; r = ttm_bo_reserve(&bo->tbo, true, no_wait, NULL); if (unlikely(r != 0)) return r; r = ttm_bo_wait(&bo->tbo, true, no_wait); ttm_bo_unreserve(&bo->tbo); return r; } Commit Message: drm/virtio: don't leak bo on drm_gem_object...
0
63,755
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 rds_conn_peer_gen_update(struct rds_connection *conn, u32 peer_gen_num) { int i; struct rds_message *rm, *tmp; unsigned long flags; WARN_ON(conn->c_trans->t_type != RDS_TRANS_TCP); if (peer_gen_num != 0) { if (conn->c_peer_gen_num != 0 && peer_gen_num != conn->c_peer_gen_num) { ...
0
87,818
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: virDomainIsPersistent(virDomainPtr dom) { VIR_DOMAIN_DEBUG(dom); virResetLastError(); virCheckDomainReturn(dom, -1); if (dom->conn->driver->domainIsPersistent) { int ret; ret = dom->conn->driver->domainIsPersistent(dom); if (ret < 0) goto error; retur...
0
93,837
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 opfcmov(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; char* fcmov = op->mnemonic + strlen("fcmov"); switch (op->operands_count) { case 2: if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL && op->operands[0].reg == 0 && op->operands[1].type & OT_FPUREG & ~OT_REGALL ) { if ( !strcmp...
0
75,389
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 inet_sk_rebuild_header(struct sock *sk) { struct inet_sock *inet = inet_sk(sk); struct rtable *rt = (struct rtable *)__sk_dst_check(sk, 0); __be32 daddr; int err; /* Route is OK, nothing to do. */ if (rt) return 0; /* Reroute. */ daddr = inet->inet_daddr; if (inet->opt && inet->opt->sr...
1
165,543
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 RenderBox::paintBoxDecorationsWithRect(PaintInfo& paintInfo, const LayoutPoint& paintOffset, const LayoutRect& paintRect) { BackgroundBleedAvoidance bleedAvoidance = determineBackgroundBleedAvoidance(paintInfo.context); if (!boxShadowShouldBeAppliedToBackground(bleedAvoidance)) paintBoxShado...
0
116,568
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: error::Error GLES2DecoderPassthroughImpl::DoCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, ...
0
141,911
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::UpdatePopup() { model()->SetInputInProgress(true); if (!model()->has_focus()) return; const gfx::Range sel = GetSelectedRange(); model()->StartAutocomplete(!sel.is_empty(), sel.GetMax() < text().length()); } Commit Message: Strip JavaScript schemas on Linux text drop When dro...
0
150,649
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: ModuleExport void UnregisterYCBCRImage(void) { (void) UnregisterMagickInfo("YCbCr"); (void) UnregisterMagickInfo("YCbCrA"); } Commit Message: fix memory leak in ReadYCBCRImage as SetImageExtent failure CWE ID: CWE-772
0
60,756
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: BpHDCP(const sp<IBinder> &impl) : BpInterface<IHDCP>(impl) { } Commit Message: HDCP: buffer over flow check -- DO NOT MERGE bug: 20222489 Change-Id: I3a64a5999d68ea243d187f12ec7717b7f26d93a3 (cherry picked from commit 532cd7b86a5fdc7b9a30a45d8ae2d16ef7660a72) CWE ID: CWE-189
0
157,595
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 vrend_renderer_resource_detach_iov(int res_handle, struct iovec **iov_p, int *num_iovs_p) { struct vrend_resource *res; res = vrend_resource_lookup(res_handle, 0); if (!res) { return; } if (iov_p) *iov_...
0
8,916
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 _php_pgsql_detect_identifier_escape(const char *identifier, size_t len) /* {{{ */ { size_t i; /* Handle edge case. Cannot be a escaped string */ if (len <= 2) { return FAILURE; } /* Detect double qoutes */ if (identifier[0] == '"' && identifier[len-1] == '"') { /* Detect wrong format of " in...
0
5,213
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 IDNToUnicodeOneComponent(const base::char16* comp, size_t comp_len, bool is_tld_ascii, bool enable_spoof_checks, base::string16* out, bool* has_idn_compon...
1
172,728
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 zend_object *spl_dllist_object_clone(zval *zobject) /* {{{ */ { zend_object *old_object; zend_object *new_object; old_object = Z_OBJ_P(zobject); new_object = spl_dllist_object_new_ex(old_object->ce, zobject, 1); zend_objects_clone_members(new_object, old_object); return new_object; ...
0
54,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: static void serialize_plist(node_t* node, void* data) { uint64_t *index_val = NULL; struct serialize_s *ser = (struct serialize_s *) data; uint64_t current_index = ser->objects->len; void* val = hash_table_lookup(ser->ref_table, node); if (val) { return; } index_val = (uin...
0
68,040
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: gx_dc_pattern2_save_dc( const gx_device_color * pdevc, gx_device_color_saved * psdc ) { gs_pattern2_instance_t * pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern; psdc->type = pdevc->type; psdc->colors.pattern2.id = pinst->pattern_id; psdc->colors.pattern2.shfill = pinst->shfill; }...
0
1,721
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 Document::NeedsLayoutTreeUpdate() const { if (!IsActive() || !View()) return false; if (NeedsFullLayoutTreeUpdate()) return true; if (ChildNeedsStyleRecalc()) return true; if (ChildNeedsStyleInvalidation()) return true; if (GetLayoutView() && GetLayoutView()->WasNotifiedOfSubtreeCha...
0
134,117
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_rq_size(struct mlx5_ib_dev *dev, struct ib_qp_cap *cap, int has_rq, struct mlx5_ib_qp *qp, struct mlx5_ib_create_qp *ucmd) { int wqe_size; int wq_size; /* Sanity check RQ size before proceeding */ if (cap->max_recv_wr > (1 << MLX5_CAP_GEN(dev->mdev, log_max_qp_sz))) return -EINVAL; ...
0
92,196
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 rgbinitialproc(i_ctx_t *i_ctx_p, ref *space) { gs_client_color cc; cc.pattern = 0x00; cc.paint.values[0] = 0; cc.paint.values[1] = 0; cc.paint.values[2] = 0; return gs_setcolor(igs, &cc); } Commit Message: CWE ID: CWE-704
0
3,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: msPostGISRetrievePK(layerObj *layer) { PGresult *pgresult = NULL; char *sql = 0; size_t size; msPostGISLayerInfo *layerinfo = 0; int length; int pgVersion; char *pos_sep; char *schema = NULL; char *table = NULL; if (layer->debug) { msDebug("msPostGISRetrievePK called.\n"); } layerinf...
0
40,834
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: TIFFSetWriteOffset(TIFF* tif, toff_t off) { tif->tif_curoff = off; } Commit Message: * tools/tiffcrop.c: fix various out-of-bounds write vulnerabilities in heap or stack allocated buffers. Reported as MSVR 35093, MSVR 35096 and MSVR 35097. Discovered by Axel Souchet and Vishal Chauhan from the MSRC Vulnerabilit...
0
48,322
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: long long Chapters::Atom::GetStartTime(const Chapters* pChapters) const { return GetTime(pChapters, m_start_timecode); } Commit Message: libwebm: Pull from upstream Rolling mkvparser from upstream. Primarily for fixing a bug on parsing failures with certain Opus WebM files. Upstream commit hash of this pul...
1
174,355
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: XML_SetEndNamespaceDeclHandler(XML_Parser parser, XML_EndNamespaceDeclHandler end) { if (parser != NULL) parser->m_endNamespaceDeclHandler = end; } Commit Message: xmlparse.c: Deny internal entities closing the doctype CWE ID: CWE-611
0
88,220
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 (Device *device) { char *s; guint n; gboolean ret; char *path; GDir *dir; const char *name; GList *l; GList *old_slaves_objpath; GList *old_holders_objpath; GList *cur_slaves_objpath; GList *cur_holders_objpath; GList *added_objpath; GList *removed_objpath; GPtrArray *symli...
0
11,827
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 vlan_dev_neigh_setup(struct net_device *dev, struct neigh_parms *pa) { struct net_device *real_dev = vlan_dev_info(dev)->real_dev; const struct net_device_ops *ops = real_dev->netdev_ops; int err = 0; if (netif_device_present(real_dev) && ops->ndo_neigh_setup) err = ops->ndo_neigh_setup(real_dev...
0
24,280
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 ContentSecurityPolicy::allowFrameFromSource( const KURL& url, RedirectStatus redirectStatus, SecurityViolationReportingPolicy reportingPolicy) const { return isAllowedByAll<&CSPDirectiveList::allowFrameFromSource>( m_policies, url, redirectStatus, reportingPolicy); } Commit Message: CSP:...
0
136,728
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 rq_attach_root(struct rq *rq, struct root_domain *rd) { struct root_domain *old_rd = NULL; unsigned long flags; raw_spin_lock_irqsave(&rq->lock, flags); if (rq->rd) { old_rd = rq->rd; if (cpumask_test_cpu(rq->cpu, old_rd->online)) set_rq_offline(rq); cpumask_clear_cpu(rq->cpu, old_rd-...
0
26,320
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 DragWindowTo(WindowSelectorItem* item, const gfx::Point& end_location) { const gfx::Point start_location(item->target_bounds().CenterPoint()); window_selector()->InitiateDrag(item, start_location); window_selector()->Drag(item, end_location); window_selector()->CompleteDrag(item, end_locati...
0
133,202
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 FloatRoundedRect ToClipRect(const LayoutRect& rect) { if (RuntimeEnabledFeatures::SlimmingPaintV175Enabled()) return FloatRoundedRect(FloatRect(PixelSnappedIntRect(rect))); return FloatRoundedRect(FloatRect(rect)); } Commit Message: Reland "[CI] Make paint property nodes non-ref-counted" This rev...
0
125,458
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: BrowserPolicyConnector::BrowserPolicyConnector() : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { managed_platform_provider_.reset(CreateManagedPlatformProvider()); recommended_platform_provider_.reset(CreateRecommendedPlatformProvider()); managed_cloud_provider_.reset(new CloudPolicyProviderI...
0
97,723