instruction
stringclasses
1 value
input
stringlengths
56
241k
output
int64
0
1
__index_level_0__
int64
0
175k
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: PassRefPtrWillBeRawPtr<Element> Document::createElement(const QualifiedName& qName, bool createdByParser) { RefPtrWillBeRawPtr<Element> e = nullptr; if (qName.namespaceURI() == xhtmlNamespaceURI) e = HTMLElementFactory::createHTMLElement(qName.localName(), *this, 0, createdByParser); else if ...
0
124,317
Analyze the following 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(SplDoublyLinkedList, valid) { spl_dllist_object *intern = Z_SPLDLLIST_P(getThis()); if (zend_parse_parameters_none() == FAILURE) { return; } RETURN_BOOL(intern->traverse_pointer != NULL); } Commit Message: Fix bug #71735: Double-free in SplDoublyLinkedList::offsetSet CWE ID: CWE-415
0
54,292
Analyze the following 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 ChromeNetworkDelegate::OnBeforeSendHeaders( net::URLRequest* request, const net::CompletionCallback& callback, net::HttpRequestHeaders* headers) { TRACE_EVENT_ASYNC_STEP_PAST0("net", "URLRequest", request, "SendRequest"); return ExtensionWebRequestEventRouter::GetInstance()->OnBeforeSendHeader...
0
113,563
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: NavigationRequest::TakeNavigationHandle() { return std::move(navigation_handle_); } Commit Message: Use an opaque URL rather than an empty URL for request's site for cookies. Apparently this makes a big difference to the cookie settings backend. Bug: 881715 Change-Id: Id87fa0c6a858bae6a3f8fff4d6af3f974b00d5e...
0
132,964
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: MagickExport int LocaleUppercase(const int c) { #if defined(MAGICKCORE_LOCALE_SUPPORT) if (c_locale != (locale_t) NULL) return(toupper_l((int) ((unsigned char) c),c_locale)); #endif return(toupper((int) ((unsigned char) c))); } Commit Message: ... CWE ID: CWE-125
1
169,712
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: psf_close_rsrc (SF_PRIVATE *psf) { psf_close_fd (psf->rsrc.filedes) ; psf->rsrc.filedes = -1 ; return 0 ; } /* psf_close_rsrc */ Commit Message: src/file_io.c : Prevent potential divide-by-zero. Closes: https://github.com/erikd/libsndfile/issues/92 CWE ID: CWE-189
0
45,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: sharg_append(GArray *a, const gchar *str) { const gchar *s = (str ? str : ""); g_array_append_val(a, s); } Commit Message: disable Uzbl javascript object because of security problem. CWE ID: CWE-264
0
18,404
Analyze the following 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_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname, u32, mask) { struct fsnotify_group *group; struct inode *inode; struct path path; struct file *filp; int ret, fput_needed; unsigned flags = 0; filp = fget_light(fd, &fput_needed); if (unlikely(!filp)) return -EBADF; /* verif...
0
27,533
Analyze the following 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 TestRenderFrame::DeleteSurroundingText(int before, int after) { GetFrameInputHandler()->DeleteSurroundingText(before, after); } Commit Message: Convert FrameHostMsg_DidAddMessageToConsole to Mojo. Note: Since this required changing the test RenderViewImplTest.DispatchBeforeUnloadCanDetachFrame, I manuall...
0
139,919
Analyze the following 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 nfsd_pool_stats_release(struct inode *inode, struct file *file) { int ret = seq_release(inode, file); struct net *net = inode->i_sb->s_fs_info; mutex_lock(&nfsd_mutex); /* this function really, really should have been called svc_put() */ nfsd_destroy(net); mutex_unlock(&nfsd_mutex); return ret; } Com...
0
67,146
Analyze the following 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 void TabClosingAt(TabStripModel* tab_strip_model, TabContentsWrapper* contents, int index) { states_.push_back(new State(contents, index, CLOSE)); } Commit Message: chromeos: fix bug where "aw snap" page replaces first tab if it was a NTP wh...
0
98,177
Analyze the following 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 airo_get_name(struct net_device *dev, struct iw_request_info *info, char *cwrq, char *extra) { strcpy(cwrq, "IEEE 802.11-DS"); return 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 d...
0
23,955
Analyze the following 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 llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) { struct sock *sk = sock->sk; struct llc_sock *llc = llc_sk(sk); DECLARE_SOCKADDR(struct sockaddr_llc *, addr, msg->msg_name); int flags = msg->msg_flags; int noblock = flags & MSG_DONTWAIT; struct sk_buff *skb; size_t size = 0;...
0
53,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 Pause() { host_->OnPauseStream(kStreamId); SyncWithAudioThread(); } Commit Message: Switching AudioOutputAuthorizationHandler from using AudioManager interface to AudioSystem one. BUG=672468 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromiu...
0
128,209
Analyze the following 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_compare(const void *a, const void *b) { xfs_attr_sf_sort_t *sa, *sb; sa = (xfs_attr_sf_sort_t *)a; sb = (xfs_attr_sf_sort_t *)b; if (sa->hash < sb->hash) { return(-1); } else if (sa->hash > sb->hash) { return(1); } else { return(sa->entno - sb->entno); } } Commit Message: xfs: re...
0
44,965
Analyze the following 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 OMXNodeInstance::prepareForAdaptivePlayback( OMX_U32 portIndex, OMX_BOOL enable, OMX_U32 maxFrameWidth, OMX_U32 maxFrameHeight) { Mutex::Autolock autolock(mLock); CLOG_CONFIG(prepareForAdaptivePlayback, "%s:%u en=%d max=%ux%u", portString(portIndex), portIndex, enable, ma...
0
157,577
Analyze the following 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_event(struct perf_event *event) { irq_work_sync(&event->pending); if (!event->parent) { if (event->attach_state & PERF_ATTACH_TASK) jump_label_dec(&perf_sched_events); if (event->attr.mmap || event->attr.mmap_data) atomic_dec(&nr_mmap_events); if (event->attr.comm) atomic_dec(&n...
0
26,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: PluginModule::PluginModule(const std::string& name, const FilePath& path, PluginDelegate::ModuleLifetime* lifetime_delegate) : lifetime_delegate_(lifetime_delegate), callback_tracker_(new ::ppapi::CallbackTracker), is_in_destructor_(false), ...
1
170,747
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: TEE_Result tee_mmu_user_pa2va_helper(const struct user_ta_ctx *utc, paddr_t pa, void **va) { TEE_Result res; paddr_t p; struct vm_region *region; TAILQ_FOREACH(region, &utc->vm_info->regions, link) { size_t granule; size_t size; size_t ofs; /* pa2va is expected only for memory tracked thro...
0
86,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: int dtls1_read_bytes(SSL *s, int type, int *recvd_type, unsigned char *buf, int len, int peek) { int al, i, j, ret; unsigned int n; SSL3_RECORD *rr; void (*cb) (const SSL *ssl, int type2, int val) = NULL; if (!SSL3_BUFFER_is_initialised(&s->rlayer.rbuf)) { /* Not ...
1
165,262
Analyze the following 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 dev_gso_skb_destructor(struct sk_buff *skb) { struct dev_gso_cb *cb; do { struct sk_buff *nskb = skb->next; skb->next = nskb->next; nskb->next = NULL; kfree_skb(nskb); } while (skb->next); cb = DEV_GSO_CB(skb); if (cb->destructor) cb->destructor(skb); } Commit Message: veth: Dont kf...
0
32,118
Analyze the following 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 mptsas_config_sas_io_unit_3(MPTSASState *s, uint8_t **data, int address) { return MPTSAS_CONFIG_PACK_EXT(3, MPI_CONFIG_EXTPAGETYPE_SAS_IO_UNIT, 0x06, "*l*l*l*l*l*l*l*l*l"); } Commit Message: CWE ID: CWE-20
0
8,668
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void NodeAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) { v8::Local<v8::Object> holder = info.Holder(); TestObject* impl = V8TestObject::ToImpl(holder); V8SetReturnValueFast(info, WTF::GetPtr(impl->nodeAttribute()), impl); } Commit Message: bindings: Support "attribute F...
0
134,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 CreateHTTPRangeResponseHeader( /*! String containing the range. */ char *ByteRangeSpecifier, /*! Length of the file. */ off_t FileLength, /*! [out] SendInstruction object where the range operations will be stored. */ struct SendInstruction *Instr) { off_t FirstByte, LastByte; char *RangeInput; ...
0
73,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: void SetGuestLocale(Profile* const profile) { std::unique_ptr<GuestLanguageSetCallbackData> data( new GuestLanguageSetCallbackData(profile)); locale_util::SwitchLanguageCallback callback(base::Bind( &GuestLanguageSetCallbackData::Callback, base::Passed(std::move(data)))); const user_manager::Use...
0
124,051
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: long kvm_arch_vm_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) { struct kvm *kvm = filp->private_data; void __user *argp = (void __user *)arg; int r = -ENOTTY; switch (ioctl) { case KVM_SET_MEMORY_REGION: { struct kvm_memory_region kvm_mem; struct kvm_userspace_memory_region kvm_user...
0
20,614
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool Textfield::GetTextFromRange(const gfx::Range& range, base::string16* range_text) const { if (!ImeEditingAllowed() || !range.IsValid()) return false; gfx::Range text_range; if (!GetTextRange(&text_range) || !text_range.Contains(range)) return false; *range_te...
0
126,350
Analyze the following 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 MaybeReportDownloadDeepScanningVerdict( Profile* profile, const GURL& url, const std::string& file_name, const std::string& download_digest_sha256, BinaryUploadService::Result result, DeepScanningClientResponse response) { if (response.malware_scan_verdict().verdict() == ...
1
172,413
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: toggle_dac_capability(int writable, int enable) { int rc; cap_t caps; cap_value_t capability = writable ? CAP_DAC_OVERRIDE : CAP_DAC_READ_SEARCH; if (getuid() != 0) return 0; caps = cap_get_proc(); if (caps == NULL) { fprintf(stderr, "Unable to get current capability set: %s\n", strerror(errno)); ...
0
2,053
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: test_bson_build_child (void) { bson_t b; bson_t child; bson_t *b2; bson_t *child2; bson_init (&b); BSON_ASSERT (bson_append_document_begin (&b, "foo", -1, &child)); BSON_ASSERT (bson_append_utf8 (&child, "bar", -1, "baz", -1)); BSON_ASSERT (bson_append_document_end (&b, &child)); b2 =...
0
77,899
Analyze the following 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 CameraClient::handlePostview(const sp<IMemory>& mem) { disableMsgType(CAMERA_MSG_POSTVIEW_FRAME); sp<ICameraClient> c = mRemoteCallback; mLock.unlock(); if (c != 0) { c->dataCallback(CAMERA_MSG_POSTVIEW_FRAME, mem, NULL); } } Commit Message: Camera: Disallow dumping clients directly ...
0
161,781
Analyze the following 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 WebContentsImpl::CreateSwappedOutRenderView( SiteInstance* instance) { int render_view_routing_id = MSG_ROUTING_NONE; if (SiteIsolationPolicy::IsSwappedOutStateForbidden()) { GetRenderManager()->CreateRenderFrameProxy(instance); } else { GetRenderManager()->CreateRenderFrame( instanc...
0
131,783
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: GF_Err cprt_Size(GF_Box *s) { GF_CopyrightBox *ptr = (GF_CopyrightBox *)s; ptr->size += 2; if (ptr->notice) ptr->size += strlen(ptr->notice) + 1; return GF_OK; } Commit Message: fixed 2 possible heap overflows (inc. #1088) CWE ID: CWE-125
0
80,022
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: AP_DECLARE(const char *) ap_psignature(const char *prefix, request_rec *r) { char sport[20]; core_dir_config *conf; conf = (core_dir_config *)ap_get_core_module_config(r->per_dir_config); if ((conf->server_signature == srv_sig_off) || (conf->server_signature == srv_sig_unset)) { ...
0
64,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: void _xml_endNamespaceDeclHandler(void *userData, const XML_Char *prefix) { xml_parser *parser = (xml_parser *)userData; if (parser && parser->endNamespaceDeclHandler) { zval *retval, *args[2]; args[0] = _xml_resource_zval(parser->index); args[1] = _xml_xmlchar_zval(prefix, 0, parser->target_encoding); ...
0
10,989
Analyze the following 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 select_size(struct sock *sk, int sg) { struct tcp_sock *tp = tcp_sk(sk); int tmp = tp->mss_cache; if (sg) { if (sk_can_gso(sk)) tmp = 0; else { int pgbreak = SKB_MAX_HEAD(MAX_TCP_HEADER); if (tmp >= pgbreak && tmp <= pgbreak + (MAX_SKB_FRAGS - 1) * PAGE_SIZE) tmp = p...
0
31,861
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: long vhost_dev_init(struct vhost_dev *dev, struct vhost_virtqueue *vqs, int nvqs) { int i; dev->vqs = vqs; dev->nvqs = nvqs; mutex_init(&dev->mutex); dev->log_ctx = NULL; dev->log_file = NULL; dev->memory = NULL; dev->mm = NULL; spin_lock_init(&dev->work_lock); INIT_LIST_HEAD(&dev->work_list); d...
0
33,784
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int restore_node_summary(struct f2fs_sb_info *sbi, unsigned int segno, struct f2fs_summary_block *sum) { struct f2fs_node *rn; struct f2fs_summary *sum_entry; block_t addr; int i, idx, last_offset, nrpages; /* scan the node segment */ last_offset = sbi->blocks_per_seg; addr = START_BLOCK(sbi, segno); ...
0
85,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 JSON_INLINE int isnan(double x) { return x != x; } Commit Message: CVE-2013-6401: Change hash function, randomize hashes Thanks to Florian Weimer and Eric Sesterhenn for reporting, reviewing and testing. CWE ID: CWE-310
0
40,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: void __user *compat_alloc_user_space(unsigned long len) { void __user *ptr; /* If len would occupy more than half of the entire compat space... */ if (unlikely(len > (((compat_uptr_t)~0) >> 1))) return NULL; ptr = arch_compat_alloc_user_space(len); if (unlikely(!access_ok(VERIFY_WRITE, ptr, len))) ret...
0
82,635
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: create_initial_guard_context(void) { tor_assert(! curr_guard_context); if (!guard_contexts) { guard_contexts = smartlist_new(); } guard_selection_type_t type = GS_TYPE_INFER; const char *name = choose_guard_selection( get_options(), networkst...
0
69,660
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void Browser::OpenFileManager() { UserMetrics::RecordAction(UserMetricsAction("OpenFileManager")); ShowSingletonTabRespectRef(GURL(chrome::kChromeUIFileManagerURL)); } Commit Message: Implement a bubble that appears at the top of the screen when a tab enters fullscreen mode via webkitRequestFullScreen(), te...
0
97,299
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: blink::WebFrame* RenderFrameImpl::ResolveOpener(int opener_frame_routing_id) { if (opener_frame_routing_id == MSG_ROUTING_NONE) return nullptr; RenderFrameProxy* opener_proxy = RenderFrameProxy::FromRoutingID(opener_frame_routing_id); if (opener_proxy) return opener_proxy->web_frame(); Ren...
0
139,822
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void set_maintenance_mode(void *send_info, bool enable) { struct smi_info *smi_info = send_info; if (!enable) atomic_set(&smi_info->req_events, 0); } Commit Message: ipmi_si: fix use-after-free of resource->name When we excute the following commands, we got oops rmmod ipmi_si cat /proc/ioports [ ...
0
90,246
Analyze the following 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_modifier_exec (struct t_weechat_plugin *plugin, const char *modifier, const char *modifier_data, const char *string) { struct t_hook *ptr_hook, *next_hook; char *new_msg, *message_modified; /* make C compiler happy */ (void) plugin; if (!modifier || !modifier...
0
3,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: void IndexedDBDispatcher::OnWorkerRunLoopStopped() { delete this; } Commit Message: Add DCHECK to ensure IndexedDBDispatcher doesn't get re-created. This could happen if there are IDB objects that survive the call to didStopWorkerRunLoop. BUG=121734 TEST= Review URL: http://codereview.chromium.org/9999035 ...
0
108,693
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void ConvertAnswerOptionsToWebrtcAnswerOptions( const blink::WebRTCAnswerOptions& options, webrtc::PeerConnectionInterface::RTCOfferAnswerOptions* output) { output->voice_activity_detection = options.VoiceActivityDetection(); } Commit Message: Check weak pointers in RTCPeerConnectionHandler::WebRtcSetD...
0
152,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: ExtensionsAPIClient::CreateContentRulesRegistry( content::BrowserContext* browser_context, RulesCacheDelegate* cache_delegate) const { return scoped_refptr<ContentRulesRegistry>(); } Commit Message: Hide DevTools frontend from webRequest API Prevent extensions from observing requests for remote DevToo...
0
146,597
Analyze the following 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 hmac_add_misc(struct shash_desc *desc, struct inode *inode, char *digest) { struct h_misc { unsigned long ino; __u32 generation; uid_t uid; gid_t gid; umode_t mode; } hmac_misc; memset(&hmac_misc, 0, sizeof hmac_misc); hmac_misc.ino = inode->i_ino; hmac_misc.generation = inode->i_...
0
33,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: tls1_heartbeat(SSL *s) { unsigned char *buf, *p; int ret; unsigned int payload = 18; /* Sequence number + random bytes */ unsigned int padding = 16; /* Use minimum padding */ /* Only send if peer supports and accepts HB requests... */ if (!(s->tlsext_heartbeat & SSL_TLSEXT_HB_ENABLED) || s->tlsext_he...
0
10,825
Analyze the following 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 timeval ns_to_timeval(const s64 nsec) { struct timespec ts = ns_to_timespec(nsec); struct timeval tv; tv.tv_sec = ts.tv_sec; tv.tv_usec = (suseconds_t) ts.tv_nsec / 1000; return tv; } Commit Message: remove div_long_long_rem x86 is the only arch right now, which provides an optimized for div_long_...
0
24,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: virtual void TearDown() { memoryCache()->evictResources(); replaceMemoryCacheForTesting(m_globalMemoryCache.release()); } Commit Message: Add assertions that the empty Platform::cryptographicallyRandomValues() overrides are not being used. These implementations are not safe and look...
0
132,390
Analyze the following 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 br_mdb_fill_info(struct sk_buff *skb, struct netlink_callback *cb, struct net_device *dev) { struct net_bridge *br = netdev_priv(dev); struct net_bridge_mdb_htable *mdb; struct nlattr *nest, *nest2; int i, err = 0; int idx = 0, s_idx = cb->args[1]; if (br->multicast_disabled) return 0; ...
1
166,053
Analyze the following 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 InputMsgWatcher::HasReceivedAck() const { return ack_result_ != INPUT_EVENT_ACK_STATE_UNKNOWN; } Commit Message: Apply ExtensionNavigationThrottle filesystem/blob checks to all frames. BUG=836858 Change-Id: I34333a72501129fd40b5a9aa6378c9f35f1e7fc2 Reviewed-on: https://chromium-review.googlesource.com/1...
0
156,083
Analyze the following 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 void PreEncodeFrameHook(::libvpx_test::VideoSource *video, ::libvpx_test::Encoder *encoder) { if (video->frame() == 1) { encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_); } if (cfg_.ts_number_layers > 1) { if (video->frame() == 1) { ...
1
174,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 EventBindings::AttachFilteredEvent( const v8::FunctionCallbackInfo<v8::Value>& args) { CHECK_EQ(2, args.Length()); CHECK(args[0]->IsString()); CHECK(args[1]->IsObject()); std::string event_name = *v8::String::Utf8Value(args[0]); if (!context()->HasAccessOrThrowError(event_name)) return; ...
1
172,060
Analyze the following 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 sc_asn1_print_bit_string(const u8 * buf, size_t buflen, size_t depth) { #ifndef _WIN32 long long a = 0; #else __int64 a = 0; #endif int r, i; if (buflen > sizeof(a) + 1) { print_hex(buf, buflen, depth); } else { r = sc_asn1_decode_bit_string(buf, buflen, &a, sizeof(a)); if (r < 0) { pri...
0
78,131
Analyze the following 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 redisOpArrayInit(redisOpArray *oa) { oa->ops = NULL; oa->numops = 0; } Commit Message: Security: Cross Protocol Scripting protection. This is an attempt at mitigating problems due to cross protocol scripting, an attack targeting services using line oriented protocols like Redis that can accept HTTP...
0
70,058
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: PluginServiceImpl::~PluginServiceImpl() { #if defined(OS_WIN) hkcu_watcher_.StopWatching(); hklm_watcher_.StopWatching(); if (hkcu_event_.get()) hkcu_event_->Release(); if (hklm_event_.get()) hklm_event_->Release(); #endif DCHECK(pending_plugin_clients_.empty()); } Commit Message: Follow-on fix...
0
116,808
Analyze the following 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 *show_partition_start(struct seq_file *seqf, loff_t *pos) { void *p; p = disk_seqf_start(seqf, pos); if (!IS_ERR_OR_NULL(p) && !*pos) seq_puts(seqf, "major minor #blocks name\n\n"); return p; } Commit Message: block: fix use-after-free in seq file I got a KASAN report of use-after-free: ...
0
49,721
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int kvm_vm_ioctl_set_device_addr(struct kvm *kvm, struct kvm_arm_device_addr *dev_addr) { unsigned long dev_id, type; dev_id = (dev_addr->id & KVM_ARM_DEVICE_ID_MASK) >> KVM_ARM_DEVICE_ID_SHIFT; type = (dev_addr->id & KVM_ARM_DEVICE_TYPE_MASK) >> KVM_ARM_DEVICE_TYPE_SHIFT; switch (dev_id) { ...
0
28,975
Analyze the following 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 SCSIDevice *virtio_scsi_device_find(VirtIOSCSI *s, uint8_t *lun) { if (lun[0] != 1) { return NULL; } if (lun[2] != 0 && !(lun[2] >= 0x40 && lun[2] < 0x80)) { return NULL; } return scsi_device_find(&s->bus, 0, lun[1], virtio_scsi_get_lun(lun)); } Commit Message: ...
0
15,620
Analyze the following 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 FrameBuffer::Create() { ScopedGLErrorSuppressor suppressor(decoder_); Destroy(); glGenFramebuffersEXT(1, &id_); } Commit Message: Revert "Revert 100494 - Fix bug in SimulateAttrib0.""" TEST=none BUG=95625 TBR=apatrick@chromium.org Review URL: http://codereview.chromium.org/7796016 git-svn-id: svn:/...
0
99,098
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void ThreadHeap::ReportMemoryUsageHistogram() { static size_t supported_max_size_in_mb = 4 * 1024; static size_t observed_max_size_in_mb = 0; if (!IsMainThread()) return; size_t size_in_mb = ThreadState::Current()->Heap().HeapStats().AllocatedSpace() / 1024 / 1024 + 1; if (siz...
0
153,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: bool DownloadItemImpl::TimeRemaining(base::TimeDelta* remaining) const { if (total_bytes_ <= 0) return false; // We never received the content_length for this download. int64_t speed = CurrentSpeed(); if (speed == 0) return false; *remaining = base::TimeDelta::FromSeconds((total_bytes_ - ...
0
146,389
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: sysEvent_t Com_GetEvent( void ) { if ( com_pushedEventsHead > com_pushedEventsTail ) { com_pushedEventsTail++; return com_pushedEvents[ ( com_pushedEventsTail - 1 ) & ( MAX_PUSHED_EVENTS - 1 ) ]; } return Com_GetRealEvent(); } Commit Message: All: Merge some file writing extension checks CWE ID: CWE-269
0
95,597
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: http_Setup(struct http *hp, struct ws *ws) { uint16_t shd; txt *hd; unsigned char *hdf; /* XXX: This is not elegant, is it efficient ? */ shd = hp->shd; hd = hp->hd; hdf = hp->hdf; memset(hp, 0, sizeof *hp); memset(hd, 0, sizeof *hd * shd); memset(hdf, 0, sizeof *hdf * shd); hp->magic = HTTP_MAGIC; h...
0
56,435
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int XMLRPC_ServerRegisterMethod(XMLRPC_SERVER server, const char *name, XMLRPC_Callback cb) { if(server && name && cb) { server_method* sm = malloc(sizeof(server_method)); if(sm) { sm->name = strdup(name); sm->method = cb; sm->desc = NULL; return Q_PushT...
0
12,166
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void HTMLInputElement::updateClearButtonVisibility() { m_inputTypeView->updateClearButtonVisibility(); } 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. N...
0
114,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: bool RenderFrameImpl::UniqueNameFrameAdapter::IsMainFrame() const { return render_frame_->IsMainFrame(); } Commit Message: Convert FrameHostMsg_DidAddMessageToConsole to Mojo. Note: Since this required changing the test RenderViewImplTest.DispatchBeforeUnloadCanDetachFrame, I manually re-introduced https://cr...
0
139,710
Analyze the following 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_event_idx_default(struct perf_event *event) { return 0; } Commit Message: perf: Fix event->ctx locking There have been a few reported issues wrt. the lack of locking around changing event->ctx. This patch tries to address those. It avoids the whole rwsem thing; and while it appears to work, pl...
0
50,480
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: PathManager* path_manager() { return group_->path_manager(); } Commit Message: Add GL_PROGRAM_COMPLETION_QUERY_CHROMIUM This makes the query of GL_COMPLETION_STATUS_KHR to programs much cheaper by minimizing the round-trip to the GPU thread. Bug: 881152, 957001 Change-Id: Iadfa798af29225e752c710ca5c25f50b3dd...
0
141,714
Analyze the following 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 CallWithExecutionContextAndScriptStateAndIsolateAnyAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) { v8::Local<v8::Object> holder = info.Holder(); TestObject* impl = V8TestObject::ToImpl(holder); ExecutionContext* execution_context = ExecutionContext::ForRelevantRealm...
0
134,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: do_run_simple_dialog (gpointer _data) { RunSimpleDialogData *data = _data; const char *button_title; GtkWidget *dialog; int result; int response_id; g_mutex_lock (&data->mutex); /* Create the dialog. */ dialog = gtk_message_dialog_new (*data->parent_window, ...
0
61,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: GF_Err sdp_Read(GF_Box *s, GF_BitStream *bs) { u32 length; GF_SDPBox *ptr = (GF_SDPBox *)s; if (ptr == NULL) return GF_BAD_PARAM; length = (u32) (ptr->size); ptr->sdpText = (char*)gf_malloc(sizeof(char) * (length+1)); if (!ptr->sdpText) return GF_OUT_OF_MEM; gf_bs_read_data(bs, ptr->sdpText, length); pt...
0
80,387
Analyze the following 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 DestroyXMLTreeOrdered(XMLTreeInfo *xml_info) { XMLTreeInfo *node, *ordered; ordered=xml_info->ordered; while(ordered != (XMLTreeInfo *) NULL) { node=ordered; ordered=node->ordered; node->ordered=(XMLTreeInfo *) NULL; (void) DestroyXMLTree(node); } } Commit Message: ...
0
71,960
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: barrier_find_nearest(BarrierScreenPtr cs, DeviceIntPtr dev, int dir, int x1, int y1, int x2, int y2) { struct PointerBarrierClient *c, *nearest = NULL; double min_distance = INT_MAX; /* can't get higher than that in X anyway */ xorg_list_for_each_entry(c...
0
17,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: void _WM_do_control_data_decrement(struct _mdi *mdi, struct _event_data *data) { uint8_t ch = data->channel; MIDI_EVENT_DEBUG(__FUNCTION__,ch, data->data.value); if ((mdi->channel[ch].reg_non == 0) && (mdi->channel[ch].reg_data == 0x0000)) { /* Pitch Bend...
0
63,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: ChildThread::ChildThreadMessageRouter::ChildThreadMessageRouter( IPC::Sender* sender) : sender_(sender) {} Commit Message: [FileAPI] Clean up WebFileSystemImpl before Blink shutdown WebFileSystemImpl should not outlive V8 instance, since it may have references to V8. This CL ensures it deleted before Bl...
0
121,297
Analyze the following 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_hv_hypercall(struct kvm_vcpu *vcpu) { u64 param, ingpa, outgpa, ret; uint16_t code, rep_idx, rep_cnt, res = HV_STATUS_SUCCESS, rep_done = 0; bool fast, longmode; /* * hypercall generates UD from non zero cpl and real mode * per HYPER-V spec */ if (kvm_x86_ops->get_cpl(vcpu) != 0 || !is_protmod...
0
35,793
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: std::wstring BookmarkManagerView::GetWindowName() const { return prefs::kBookmarkManagerPlacement; } Commit Message: Relands cl 16982 as it wasn't the cause of the build breakage. Here's the description for that cl: Lands http://codereview.chromium.org/115505 for bug http://crbug.com/4030 for tyoshino. BUG=h...
0
109,099
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: CIFSSMBQFSUnixInfo(const int xid, struct cifs_tcon *tcon) { /* level 0x200 SMB_QUERY_CIFS_UNIX_INFO */ TRANSACTION2_QFSI_REQ *pSMB = NULL; TRANSACTION2_QFSI_RSP *pSMBr = NULL; FILE_SYSTEM_UNIX_INFO *response_data; int rc = 0; int bytes_returned = 0; __u16 params, byte_count; cFYI(1, "In QFSUnixInfo"); QF...
0
24,975
Analyze the following 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 ablkcipher_copy_iv(struct ablkcipher_walk *walk, struct crypto_tfm *tfm, unsigned int alignmask) { unsigned bs = walk->blocksize; unsigned int ivsize = tfm->crt_ablkcipher.ivsize; unsigned aligned_bs = ALIGN(bs, alignmask + 1); unsigned int size = aligned_bs * 2 + ivsize + ...
0
31,179
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: GetShortIns( TT_ExecContext exc ) { /* Reading a byte stream so there is no endianness (DaveP) */ exc->IP += 2; return (FT_Short)( ( exc->code[exc->IP - 2] << 8 ) + exc->code[exc->IP - 1] ); } Commit Message: CWE ID: CWE-476
0
10,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 decode_sce_lfe(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, uint8_t id_syn_ele) { uint8_t channels = hDecoder->fr_channels; uint8_t tag = 0; if (channels+1 > MAX_CHANNELS) { hInfo->error = 12; re...
0
88,376
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void PeopleHandler::UpdateSyncStatus() { FireWebUIListener("sync-status-changed", *GetSyncStatusDictionary()); } Commit Message: [signin] Add metrics to track the source for refresh token updated events This CL add a source for update and revoke credentials operations. It then surfaces the source in the chrom...
0
143,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: get_arg0_string (Buffer *buffer) { GDBusMessage *message = g_dbus_message_new_from_blob (buffer->data, buffer->size, 0, NULL); GVariant *body; g_autoptr(GVariant) arg0 = NULL; char *name = NULL; if (message != NULL && (body = g_dbus_message_get_body (message)) != NULL && (arg0 = g_variant_g...
0
84,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: void NTPResourceCache::CreateNewTabIncognitoHTML() { DictionaryValue localized_strings; localized_strings.SetString("title", l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); int new_tab_message_ids = IDS_NEW_TAB_OTR_MESSAGE; int new_tab_html_idr = IDR_INCOGNITO_TAB_HTML; const char* new_tab_link = k...
0
107,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: svc_create_pooled(struct svc_program *prog, unsigned int bufsize, struct svc_serv_ops *ops) { struct svc_serv *serv; unsigned int npools = svc_pool_map_get(); serv = __svc_create(prog, bufsize, npools, ops); if (!serv) goto out_err; return serv; out_err: svc_pool_map_put(); return NULL; } Commit Me...
0
65,931
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: runtest(int i) { int ret = 0, res; int old_errors, old_tests, old_leaks; old_errors = nb_errors; old_tests = nb_tests; old_leaks = nb_leaks; if ((tests_quiet == 0) && (testDescriptions[i].desc != NULL)) printf("## %s\n", testDescriptions[i].desc); res = launchTests(&testDescriptions[...
0
59,618
Analyze the following 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_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align, struct module *module) { int r; int cpu; r = kvm_arch_init(opaque); if (r) goto out_fail; /* * kvm_arch_init makes sure there's at most one caller * for architectures that support multiple implementations, * like intel and amd ...
0
29,327
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static inline bool got_nohz_idle_kick(void) { int cpu = smp_processor_id(); if (!test_bit(NOHZ_BALANCE_KICK, nohz_flags(cpu))) return false; if (idle_cpu(cpu) && !need_resched()) return true; /* * We can't run Idle Load Balance on this CPU for this time so we * cancel it and clear NOHZ_BALANCE_KICK...
0
55,539
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void PwnMessageHelper::FileSystemWrite(RenderProcessHost* process, int request_id, GURL file_path, std::string blob_uuid, int64_t position) { TestFileapiOpe...
0
156,060
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: RenderFrameHostCreatedObserver::~RenderFrameHostCreatedObserver() { } Commit Message: Add a check for disallowing remote frame navigations to local resources. Previously, RemoteFrame navigations did not perform any renderer-side checks and relied solely on the browser-side logic to block disallowed navigations ...
0
143,944
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: FT_Stream_New( FT_Library library, const FT_Open_Args* args, FT_Stream *astream ) { FT_Error error; FT_Memory memory; FT_Stream stream; *astream = 0; if ( !library ) return FT_Err_Invalid_Library_Handle; if ( !args ) ...
0
9,680
Analyze the following 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 _WM_GetSamplesPerTick(uint32_t divisions, uint32_t tempo) { float microseconds_per_tick; float secs_per_tick; float samples_per_tick; /* Slow but needed for accuracy */ microseconds_per_tick = (float) tempo / (float) divisions; secs_per_tick = microseconds_per_tick / 1000000.0f; ...
0
63,219
Analyze the following 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 IOThread::ChangedToOnTheRecord() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&IOThread::ChangedToOnTheRecordOnIOThread, base::Unretained(this))); } Commit Message: Added daily UMA for non-da...
0
113,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 RenderProcessHostImpl::CreateRendererHost( mojom::RendererHostAssociatedRequest request) { renderer_host_binding_.Bind(std::move(request)); } Commit Message: Correct mojo::WrapSharedMemoryHandle usage Fixes some incorrect uses of mojo::WrapSharedMemoryHandle which were assuming that the call actually...
0
149,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: int tty_release(struct inode *inode, struct file *filp) { struct tty_struct *tty = file_tty(filp); struct tty_struct *o_tty = NULL; int do_sleep, final; int idx; long timeout = 0; int once = 1; if (tty_paranoia_check(tty, inode, __func__)) return 0; tty_lock(tty); check_tty_count(tty, __func__); __...
0
55,940
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void GLES2DecoderImpl::DoTexParameterf( GLenum target, GLenum pname, GLfloat param) { TextureRef* texture = texture_manager()->GetTextureInfoForTarget( &state_, target); if (!texture) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glTexParameterf", "unknown texture"); return; } texture_manager...
0
120,850