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: config_tos( config_tree *ptree ) { attr_val *tos; int item; item = -1; /* quiet warning */ tos = HEAD_PFIFO(ptree->orphan_cmds); for (; tos != NULL; tos = tos->link) { switch(tos->attr) { default: NTP_INSIST(0); break; case T_Ceiling: item = PROTO_CEILING; break; case T_Floor: it...
0
20,762
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: DictionaryValue* ClientCommandToValue(const sync_pb::ClientCommand& proto) { DictionaryValue* value = new DictionaryValue(); SET_INT32(set_sync_poll_interval); SET_INT32(set_sync_long_poll_interval); SET_INT32(max_commit_batch_size); SET_INT32(sessions_commit_delay_seconds); SET_INT32(throttle_delay_s...
0
29,184
Analyze the following 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 loff_t blk_to_logical(struct inode *inode, sector_t blk) { return (blk << inode->i_blkbits); } Commit Message: vfs: ioctl: prevent double-fetch in dedupe ioctl This prevents a double-fetch from user space that can lead to to an undersized allocation and heap overflow. Fixes: 54dbc1517237 ("vfs: ...
0
28,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 RilSapSocket::onRequestComplete(RIL_Token t, RIL_Errno e, void *response, size_t response_len) { SapSocketRequest* request= (SapSocketRequest*)t; MsgHeader *hdr = request->curr; MsgHeader rsp; rsp.token = request->curr->token; rsp.type = MsgType_RESPONSE; rsp.id = request->curr->id; rsp....
0
14,256
Analyze the following 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 ext4_da_reserve_space(struct inode *inode) { struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); struct ext4_inode_info *ei = EXT4_I(inode); int ret; /* * We will charge metadata quota at writeout time; this saves * us from metadata over-estimation, though we may go over by * a small amount in ...
0
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 bool is_cc_error(PRInt32 err) { switch(err) { case SSL_ERROR_BAD_CERT_ALERT: case SSL_ERROR_EXPIRED_CERT_ALERT: case SSL_ERROR_REVOKED_CERT_ALERT: return true; default: return false; } } Commit Message: nss: refuse previously loaded certificate from file ... when we are not asked to ...
0
15,224
Analyze the following 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_crypt_info(struct fscrypt_info *ci) { if (!ci) return; key_put(ci->ci_keyring_key); crypto_free_skcipher(ci->ci_ctfm); kmem_cache_free(fscrypt_info_cachep, ci); } Commit Message: fscrypt: remove broken support for detecting keyring key revocation Filesystem encryption ostensibly sup...
1
25,336
Analyze the following 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 attach_to_pi_owner(u32 uval, union futex_key *key, struct futex_pi_state **ps) { pid_t pid = uval & FUTEX_TID_MASK; struct futex_pi_state *pi_state; struct task_struct *p; /* * We are the first waiter - try to look up the real owner and attach * the new pi_state to it, but bail out wh...
0
20,657
Analyze the following 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 expand_inode_data(struct inode *inode, loff_t offset, loff_t len, int mode) { struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); pgoff_t index, pg_start, pg_end; loff_t new_size = i_size_read(inode); loff_t off_start, off_end; int ret = 0; ret = inode_newsize_ok(inode, (len + offset)); if (r...
0
10,702
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: ext2_xattr_cmp(struct ext2_xattr_header *header1, struct ext2_xattr_header *header2) { struct ext2_xattr_entry *entry1, *entry2; entry1 = ENTRY(header1+1); entry2 = ENTRY(header2+1); while (!IS_LAST_ENTRY(entry1)) { if (IS_LAST_ENTRY(entry2)) return 1; if (entry1->e_hash != entry2->e_hash || ...
0
7,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: static int xfrm_add_pol_expire(struct sk_buff *skb, struct nlmsghdr *nlh, struct nlattr **attrs) { struct net *net = sock_net(skb->sk); struct xfrm_policy *xp; struct xfrm_user_polexpire *up = nlmsg_data(nlh); struct xfrm_userpolicy_info *p = &up->pol; u8 type = XFRM_POLICY_TYPE_MAIN; int err = -ENOENT; ...
0
10,580
Analyze the following 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 PDFiumEngine::FillPageSides(int progressive_index) { DCHECK_GE(progressive_index, 0); DCHECK_LT(static_cast<size_t>(progressive_index), progressive_paints_.size()); int page_index = progressive_paints_[progressive_index].page_index; const pp::Rect& dirty_in_screen = progressive_paints_[progressive_i...
0
10,273
Analyze the following 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 BackendImpl::OnStatsTimer() { if (disabled_) return; stats_.OnEvent(Stats::TIMER); int64_t time = stats_.GetCounter(Stats::TIMER); int64_t current = stats_.GetCounter(Stats::OPEN_ENTRIES); if (num_refs_ && (current != num_refs_)) { int64_t diff = (num_refs_ - current) / 50; if (!diff)...
0
16,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: status_t Parcel::readCharVector(std::vector<char16_t>* val) const { return readTypedVector(val, &Parcel::readChar); } Commit Message: Add bound checks to utf16_to_utf8 Bug: 29250543 Change-Id: I518e7b2fe10aaa3f1c1987586a09b1110aff7e1a (cherry picked from commit 7e93b2ddcb49b5365fbe1dab134ffb38e6f1c719) CWE ID...
0
26,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: static inline void unregister_as_ext2(void) { } Commit Message: ext4: fix undefined behavior in ext4_fill_flex_info() Commit 503358ae01b70ce6909d19dd01287093f6b6271c ("ext4: avoid divide by zero when trying to mount a corrupted file system") fixes CVE-2009-4307 by performing a sanity check on s_log_groups_per_f...
0
22,422
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int do_recv_NPPrintData(rpc_message_t *message, void *p_value) { NPPrintData *printData = (NPPrintData *)p_value; int error; if ((error = rpc_message_recv_uint32(message, &printData->size)) < 0) return error; if ((error = rpc_message_recv_bytes(message, printData->data, printData->size)) < 0) re...
0
21,616
Analyze the following 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 SynchronousCompositorOutputSurface::Invalidate() { DCHECK(CalledOnValidThread()); if (sync_client_) sync_client_->Invalidate(); } Commit Message: sync compositor: pass simple gfx types by const ref See bug for reasoning BUG=159273 Review URL: https://codereview.chromium.org/1417893006 Cr-Commit-...
0
25,555
Analyze the following 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 ZSTD_CCtxParam_getParameter( ZSTD_CCtx_params* CCtxParams, ZSTD_cParameter param, unsigned* value) { switch(param) { case ZSTD_p_format : *value = CCtxParams->format; break; case ZSTD_p_compressionLevel : *value = CCtxParams->compressionLevel; break; ...
0
13,959
Analyze the following 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 socket_full(struct pool *pool, int wait) { SOCKETTYPE sock = pool->sock; struct timeval timeout; fd_set rd; if (unlikely(wait < 0)) wait = 0; FD_ZERO(&rd); FD_SET(sock, &rd); timeout.tv_usec = 0; timeout.tv_sec = wait; if (select(sock + 1, &rd, NULL, NULL, &timeout) > 0) return true; re...
0
25,450
Analyze the following 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 GfxColorSpace::getNumColorSpaceModes() { return nGfxColorSpaceModes; } Commit Message: CWE ID: CWE-189
0
6,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 void sock_destroy_inode(struct inode *inode) { struct socket_alloc *ei; struct socket_wq *wq; ei = container_of(inode, struct socket_alloc, vfs_inode); wq = rcu_dereference_protected(ei->socket.wq, 1); kfree_rcu(wq, rcu); kmem_cache_free(sock_inode_cachep, ei); } Commit Message: Fix order of argume...
0
23,917
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: WORD32 ih264d_start_of_pic(dec_struct_t *ps_dec, WORD32 i4_poc, pocstruct_t *ps_temp_poc, UWORD16 u2_frame_num, dec_pic_params_t *ps_pps) { pocstruct_t *ps_prev_poc = &ps_dec->s_cur_pic_poc; pocstruct_t *ps_cur_poc = ps_temp_poc; pic_buffer_t *pic_buf; ivd...
1
10,147
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: _handle_captcha(xmpp_stanza_t *const stanza) { xmpp_ctx_t *ctx = connection_get_ctx(); const char *from = xmpp_stanza_get_from(stanza); if (!from) { log_warning("Message received with no from attribute, ignoring"); return; } char *message = xmpp_message_get_body(stanza); ...
0
29,682
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: AudioParameters GetInputParametersOnDeviceThread(AudioManager* audio_manager, const std::string& device_id) { DCHECK(audio_manager->GetTaskRunner()->BelongsToCurrentThread()); if (!audio_manager->HasAudioInputDevices()) return AudioParameters(); r...
1
16,259
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: initialize_request (const struct url *u, struct http_stat *hs, int *dt, struct url *proxy, bool inhibit_keep_alive, bool *basic_auth_finished, wgint *body_data_size, char **user, char **passwd, uerr_t *ret) { bool head_only = !!(*dt & HEAD_ONLY); struct request *req; ...
0
9,396
Analyze the following 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 GetClientID(const ClientServiceMap<ClientType, ServiceType>* map, ResultType service_id, ResultType* result) { ClientType client_id = 0; if (!map->GetClientID(static_cast<ServiceType>(service_id), &client_id)) { return false; } *result = static_cast<ResultType>(c...
0
28,559
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void ProfileSyncService::InitSettings() { const CommandLine& command_line = *CommandLine::ForCurrentProcess(); if (command_line.HasSwitch(switches::kSyncServiceURL)) { std::string value(command_line.GetSwitchValueASCII( switches::kSyncServiceURL)); if (!value.empty()) { GURL custom_sync...
0
15,537
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: for_selectRule(const TranslationTableHeader *table, int pos, OutString output, int mode, const InString *input, formtype *typebuf, EmphasisInfo *emphasisBuffer, int *transOpcode, int prevTransOpcode, const TranslationTableRule **transRule, int *transCharslen, int *passCharDots, widechar const **passInstruct...
0
23,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: static unsigned char conv_ascii2bin(unsigned char a) { if (a & 0x80) return B64_ERROR; return data_ascii2bin[a]; } Commit Message: CWE ID: CWE-189
0
9,548
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: const MockTransaction* FindMockTransaction(const GURL& url) { MockTransactionMap::const_iterator it = mock_transactions.find(url.spec()); if (it != mock_transactions.end()) return it->second; for (size_t i = 0; i < arraysize(kBuiltinMockTransactions); ++i) { if (url == GURL(kBuiltinMockTransactions...
0
9,047
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: sp<IMemory> MediaMetadataRetriever::getFrameAtTime(int64_t timeUs, int option) { ALOGV("getFrameAtTime: time(%" PRId64 " us) option(%d)", timeUs, option); Mutex::Autolock _l(mLock); if (mRetriever == 0) { ALOGE("retriever is not initialized"); return NULL; } return mRetriever->getFrameAtTime(time...
0
321
Analyze the following 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_xdr_dec_test_stateid(struct rpc_rqst *rqstp, struct xdr_stream *xdr, struct nfs41_test_stateid_res *res) { struct compound_hdr hdr; int status; status = decode_compound_hdr(xdr, &hdr); if (status) goto out; status = decode_sequence(xdr, &res->seq_res, rqstp); if (status)...
0
6,879
Analyze the following 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 ContentSearchCallback(MessageLoop* message_loop, base::PlatformFileError error, scoped_ptr<gdata::GDataDirectoryProto> dir_proto) { ASSERT_EQ(base::PLATFORM_FILE_OK, error); ASSERT_TRUE(dir_proto.get()); ASSERT_EQ(1, dir_proto->child_files_size());...
0
2,690
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: numTab(int n) { TabBuffer *tab; int i; if (n == 0) return CurrentTab; if (n == 1) return FirstTab; if (nTab <= 1) return NULL; for (tab = FirstTab, i = 1; tab && i < n; tab = tab->nextTab, i++) ; return tab; } Commit Message: Make temporary directory safely when ~/.w3m is unwritab...
0
15,927
Analyze the following 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 InputEventAckNotificationObserver::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { if (type == chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN) { AutomationJSONReply(automation_, reply_message_.release()).SendS...
0
27,883
Analyze the following 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 DTLS_RECORD_LAYER_clear(RECORD_LAYER *rl) { DTLS_RECORD_LAYER *d; pitem *item = NULL; DTLS1_RECORD_DATA *rdata; pqueue *unprocessed_rcds; pqueue *processed_rcds; pqueue *buffered_app_data; d = rl->d; while ((item = pqueue_pop(d->unprocessed_rcds.q)) != NULL) { rdata ...
0
12,926
Analyze the following 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 dentry *__d_lookup_rcu(const struct dentry *parent, const struct qstr *name, unsigned *seqp) { u64 hashlen = name->hash_len; const unsigned char *str = name->name; struct hlist_bl_head *b = d_hash(hashlen_hash(hashlen)); struct hlist_bl_node *node; struct dentry *dentry; /* * Note: There i...
0
13,078
Analyze the following 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 DevToolsUIBindings::SetInspectedPageBounds(const gfx::Rect& rect) { delegate_->SetInspectedPageBounds(rect); } Commit Message: DevTools: move front-end URL handling to DevToolsUIBindingds BUG=662859 Review-Url: https://codereview.chromium.org/2607833002 Cr-Commit-Position: refs/heads/master@{#440926} CW...
0
19,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: void AutoFillManager::OnShowAutoFillDialog() { if (!CommandLine::ForCurrentProcess()->HasSwitch( switches::kDisableTabbedOptions)) { Browser* browser = BrowserList::GetLastActive(); if (browser) browser->ShowOptionsTab(chrome::kAutoFillSubPage); return; } ShowAutoFillDialog(tab_...
0
24,807
Analyze the following 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 sig_winch(int sig) { unsigned short width,height; struct mt_packet data; int plen; /* terminal height/width has changed, inform server */ if (get_terminal_size(&width, &height) != -1) { init_packet(&data, MT_PTYPE_DATA, srcmac, dstmac, sessionkey, outcounter); width = htole16(width); heigh...
0
1,897
Analyze the following 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 AppCacheHost::GetStatusWithCallback(const GetStatusCallback& callback, void* callback_param) { DCHECK(pending_start_update_callback_.is_null() && pending_swap_cache_callback_.is_null() && pending_get_status_callback_.is_null()); pending_get_sta...
0
18,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: int ip_route_input_noref(struct sk_buff *skb, __be32 daddr, __be32 saddr, u8 tos, struct net_device *dev) { struct fib_result res; int err; tos &= IPTOS_RT_MASK; rcu_read_lock(); err = ip_route_input_rcu(skb, daddr, saddr, tos, dev, &res); rcu_read_unlock(); return err; } Commit Message: net: check ...
0
18,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: void QQuickWebView::hoverEnterEvent(QHoverEvent* event) { Q_D(QQuickWebView); d->pageView->eventHandler()->handleHoverMoveEvent(event); } Commit Message: [Qt][WK2] Allow transparent WebViews https://bugs.webkit.org/show_bug.cgi?id=80608 Reviewed by Tor Arne Vestbø. Added support for transparentBackgrou...
0
3,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: set_ambient_capabilities (void) { if (is_privileged) return; prctl_caps (requested_caps, FALSE, TRUE); } Commit Message: Don't create our own temporary mount point for pivot_root An attacker could pre-create /tmp/.bubblewrap-$UID and make it a non-directory, non-symlink (in which case mounting our tmpfs...
0
9,448
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: ~RuntimeConfigItem() { if (admin) free(admin); if (config) free(config); } Commit Message: CWE ID: CWE-134
0
28,796
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void overloadedMethodC1Method(const v8::FunctionCallbackInfo<v8::Value>& info) { ExceptionState exceptionState(ExceptionState::ExecutionContext, "overloadedMethodC", "TestObjectPython", info.Holder(), info.GetIsolate()); if (UNLIKELY(info.Length() < 1)) { exceptionState.throwTypeError(Excep...
0
1,636
Analyze the following 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 AudioInputRendererHost::OnData(media::AudioInputController* controller, const uint8* data, uint32 size) { NOTREACHED() << "Only low-latency mode is supported."; } Commit Message: Improve validation when creating audio streams. BUG=16...
0
27,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: static void VoidMethodTestMultipleEnumArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { ExceptionState exception_state(info.GetIsolate(), ExceptionState::kExecutionContext, "TestObject", "voidMethodTestMultipleEnumArg"); TestObject* impl = V8TestObject::ToImpl(info.Holder()); if (UNLIKELY(info....
0
7,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: static int __init local_init(void) { int r = -ENOMEM; /* allocate a slab for the dm_ios */ _io_cache = KMEM_CACHE(dm_io, 0); if (!_io_cache) return r; _rq_tio_cache = KMEM_CACHE(dm_rq_target_io, 0); if (!_rq_tio_cache) goto out_free_io_cache; _rq_cache = kmem_cache_create("dm_old_clone_request", siz...
0
3,419
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: JBIG2Bitmap::JBIG2Bitmap(Guint segNumA, int wA, int hA): JBIG2Segment(segNumA) { w = wA; h = hA; line = (wA + 7) >> 3; if (w <= 0 || h <= 0 || line <= 0 || h >= (INT_MAX - 1) / line) { error(errSyntaxError, -1, "invalid width/height"); data = NULL; return; } data = (Guchar *)gmalloc_che...
0
11,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: AXObjectCache* Document::ExistingAXObjectCache() const { if (!AxObjectCacheOwner().GetLayoutView()) return 0; return AxObjectCacheOwner().ax_object_cache_.Get(); } Commit Message: Inherit CSP when we inherit the security origin This prevents attacks that use main window navigation to get out of the exi...
0
4,176
Analyze the following 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 dma_get_cache_alignment(void) { return ia64_max_cacheline_size; } Commit Message: [IA64] Workaround for RSE issue Problem: An application violating the architectural rules regarding operation dependencies and having specific Register Stack Engine (RSE) state at the time of the violation, may result ...
0
4,110
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool Smb4KGlobal::coreIsInitialized() { return p->coreInitialized; } Commit Message: CWE ID: CWE-20
0
28,471
Analyze the following 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 AreSwitchesIdenticalToCurrentCommandLine( const CommandLine& new_cmdline, const CommandLine& active_cmdline) { std::set<CommandLine::StringType> new_flags = ExtractFlagsFromCommandLine(new_cmdline); std::set<CommandLine::StringType> active_flags = ExtractFlagsFromCommandLine(active_cmdlin...
0
2,903
Analyze the following 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 NeedsScrollOrScrollTranslation(const LayoutObject& object) { if (!object.HasOverflowClip()) return false; IntSize scroll_offset = ToLayoutBox(object).ScrolledContentOffset(); return !scroll_offset.IsZero() || NeedsScrollNode(object); } Commit Message: Reland "[CI] Make paint property nodes ...
0
6,594
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: FloatQuad RenderBox::absoluteContentQuad() const { LayoutRect rect = contentBoxRect(); return localToAbsoluteQuad(FloatRect(rect)); } Commit Message: Separate repaint and layout requirements of StyleDifference (Step 1) Previously StyleDifference was an enum that proximately bigger values imply smaller v...
0
17,967
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: ID3::Iterator::~Iterator() { if (mID) { free(mID); mID = NULL; } } Commit Message: better validation lengths of strings in ID3 tags Validate lengths on strings in ID3 tags, particularly around 0. Also added code to handle cases when we can't get memory for copies of strings we want to extract ...
0
3,286
Analyze the following 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 init_mp_dev(struct pci_dev *pcidev, mppcibrd_t brd) { static struct mp_device_t *sbdev = mp_devs; unsigned long addr = 0; int j; struct resource *ret = NULL; sbdev->device_id = brd.device_id; pci_read_config_byte(pcidev, PCI_CLASS_REVISION, &(sbdev->revision)); sbdev->name = brd.name; sbdev->u...
0
3,469
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt) { struct l2cap_chan_list *l; struct l2cap_conn *conn = hcon->l2cap_data; struct sock *sk; if (!conn) return 0; l = &conn->chan_list; BT_DBG("conn %p", conn); read_lock(&l->lock); for (sk = l->head; sk; sk = l2cap_pi(sk)->ne...
0
21,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: void IterateOverPieces(const int sizes[], Callback2<int, int>::Type* function) { DCHECK_GT(sizes[0], 0); int pos = 0; int index = 0; while (pos < kDataSize) { int size = std::min(sizes[index], kDataSize - pos); ++index; if (sizes[index] <= 0) i...
0
10,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: fast_unwrap_error(krb5_context context, struct fast_state *state, KRB_ERROR *error) { if (state->armor_crypto == NULL) return check_fast(context, state); return 0; } Commit Message: CVE-2019-12098: krb5: always confirm PA-PKINIT-KX for anon PKINIT RFC8062 Section 7 requires verification of the PA-PKIN...
0
25,741
Analyze the following 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 _save_mc(struct microcode_intel **mc_saved, u8 *ucode_ptr, unsigned int *mc_saved_count_p) { int i; int found = 0; unsigned int mc_saved_count = *mc_saved_count_p; struct microcode_header_intel *mc_header; mc_header = (struct microcode_header_intel *)ucode_ptr; for (i = 0; i < mc_saved_c...
0
4,170
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: DEFINE_TRACE(Notification) { visitor->trace(m_asyncRunner); RefCountedGarbageCollectedEventTargetWithInlineData<Notification>::trace(visitor); ActiveDOMObject::trace(visitor); } Commit Message: Notification actions may have an icon url. This is behind a runtime flag for two reasons: * The implementa...
0
10,947
Analyze the following 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 TEE_Result load_elf(const TEE_UUID *uuid, struct user_ta_ctx *utc) { TEE_Result res; const struct user_ta_store_ops *op = NULL; SCATTERED_ARRAY_FOREACH(op, ta_stores, struct user_ta_store_ops) { DMSG("Lookup user TA ELF %pUl (%s)", (void *)uuid, op->description); res = load_elf_from_store(u...
0
26,573
Analyze the following 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 nested_vmx_setup_ctls_msrs(struct nested_vmx_msrs *msrs, bool apicv) { if (!nested) { memset(msrs, 0, sizeof(*msrs)); return; } /* * Note that as a general rule, the high half of the MSRs (bits in * the control fields which may be 1) should be initialized by the * intersection of the und...
0
14,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: SYSCALL_DEFINE0(munlockall) { int ret; if (down_write_killable(&current->mm->mmap_sem)) return -EINTR; ret = apply_mlockall_flags(0); up_write(&current->mm->mmap_sem); return ret; } Commit Message: mlock: fix mlock count can not decrease in race condition Kefeng reported that when running the follow tes...
0
16,696
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: hook_connect (struct t_weechat_plugin *plugin, const char *proxy, const char *address, int port, int sock, int ipv6, void *gnutls_sess, void *gnutls_cb, int gnutls_dhkey_size, const char *local_hostname, t_hook_callback_connect *callback, void *callback_data) { struct...
0
28,483
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: horizontalAccumulate8abgr(uint16 *wp, int n, int stride, unsigned char *op, unsigned char *ToLinear8) { register unsigned int cr, cg, cb, ca, mask; register unsigned char t0, t1, t2, t3; if (n >= stride) { mask = CODE_MASK; if (stride == 3) { op[0] = 0; t1 = ToLinear8[cb = (wp[2] & mas...
0
12,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: size_t Parcel::dataAvail() const { size_t result = dataSize() - dataPosition(); if (result > INT32_MAX) { abort(); } return result; } Commit Message: Add bound checks to utf16_to_utf8 Bug: 29250543 Change-Id: I518e7b2fe10aaa3f1c1987586a09b1110aff7e1a (cherry picked from commit 7e93b2ddcb49b5365fbe1d...
0
16,557
Analyze the following 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 WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) { DCHECK(data_source_ || chunk_demuxer_); if (data_source_) UMA_HISTOGRAM_TIMES("Media.UnderflowDuration2.SRC", duration); else UMA_HISTOGRAM_TIMES("Media.UnderflowDuration2.MSE", duration); if (is_encrypted_) UMA_HIS...
0
23,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: void ExtensionInstallDialogViewTestBase::SetUpOnMainThread() { ExtensionBrowserTest::SetUpOnMainThread(); extension_ = ExtensionBrowserTest::LoadExtension(test_data_dir_.AppendASCII( "install_prompt/permissions_scrollbar_regression")); web_contents_ = browser()->tab_strip_model()->GetWebContentsAt(0...
0
20,186
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: rad_send_request(struct rad_handle *h) { struct timeval timelimit; struct timeval tv; int fd; int n; n = rad_init_send_request(h, &fd, &tv); if (n != 0) return n; gettimeofday(&timelimit, NULL); timeradd(&tv, &timelimit, &timelimit); for ( ; ; ) { fd_set readfds; FD_ZERO(&readfds); FD_SET(fd...
0
26,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: int ip_route_input_rcu(struct sk_buff *skb, __be32 daddr, __be32 saddr, u8 tos, struct net_device *dev, struct fib_result *res) { /* Multicast recognition logic is moved from route cache to here. The problem was that too many Ethernet cards have broken/missing hardware multicast filters :-( As r...
0
14,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: static void free_mnt_ns(struct mnt_namespace *ns) { ns_free_inum(&ns->ns); dec_mnt_namespaces(ns->ucounts); put_user_ns(ns->user_ns); kfree(ns); } Commit Message: mnt: Add a per mount namespace limit on the number of mounts CAI Qian <caiqian@redhat.com> pointed out that the semantics of shared subtrees make...
0
7,015
Analyze the following 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
28,803
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: SWriteGetPortAttributeReply(ClientPtr client, xvGetPortAttributeReply * rep) { swaps(&rep->sequenceNumber); swapl(&rep->length); swapl(&rep->value); WriteToClient(client, sz_xvGetPortAttributeReply, rep); return Success; } Commit Message: CWE ID: CWE-20
0
11,558
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: MemoryObserver() {} Commit Message: Suspend shared timers while blockingly closing databases BUG=388771 R=michaeln@chromium.org Review URL: https://codereview.chromium.org/409863002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284785 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-362
0
26,171
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bt_status_t btif_dm_get_remote_service_record(bt_bdaddr_t *remote_addr, bt_uuid_t *uuid) { tSDP_UUID sdp_uuid; bdstr_t bdstr; BTIF_TRACE_EVENT("%s: remote_addr=%s", __FUNCTION__, bdaddr_to_string(remote_addr, bdstr, sizeof(bdstr))); sdp_uuid.len = MAX_UUID_SIZE; memcpy(sdp_uuid.uu.uuid128, uui...
0
7,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: int bdev_read_only(struct block_device *bdev) { if (!bdev) return 0; return bdev->bd_part->policy; } Commit Message: block: fix use-after-free in seq file I got a KASAN report of use-after-free: ================================================================== BUG: KASAN: use-after-free in klist_i...
0
28,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: void UserSelectionScreen::Show() {} Commit Message: cros: Check initial auth type when showing views login. Bug: 859611 Change-Id: I0298db9bbf4aed6bd40600aef2e1c5794e8cd058 Reviewed-on: https://chromium-review.googlesource.com/1123056 Reviewed-by: Xiaoyin Hu <xiaoyinh@chromium.org> Commit-Queue: Jacob Dufault <...
0
21,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: static void bond_attach_slave(struct bonding *bond, struct slave *new_slave) { if (bond->first_slave == NULL) { /* attaching the first slave */ new_slave->next = new_slave; new_slave->prev = new_slave; bond->first_slave = new_slave; } else { new_slave->next = bond->first_slave; new_slave->prev = bond-...
0
22,207
Analyze the following 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 handle_vmon(struct kvm_vcpu *vcpu) { struct kvm_segment cs; struct vcpu_vmx *vmx = to_vmx(vcpu); struct vmcs *shadow_vmcs; const u64 VMXON_NEEDED_FEATURES = FEATURE_CONTROL_LOCKED | FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SMX; /* The Intel VMX Instruction Reference lists a bunch of bits that * ...
0
305
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: divide (mpn_t a, mpn_t b, mpn_t *q) { /* Algorithm: First normalise a and b: a=[a[m-1],...,a[0]], b=[b[n-1],...,b[0]] with m>=0 and n>0 (in base beta = 2^GMP_LIMB_BITS). If m<n, then q:=0 and r:=a. If m>=n=1, perform a single-precision division: r:=0, j:=m, while j>0 do ...
0
29,288
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: MessageService* ExtensionSystemImpl::message_service() { return shared_->message_service(); } Commit Message: Check prefs before allowing extension file access in the permissions API. R=mpcomplete@chromium.org BUG=169632 Review URL: https://chromiumcodereview.appspot.com/11884008 git-svn-id: svn://svn.chr...
0
7,286
Analyze the following 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 ops_free_list(const struct pernet_operations *ops, struct list_head *net_exit_list) { struct net *net; if (ops->size && ops->id) { list_for_each_entry(net, net_exit_list, exit_list) ops_free(ops, net); } } Commit Message: net: Fix double free and memory corruption in get_net_ns_by_id() ...
0
10,705
Analyze the following 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 FrameFetchContext::ModifyRequestForCSP(ResourceRequest& resource_request) { if (IsDetached()) return; GetFrame()->Loader().RecordLatestRequiredCSP(); GetFrame()->Loader().ModifyRequestForCSP(resource_request, document_); } Commit Message: DevTools: send proper resource type in Network.RequestWill...
0
24,231
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static ssize_t comm_write(struct file *file, const char __user *buf, size_t count, loff_t *offset) { struct inode *inode = file->f_path.dentry->d_inode; struct task_struct *p; char buffer[TASK_COMM_LEN]; memset(buffer, 0, sizeof(buffer)); if (count > sizeof(buffer) - 1) count = sizeof(buffer) - 1; if...
0
12,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: static void DeleteFromArguments(Handle<JSObject> obj, uint32_t entry) { Handle<FixedArray> parameter_map(FixedArray::cast(obj->elements())); Handle<SeededNumberDictionary> dict( SeededNumberDictionary::cast(parameter_map->get(1))); uint32_t index = GetIndexForEntryImpl(*dict, entry); Handle<Object> result =...
0
7,809
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void FrameView::addSlowRepaintObject() { if (!m_slowRepaintObjectCount++) { if (Page* page = m_frame->page()) { if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator()) scrollingCoordinator->frameViewHasSlowRepaintObjectsDidChange(this); } ...
0
17,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: ModuleExport void UnregisterMSLImage(void) { (void) UnregisterMagickInfo("MSL"); #if defined(MAGICKCORE_XML_DELEGATE) xmlCleanupParser(); #endif } Commit Message: https://github.com/ImageMagick/ImageMagick/issues/636 CWE ID: CWE-772
0
5,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: BrowserPpapiHostImpl::InstanceData::InstanceData( const PepperRendererInstanceData& renderer_data) : renderer_data(renderer_data), is_throttled(false) { } Commit Message: Validate in-process plugin instance messages. Bug: 733548, 733549 Cq-Include-Trybots: master.tryserver.chromium.linux:linux_site_isol...
0
8,651
Analyze the following 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::AdjustFloatRectForScrollAndAbsoluteZoom( FloatRect& rect, const LayoutObject& layout_object) const { if (!View()) return; AdjustForAbsoluteZoom::AdjustFloatRect(rect, layout_object); } Commit Message: Cleanup and remove dead code in SetFocusedElement This early-out was added in: ...
0
13,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: static int hub_set_address(struct usb_device *udev, int devnum) { int retval; struct usb_hcd *hcd = bus_to_hcd(udev->bus); /* * The host controller will choose the device address, * instead of the core having chosen it earlier */ if (!hcd->driver->address_device && devnum <= 1) return -EINVAL; if (u...
0
17,207
Analyze the following 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_access(struct inode *inode, struct nfs_access_entry *entry) { struct nfs_server *server = NFS_SERVER(inode); struct nfs4_accessargs args = { .fh = NFS_FH(inode), .bitmask = server->cache_consistency_bitmask, }; struct nfs4_accessres res = { .server = server, }; struct rpc_message...
0
5,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: int ASN1_INTEGER_set(ASN1_INTEGER *a, long v) { int j, k; unsigned int i; unsigned char buf[sizeof(long) + 1]; long d; a->type = V_ASN1_INTEGER; if (a->length < (int)(sizeof(long) + 1)) { if (a->data != NULL) OPENSSL_free(a->data); if ((a->data = (...
0
3,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 ExtensionApiTest::RunExtensionTestIncognito( const std::string& extension_name) { return RunExtensionTestImpl(extension_name, std::string(), NULL, kFlagEnableIncognito | kFlagEnableFileAccess); } Commit Messag...
0
20,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: static int do_tcp_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen) { struct inet_connection_sock *icsk = inet_csk(sk); struct tcp_sock *tp = tcp_sk(sk); int val, len; if (get_user(len, optlen)) return -EFAULT; len = min_t(unsigned int, len, sizeof(int)); if...
0
28,334
Analyze the following 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 CL_Configstrings_f( void ) { int i; int ofs; if ( clc.state != CA_ACTIVE ) { Com_Printf( "Not connected to a server.\n"); return; } for ( i = 0 ; i < MAX_CONFIGSTRINGS ; i++ ) { ofs = cl.gameState.stringOffsets[ i ]; if ( !ofs ) { continue; } Com_Printf( "%4i: %s\n", i, cl.gameState.s...
0
27,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: void rds_send_reset(struct rds_connection *conn) { struct rds_message *rm, *tmp; unsigned long flags; if (conn->c_xmit_rm) { rm = conn->c_xmit_rm; conn->c_xmit_rm = NULL; /* Tell the user the RDMA op is no longer mapped by the * transport. This isn't entirely true (it's flushed out * independently...
0
6,675
Analyze the following 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 avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2), void *arg, int *ret, int count, int size) { int i; for (i = 0; i < count; i++) { int r = func(c, (char *)arg + i * size); if (ret) ret[i] = r; } emms_c(); return 0; } Commi...
0
15,085