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: base::TimeTicks SanitizeNavigationTiming( const base::TimeTicks& browser_navigation_start, const base::TimeTicks& renderer_navigation_start) { DCHECK(!browser_navigation_start.is_null()); return std::min(browser_navigation_start, renderer_navigation_start); } Commit Message: If a page calls |window.f...
0
14,023
Analyze the following 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 cryp_enable_power( struct device *dev, struct cryp_device_data *device_data, bool restore_device_context) { int ret = 0; dev_dbg(dev, "[%s]", __func__); spin_lock(&device_data->power_state_spinlock); if (!device_data->power_state) { ret = regulator_enable(device_data->pwr_regulator); if...
0
28,509
Analyze the following 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 InspectorPageAgent::ScreencastEnabled() { return enabled_ && state_->booleanProperty(PageAgentState::kScreencastEnabled, false); } Commit Message: DevTools: send proper resource type in Network.RequestWillBeSent This patch plumbs resoure type into the DispatchWillSendRequest instrumenation. This...
0
24,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 bdrv_is_whitelisted(BlockDriver *drv, bool read_only) { static const char *whitelist_rw[] = { CONFIG_BDRV_RW_WHITELIST }; static const char *whitelist_ro[] = { CONFIG_BDRV_RO_WHITELIST }; const char **p; if (!whitelist_rw[0] && !whitelist_ro[0]) { return...
0
1,869
Analyze the following 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 sock_kfree_s(struct sock *sk, void *mem, int size) { kfree(mem); atomic_sub(size, &sk->sk_omem_alloc); } Commit Message: net: sock: validate data_len before allocating skb in sock_alloc_send_pskb() We need to validate the number of pages consumed by data_len, otherwise frags array could be overflowed by ...
0
540
Analyze the following 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 WebLocalFrameImpl::SetFrameWidget(WebFrameWidgetBase* frame_widget) { frame_widget_ = frame_widget; } Commit Message: Inherit CSP when we inherit the security origin This prevents attacks that use main window navigation to get out of the existing csp constraints such as the related bug Bug: 747847 Chang...
0
28,434
Analyze the following 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 ext4_falloc_update_inode(struct inode *inode, int mode, loff_t new_size, int update_ctime) { struct timespec now; if (update_ctime) { now = current_fs_time(inode->i_sb); if (!timespec_equal(&inode->i_ctime, &now)) inode->i_ctime = now; } /* * Update only when preallocation was reques...
0
28,629
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: GF_Err gf_sm_load_run(GF_SceneLoader *load) { if (load->process) return load->process(load); return GF_OK; } Commit Message: fix some overflows due to strcpy fixes #1184, #1186, #1187 among other things CWE ID: CWE-119
0
14,354
Analyze the following 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 SkipConditionalFeatureEntry(const FeatureEntry& entry) { version_info::Channel channel = chrome::GetChannel(); #if defined(OS_CHROMEOS) if (!strcmp("mash", entry.internal_name) && channel == version_info::Channel::STABLE) { return true; } if (!strcmp(switches::kEnableUiDevTools, entry.inte...
0
28,010
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static v8::Local<v8::Function> createFunction(ScriptState* scriptState, ReadResult* value) { ReadResultCapturingFunction* self = new ReadResultCapturingFunction(scriptState, value); return self->bindToV8Function(); } Commit Message: Remove blink::ReadableStream This CL removes two st...
0
16,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: static void _zend_is_inconsistent(const HashTable *ht, const char *file, int line) { if ((ht->u.flags & HASH_MASK_CONSISTENCY) == HT_OK) { return; } switch ((ht->u.flags & HASH_MASK_CONSISTENCY)) { case HT_IS_DESTROYING: zend_output_debug_string(1, "%s(%d) : ht=%p is being destroyed", file, line, ht); ...
0
11,945
Analyze the following 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 TopSitesImpl::IsNonForcedFull() { return loaded_ && cache_->GetNumNonForcedURLs() >= kNonForcedTopSitesNumber; } 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 th...
0
29,451
Analyze the following 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 session_close(struct session *session) { if (session->have_thread) { pcap_breakloop(session->fp); #ifdef _WIN32 SetEvent(pcap_getevent(session->fp)); WaitForSingleObject(session->thread, INFINITE); CloseHandle(session->thread); session->have_thread = 0; session->thread = INVALID_HANDL...
0
5,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: void QQuickWebViewExperimental::setProxyAuthenticationDialog(QDeclarativeComponent* proxyAuthenticationDialog) { Q_D(QQuickWebView); if (d->proxyAuthenticationDialog == proxyAuthenticationDialog) return; d->proxyAuthenticationDialog = proxyAuthenticationDialog; emit proxyAuthenticationDial...
0
17,581
Analyze the following 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 size_t EncodeImage(Image *image,const unsigned char *scanline, const size_t bytes_per_line,unsigned char *pixels) { #define MaxCount 128 #define MaxPackbitsRunlength 128 register const unsigned char *p; register ssize_t i; register unsigned char *q; size_t length; ssize_t...
0
26,368
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static AddressParts gen_lea_modrm_0(CPUX86State *env, DisasContext *s, int modrm) { int def_seg, base, index, scale, mod, rm; target_long disp; bool havesib; def_seg = R_DS; index = -1; scale = 0; disp = 0; mod = (modrm >> 6) & 3; rm = modr...
0
26,860
Analyze the following 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 perf_cgroup_sched_out(struct task_struct *task) { } Commit Message: perf: Remove the nmi parameter from the swevent and overflow interface The nmi parameter indicated if we could do wakeups from the current context, if not, we would set some state and self-IPI and let the resulting interrupt ...
0
14,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: rend_service_receive_introduction(origin_circuit_t *circuit, const uint8_t *request, size_t request_len) { /* Global status stuff */ int status = 0, result; const or_options_t *options = get_options(); char *err_msg = NULL; int err_msg_...
0
18,467
Analyze the following 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 int cow_file_range_inline(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct inode *inode, u64 start, u64 end, size_t compressed_size, int compress_type, struct page **compressed_pages) { u64 isize = i_size_read(inode); u64 actual_end = min(end + 1, isize); u6...
0
20,233
Analyze the following 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 InlineLoginHandlerImpl::FinishCompleteLogin( const FinishCompleteLoginParams& params, Profile* profile, Profile::CreateStatus status) { std::string default_email; std::string validate_email; if (net::GetValueForKeyInQuery(params.url, "email", &default_email) && net::GetValueForKeyInQu...
0
5,268
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: dist_lb(PG_FUNCTION_ARGS) { #ifdef NOT_USED LINE *line = PG_GETARG_LINE_P(0); BOX *box = PG_GETARG_BOX_P(1); #endif /* need to think about this one for a while */ ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("function \"dist_lb\" not implemented"))); PG_RETURN_NULL(); } Com...
0
3,687
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: invoke_NPN_RequestRead(NPStream *stream, NPByteRange *rangeList) { npw_return_val_if_fail(rpc_method_invoke_possible(g_rpc_connection), NPERR_GENERIC_ERROR); int error = rpc_method_invoke(g_rpc_connection, RPC_METHOD_NPN_REQUEST_READ, RPC_TYPE_NP_STREAM, stream, RPC_TYPE_NP_BYT...
0
28,650
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void DevToolsSession::DispatchProtocolMessage( blink::mojom::DevToolsMessageChunkPtr chunk) { if (chunk->is_first && !response_message_buffer_.empty()) { ReceivedBadMessage(); return; } response_message_buffer_ += std::move(chunk->data); if (!chunk->is_last) return; if (!chunk->post_s...
0
23,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: smb2_new_read_req(struct kvec *iov, struct cifs_io_parms *io_parms, unsigned int remaining_bytes, int request_type) { int rc = -EACCES; struct smb2_read_req *req = NULL; rc = small_smb2_init(SMB2_READ, io_parms->tcon, (void **) &req); if (rc) return rc; if (io_parms->tcon->ses->server == NULL) retur...
0
1,730
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: rb_event_ts_length(struct ring_buffer_event *event) { unsigned len = 0; if (event->type_len == RINGBUF_TYPE_TIME_EXTEND) { /* time extends include the data event after it */ len = RB_LEN_TIME_EXTEND; event = skip_time_extend(event); } return len + rb_event_length(event); } Commit Message: ring-buffer:...
0
27,993
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: AccessibilityUIElement::~AccessibilityUIElement() { } Commit Message: [GTK][WTR] Implement AccessibilityUIElement::stringValue https://bugs.webkit.org/show_bug.cgi?id=102951 Reviewed by Martin Robinson. Implement AccessibilityUIElement::stringValue in the ATK backend in the same manner it is implemented in Dum...
0
16,153
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_type, char *sig, int sig_len, char *fname, char **signature, int *signature_len, char **error) /* {{{ */ { int read_size, len; zend_off_t read_len; unsigned char buf[1024]; php_stream_rewind(fp); switch (sig_type) { case PHAR_SI...
1
10,805
Analyze the following 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 llcp_tlv_rw(u8 *tlv) { return llcp_tlv8(tlv, LLCP_TLV_RW) & 0xf; } Commit Message: net: nfc: Fix NULL dereference on nfc_llcp_build_tlv fails KASAN report this: BUG: KASAN: null-ptr-deref in nfc_llcp_build_gb+0x37f/0x540 [nfc] Read of size 3 at addr 0000000000000000 by task syz-executor.0/5401 CPU:...
0
17,017
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: pair_decode(char *str, float8 *x, float8 *y, char **s) { int has_delim; char *cp; if (!PointerIsValid(str)) return FALSE; while (isspace((unsigned char) *str)) str++; if ((has_delim = (*str == LDELIM))) str++; while (isspace((unsigned char) *str)) str++; *x = strtod(str, &cp); if (cp <= st...
0
5,193
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool SpdyWriteQueue::IsEmpty() const { for (int i = MINIMUM_PRIORITY; i <= MAXIMUM_PRIORITY; i++) { if (!queue_[i].empty()) return false; } return true; } Commit Message: These can post callbacks which re-enter into SpdyWriteQueue. BUG=369539 Review URL: https://codereview.chromium.org/26593300...
0
6,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: static bool tcp_syn_flood_action(const struct sock *sk, const struct sk_buff *skb, const char *proto) { struct request_sock_queue *queue = &inet_csk(sk)->icsk_accept_queue; const char *msg = "Dropping request"; bool want_cookie = false; #ifdef CONFIG_SYN_COOKIES if (sysctl_tcp_syncookies) { msg =...
0
26,725
Analyze the following 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 ResourcePrefetchPredictorTest::SetUp() { InitializeSampleData(); CHECK(profile_->CreateHistoryService(true, false)); profile_->BlockUntilHistoryProcessesPendingRequests(); CHECK(HistoryServiceFactory::GetForProfile( profile_.get(), ServiceAccessType::EXPLICIT_ACCESS)); ResetPredictor(); co...
0
25,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: static void acct_clear(void) { memset(&acct_info, 0, sizeof(acct_info)); } Commit Message: CWE ID: CWE-20
0
18,932
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: SPL_METHOD(SplObjectStorage, current) { spl_SplObjectStorageElement *element; spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(getThis()); if (zend_parse_parameters_none() == FAILURE) { return; } if ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) == NULL) { return; } ZV...
0
26,664
Analyze the following 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 HTMLSelectElement::isPresentationAttribute(const QualifiedName& name) const { if (name == alignAttr) { return false; } return HTMLFormControlElementWithState::isPresentationAttribute(name); } Commit Message: SelectElement should remove an option when null is assigned by indexed setter ...
0
5,427
Analyze the following 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 status_t allocateBufferWithBackup( node_id node, OMX_U32 port_index, const sp<IMemory> &params, buffer_id *buffer) { Parcel data, reply; data.writeInterfaceToken(IOMX::getInterfaceDescriptor()); data.writeInt32((int32_t)node); data.writeInt32(port_index); ...
0
7,522
Analyze the following 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_put_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event) { intel_put_shared_regs_event_constraints(cpuc, event); } Commit Message: perf/x86: Fix offcore_rsp valid mask for SNB/IVB The valid mask for both offcore_response_0 and offcore_response_1 was wrong for SNB/SNB-E...
0
22,650
Analyze the following 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 http_req_rule *parse_http_req_cond(const char **args, const char *file, int linenum, struct proxy *proxy) { struct http_req_rule *rule; struct http_req_action_kw *custom = NULL; int cur_arg; char *error; rule = (struct http_req_rule*)calloc(1, sizeof(struct http_req_rule)); if (!rule) { Alert("par...
0
29,945
Analyze the following 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 aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) { unsigned index = id->driver_data; struct Scsi_Host *shost; struct aac_dev *aac; struct list_head *insert = &aac_devices; int error = -ENODEV; int unique_id = 0; u64 dmamask; extern int aac_sync_mode; list_for_each_entry(aac...
0
9,588
Analyze the following 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 GURL& url() const { return url_; } Commit Message: Fix UAF in Origin Info Bubble and permission settings UI. In addition to fixing the UAF, will this also fix the problem of the bubble showing over the previous tab (if the bubble is open when the tab it was opened for closes). BUG=490492 TBR=tedchoc R...
0
11,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: static int hid_parser_reserved(struct hid_parser *parser, struct hid_item *item) { dbg_hid("reserved item type, tag 0x%x\n", item->tag); return 0; } Commit Message: HID: core: prevent out-of-bound readings Plugging a Logitech DJ receiver with KASAN activated raises a bunch of out-of-bound readings. The field...
0
25,531
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: tracing_saved_cmdlines_size_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos) { char buf[64]; int r; arch_spin_lock(&trace_cmdline_lock); r = scnprintf(buf, sizeof(buf), "%u\n", savedcmd->cmdline_num); arch_spin_unlock(&trace_cmdline_lock); return simple_read_from_buffer(ubuf, cnt,...
0
27,175
Analyze the following 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 SparseHistogram::AddCount(Sample value, int count) { if (count <= 0) { NOTREACHED(); return; } { base::AutoLock auto_lock(lock_); samples_->Accumulate(value, count); } FindAndRunCallback(value); } Commit Message: Convert DCHECKs to CHECKs for histogram types When a histogram is l...
0
7,683
Analyze the following 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 CollectScrollDeltas(ScrollAndScaleSet* scroll_info, LayerTreeImpl* tree_impl) { if (tree_impl->LayerListIsEmpty()) return; int inner_viewport_layer_id = tree_impl->InnerViewportScrollLayer() ? tree_impl->InnerViewportScrollLayer()->id() ...
0
11,923
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int pppol2tp_seq_show(struct seq_file *m, void *v) { struct pppol2tp_seq_data *pd = v; /* display header on line 1 */ if (v == SEQ_START_TOKEN) { seq_puts(m, "PPPoL2TP driver info, " PPPOL2TP_DRV_VERSION "\n"); seq_puts(m, "TUNNEL name, user-data-ok session-count\n"); seq_puts(m, " debug tx-pkts/...
0
7,929
Analyze the following 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 hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv, const char* name) { unsigned long flags = 0; int bin; IRDA_ASSERT( hashbin != NULL, return;); IRDA_ASSERT( hashbin->magic == HB_MAGIC, return;); /* * Locate hashbin */ if ( name ) hashv = hash( name ); bin = GET_HASHBIN(...
0
1,795
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: inline void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(FloatingObject* newFloat) { LayoutUnit height = m_block->logicalHeight(); if (height < newFloat->logicalTop(m_block->isHorizontalWritingMode()) || height >= newFloat->logicalBottom(m_block->isHorizontalWritingMode())) return; Shap...
0
6,835
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void SpeechRecognitionManagerImpl::StartSession(int session_id) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (!SessionExists(session_id)) return; if (primary_session_id_ != kSessionIDInvalid && primary_session_id_ != session_id) { AbortSession(primary_session_id_); } primary_session_id_ ...
0
27,988
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: parserInit(XML_Parser parser, const XML_Char *encodingName) { parser->m_processor = prologInitProcessor; XmlPrologStateInit(&parser->m_prologState); if (encodingName != NULL) { parser->m_protocolEncodingName = copyString(encodingName, &(parser->m_mem)); } parser->m_curBase = NULL; XmlInitEncoding(...
0
23,260
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: XRecordFreeData(XRecordInterceptData *data) { /* we can do this cast because that is what we really allocated */ struct intercept_queue *iq = (struct intercept_queue *)data; struct reply_buffer *rbp = NULL; struct mem_cache_str *cache = iq->cache; /* * figure out what reply_buffer this p...
0
23,935
Analyze the following 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_wvc_bitstream (WavpackStream *wps, WavpackMetadata *wpmd) { if (!wpmd->byte_length || (wpmd->byte_length & 1)) return FALSE; bs_open_read (&wps->wvcbits, wpmd->data, (unsigned char *) wpmd->data + wpmd->byte_length); return TRUE; } Commit Message: fixes for 4 fuzz failures po...
0
13,106
Analyze the following 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_replace(struct net *net, const void __user *user, unsigned int len) { int ret; struct arpt_replace tmp; struct xt_table_info *newinfo; void *loc_cpu_entry; struct arpt_entry *iter; if (copy_from_user(&tmp, user, sizeof(tmp)) != 0) return -EFAULT; /* overflow check */ if (tmp.num_...
0
18,820
Analyze the following 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
7,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 ReportPrintDestinationHistogram(enum PrintDestinationBuckets event) { UMA_HISTOGRAM_ENUMERATION("PrintPreview.DestinationAction", event, PRINT_DESTINATION_BUCKET_BOUNDARY); } Commit Message: Print preview: Use an ID instead of memory pointer string in WebUI. BUG=144051 Review...
0
1,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: static int em_imul_3op(struct x86_emulate_ctxt *ctxt) { ctxt->dst.val = ctxt->src2.val; return fastop(ctxt, em_imul); } Commit Message: KVM: emulate: avoid accessing NULL ctxt->memopp A failure to decode the instruction can cause a NULL pointer access. This is fixed simply by moving the "done" label as close ...
0
29,661
Analyze the following 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::string16 AuthenticatorBlePowerOnManualSheetModel::GetAcceptButtonLabel() const { return l10n_util::GetStringUTF16(IDS_WEBAUTHN_BLUETOOTH_POWER_ON_MANUAL_NEXT); } Commit Message: chrome/browser/ui/webauthn: long domains may cause a line break. As requested by UX in [1], allow long host names to split...
0
10,254
Analyze the following 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 ExtensionSettingsHandler::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterBooleanPref(prefs::kExtensionsUIDeveloperMode, false, PrefService::SYNCABLE_PREF); } Commit Message: [i18n-fixlet] Make strings branding specific in extension code. I...
0
19,203
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void DevToolsWindow::OpenDevToolsWindowForFrame( Profile* profile, const scoped_refptr<content::DevToolsAgentHost>& agent_host) { DevToolsWindow* window = FindDevToolsWindow(agent_host.get()); if (!window) { window = DevToolsWindow::Create(profile, GURL(), nullptr, false, false, ...
0
14,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: PassRefPtr<Attr> Element::removeAttributeNode(Attr* attr, ExceptionCode& ec) { if (!attr) { ec = TYPE_MISMATCH_ERR; return 0; } if (attr->ownerElement() != this) { ec = NOT_FOUND_ERR; return 0; } ASSERT(document() == attr->document()); synchronizeAttribute...
0
9,063
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: rtadv_recv_packet (int sock, u_char *buf, int buflen, struct sockaddr_in6 *from, ifindex_t *ifindex, int *hoplimit) { int ret; struct msghdr msg; struct iovec iov; struct cmsghdr *cmsgptr; struct in6_addr dst; char adata[1024]; /* Fill in message and iovec. */ msg.msg_name = (void *) ...
0
11,393
Analyze the following 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 WebRTCAudioDeviceTest::OnGetHardwareInputChannelCount(uint32* channels) { EXPECT_TRUE(audio_util_callback_); *channels = audio_util_callback_ ? audio_util_callback_->GetAudioInputHardwareChannelCount( AudioManagerBase::kDefaultDeviceId) : 0; } Commit Message: Allow browser to handle all ...
0
15,538
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: float Parcel::readFloat() const { return readAligned<float>(); } Commit Message: Disregard alleged binder entities beyond parcel bounds When appending one parcel's contents to another, ignore binder objects within the source Parcel that appear to lie beyond the formal bounds of that Parcel's data buffer. Bug ...
0
2,319
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void WebGLRenderingContextBase::DrawingBufferClientRestoreTexture2DBinding() { if (!ContextGL()) return; RestoreCurrentTexture2D(); } Commit Message: Reset ES3 pixel pack parameters and PIXEL_PACK_BUFFER binding in DrawingBuffer before ReadPixels() and recover them later. BUG=740603 TEST=new conformance...
0
4,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: static bool ExecuteStyleWithCSS(LocalFrame& frame, Event*, EditorCommandSource, const String& value) { frame.GetEditor().SetShouldStyleWithCSS( !DeprecatedEqualIgnoringCase(value, "false")); return true; } C...
0
19,821
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void reflectTestInterfaceAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) { TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); TestObjectPythonV8Internal::reflectTestInterfaceAttributeAttributeGetter(info); TRACE_EVENT_SET_SAMPLING_STAT...
0
23,933
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: TabContentsWrapper* Browser::GetConstrainingContentsWrapper( TabContentsWrapper* source) { return source; } Commit Message: Implement a bubble that appears at the top of the screen when a tab enters fullscreen mode via webkitRequestFullScreen(), telling the user how to exit fullscreen. This is implemente...
0
14,133
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: points_box(PG_FUNCTION_ARGS) { Point *p1 = PG_GETARG_POINT_P(0); Point *p2 = PG_GETARG_POINT_P(1); PG_RETURN_BOX_P(box_construct(p1->x, p2->x, p1->y, p2->y)); } Commit Message: Predict integer overflow to avoid buffer overruns. Several functions, mostly type input functions, calculated an allocation s...
0
22,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: void RenderViewImpl::OnSelectRange(const gfx::Point& start, const gfx::Point& end) { if (!webview()) return; handling_select_range_ = true; webview()->focusedFrame()->selectRange(start, end); handling_select_range_ = false; } Commit Message: Allow browser to handle...
0
2,786
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: raptor_free_option_description(raptor_option_description* option_description) { if(!option_description) return; /* these are shared strings pointing to static data in raptor_options_list[] */ /* RAPTOR_FREE(char*, option_description->name); */ /* RAPTOR_FREE(char*, option_description->label); */ i...
0
6,491
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int lxc_attach_drop_privs(struct lxc_proc_context_info *ctx) { int last_cap = lxc_caps_last_cap(); int cap; for (cap = 0; cap <= last_cap; cap++) { if (ctx->capability_mask & (1LL << cap)) continue; if (prctl(PR_CAPBSET_DROP, cap, 0, 0, 0)) { SYSERROR("failed to remove capability id %d", cap...
0
24,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: ~SandboxSymbolizeHelper() { UnregisterCallback(); CloseObjectFiles(); } Commit Message: Convert ARRAYSIZE_UNSAFE -> arraysize in base/. R=thestig@chromium.org BUG=423134 Review URL: https://codereview.chromium.org/656033009 Cr-Commit-Position: refs/heads/master@{#299835} CWE ID: CWE-189
0
16,054
Analyze the following 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 ResourceDispatcherHostImpl::BlockRequestsForRoute(int child_id, int route_id) { DCHECK_CURRENTLY_ON(BrowserThread::IO); GlobalRoutingID key(child_id, route_id); DCHECK(blocked_loaders_map_.find(key) == blocked_loaders_map_.end()) << "BlockReq...
0
2,516
Analyze the following 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 ParamTraits<DictionaryValue>::Log(const param_type& p, std::string* l) { std::string json; base::JSONWriter::Write(&p, &json); l->append(json); } Commit Message: Validate that paths don't contain embedded NULLs at deserialization. BUG=166867 Review URL: https://chromiumcodereview.appspot.com/1174300...
0
8,205
Analyze the following 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 nfs_callback_up(u32 minorversion, struct rpc_xprt *xprt) { struct svc_serv *serv; struct nfs_callback_data *cb_info = &nfs_callback_info[minorversion]; int ret; struct net *net = xprt->xprt_net; mutex_lock(&nfs_callback_mutex); serv = nfs_callback_create_svc(minorversion); if (IS_ERR(serv)) { ret =...
0
14,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 void fill_timing_for_id3_timestamped_stream(struct playlist *pls) { if (pls->id3_offset >= 0) { pls->pkt.dts = pls->id3_mpegts_timestamp + av_rescale_q(pls->id3_offset, pls->ctx->streams[pls->pkt.stream_index]->time_...
0
28,700
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: vrrp_tfile_weight_handler(vector_t *strvec) { int weight; vrrp_tracked_file_t *tfile = LIST_TAIL_DATA(vrrp_data->vrrp_track_files); if (vector_size(strvec) < 2) { report_config_error(CONFIG_GENERAL_ERROR, "No weight specified for track file %s - ignoring", tfile->fname); return; } if (tfile->weight != 1...
0
3,187
Analyze the following 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 WebContentsImpl::OnAudioStateChanged(bool is_audible) { SendPageMessage(new PageMsg_AudioStateChanged(MSG_ROUTING_NONE, is_audible)); NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB); } Commit Message: If JavaScript shows a dialog, cause the page to lose fullscreen. BUG=670135, 550017, 726761, 728276...
0
26,206
Analyze the following 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 unix_release(struct socket *sock) { struct sock *sk = sock->sk; if (!sk) return 0; unix_release_sock(sk, 0); sock->sk = NULL; return 0; } Commit Message: net: rework recvmsg handler msg_name and msg_namelen logic This patch now always passes msg->msg_namelen as 0. recvmsg handlers must set ...
0
10,156
Analyze the following 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 rt6_release(struct rt6_info *rt) { if (atomic_dec_and_test(&rt->rt6i_ref)) dst_free(&rt->dst); } Commit Message: net: fib: fib6_add: fix potential NULL pointer dereference When the kernel is compiled with CONFIG_IPV6_SUBTREES, and we return with an error in fn = fib6_add_1(), then erro...
0
16,754
Analyze the following 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 venc_dev::venc_enable_initial_qp(QOMX_EXTNINDEX_VIDEO_INITIALQP* initqp) { int rc; struct v4l2_control control; struct v4l2_ext_control ctrl[4]; struct v4l2_ext_controls controls; ctrl[0].id = V4L2_CID_MPEG_VIDC_VIDEO_I_FRAME_QP; ctrl[0].value = initqp->nQpI; ctrl[1].id = V4L2_CID_MPEG_VIDC_...
0
29,605
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: setPathObject(JsonbIterator **it, Datum *path_elems, bool *path_nulls, int path_len, JsonbParseState **st, int level, Jsonb *newval, uint32 npairs, bool create) { JsonbValue v; int i; JsonbValue k; bool done = false; if (level >= path_len || path_nulls[level]) done = true; /* empty object i...
0
15,394
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: u32 flow_hash_from_keys(struct flow_keys *keys) { __flow_hash_secret_init(); return __flow_hash_from_keys(keys, hashrnd); } Commit Message: flow_dissector: Jump to exit code in __skb_flow_dissect Instead of returning immediately (on a parsing failure for instance) we jump to cleanup code. This always sets pro...
0
16,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: static int perf_fasync(int fd, struct file *filp, int on) { struct inode *inode = file_inode(filp); struct perf_event *event = filp->private_data; int retval; mutex_lock(&inode->i_mutex); retval = fasync_helper(fd, filp, on, &event->fasync); mutex_unlock(&inode->i_mutex); if (retval < 0) return retval;...
0
21,227
Analyze the following 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 pmcraid_ioa_reset(struct pmcraid_cmd *cmd) { struct pmcraid_instance *pinstance = cmd->drv_inst; u8 reset_complete = 0; pinstance->ioa_reset_in_progress = 1; if (pinstance->reset_cmd != cmd) { pmcraid_err("reset is called with different command block\n"); pinstance->reset_cmd = cmd; } pmc...
0
27,092
Analyze the following 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 gboolean highlight_forbidden(void) { GList *forbidden_words = load_words_from_file(FORBIDDEN_WORDS_BLACKLLIST); GList *allowed_words = load_words_from_file(FORBIDDEN_WORDS_WHITELIST); const gboolean result = highligh_words_in_tabs(forbidden_words, allowed_words, /*case sensitive*/false); ...
0
23,569
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: AMRSource::~AMRSource() { if (mStarted) { stop(); } } Commit Message: Fix integer overflow and divide-by-zero Bug: 35763994 Test: ran CTS with and without fix Change-Id: If835e97ce578d4fa567e33e349e48fb7b2559e0e (cherry picked from commit 8538a603ef992e75f29336499cb783f3ec19f18c) CWE ID: CWE-190
0
26,160
Analyze the following 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 fz_colorspace_is_device_gray(fz_context *ctx, const fz_colorspace *cs) { return fz_colorspace_is_device(ctx, cs) && fz_colorspace_is_gray(ctx, cs); } Commit Message: CWE ID: CWE-20
0
28,742
Analyze the following 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 RuntimeCallStatsCounterReadOnlyAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) { v8::Local<v8::Object> holder = info.Holder(); TestObject* impl = V8TestObject::ToImpl(holder); V8SetReturnValue(info, impl->runtimeCallStatsCounterReadOnlyAttribute()); } Commit Message:...
0
22,191
Analyze the following 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_xdr_enc_create(struct rpc_rqst *req, struct xdr_stream *xdr, const struct nfs4_create_arg *args) { struct compound_hdr hdr = { .minorversion = nfs4_xdr_minorversion(&args->seq_args), }; encode_compound_hdr(xdr, req, &hdr); encode_sequence(xdr, &args->seq_args, &hdr); encode_putfh(xdr,...
0
10,139
Analyze the following 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 js_isnumber(js_State *J, int idx) { return stackidx(J, idx)->type == JS_TNUMBER; } Commit Message: CWE ID: CWE-119
0
5,683
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: unsigned HTMLInputElement::width() const { return input_type_->Width(); } Commit Message: MacViews: Enable secure text input for password Textfields. In Cocoa the NSTextInputContext automatically enables secure text input when activated and it's in the secure text entry mode. RenderWidgetHostViewMac did the ...
0
19,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: ExtensionFunction::ResponseAction UsbGetDevicesFunction::Run() { scoped_ptr<extensions::core_api::usb::GetDevices::Params> parameters = GetDevices::Params::Create(*args_); EXTENSION_FUNCTION_VALIDATE(parameters.get()); if (parameters->options.filters) { filters_.resize(parameters->options.filters...
0
25,622
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int asymmetric_keyid_match(const char *kid, const char *id) { size_t idlen, kidlen; if (!kid || !id) return 0; /* make it possible to use id as in the request: "id:<id>" */ if (strncmp(id, "id:", 3) == 0) id += 3; /* Anything after here requires a partial match on the ID string */ idlen = strlen(id);...
0
4,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: xfs_attr_shortform_getvalue(xfs_da_args_t *args) { xfs_attr_shortform_t *sf; xfs_attr_sf_entry_t *sfe; int i; ASSERT(args->dp->i_afp->if_flags == XFS_IFINLINE); sf = (xfs_attr_shortform_t *)args->dp->i_afp->if_u1.if_data; sfe = &sf->list[0]; for (i = 0; i < sf->hdr.count; sfe = XFS_ATTR_SF_NEXTENTRY(s...
0
18,485
Analyze the following 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 LauncherView::RemoveIconObserver(LauncherIconObserver* observer) { observers_.RemoveObserver(observer); } Commit Message: ash: Add launcher overflow bubble. - Host a LauncherView in bubble to display overflown items; - Mouse wheel and two-finger scroll to scroll the LauncherView in bubble in case overflo...
0
17,780
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: mprint(struct magic_set *ms, struct magic *m) { uint64_t v; float vf; double vd; int64_t t = 0; char buf[128], tbuf[26]; union VALUETYPE *p = &ms->ms_value; switch (m->type) { case FILE_BYTE: v = file_signextend(ms, m, (uint64_t)p->b); switch (check_fmt(ms, m)) { case -1: return -1; case ...
0
1,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: static void print_guid(ff_asf_guid *g) { int i; PRINT_IF_GUID(g, ff_asf_header); else PRINT_IF_GUID(g, ff_asf_file_header); else PRINT_IF_GUID(g, ff_asf_stream_header); else PRINT_IF_GUID(g, ff_asf_audio_stream); else PRINT_IF_GUID(g, ff_asf_audio_conceal_none); else PRINT_IF_GUID(g, f...
0
4,233
Analyze the following 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 smp_send_keypress_notification(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) { p_cb->local_keypress_notification = *(uint8_t*)p_data; smp_send_cmd(SMP_OPCODE_PAIR_KEYPR_NOTIF, p_cb); } Commit Message: DO NOT MERGE Fix OOB read before buffer length check Bug: 111936834 Test: manual Change-Id: Ib98528fb62db0d724...
0
29,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 jspInit() { jspSoftInit(); } Commit Message: Fix bug if using an undefined member of an object for for..in (fix #1437) CWE ID: CWE-125
0
18,986
Analyze the following 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::SyncModelHasUserCreatedNodes(bool* has_nodes) { DCHECK(has_nodes); *has_nodes = false; int64 typed_url_sync_id; if (!GetSyncIdForTaggedNode(kTypedUrlTag, &typed_url_sync_id)) { LOG(ERROR) << "Server did not create the top-level typed_url node. We " << "migh...
0
29,246