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: void comps_mrtree_set(COMPS_MRTree * rt, char * key, void * data) { __comps_mrtree_set(rt, key, strlen(key), data); } Commit Message: Fix UAF in comps_objmrtree_unite function The added field is not used at all in many places and it is probably the left-over of some copy-paste. CWE ID: CWE-416
0
14,902
Analyze the following 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 hci_send_to_control(struct sk_buff *skb, struct sock *skip_sk) { struct sock *sk; struct hlist_node *node; BT_DBG("len %d", skb->len); read_lock(&hci_sk_list.lock); sk_for_each(sk, node, &hci_sk_list.head) { struct sk_buff *nskb; /* Skip the original socket */ if (sk == skip_sk) continue; ...
0
5,865
Analyze the following 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 TypedUrlModelAssociator::IsAssociated(const std::string& typed_url) { DCHECK(expected_loop_ == MessageLoop::current()); return id_map_.find(typed_url) != id_map_.end(); } Commit Message: Now ignores obsolete sync nodes without visit transitions. Also removed assertion that was erroneously triggered by ...
0
11,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: gfx::Point RenderView::GetScrollOffset() { WebSize scroll_offset = webview()->mainFrame()->scrollOffset(); return gfx::Point(scroll_offset.width, scroll_offset.height); } Commit Message: DevTools: move DevToolsAgent/Client into content. BUG=84078 TEST= Review URL: http://codereview.chromium.org/7461019 gi...
0
16,431
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: HTStream *HTMLToC(HTPresentation *pres GCC_UNUSED, HTParentAnchor *anchor, HTStream *sink) { HTStructured *html; if (sink) (*sink->isa->put_string) (sink, "/* "); /* Before even title */ html = HTML_new(anchor, WWW_PLAINTEXT, sink); html->comment_start = "/* "; html->comment_end = "...
0
21,006
Analyze the following 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 JNI_OfflinePageDownloadBridge_StartDownload( JNIEnv* env, const JavaParamRef<jclass>& clazz, const JavaParamRef<jobject>& j_tab, const JavaParamRef<jstring>& j_origin) { TabAndroid* tab = TabAndroid::GetNativeTab(env, j_tab); if (!tab) return; content::WebContents* web_contents = t...
0
23,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: static int cipso_v4_delopt(struct ip_options **opt_ptr) { int hdr_delta = 0; struct ip_options *opt = *opt_ptr; if (opt->srr || opt->rr || opt->ts || opt->router_alert) { u8 cipso_len; u8 cipso_off; unsigned char *cipso_ptr; int iter; int optlen_new; cipso_off = opt->cipso - sizeof(struc...
1
29,097
Analyze the following 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 RenderProcessHostImpl::IsProcessBackgrounded() const { return priority_.background; } 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 memory protection applied to a han...
0
26,161
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: ProcRenderFillRectangles (ClientPtr client) { PicturePtr pDst; int things; REQUEST(xRenderFillRectanglesReq); REQUEST_AT_LEAST_SIZE (xRenderFillRectanglesReq); if (!PictOpValid (stuff->op)) { client->errorValue = stuff->op; return BadValue; } VERIFY_PICTURE (...
0
25,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: const GDataDirectory* GDataEntry::AsGDataDirectoryConst() const { return const_cast<GDataEntry*>(this)->AsGDataDirectory(); } Commit Message: gdata: Define the resource ID for the root directory Per the spec, the resource ID for the root directory is defined as "folder:root". Add the resource ID to the root d...
0
2,570
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: Ins_GC( TT_ExecContext exc, FT_Long* args ) { FT_ULong L; FT_F26Dot6 R; L = (FT_ULong)args[0]; if ( BOUNDSL( L, exc->zp2.n_points ) ) { if ( exc->pedantic_hinting ) exc->error = FT_THROW( Invalid_Reference ); R = 0; } else { if...
0
1,247
Analyze the following 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 decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { struct priv *ctx = crypto_blkcipher_ctx(desc->tfm); struct blkcipher_walk w; blkcipher_walk_init(&w, dst, src, nbytes); return crypt(desc, &w, ctx, crypto_cipher_alg(ctx->child...
0
12,604
Analyze the following 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 nl80211_send_sta_del_event(struct cfg80211_registered_device *rdev, struct net_device *dev, const u8 *mac_addr, gfp_t gfp) { struct sk_buff *msg; void *hdr; msg = nlmsg_new(NLMSG_GOODSIZE, gfp); if (!msg) return; hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_DEL_STATION); if (!hdr) { nlm...
0
18,481
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: KURL Document::openSearchDescriptionURL() { static const char* const openSearchMIMEType = "application/opensearchdescription+xml"; static const char* const openSearchRelation = "search"; if (!frame() || frame()->tree()->parent()) return KURL(); if (frame()->loader()->state() != FrameStat...
0
11,400
Analyze the following 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 __init void reserve_ibft_region(void) { unsigned long addr, size = 0; addr = find_ibft_region(&size); if (size) memblock_reserve(addr, size); } Commit Message: acpi: Disable ACPI table override if securelevel is set From the kernel documentation (initrd_table_override.txt): If the ACPI_INITRD_T...
0
406
Analyze the following 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 OverloadedMethodNMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { scheduler::CooperativeSchedulingManager::Instance()->Safepoint(); bool is_arity_error = false; switch (std::min(1, info.Length())) { case 1: if (V8TestInterface::HasInstance(info[0], info.GetIsolate())) { ...
0
22,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: int page_readlink(struct dentry *dentry, char __user *buffer, int buflen) { DEFINE_DELAYED_CALL(done); int res = readlink_copy(buffer, buflen, page_get_link(dentry, d_inode(dentry), &done)); do_delayed_call(&done); return res; } Commit Message: vfs: rename: check backing inode being equal If ...
0
26,152
Analyze the following 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 MockScreenshotManager(content::NavigationControllerImpl* owner) : content::NavigationEntryScreenshotManager(owner), encoding_screenshot_in_progress_(false) { } Commit Message: Prevent renderer initiated back navigation to cancel a browser one. Renderer initiated back/forward navigatio...
0
9,002
Analyze the following 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_shared_sigalgs(SSL *s) { const unsigned char *pref, *allow, *conf; size_t preflen, allowlen, conflen; size_t nmatch; TLS_SIGALGS *salgs = NULL; CERT *c = s->cert; unsigned int is_suiteb = tls1_suiteb(s); if (c->shared_sigalgs) { OPENSSL_free(c->shared_sigalgs); c->shared_sigalgs ...
0
11,028
Analyze the following 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 extension_and_user_data(MpegEncContext *s, GetBitContext *gb, int id) { uint32_t startcode; uint8_t extension_type; startcode = show_bits_long(gb, 32); if (startcode == USER_DATA_STARTCODE || startcode == EXT_STARTCODE) { if ((id == 2 || id == 4) && startcode == EXT_STARTCODE...
0
18,524
Analyze the following 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_seq_ioctl_get_client_info(struct snd_seq_client *client, void __user *arg) { struct snd_seq_client *cptr; struct snd_seq_client_info client_info; if (copy_from_user(&client_info, arg, sizeof(client_info))) return -EFAULT; /* requested client number */ cptr = snd_seq_client_use_ptr(cl...
0
29,108
Analyze the following 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 vhost_get_vq_desc(struct vhost_dev *dev, struct vhost_virtqueue *vq, struct iovec iov[], unsigned int iov_size, unsigned int *out_num, unsigned int *in_num, struct vhost_log *log, unsigned int *log_num) { struct vring_desc desc; unsigned int i, head, found = 0; u16 last_avail_idx; ...
0
3,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 ContentSecurityPolicy::shouldBypassContentSecurityPolicy( const KURL& url, SchemeRegistry::PolicyAreas area) { if (SecurityOrigin::shouldUseInnerURL(url)) { return SchemeRegistry::schemeShouldBypassContentSecurityPolicy( SecurityOrigin::extractInnerURL(url).protocol(), area); } else {...
0
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: void WaitForHistory() { BlockUntilHistoryProcessesPendingRequests(history_service()); } Commit Message: TopSites: Clear thumbnails from the cache when their URLs get removed We already cleared the thumbnails from persistent storage, but they remained in the in-memory cache, so they remained accessible (...
0
11,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: static void h263_h_loop_filter_c(uint8_t *src, int stride, int qscale){ if(CONFIG_H263_DECODER || CONFIG_H263_ENCODER) { int y; const int strength= ff_h263_loop_filter_strength[qscale]; for(y=0; y<8; y++){ int d1, d2, ad1; int p0= src[y*stride-2]; int p1= src[y*stride-1]; ...
0
11,839
Analyze the following 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 BaseMultipleFieldsDateAndTimeInputType::restoreFormControlState(const FormControlState& state) { if (!m_dateTimeEditElement) return; DateTimeFieldsState dateTimeFieldsState = DateTimeFieldsState::restoreFormControlState(state); m_dateTimeEditElement->setValueAsDateTimeFieldsState(dateTime...
0
26,442
Analyze the following 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 region16_intersect_rect(REGION16* dst, const REGION16* src, const RECTANGLE_16* rect) { REGION16_DATA* newItems; const RECTANGLE_16* srcPtr, *endPtr, *srcExtents; RECTANGLE_16* dstPtr; UINT32 nbRects, usedRects; RECTANGLE_16 common, newExtents; assert(src); assert(src->data); srcPtr = region16_r...
1
14,514
Analyze the following 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 RenderFrameHostImpl::SendNavigateMessage( const CommonNavigationParams& common_params, const StartNavigationParams& start_params, const RequestNavigationParams& request_params) { RenderFrameDevToolsAgentHost::OnBeforeNavigation( frame_tree_node_->current_frame_host(), this); Send(new Fr...
0
4,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: const HTMLElement& toHTMLElement(const FormAssociatedElement& associatedElement) { if (associatedElement.isFormControlElement()) return toHTMLFormControlElement(associatedElement); return toHTMLObjectElement(associatedElement); } Commit Message: Fix a crash when a form control is in a past naems ...
0
23,612
Analyze the following 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 update_read_refresh_rect(rdpUpdate* update, wStream* s) { int index; BYTE numberOfAreas; RECTANGLE_16* areas; if (Stream_GetRemainingLength(s) < 4) return FALSE; Stream_Read_UINT8(s, numberOfAreas); Stream_Seek(s, 3); /* pad3Octects */ if (Stream_GetRemainingLength(s) < ((size_t) numberOfAreas * ...
0
13,801
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: nautilus_file_operations_unmount_mount_full (GtkWindow *parent_window, GMount *mount, GMountOperation *mount_operation, gboolean ...
0
11,359
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: GahpClient::gt4_gram_client_job_destroy(const char * job_contact) { static const char* command = "GT4_GRAM_JOB_DESTROY"; if (server->m_commands_supported->contains_anycase(command)==FALSE) { return GAHPCLIENT_COMMAND_NOT_SUPPORTED; } if (!job_contact) job_contact=NULLSTRING; std::string reqline; int x ...
0
16,341
Analyze the following 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 vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { struct vmw_private *dev_priv = vmw_priv(dev); struct vmw_user_surface *user_srf; struct vmw_surface *srf; struct vmw_resource *res; struct vmw_resource *tmp; union drm_vmw_gb_surface_create_arg *arg = ...
1
9,887
Analyze the following 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 disable_interrupts( struct airo_info *ai ) { OUT4500( ai, EVINTEN, 0 ); } Commit Message: net: Audit drivers to identify those needing IFF_TX_SKB_SHARING cleared After the last patch, We are left in a state in which only drivers calling ether_setup have IFF_TX_SKB_SHARING set (we assume that driver...
0
8,257
Analyze the following 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 do_remove_conflicting_framebuffers(struct apertures_struct *a, const char *name, bool primary) { int i; /* check all firmware fbs and kick off if the base addr overlaps */ for (i = 0 ; i < FB_MAX; i++) { struct apertures_struct *gen_aper; if (!registered_fb[i]) continue; if (!(r...
0
8,272
Analyze the following 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 mailimf_comment_parse(const char * message, size_t length, size_t * indx) { size_t cur_token; int r; cur_token = * indx; r = mailimf_oparenth_parse(message, length, &cur_token); if (r != MAILIMF_NO_ERROR) return r; while (1) { r = mailimf_comment_fws_ccontent_parse(me...
0
25,599
Analyze the following 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::isSecureContext(String& errorMessage, const SecureContextCheck privilegeContextCheck) const { return isSecureContextImpl(&errorMessage, privilegeContextCheck); } Commit Message: Change Document::detach() to RELEASE_ASSERT all subframes are gone. BUG=556724,577105 Review URL: https://coderevi...
0
1,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: struct bio *bio_alloc_bioset(gfp_t gfp_mask, unsigned int nr_iovecs, struct bio_set *bs) { gfp_t saved_gfp = gfp_mask; unsigned front_pad; unsigned inline_vecs; struct bio_vec *bvl = NULL; struct bio *bio; void *p; if (!bs) { if (nr_iovecs > UIO_MAXIOV) return NULL; p = kmalloc(sizeof(stru...
0
6,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: StartFileUploadParams(const FilePath& in_local_file_path, const FilePath& in_remote_file_path, const FileOperationCallback& in_callback) : local_file_path(in_local_file_path), remote_file_path(in_remote_file_path), callback(in_callback) {} C...
0
29,814
Analyze the following 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::RegisterLocalStatePrefs( PrefRegistrySimple* registry) { registry->RegisterStringPref(prefs::kIsolateOrigins, std::string()); registry->RegisterBooleanPref(prefs::kSitePerProcess, false); registry->RegisterBooleanPref(prefs::kTabLifecyclesEnabled, true); registry->Regi...
0
6,942
Analyze the following 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 InterstitialPageImpl::InterstitialPageRVHDelegateView::GotFocus() { WebContents* web_contents = interstitial_page_->web_contents(); if (web_contents) static_cast<WebContentsImpl*>(web_contents)->NotifyWebContentsFocused(); } Commit Message: Don't show current RenderWidgetHostView while interstitial ...
0
1,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: error::Error GLES2DecoderImpl::HandleBeginQueryEXT( uint32 immediate_data_size, const cmds::BeginQueryEXT& c) { GLenum target = static_cast<GLenum>(c.target); GLuint client_id = static_cast<GLuint>(c.id); int32 sync_shm_id = static_cast<int32>(c.sync_data_shm_id); uint32 sync_shm_offset = static_cast<...
0
8,518
Analyze the following 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::setXMLVersion(const String& version, ExceptionCode& ec) { if (!implementation()->hasFeature("XML", String())) { ec = NOT_SUPPORTED_ERR; return; } if (!XMLDocumentParser::supportsXMLVersion(version)) { ec = NOT_SUPPORTED_ERR; return; } m_xmlVersi...
0
16,400
Analyze the following 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 sctp_cmp_addr_exact(const union sctp_addr *ss1, const union sctp_addr *ss2) { struct sctp_af *af; af = sctp_get_af_specific(ss1->sa.sa_family); if (unlikely(!af)) return 0; return af->cmp_addr(ss1, ss2); } Commit Message: net: sctp: inherit auth_capable on INIT collisions Jason reported an oops c...
0
3,878
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: base::PlatformFileError SystemToPlatformError(int error) { switch (error) { case 0: return base::PLATFORM_FILE_OK; case EACCES: case EISDIR: case EROFS: case EPERM: return base::PLATFORM_FILE_ERROR_ACCESS_DENIED; case ETXTBSY: return base::PLATFORM_FILE_ERROR_IN_USE; ...
0
27,978
Analyze the following 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 nfs41_lock_expired(struct nfs4_state *state, struct file_lock *request) { int status; struct nfs_server *server = NFS_SERVER(state->inode); status = nfs41_test_stateid(server, state); if (status == NFS_OK) return 0; nfs41_free_stateid(server, state); return nfs4_lock_expired(state, request); }...
0
8,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: int XfrmController::fillNlAttrXfrmEncapTmpl(const XfrmSaInfo& record, nlattr_encap_tmpl* tmpl) { if (record.encap.type == XfrmEncapType::NONE) { return 0; } int len = NLA_HDRLEN + sizeof(xfrm_encap_tmpl); tmpl->tmpl.encap_type = static_cast<uint16_t>(record.encap.type); tmpl->tmpl.encap_sport = htons...
0
26,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: static int piv_process_discovery(sc_card_t *card) { int r; u8 * rbuf = NULL; size_t rbuflen = 0; r = piv_get_cached_data(card, PIV_OBJ_DISCOVERY, &rbuf, &rbuflen); /* Note rbuf and rbuflen are now pointers into cache */ if (r < 0) goto err; sc_log(card->ctx, "Discovery = %p:%"SC_FORMAT_LEN_SIZE_T"u", r...
0
1,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: static void next_entry(struct ctl_table_header **phead, struct ctl_table **pentry) { struct ctl_table_header *head = *phead; struct ctl_table *entry = *pentry; struct ctl_node *ctl_node = &head->node[entry - head->ctl_table]; spin_lock(&sysctl_lock); unuse_table(head); ctl_node = first_usable_entry(rb_nex...
0
7,801
Analyze the following 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 Reinst *emit(Reprog *prog, int opcode) { Reinst *inst = prog->end++; inst->opcode = opcode; inst->n = 0; inst->c = 0; inst->cc = NULL; inst->x = inst->y = NULL; return inst; } Commit Message: Bug 700937: Limit recursion in regexp matcher. Also handle negative return code as an error in the JS bind...
0
15,593
Analyze the following 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 pfkey_broadcast(struct sk_buff *skb, gfp_t allocation, int broadcast_flags, struct sock *one_sk, struct net *net) { struct netns_pfkey *net_pfkey = net_generic(net, pfkey_net_id); struct sock *sk; struct hlist_node *node; struct sk_buff *skb2 = NULL; int err = -ESRCH; /* XXX Do we ne...
0
16,167
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: DetachOffloadGPU(ScreenPtr slave) { assert(slave->isGPU); xorg_list_del(&slave->offload_head); slave->current_master = NULL; } Commit Message: CWE ID: CWE-369
0
18,364
Analyze the following 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_set_blend_color(struct vrend_context *ctx, struct pipe_blend_color *color) { ctx->sub->blend_color = *color; glBlendColor(color->color[0], color->color[1], color->color[2], color->color[3]); } Commit Message: CWE ID: CWE-772
0
6,681
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: DRMExtractor::~DRMExtractor() { } Commit Message: Fix security vulnerability in libstagefright bug: 28175045 Change-Id: Icee6c7eb5b761da4aa3e412fb71825508d74d38f CWE ID: CWE-119
0
19,400
Analyze the following 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 HevcParameterSets::findParam32(uint32_t key, uint32_t *param) { return findParam(key, param, mParams); } Commit Message: Validate lengths in HEVC metadata parsing Add code to validate the size parameter passed to HecvParameterSets::addNalUnit(). Previously vulnerable to decrementing an unsigned past 0, y...
0
28,739
Analyze the following 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 nfs4_close_prepare(struct rpc_task *task, void *data) { struct nfs4_closedata *calldata = data; struct nfs4_state *state = calldata->state; struct inode *inode = calldata->inode; bool is_rdonly, is_wronly, is_rdwr; int call_close = 0; dprintk("%s: begin!\n", __func__); if (nfs_wait_on_sequence...
0
19,440
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: SMB2_echo(struct TCP_Server_Info *server) { struct smb2_echo_req *req; int rc = 0; struct kvec iov[1]; struct smb_rqst rqst = { .rq_iov = iov, .rq_nvec = 1 }; unsigned int total_len; cifs_dbg(FYI, "In echo request\n"); if (server->tcpStatus == CifsNeedNegotiate) { /* No need to send echo on newly ...
0
5,282
Analyze the following 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 propagate_mnt(struct mount *dest_mnt, struct mountpoint *dest_mp, struct mount *source_mnt, struct hlist_head *tree_list) { struct mount *m, *n; int ret = 0; /* * we don't want to bother passing tons of arguments to * propagate_one(); everything is serialized by namespace_sem, * so globals wil...
1
29,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: _gnutls_server_find_pk_algos_in_ciphersuites (const opaque * data, int datalen) { int j; gnutls_pk_algorithm_t algo = GNUTLS_PK_NONE, prev_algo = 0; gnutls_kx_algorithm_t kx; cipher_suite_st cs; if (datalen % 2 != 0) { gnutls_assert (); return GNUTLS_E_UNEXPECTED_PACKET_LENGT...
0
6,506
Analyze the following 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 wchar_t* _cmsMLUgetWide(const cmsMLU* mlu, cmsUInt32Number *len, cmsUInt16Number LanguageCode, cmsUInt16Number CountryCode, cmsUInt16Number* UsedLanguageCode, cmsUInt16Number* UsedCountryCode) { int i; int Best...
0
7,056
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: __releases(key_serial_lock) { spin_unlock(&key_serial_lock); } Commit Message: KEYS: Fix race between updating and finding a negative key Consolidate KEY_FLAG_INSTANTIATED, KEY_FLAG_NEGATIVE and the rejection error into one field such that: (1) The instantiation state can be modified/read atomically. (2) ...
0
9,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 void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs) { struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); struct debug_store *ds = cpuc->ds; struct pebs_record_nhm *at, *top; struct perf_event *event = NULL; u64 status = 0; int bit, n; if (!x86_pmu.pebs_active) return; at = (struct pe...
0
4,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: int vrend_create_sampler_view(struct vrend_context *ctx, uint32_t handle, uint32_t res_handle, uint32_t format, uint32_t val0, uint32_t val1, uint32_t swizzle_packed) { struct vrend_sampler_view *view; struct vrend_res...
0
3,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 fetch_tempfile(char *line, void *data) { FILE *fp = data; if (!line) rewind(fp); else if (fputs(line, fp) == EOF || fputc('\n', fp) == EOF) return -1; return 0; } Commit Message: Add alloc fail check in nntp_fetch_headers CWE ID: CWE-20
0
12,806
Analyze the following 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 SearchBuffer::prependContext(const UChar*, size_t) { ASSERT_NOT_REACHED(); } Commit Message: Upgrade a TextIterator ASSERT to a RELEASE_ASSERT as a defensive measure. BUG=156930,177197 R=inferno@chromium.org Review URL: https://codereview.chromium.org/15057010 git-svn-id: svn://svn.chromium.org/blink...
0
26,006
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: set_home_var () { SHELL_VAR *temp_var; temp_var = find_variable ("HOME"); if (temp_var == 0) temp_var = bind_variable ("HOME", sh_get_home_dir (), 0); #if 0 VSETATTR (temp_var, att_exported); #endif } Commit Message: CWE ID: CWE-119
0
10,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: static NOINLINE double my_SQRT(double X) { union { float f; int32_t i; } v; double invsqrt; double Xhalf = X * 0.5; /* Fast and good approximation to 1/sqrt(X), black magic */ v.f = X; /*v.i = 0x5f3759df - (v.i >> 1);*/ v.i = 0x5f375a86 - (v.i >> 1); /* - this constant is slightly better */ invsqr...
0
1,776
Analyze the following 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 fini(void) { crypto_unregister_algs(camellia_algs, ARRAY_SIZE(camellia_algs)); } Commit Message: crypto: prefix module autoloading with "crypto-" This prefixes all crypto module loading with "crypto-" so we never run the risk of exposing module auto-loading to userspace via a crypto API, as ...
0
22,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: struct regulator *regulator_get_optional(struct device *dev, const char *id) { return _regulator_get(dev, id, false, false); } Commit Message: regulator: core: Fix regualtor_ena_gpio_free not to access pin after freeing After freeing pin from regulator_ena_gpio_free, loop can access the pin. So this patch fixe...
0
5,677
Analyze the following 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 no_tty(void) { struct task_struct *tsk = current; tty_lock(); disassociate_ctty(0); tty_unlock(); proc_clear_tty(tsk); } Commit Message: TTY: drop driver reference in tty_open fail path When tty_driver_lookup_tty fails in tty_open, we forget to drop a reference to the tty driver. This was added by com...
0
20,956
Analyze the following 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 kvm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) { unsigned long old_cr0 = kvm_read_cr0(vcpu); unsigned long update_bits = X86_CR0_PG | X86_CR0_WP | X86_CR0_CD | X86_CR0_NW; cr0 |= X86_CR0_ET; #ifdef CONFIG_X86_64 if (cr0 & 0xffffffff00000000UL) return 1; #endif cr0 &= ~CR0_RESERVED_BIT...
0
20,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: DeactivatePointerGrab(DeviceIntPtr mouse) { GrabPtr grab = mouse->deviceGrab.grab; DeviceIntPtr dev; Bool wasPassive = mouse->deviceGrab.fromPassiveGrab; Bool wasImplicit = (mouse->deviceGrab.fromPassiveGrab && mouse->deviceGrab.implicitGrab); XID grab_resource = grab->...
0
28,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: JSValue jsTestObjContentDocument(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(slotBase)); TestObj* impl = static_cast<TestObj*>(castedThis->impl()); return shouldAllowAccessToNode(exec, impl->contentDocument()) ? toJS(exec, castedThis->glo...
0
28,437
Analyze the following 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_abs_value(struct usb_mixer_elem_info *cval, int val) { if (val < 0) return cval->min; if (!cval->res) cval->res = 1; val *= cval->res; val += cval->min; if (val > cval->max) return cval->max; return val; } Commit Message: ALSA: usb-audio: Kill stray URB at exiting USB-audio driver may...
0
27,717
Analyze the following 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 HTMLTextAreaElement::setRows(int rows) { setIntegralAttribute(rowsAttr, rows); } Commit Message: Add HTMLFormControlElement::supportsAutofocus to fix a FIXME comment. This virtual function should return true if the form control can hanlde 'autofocucs' attribute if it is specified. Note: HTMLInputEleme...
0
5,278
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: print_octets(netdissect_options *ndo, const u_char *dat, u_int length) { u_int i; for (i=0; i<length; i++) { ND_PRINT((ndo, "%02x", *dat++)); } } Commit Message: CVE-2017-13006/L2TP: Check whether an AVP's content exceeds the AVP length. It's not good enough to check whether all the data specified by the A...
0
8,722
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: encode_restorefh(struct xdr_stream *xdr, struct compound_hdr *hdr) { __be32 *p; p = reserve_space(xdr, 4); *p = cpu_to_be32(OP_RESTOREFH); hdr->nops++; hdr->replen += decode_restorefh_maxsz; } Commit Message: NFSv4: include bitmap in nfsv4 get acl data The NFSv4 bitmap size is unbounded: a server can retu...
0
4,729
Analyze the following 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 CLASS kodak_65000_load_raw() { short buf[256]; int row, col, len, pred[2], ret, i; for (row=0; row < height; row++) for (col=0; col < width; col+=256) { pred[0] = pred[1] = 0; len = MIN (256, width-col); ret = kodak_65000_decode (buf, len); for (i=0; i < len; i++) if ((BAY...
0
2,862
Analyze the following 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::setContextFeatures(PassRefPtr<ContextFeatures> features) { m_contextFeatures = features; } 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...
0
13,839
Analyze the following 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 ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an) { struct ath_atx_ac *ac; struct ath_atx_tid *tid; struct ath_txq *txq; int tidno; for (tidno = 0, tid = &an->tid[tidno]; tidno < IEEE80211_NUM_TIDS; tidno++, tid++) { ac = tid->ac; txq = ac->txq; ath_txq_lock(sc, txq); if (...
0
12,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 int dn_confirm_accept(struct sock *sk, long *timeo, gfp_t allocation) { struct dn_scp *scp = DN_SK(sk); DEFINE_WAIT(wait); int err; if (scp->state != DN_CR) return -EINVAL; scp->state = DN_CC; scp->segsize_loc = dst_metric_advmss(__sk_dst_get(sk)); dn_send_conn_conf(sk, allocation); prepare_to...
0
29,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: void RenderThreadImpl::SetRendererBlinkPlatformImplForTesting( RendererBlinkPlatformImpl* blink_platform_impl) { g_current_blink_platform_impl_for_testing = blink_platform_impl; } Commit Message: Roll src/third_party/boringssl/src 664e99a64..696c13bd6 https://boringssl.googlesource.com/boringssl/+log/664e...
0
20,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 vga_common_init(VGACommonState *s, Object *obj, bool global_vmstate) { int i, j, v, b; for(i = 0;i < 256; i++) { v = 0; for(j = 0; j < 8; j++) { v |= ((i >> j) & 1) << (j * 4); } expand4[i] = v; v = 0; for(j = 0; j < 4; j++) { ...
0
6,424
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: SmartScheduleTimer (int sig) { SmartScheduleTime += SmartScheduleInterval; } Commit Message: CWE ID: CWE-362
0
9,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 WebGL2RenderingContextBase::texSubImage2D( ExecutionContext* execution_context, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, HTMLCanvasElement* canvas, ExceptionState& exception_state) { if (isContextLost()) return; if (boun...
0
11,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: rdp_send_confirm_active(void) { STREAM s; uint32 sec_flags = g_encryption ? (RDP5_FLAG | SEC_ENCRYPT) : RDP5_FLAG; uint16 caplen = RDP_CAPLEN_GENERAL + RDP_CAPLEN_BITMAP + RDP_CAPLEN_ORDER + RDP_CAPLEN_COLCACHE + RDP_CAPLEN_ACTIVATE + RDP_CAPLEN_CONTROL + RDP_CAPLEN_SHARE + RDP_CAPLEN_BRUSHCACH...
0
27,013
Analyze the following 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 AppListControllerDelegateWin::ActivateApp( Profile* profile, const extensions::Extension* extension, int event_flags) { LaunchApp(profile, extension, event_flags); } Commit Message: Upgrade old app host to new app launcher on startup This patch is a continuation of https://codereview.chromium.org/168...
0
25,002
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: DialogNotification::DialogNotification(Type type, const base::string16& display_text) : type_(type), display_text_(display_text), checked_(false) { std::vector<base::string16> pieces; base::SplitStringDontTrim(display_text, kRangeSeparator, &pieces); if...
0
2,335
Analyze the following 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 vrend_compile_shader(struct vrend_context *ctx, struct vrend_shader *shader) { GLint param; glShaderSource(shader->id, 1, (const char **)&shader->glsl_prog, NULL); glCompileShader(shader->id); glGetShaderiv(shader->id, GL_COMPILE_STATUS, &param); if (par...
0
4,238
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: content::WebContents* GetTabsAPIDefaultWebContents( UIThreadExtensionFunction* function, int tab_id, std::string* error) { content::WebContents* web_contents = nullptr; if (tab_id != -1) { GetTabById(tab_id, function->browser_context(), function->include_incognito_information(),...
0
23,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: TabContents* Browser::AddRestoredTab( const std::vector<TabNavigation>& navigations, int tab_index, int selected_navigation, const std::string& extension_app_id, bool select, bool pin, bool from_last_session, SessionStorageNamespace* session_storage_namespace) { TabContentsWrappe...
0
21,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: static int smaps_rollup_release(struct inode *inode, struct file *file) { struct seq_file *seq = file->private_data; struct proc_maps_private *priv = seq->private; if (priv->mm) mmdrop(priv->mm); kfree(priv); return single_release(inode, file); } Commit Message: coredump: fix race condition between mmge...
0
13,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: void MockPrinter::SetDefaultPrintSettings(const PrintMsg_Print_Params& params) { dpi_ = params.dpi; max_shrink_ = params.max_shrink; min_shrink_ = params.min_shrink; desired_dpi_ = params.desired_dpi; selection_only_ = params.selection_only; page_size_ = params.page_size; printable_size_ = params.pr...
0
29,885
Analyze the following 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 SimulateMonitorDeviceChangeReceived(uint32_t callback_id) { PpapiHostMsg_DeviceEnumeration_MonitorDeviceChange msg(callback_id); ppapi::proxy::ResourceMessageCallParams call_params( resource_host_.pp_resource(), 123); ppapi::host::HostMessageContext context(call_params); int32_t res...
0
6,740
Analyze the following 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 tipc_wait_for_rcvmsg(struct socket *sock, long *timeop) { struct sock *sk = sock->sk; DEFINE_WAIT(wait); long timeo = *timeop; int err; for (;;) { prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); if (timeo && skb_queue_empty(&sk->sk_receive_queue)) { if (sock->state == SS_DISCONNE...
0
16,630
Analyze the following 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 alloc_kmem_cache_cpus(struct kmem_cache *s, gfp_t flags) { int cpu; for_each_online_cpu(cpu) { struct kmem_cache_cpu *c = get_cpu_slab(s, cpu); if (c) continue; c = alloc_kmem_cache_cpu(s, cpu, flags); if (!c) { free_kmem_cache_cpus(s); return 0; } s->cpu_slab[cpu] = c; } re...
0
20,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: bool QuotaThreadTask::RunOnTargetThreadAsync() { RunOnTargetThread(); return true; } Commit Message: Quota double-delete fix BUG=142310 Review URL: https://chromiumcodereview.appspot.com/10832407 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152532 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-3...
0
1,293
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: WebRtcConstraintsBrowserTest() : user_media_(GetParam()) {} Commit Message: Add tests for closing a frame within the scope of a getusermedia callback. BUG=472617, 474370 Review URL: https://codereview.chromium.org/1073783003 Cr-Commit-Position: refs/heads/master@{#324633} CWE ID:
0
11,123
Analyze the following 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::regionBasedColumnsEnabled() const { return settings() && settings()->regionBasedColumnsEnabled(); } 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...
0
2,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: char *usb_cache_string(struct usb_device *udev, int index) { char *buf; char *smallbuf = NULL; int len; if (index <= 0) return NULL; buf = kmalloc(MAX_USB_STRING_SIZE, GFP_NOIO); if (buf) { len = usb_string(udev, index, buf, MAX_USB_STRING_SIZE); if (len > 0) { smallbuf = kmalloc(++len, GFP_NOIO)...
0
18,767