instruction
stringclasses
1 value
input
stringlengths
64
129k
output
int64
0
1
__index_level_0__
int64
0
30k
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void Document::LayoutUpdated() { if (GetFrame() && GetFrame()->IsMainFrame()) GetFrame()->GetPage()->GetChromeClient().LayoutUpdated(); Markers().InvalidateRectsForAllTextMatchMarkers(); if (IsRenderingReady() && body() && !GetStyleEngine().HasPendingScriptBlockingSheets()) { if (!document_t...
0
895
Analyze the following 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 find_new_snapshot_id(BlockDriverState *bs, char *id_str, int id_str_size) { BDRVQcowState *s = bs->opaque; QCowSnapshot *sn; int i; unsigned long id, id_max = 0; for(i = 0; i < s->nb_snapshots; i++) { sn = s->snapshots + i; id = str...
0
16,792
Analyze the following 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 X86_insn_reg_att2(unsigned int id, x86_reg *reg1, enum cs_ac_type *access1, x86_reg *reg2, enum cs_ac_type *access2) { unsigned int i; for (i = 0; i < ARR_SIZE(insn_regs_intel2); i++) { if (insn_regs_intel2[i].insn == id) { *reg1 = insn_regs_intel2[i].reg2; *reg2 = insn_regs_intel2[i].reg1; ...
0
7,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: bool HTMLTextAreaElement::hasCustomFocusLogic() const { return true; } Commit Message: Add HTMLFormControlElement::supportsAutofocus to fix a FIXME comment. This virtual function should return true if the form control can hanlde 'autofocucs' attribute if it is specified. Note: HTMLInputElement::supportsAut...
0
4,654
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: ClientDiscardableSharedMemoryManager::CreateMemoryAllocatorDump( DiscardableSharedMemoryHeap::Span* span, const char* name, base::trace_event::ProcessMemoryDump* pmd) const { base::AutoLock lock(lock_); return heap_->CreateMemoryAllocatorDump(span, name, pmd); } Commit Message: Correct mojo::Wrap...
0
26,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 WebMediaPlayerImpl::SetIsEffectivelyFullscreen( blink::WebFullscreenVideoStatus fullscreen_video_status) { delegate_->SetIsEffectivelyFullscreen(delegate_id_, fullscreen_video_status); } Commit Message: Simplify "WouldTaintOrigin" concept in media/blink Currently WebMediaPlayer has three predicates: ...
0
26,998
Analyze the following 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 setDefaultBufferFormat(PixelFormat defaultFormat) { Parcel data, reply; data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor()); data.writeInt32(static_cast<int32_t>(defaultFormat)); status_t result = remote()->transact(SET_DEFAULT_BUFFER_FORMAT, data, &reply...
0
8,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: MultibufferDataSource::~MultibufferDataSource() { DCHECK(render_task_runner_->BelongsToCurrentThread()); } Commit Message: Simplify "WouldTaintOrigin" concept in media/blink Currently WebMediaPlayer has three predicates: - DidGetOpaqueResponseFromServiceWorker - HasSingleSecurityOrigin - DidPassCORSAccessC...
0
486
Analyze the following 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 _vivid_fb_check_var(struct fb_var_screeninfo *var, struct vivid_dev *dev) { dprintk(dev, 1, "vivid_fb_check_var\n"); var->bits_per_pixel = 16; if (var->green.length == 5) { var->red.offset = 10; var->red.length = 5; var->green.offset = 5; var->green.length = 5; var->blue.offset = 0; var...
0
15,417
Analyze the following 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 ext3_handle_error(struct super_block *sb) { struct ext3_super_block *es = EXT3_SB(sb)->s_es; EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS; es->s_state |= cpu_to_le16(EXT3_ERROR_FS); if (sb->s_flags & MS_RDONLY) return; if (!test_opt (sb, ERRORS_CONT)) { journal_t *journal = EXT3_SB(sb)->s_j...
0
14,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: void RenderWidgetHostImpl::OnLocalSurfaceIdChanged( const cc::RenderFrameMetadata& metadata) { DidUpdateVisualProperties(metadata); } Commit Message: Start rendering timer after first navigation Currently the new content rendering timer in the browser process, which clears an old page's contents 4 seconds...
0
3,718
Analyze the following 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 tcp_check_space(struct sock *sk) { if (sock_flag(sk, SOCK_QUEUE_SHRUNK)) { sock_reset_flag(sk, SOCK_QUEUE_SHRUNK); /* pairs with tcp_poll() */ smp_mb__after_atomic(); if (sk->sk_socket && test_bit(SOCK_NOSPACE, &sk->sk_socket->flags)) tcp_new_space(sk); } } Commit Message: tcp: mak...
0
22,686
Analyze the following 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 path_is_under(struct path *path1, struct path *path2) { bool res; read_seqlock_excl(&mount_lock); res = is_path_reachable(real_mount(path1->mnt), path1->dentry, path2); read_sequnlock_excl(&mount_lock); return res; } Commit Message: mnt: Add a per mount namespace limit on the number of mounts CAI Qian...
0
15,356
Analyze the following 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 netdev_tx_t ifb_xmit(struct sk_buff *skb, struct net_device *dev) { struct ifb_private *dp = netdev_priv(dev); u32 from = G_TC_FROM(skb->tc_verd); u64_stats_update_begin(&dp->rsync); dp->rx_packets++; dp->rx_bytes += skb->len; u64_stats_update_end(&dp->rsync); if (!(from & (AT_INGRESS|AT_EGRESS)) ...
0
16,908
Analyze the following 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 childAttachedAllowedWhenAttachingChildren(ContainerNode* node) { if (node->isShadowRoot()) return true; if (node->isInsertionPoint()) return true; if (node->isElementNode() && toElement(node)->shadow()) return true; return false; } Commit Message: Notify nodes remo...
0
26,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: irc_server_sasl_enabled (struct t_irc_server *server) { const char *sasl_username, *sasl_password; sasl_username = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_SASL_USERNAME); sasl_password = IRC_SERVER_OPTION_STRING(server, ...
0
21,998
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: ttwu_do_wakeup(struct rq *rq, struct task_struct *p, int wake_flags) { trace_sched_wakeup(p, true); check_preempt_curr(rq, p, wake_flags); p->state = TASK_RUNNING; #ifdef CONFIG_SMP if (p->sched_class->task_woken) p->sched_class->task_woken(rq, p); if (unlikely(rq->idle_stamp)) { u64 delta = rq->clock ...
0
17,841
Analyze the following 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 CaptivePortalDetector::Cancel() { url_fetcher_.reset(); detection_callback_.Reset(); } Commit Message: Add data usage tracking for chrome services Add data usage tracking for captive portal, web resource and signin services BUG=655749 Review-Url: https://codereview.chromium.org/2643013004 Cr-Commit-P...
0
11,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: static inline unsigned char *PopHexPixel(const char hex_digits[][3], const size_t pixel,unsigned char *pixels) { register const char *hex; hex=hex_digits[pixel]; *pixels++=(unsigned char) (*hex++); *pixels++=(unsigned char) (*hex); return(pixels); } Commit Message: https://github.com/ImageMagick...
0
19,007
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: GLenum GLES2DecoderPassthroughImpl::PopError() { GLenum error = GL_NO_ERROR; if (!errors_.empty()) { error = *errors_.begin(); errors_.erase(errors_.begin()); } return error; } Commit Message: Add GL_PROGRAM_COMPLETION_QUERY_CHROMIUM This makes the query of GL_COMPLETION_STATUS_KHR to programs m...
0
575
Analyze the following 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 TestingAutomationProvider::AddPrivateNetwork( DictionaryValue* args, IPC::Message* reply_message) { std::string hostname, service_name, provider_type, key, cert_id, cert_nss, username, password; if (!args->GetString("hostname", &hostname) || !args->GetString("service_name", &service_name)...
0
9,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: SPICE_GNUC_VISIBLE int spice_server_set_agent_file_xfer(SpiceServer *s, int enable) { spice_assert(reds == s); agent_file_xfer = enable; reds->agent_state.write_filter.file_xfer_enabled = agent_file_xfer; reds->agent_state.read_filter.file_xfer_enabled = agent_file_xfer; return 0; } Commit Me...
0
3,779
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: VBRISeeker::VBRISeeker() : mDurationUs(-1) { } Commit Message: Make VBRISeeker more robust Bug: 32577290 Change-Id: I9bcc9422ae7dd3ae4a38df330c9dcd7ac4941ec8 (cherry picked from commit 7fdd36418e945cf6a500018632dfb0ed8cb1a343) CWE ID:
0
15,695
Analyze the following 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 nsc_encode_argb_to_aycocg(NSC_CONTEXT* context, const BYTE* data, UINT32 scanline) { UINT16 x; UINT16 y; UINT16 rw; BYTE ccl; const BYTE* src; BYTE* yplane = NULL; BYTE* coplane = NULL; BYTE* cgplane = NULL; BYTE* aplane = NULL; INT16 r_val; INT16 g_...
1
12,958
Analyze the following 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 nd_jump_link(struct nameidata *nd, struct path *path) { path_put(&nd->path); nd->path = *path; nd->inode = nd->path.dentry->d_inode; nd->flags |= LOOKUP_JUMPED; } Commit Message: fs: umount on symlink leaks mnt count Currently umount on symlink blocks following umount: /vz is separate mount # ls /vz...
0
22,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: error::Error GLES2DecoderImpl::HandleGetActiveUniformsiv( uint32_t immediate_data_size, const volatile void* cmd_data) { if (!feature_info_->IsWebGL2OrES3Context()) return error::kUnknownCommand; const volatile gles2::cmds::GetActiveUniformsiv& c = *static_cast<const volatile gles2::cmds::Ge...
0
18,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: Policy* Document::policy() { if (!policy_) policy_ = new DocumentPolicy(this); return policy_.Get(); } Commit Message: Inherit CSP when self-navigating to local-scheme URL As the linked bug example shows, we should inherit CSP when we navigate to a local-scheme URL (even if we are in a main browsing con...
0
3,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: int usb_port_suspend(struct usb_device *udev, pm_message_t msg) { struct usb_hub *hub = usb_hub_to_struct_hub(udev->parent); struct usb_port *port_dev = hub->ports[udev->portnum - 1]; int port1 = udev->portnum; int status; bool really_suspend = true; usb_lock_port(port_dev); /* enable remote wakeup wh...
0
1,688
Analyze the following 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 Instance::DocumentHasUnsupportedFeature(const std::string& feature) { std::string metric("PDF_Unsupported_"); metric += feature; if (!unsupported_features_reported_.count(metric)) { unsupported_features_reported_.insert(metric); UserMetricsRecordAction(metric); } if (!full_) return; ...
0
6,615
Analyze the following 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 OnOfflinePageAcquireFileAccessPermissionDone( const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter, const ScopedJavaGlobalRef<jobject>& j_tab_ref, const std::string& origin, bool granted) { if (!granted) return; content::WebContents* web_contents = web_contents_...
0
11,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: void XmlWriter::StartWriting() { buffer_ = xmlBufferCreate(); writer_ = xmlNewTextWriterMemory(buffer_, 0); xmlTextWriterSetIndent(writer_, 1); xmlTextWriterStartDocument(writer_, NULL, NULL, NULL); } Commit Message: Roll libxml to 3939178e4cb797417ff033b1e04ab4b038e224d9 Removes a few patches fixed ups...
0
11,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: void UpdatePolicyDuration(base::TimeTicks now, base::TimeTicks policy_expiration, base::TimeDelta* policy_duration) { if (policy_expiration <= now) return; if (policy_duration->is_zero()) { *policy_duration = policy_expiration - now; return; }...
0
23,984
Analyze the following 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 disk_check_events(struct disk_events *ev, unsigned int *clearing_ptr) { struct gendisk *disk = ev->disk; char *envp[ARRAY_SIZE(disk_uevents) + 1] = { }; unsigned int clearing = *clearing_ptr; unsigned int events; unsigned long intv; int nr_events = 0, i; /* check events */ events = d...
0
3,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 void transmit_fragment(BT_HDR *packet, bool send_transmit_finished) { uint16_t event = packet->event & MSG_EVT_MASK; serial_data_type_t type = event_to_data_type(event); btsnoop->capture(packet, false); hal->transmit_data(type, packet->data + packet->offset, packet->len); if (event != MSG_STACK_TO...
0
12,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: void RenderFrameHostImpl::DisableBeforeUnloadHangMonitorForTesting() { beforeunload_timeout_.reset(); } Commit Message: Correctly reset FP in RFHI whenever origin changes Bug: 713364 Change-Id: Id8bb923750e20f3db6fc9358b1d44120513ac95f CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation ...
0
5,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: _kdc_is_anon_request(const KDC_REQ_BODY *b) { /* some versions of heimdal use bit 14 instead of 16 for request_anonymous, as indicated in the anonymous draft prior to version 11. Bit 14 is assigned to S4U2Proxy, but all S4U2Proxy requests will have a second ticket; don't consider those anonymous */ ...
0
2,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: static bool IsSVGAttributeHandle(const PropertyHandle& property_handle) { return property_handle.IsSVGAttribute(); } Commit Message: Fix SVG crash for v0 distribution into foreignObject. We require a parent element to be an SVG element for non-svg-root elements in order to create a LayoutObject for them. Howe...
0
16,684
Analyze the following 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 daemonize(const char *name, ...) { va_list args; sigset_t blocked; va_start(args, name); vsnprintf(current->comm, sizeof(current->comm), name, args); va_end(args); /* * If we were started as result of loading a module, close all of the * user space pages. We don't need them, and if we didn't clo...
0
7,019
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int handle_apic_write(struct kvm_vcpu *vcpu) { unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION); u32 offset = exit_qualification & 0xfff; /* APIC-write VM exit is trap-like and thus no need to adjust IP */ kvm_apic_write_nodecode(vcpu, offset); return 1; } Commit Message: x86,kvm,vm...
0
16,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: static ssize_t ib_ucm_send_apr(struct ib_ucm_file *file, const char __user *inbuf, int in_len, int out_len) { return ib_ucm_send_info(file, inbuf, in_len, (void *)ib_send_cm_apr); } Commit Message: IB/security: Restrict use of the write() interface The drivers/infiniband stack uses write() ...
0
21,385
Analyze the following 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 igmp_heard_report(struct in_device *in_dev, __be32 group) { struct ip_mc_list *im; /* Timers are only set for non-local groups */ if (group == IGMP_ALL_HOSTS) return; rcu_read_lock(); for_each_pmc_rcu(in_dev, im) { if (im->multiaddr == group) { igmp_stop_timer(im); break; } } rcu...
0
7,320
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static uint64_t msix_table_mmio_read(void *opaque, hwaddr addr, unsigned size) { PCIDevice *dev = opaque; return pci_get_long(dev->msix_table + addr); } Commit Message: CWE ID: CWE-476
0
11,065
Analyze the following 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 nfs40_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *state) { /* NFSv4.0 doesn't allow for delegation recovery on open expire */ nfs40_clear_delegation_stateid(state); return nfs4_open_expired(sp, state); } Commit Message: NFS: Fix a NULL pointer dereference of migration recovery ops ...
0
27,788
Analyze the following 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 decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op, unsigned d) { int rc = X86EMUL_CONTINUE; switch (d) { case OpReg: decode_register_operand(ctxt, op, op == &ctxt->dst && ctxt->twobyte && (ctxt->b == 0xb6 || ctxt->b == 0xb7)); break; case OpImmUByte: rc = decode_i...
0
28,973
Analyze the following 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 long __find_rev_next_zero_bit(const unsigned long *addr, unsigned long size, unsigned long offset) { const unsigned long *p = addr + BIT_WORD(offset); unsigned long result = size; unsigned long tmp; if (offset >= size) return size; size -= (offset & ~(BITS_PER_LONG - 1)); offset %= BI...
0
7,243
Analyze the following 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 ShowCreatedFullscreenWidget(int route_id) {} Commit Message: Add unit test for AllowBindings check. BUG=117418 TEST=none Review URL: http://codereview.chromium.org/9701038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126929 0039d316-1c4b-4281-b951-d872f2087c98 CWE ID: CWE-264
0
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: void TabStrip::SetDropArrow( const base::Optional<BrowserRootView::DropIndex>& index) { if (!index) { controller_->OnDropIndexUpdate(-1, false); drop_arrow_.reset(); return; } controller_->OnDropIndexUpdate(index->value, index->drop_before); if (drop_arrow_ && (index == drop_arrow_->inde...
0
18,475
Analyze the following 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 SkiaOutputSurfaceImpl::SetEnableDCLayers(bool enable) { auto task = base::BindOnce(&SkiaOutputSurfaceImplOnGpu::SetEnableDCLayers, base::Unretained(impl_on_gpu_.get()), enable); ScheduleGpuTask(std::move(task), {}); } Commit Message: SkiaRenderer: Support changing color spac...
0
17,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 RenderLayerCompositor::addOutOfFlowPositionedLayer(RenderLayer* layer) { m_outOfFlowPositionedLayers.add(layer); } Commit Message: Disable some more query compositingState asserts. This gets the tests passing again on Mac. See the bug for the stacktrace. A future patch will need to actually fix the inc...
0
16,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: static int encap_same(const struct bgp_attr_encap_subtlv *h1, const struct bgp_attr_encap_subtlv *h2) { const struct bgp_attr_encap_subtlv *p; const struct bgp_attr_encap_subtlv *q; if (h1 == h2) return 1; if (h1 == NULL || h2 == NULL) return 0; for (p = h1; p; p = p->next) { for (q = h2; q; ...
0
5,148
Analyze the following 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 parse_diff(struct pool *pool, json_t *val) { double old_diff, diff; if (opt_diff_mult == 0.0) diff = json_number_value(json_array_get(val, 0)) * pool->algorithm.diff_multiplier1; else diff = json_number_value(json_array_get(val, 0)) * opt_diff_mult; if (diff == 0) return false; cg_wlock(...
0
3,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: void FrameLoader::Init() { ScriptForbiddenScope forbid_scripts; ResourceRequest initial_request{KURL(g_empty_string)}; initial_request.SetRequestContext(WebURLRequest::kRequestContextInternal); initial_request.SetFrameType( frame_->IsMainFrame() ? network::mojom::RequestContextFrameType::kTopLevel ...
0
1,980
Analyze the following 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 split_header_filename(LHAFileHeader *header) { char *sep; char *new_filename; sep = strrchr(header->filename, '/'); if (sep != NULL) { new_filename = strdup(sep + 1); if (new_filename == NULL) { return 0; } *(sep + 1) = '\0'; header->path = header->filename; header->filename = n...
0
10,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: void HistogramTimeMedium(const std::string& name, int64_t ms) { if (ms < 0) return; const PPB_UMA_Private* ptr = GetUMAInterface(); if (ptr == NULL) return; ptr->HistogramCustomTimes(pp::Var(name).pp_var(), ms, kTimeMediumMin, kTimeMediumMax, ...
0
16,737
Analyze the following 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 MetricsLog::RecordCurrentSessionData( DelegatingProvider* delegating_provider, base::TimeDelta incremental_uptime, base::TimeDelta uptime) { DCHECK(!closed_); DCHECK(has_environment_); WriteRealtimeStabilityAttributes(incremental_uptime, uptime); delegating_provider->ProvideCurrentSessi...
0
1,020
Analyze the following 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 RedirectToNtpOrAppsPageIfNecessary( content::WebContents* contents, signin_metrics::AccessPoint access_point) { if (access_point != signin_metrics::AccessPoint::ACCESS_POINT_SETTINGS) RedirectToNtpOrAppsPage(contents, access_point); } Commit Message: [signin] Add metrics to track the source fo...
0
19,637
Analyze the following 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 clamp_output_samples(struct iw_context *ctx, iw_tmpsample *out_pix, int num_out_pix) { int i; for(i=0;i<num_out_pix;i++) { if(out_pix[i]<0.0) out_pix[i]=0.0; else if(out_pix[i]>1.0) out_pix[i]=1.0; } } Commit Message: Fixed a bug that could cause invalid memory to be accessed The bug could h...
0
29,070
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: WebString BlinkTestRunner::GetAbsoluteWebStringFromUTF8Path( const std::string& utf8_path) { base::FilePath path = base::FilePath::FromUTF8Unsafe(utf8_path); if (!path.IsAbsolute()) { GURL base_url = net::FilePathToFileURL(test_config_.current_working_directory.Append( FILE_PATH_LI...
0
733
Analyze the following 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 u64 mem_cgroup_move_charge_read(struct cgroup *cgrp, struct cftype *cft) { return mem_cgroup_from_cont(cgrp)->move_charge_at_immigrate; } Commit Message: mm: thp: fix pmd_bad() triggering in code paths holding mmap_sem read mode commit 1a5a9906d4e8d1976b701f889d8f35d54b928f25 upstream. In some cas...
0
29,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: void QDECL Com_Error( int code, const char *fmt, ... ) { va_list argptr; static int lastErrorTime; static int errorCount; int currentTime; qboolean restartClient; if(com_errorEntered) Sys_Error("recursive error after: %s", com_errorMessage); com_errorEntered = qtrue; Cvar_Set("com_errorCode", va("...
0
9,862
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: WtsSessionProcessDelegate::~WtsSessionProcessDelegate() { core_->Stop(); } Commit Message: Validate and report peer's PID to WorkerProcessIpcDelegate so it will be able to duplicate handles to and from the worker process. As a side effect WorkerProcessLauncher::Delegate is now responsible for retrieving the c...
0
28,797
Analyze the following 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 sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc) { struct scsi_device *SDev; struct scsi_sense_hdr sshdr; int result, err = 0, retries = 0; SDev = cd->device; retry: if (!scsi_block_when_processing_errors(SDev)) { err = -ENODEV; goto out; } result = scsi_execute(SDev, cgc-...
1
25,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: int devinet_ioctl(struct net *net, unsigned int cmd, void __user *arg) { struct ifreq ifr; struct sockaddr_in sin_orig; struct sockaddr_in *sin = (struct sockaddr_in *)&ifr.ifr_addr; struct in_device *in_dev; struct in_ifaddr **ifap = NULL; struct in_ifaddr *ifa = NULL; struct net_device *dev; char *colon...
0
12,324
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: pvscsi_on_issue_scsi(PVSCSIState *s) { trace_pvscsi_on_cmd_noimpl("PVSCSI_CMD_ISSUE_SCSI"); return PVSCSI_COMMAND_PROCESSING_FAILED; } Commit Message: CWE ID: CWE-399
0
35
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: COMPAT_SYSCALL_DEFINE3(timer_create, clockid_t, which_clock, struct compat_sigevent __user *, timer_event_spec, timer_t __user *, created_timer_id) { if (timer_event_spec) { sigevent_t event; if (get_compat_sigevent(&event, timer_event_spec)) return -EFAULT; return do_timer_create(whi...
0
15,766
Analyze the following 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 IsTimerRunning() { return GetLongPressTimer()->IsRunning(); } Commit Message: Pass ui::LatencyInfo correct with unified gesture detector on Aura. BUG=379812 TEST=GestureRecognizerTest.LatencyPassedFromTouchEvent Review URL: https://codereview.chromium.org/309823002 git-svn-id: svn://svn.chromium....
0
4,287
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: cwexec (kwset_t kws, char const *text, size_t len, struct kwsmatch *kwsmatch) { struct kwset const *kwset; struct trie * const *next; struct trie const *trie; struct trie const *accept; char const *beg, *lim, *mch, *lmch; unsigned char c; unsigned char const *delta; int d; char const *end, *qlim...
0
29,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: iodev_os_open_file(gx_io_device * iodev, const char *fname, uint len, const char *file_access, stream ** ps, gs_memory_t * mem) { return file_open_stream(fname, len, file_access, file_default_buffer_size, ps, iodev, iodev->procs.gp_fop...
0
3,529
Analyze the following 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 BackendImpl::DoomAllEntries(const CompletionCallback& callback) { DCHECK(!callback.is_null()); background_queue_.DoomAllEntries(callback); return net::ERR_IO_PENDING; } Commit Message: Blockfile cache: fix long-standing sparse + evict reentrancy problem Thanks to nedwilliamson@ (on gmail) for an alter...
0
29,178
Analyze the following 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::OpenPrivacyDashboardTabAndActivate() { OpenURL(GURL(kPrivacyDashboardUrl), GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK); window_->Activate(); } Commit Message: Implement a bubble that appears at the top of the screen when a tab enters fullscreen mode via webkitRequestFullScreen(...
0
19,102
Analyze the following 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::getCSSCanvasContext(const String& type, const String& name, int width, int height, CanvasRenderingContext2DOrWebGLRenderingContext& returnValue) { HTMLCanvasElement& element = getCSSCanvasElement(name); element.setSize(IntSize(width, height)); element.getContext(type, CanvasContextCreat...
0
13,761
Analyze the following 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 BrowserView::MaybeStackBookmarkBarAtTop() { if (bookmark_bar_view_.get()) bookmark_bar_view_->MaybeStackAtTop(); } Commit Message: Remove TabContents from TabStripModelObserver::TabDetachedAt. BUG=107201 TEST=no visible change Review URL: https://chromiumcodereview.appspot.com/11293205 git-svn-id:...
0
26,097
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void PrintPreviewHandler::HandleManagePrinters(const ListValue* /*args*/) { ++manage_printers_dialog_request_count_; printing::PrinterManagerDialog::ShowPrinterManagerDialog(); } Commit Message: Print preview: Use an ID instead of memory pointer string in WebUI. BUG=144051 Review URL: https://chromiumcoder...
0
18,811
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: String Document::domain() const { return securityOrigin()->domain(); } Commit Message: Refactoring: Move m_mayDisplaySeamlesslyWithParent down to Document The member is used only in Document, thus no reason to stay in SecurityContext. TEST=none BUG=none R=haraken@chromium.org, abarth, haraken, hayato Revi...
0
731
Analyze the following 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 tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) { struct ipv6_pinfo *np = inet6_sk(sk); struct tcp_sock *tp; struct sk_buff *opt_skb = NULL; /* Imagine: socket is IPv6. IPv4 packet arrives, goes to IPv4 receive handler and backlogged. From backlog it always goes here. Kerboom... Fo...
0
6,689
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: CURLcode imap_regular_transfer(struct connectdata *conn, bool *dophase_done) { CURLcode result=CURLE_OK; bool connected=FALSE; struct SessionHandle *data = conn->data; data->req.size = -1; /* make sure this is unknown at this point */ Curl_pgrsSetUploadCounter(data, 0); ...
0
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: make_named_pipe () { char *tname; tname = sh_mktmpname ("sh-np", MT_USERANDOM|MT_USETMPDIR); if (mkfifo (tname, 0600) < 0) { free (tname); return ((char *)NULL); } add_fifo_list (tname); return (tname); } Commit Message: CWE ID: CWE-20
0
14,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 void key_garbage_collector(struct work_struct *work) { static LIST_HEAD(graveyard); static u8 gc_state; /* Internal persistent state */ #define KEY_GC_REAP_AGAIN 0x01 /* - Need another cycle */ #define KEY_GC_REAPING_LINKS 0x02 /* - We need to reap links */ #define KEY_GC_SET_TIMER 0x04 /* - We need to ...
0
7,689
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: WebKit::WebNode* PrintWebViewHelper::PrintPreviewContext::node() const { return node_.get(); } Commit Message: Fix print preview workflow to reflect settings of selected printer. BUG=95110 TEST=none Review URL: http://codereview.chromium.org/7831041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10224...
0
3,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: safe_read(png_structp png_ptr, int fd, void *buffer_in, size_t nbytes) { size_t ntotal = 0; char *buffer = png_voidcast(char*, buffer_in); while (nbytes > 0) { unsigned int nread; int iread; /* Passing nread > INT_MAX to read is implementation defined in POSIX * 1003.1, therefore despite the unsig...
0
8,482
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int br_rports_fill_info(struct sk_buff *skb, struct netlink_callback *cb, struct net_device *dev) { struct net_bridge *br = netdev_priv(dev); struct net_bridge_port *p; struct nlattr *nest; if (!br->multicast_router || hlist_empty(&br->router_list)) return 0; nest = nla_nest_start(skb, M...
0
24,617
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: BGD_DECLARE(gdImagePtr) gdImageCrop(gdImagePtr src, const gdRect *crop) { gdImagePtr dst; dst = gdImageCreateTrueColor(crop->width, crop->height); if (!dst) return NULL; gdImageCopy(dst, src, 0, 0, crop->x, crop->y, crop->width, crop->height); return dst; } Commit Message: fix php 72494, invalid color ind...
0
15,163
Analyze the following 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 search_ioctl(struct inode *inode, struct btrfs_ioctl_search_args *args) { struct btrfs_root *root; struct btrfs_key key; struct btrfs_key max_key; struct btrfs_path *path; struct btrfs_ioctl_search_key *sk = &args->key; struct btrfs_fs_info *info = BTRFS_I(inode)->root->fs_info; in...
0
23,737
Analyze the following 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 SharedMemory::IsHandleValid(const SharedMemoryHandle& handle) { return handle != NULL; } Commit Message: Fix integer overflow in Windows shared memory handling. BUG=164490 Review URL: https://codereview.chromium.org/11450016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171369 0039d316-1c4b-4281-b...
0
15,399
Analyze the following 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 __save_altstack(stack_t __user *uss, unsigned long sp) { struct task_struct *t = current; return __put_user((void __user *)t->sas_ss_sp, &uss->ss_sp) | __put_user(sas_ss_flags(sp), &uss->ss_flags) | __put_user(t->sas_ss_size, &uss->ss_size); } Commit Message: kernel/signal.c: stop info leak via the tk...
0
1,979
Analyze the following 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_wrmsr(struct kvm_vcpu *vcpu) { struct msr_data msr; u32 ecx = vcpu->arch.regs[VCPU_REGS_RCX]; u64 data = (vcpu->arch.regs[VCPU_REGS_RAX] & -1u) | ((u64)(vcpu->arch.regs[VCPU_REGS_RDX] & -1u) << 32); msr.data = data; msr.index = ecx; msr.host_initiated = false; if (vmx_set_msr(vcpu, ...
1
16,666
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd) { struct usbnet *dev = netdev_priv(net); if (!dev->mii.mdio_read) return -EOPNOTSUPP; return mii_ethtool_gset(&dev->mii, cmd); } Commit Message: usbnet: cleanup after bind() in probe() In case bind() works, but a later error forces...
0
21,728
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: ScriptValue Performance::toJSONForBinding(ScriptState* script_state) const { V8ObjectBuilder result(script_state); BuildJSONValue(result); return result.GetScriptValue(); } Commit Message: Fix timing allow check algorithm for service workers This CL uses the OriginalURLViaServiceWorker() in the timing all...
0
27,970
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: FakeRemoteGattService* FakeCentral::GetFakeRemoteGattService( const std::string& peripheral_address, const std::string& service_id) const { FakePeripheral* fake_peripheral = GetFakePeripheral(peripheral_address); if (fake_peripheral == nullptr) { return nullptr; } return static_cast<FakeRemot...
0
2,493
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: Ins_SLOOP( INS_ARG ) { DO_SLOOP } Commit Message: CWE ID: CWE-119
0
10,229
Analyze the following 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 HttpResponseInfo* HttpProxyClientSocket::GetConnectResponseInfo() const { return response_.headers.get() ? &response_ : NULL; } Commit Message: Sanitize headers in Proxy Authentication Required responses BUG=431504 Review URL: https://codereview.chromium.org/769043003 Cr-Commit-Position: refs/heads/ma...
0
14,523
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: gfx::NativePixmapHandle>::Read(gfx::mojom::NativePixmapHandleDataView data, gfx::NativePixmapHandle* out) { #if defined(OS_LINUX) mojo::ArrayDataView<mojo::ScopedHandle> handles_data_view; data.GetFdsDataView(&handles_data_view); for (size_t i = 0; i < handles_data_vie...
0
28,021
Analyze the following 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 WebGLRenderingContextBase::drawingBufferWidth() const { return isContextLost() ? 0 : GetDrawingBuffer()->Size().Width(); } 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 test R=kbr@c...
0
25,344
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool IsRemoteStream( const std::vector<std::unique_ptr<RTCRtpReceiver>>& rtp_receivers, const std::string& stream_id) { for (const auto& receiver : rtp_receivers) { for (const auto& receiver_stream_id : receiver->state().stream_ids()) { if (stream_id == receiver_stream_id) return true;...
0
9,844
Analyze the following 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 spl_filesystem_file_read_line(zval * this_ptr, spl_filesystem_object *intern, int silent TSRMLS_DC) /* {{{ */ { int ret = spl_filesystem_file_read_line_ex(this_ptr, intern, silent TSRMLS_CC); while (SPL_HAS_FLAG(intern->flags, SPL_FILE_OBJECT_SKIP_EMPTY) && ret == SUCCESS && spl_filesystem_file_is_e...
1
9,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: struct inode *btrfs_alloc_inode(struct super_block *sb) { struct btrfs_inode *ei; struct inode *inode; ei = kmem_cache_alloc(btrfs_inode_cachep, GFP_NOFS); if (!ei) return NULL; ei->root = NULL; ei->generation = 0; ei->last_trans = 0; ei->last_sub_trans = 0; ei->logged_trans = 0; ei->delalloc_bytes ...
0
28,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: static ssize_t hugetlbfs_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos) { struct hstate *h = hstate_file(filp); struct address_space *mapping = filp->f_mapping; struct inode *inode = mapping->host; unsigned long index = *ppos >> huge_page_shift(h); unsigned long offset = *ppos &...
0
11,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: void ClientControlledShellSurface::OnSetFrame(SurfaceFrameType type) { if (container_ == ash::kShellWindowId_SystemModalContainer && type != SurfaceFrameType::NONE) { LOG(WARNING) << "A surface in system modal container should not have a frame:" << static_cast<int>(type); return; ...
0
10,243
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: GraphicBuffer::GraphicBuffer() : BASE(), mOwner(ownData), mBufferMapper(GraphicBufferMapper::get()), mInitCheck(NO_ERROR), mId(getUniqueId()) { width = height = stride = format = usage = 0; handle = NULL; } Commit Message: Fix for corruption when numFds or numInts is too larg...
0
24,731
Analyze the following 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_DEFINE2(gethostname, char __user *, name, int, len) { int i, errno; struct new_utsname *u; if (len < 0) return -EINVAL; down_read(&uts_sem); u = utsname(); i = 1 + strlen(u->nodename); if (i > len) i = len; errno = 0; if (copy_to_user(name, u->nodename, i)) errno = -EFAULT; up_read(&uts_s...
0
24,273