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: void SpdyWriteQueue::Enqueue(RequestPriority priority, SpdyFrameType frame_type, scoped_ptr<SpdyBufferProducer> frame_producer, const base::WeakPtr<SpdyStream>& stream) { CHECK_GE(priority, MINIMUM_PRIORITY); CHECK_LE(prior...
0
121,323
Analyze the following 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 OutOfProcessInstance::UpdateCursor(PP_CursorType_Dev cursor) { if (cursor == cursor_) return; cursor_ = cursor; const PPB_CursorControl_Dev* cursor_interface = reinterpret_cast<const PPB_CursorControl_Dev*>( pp::Module::Get()->GetBrowserInterface(PPB_CURSOR_CONTROL_DEV_INTERFACE)); i...
0
129,481
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void Document::UpdateStyleAndLayoutTreeIgnorePendingStylesheets() { CHECK(Lifecycle().StateAllowsTreeMutations()); StyleEngine::IgnoringPendingStylesheet ignoring(GetStyleEngine()); if (GetStyleEngine().HasPendingScriptBlockingSheets()) { HTMLElement* body_element = body(); if (body_element && !bod...
0
134,189
Analyze the following 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 RenderThread::CloseCurrentConnections() { Send(new ViewHostMsg_CloseCurrentConnections()); } Commit Message: DevTools: move DevToolsAgent/Client into content. BUG=84078 TEST= Review URL: http://codereview.chromium.org/7461019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93596 0039d316-1c4b-4281-...
0
98,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: static int create_yamaha_midi_quirk(struct snd_usb_audio *chip, struct usb_interface *iface, struct usb_driver *driver, struct usb_host_interface *alts) { static const struct snd_usb_audio_quirk yamaha_midi_quirk = { .type = QUIRK_MIDI_YAMAHA }; struct usb_midi_in_jack_descriptor *inj...
0
55,248
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: set_date_time(unsigned char *p, time_t t) { struct tm tm; get_tmfromtime(&tm, &t); set_digit(p, 4, tm.tm_year + 1900); set_digit(p+4, 2, tm.tm_mon + 1); set_digit(p+6, 2, tm.tm_mday); set_digit(p+8, 2, tm.tm_hour); set_digit(p+10, 2, tm.tm_min); set_digit(p+12, 2, tm.tm_sec); set_digit(p+14, 2, 0); set...
0
50,865
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: BrowserView::~BrowserView() { #if defined(USE_ASH) launcher_item_controller_.reset(); #endif preview_controller_.reset(NULL); browser_->tab_strip_model()->RemoveObserver(this); #if defined(OS_WIN) && !defined(USE_AURA) ticker_.Stop(); ticker_.UnregisterTickHandler(&hung_window_detector_); if (jump...
0
118,478
Analyze the following 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 JSTestObjConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject) { Base::finishCreation(exec->globalData()); ASSERT(inherits(&s_info)); putDirect(exec->globalData(), exec->propertyNames().prototype, JSTestObjPrototype::self(exec, globalObject), DontDelete | ReadOnly); pu...
0
101,200
Analyze the following 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::checkTimerFired(Timer<FrameLoader>*) { RefPtr<Frame> protect(m_frame); if (Page* page = m_frame->page()) { if (page->defersLoading()) return; } if (m_shouldCallCheckCompleted) checkCompleted(); } Commit Message: Don't wait to notify client of spoof a...
0
111,624
Analyze the following 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 LocalSiteCharacteristicsDataImpl::NotifyUsesNotificationsInBackground() { NotifyFeatureUsage( site_characteristics_.mutable_uses_notifications_in_background()); } Commit Message: Connect the LocalDB to TabManager. Bug: 773382 Change-Id: Iec8fe5226ee175105d51f300f30b4865478ac099 Reviewed-on: https...
0
132,062
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int get_implied_cluster_alloc(struct super_block *sb, struct ext4_map_blocks *map, struct ext4_extent *ex, struct ext4_ext_path *path) { struct ext4_sb_info *sbi = EXT4_SB(sb); ext4_lblk_t c_offset = EXT4_LBLK_COFF(sbi, map->m_lblk); ext4_lblk_t ex_cluster_start, ex_cluster_en...
0
44,909
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: cluster_free (struct cluster_list *cluster) { if (cluster->list) XFREE (MTYPE_CLUSTER_VAL, cluster->list); XFREE (MTYPE_CLUSTER, cluster); } Commit Message: CWE ID:
0
274
Analyze the following 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 cdrom_slot_status(struct cdrom_device_info *cdi, int slot) { struct cdrom_changer_info *info; int ret; cd_dbg(CD_CHANGER, "entering cdrom_slot_status()\n"); if (cdi->sanyo_slot) return CDS_NO_INFO; info = kmalloc(sizeof(*info), GFP_KERNEL); if (!info) return -ENOMEM; if ((ret = cdrom_rea...
0
76,275
Analyze the following 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 gfx::GLSurface* GetGLSurface() { return surface_.get(); } 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://svn.chromium.org/chrome/trunk/src@100507 0039d316-1c4b-4...
0
99,221
Analyze the following 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 cmd_dump(char *tag, char *name, int uid_start) { int r = 0; struct mailbox *mailbox = NULL; /* administrators only please */ if (!imapd_userisadmin) r = IMAP_PERMISSION_DENIED; char *intname = mboxname_from_external(name, &imapd_namespace, imapd_userid); if (!r) r = ...
0
95,140
Analyze the following 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 mpeg4_decode_gop_header(MpegEncContext *s, GetBitContext *gb) { int hours, minutes, seconds; if (!show_bits(gb, 23)) { av_log(s->avctx, AV_LOG_WARNING, "GOP header invalid\n"); return AVERROR_INVALIDDATA; } hours = get_bits(gb, 5); minutes = get_bits(gb, 6); ...
0
79,892
Analyze the following 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 load_free_nid_bitmap(struct f2fs_sb_info *sbi) { struct f2fs_nm_info *nm_i = NM_I(sbi); unsigned int i = 0; nid_t nid, last_nid; if (!enabled_nat_bits(sbi, NULL)) return; for (i = 0; i < nm_i->nat_blocks; i++) { i = find_next_bit_le(nm_i->empty_nat_bits, nm_i->nat_blocks, i); if (i >= nm_...
0
85,279
Analyze the following 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::SearchCompleted( int request_id, const std::string& file_system_path, const std::vector<std::string>& file_paths) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); ListValue file_paths_value; for (std::vector<std::string>::const_iterator it(file_paths.begin()); ...
0
113,200
Analyze the following 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 CommandBufferProxyImpl::DestroyImage(int32_t id) { CheckLock(); base::AutoLock lock(last_state_lock_); if (last_state_.error != gpu::error::kNoError) return; Send(new GpuCommandBufferMsg_DestroyImage(route_id_, id)); } Commit Message: Correct mojo::WrapSharedMemoryHandle usage Fixes some incor...
0
149,440
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void WebContentsImpl::RequestToLockMouse( RenderWidgetHostImpl* render_widget_host, bool user_gesture, bool last_unlocked_by_target, bool privileged) { for (WebContentsImpl* current = this; current; current = current->GetOuterWebContents()) { if (current->mouse_lock_widget_) { r...
0
135,865
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void RunExternalProtocolDialogWithDelegate( const GURL& url, int render_process_host_id, int routing_id, ui::PageTransition page_transition, bool has_user_gesture, ExternalProtocolHandler::Delegate* delegate) { if (delegate) { delegate->RunExternalProtocolDialog(url, render_process_h...
0
146,880
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: cib_client_status_callback(const char *node, const char *client, const char *status, void *private) { crm_node_t *peer = NULL; if (safe_str_eq(client, CRM_SYSTEM_CIB)) { crm_info("Status update: Client %s/%s now has status [%s]", node, client, status); if (safe_str_eq(status, JOINSTATUS)...
0
33,851
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: RenderViewTest::RenderViewTest() : view_(NULL) { RenderFrameImpl::InstallCreateHook(&TestRenderFrame::CreateTestRenderFrame); } Commit Message: Connect WebUSB client interface to the devices app This provides a basic WebUSB client interface in content/renderer. Most of the interface is unimplemented, but ...
0
123,082
Analyze the following 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 __net_init int sysctl_route_net_init(struct net *net) { struct ctl_table *tbl; tbl = ipv4_route_flush_table; if (!net_eq(net, &init_net)) { tbl = kmemdup(tbl, sizeof(ipv4_route_flush_table), GFP_KERNEL); if (tbl == NULL) goto err_dup; } tbl[0].extra1 = net; net->ipv4.route_hdr = register_n...
0
25,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: void DocumentWriter::begin(const KURL& urlReference, bool dispatch, SecurityOrigin* origin) { RefPtr<SecurityOrigin> forcedSecurityOrigin = origin; KURL url = urlReference; RefPtr<Document> document = createDocument(url); if (document->isPluginDocument() && m_frame->loader()->isSandboxed(Sa...
0
98,530
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: t42_is_space( FT_Byte c ) { return ( c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == '\f' || c == '\0' ); } Commit Message: CWE ID: CWE-119
0
7,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: t42_parse_sfnts( T42_Face face, T42_Loader loader ) { T42_Parser parser = &loader->parser; FT_Memory memory = parser->root.memory; FT_Byte* cur; FT_Byte* limit = parser->root.limit; FT_Error error; FT_Int num_tables = 0; FT_ULong count, t...
0
7,077
Analyze the following 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 cp2112_get_usb_config(struct hid_device *hdev, struct cp2112_usb_config_report *cfg) { int ret; ret = cp2112_hid_get(hdev, CP2112_USB_CONFIG, (u8 *)cfg, sizeof(*cfg), HID_FEATURE_REPORT); if (ret != sizeof(*cfg)) { hid_err(hdev, "error reading usb config: %d\n", ret); if (ret < 0) ...
0
66,443
Analyze the following 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 skb_checksum_setup(struct sk_buff *skb, bool recalculate) { int err; switch (skb->protocol) { case htons(ETH_P_IP): err = skb_checksum_setup_ipv4(skb, recalculate); break; case htons(ETH_P_IPV6): err = skb_checksum_setup_ipv6(skb, recalculate); break; default: err = -EPROTO; break; } re...
0
67,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 ReceiveEnableDeviceEmulation( RenderViewImpl* view, const blink::WebDeviceEmulationParams& params) { view->GetWidget()->OnEnableDeviceEmulation(params); } Commit Message: Convert FrameHostMsg_DidAddMessageToConsole to Mojo. Note: Since this required changing the test RenderViewImplTest....
0
139,904
Analyze the following 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 smbXcli_negprot_smb2_done(struct tevent_req *subreq) { struct tevent_req *req = tevent_req_callback_data(subreq, struct tevent_req); struct smbXcli_negprot_state *state = tevent_req_data(req, struct smbXcli_negprot_state); struct smbXcli_conn *conn = state->conn; size_t security_offset, se...
0
2,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 PrintingMessageFilter::GetPrintSettingsForRenderView( int render_view_id, GetPrintSettingsForRenderViewParams params, const base::Closure& callback, scoped_refptr<printing::PrinterQuery> printer_query) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); content::WebContents* wc = Get...
0
105,778
Analyze the following 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 ExtensionWebRequestTest::FireURLRequestWithData( const std::string& method, const char* content_type, const std::vector<char>& bytes_1, const std::vector<char>& bytes_2) { GURL request_url("http://www.example.com"); std::unique_ptr<net::URLRequest> request( context_->CreateRequest(r...
0
119,303
Analyze the following 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 rds_ib_add_one(struct ib_device *device) { struct rds_ib_device *rds_ibdev; struct ib_device_attr *dev_attr; /* Only handle IB (no iWARP) devices */ if (device->node_type != RDMA_NODE_IB_CA) return; dev_attr = kmalloc(sizeof *dev_attr, GFP_KERNEL); if (!dev_attr) return; if (ib_query_dev...
0
40,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: bool LauncherView::SameDragType(LauncherItemType typea, LauncherItemType typeb) const { switch (typea) { case TYPE_TABBED: case TYPE_APP_PANEL: case TYPE_PLATFORM_APP: return (typeb == TYPE_TABBED || typeb == TYPE_APP_PANEL || typeb == TYPE_P...
0
106,257
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: int HTMLInputElement::maxLength() const { return m_maxLength; } Commit Message: Setting input.x-webkit-speech should not cause focus change In r150866, we introduced element()->focus() in destroyShadowSubtree() to retain focus on <input> when its type attribute gets changed. But when x-webkit-speech attribu...
0
112,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 size_t index_entry_size(size_t path_len, size_t varint_len, uint32_t flags) { if (varint_len) { if (flags & GIT_IDXENTRY_EXTENDED) return offsetof(struct entry_long, path) + path_len + 1 + varint_len; else return offsetof(struct entry_short, path) + path_len + 1 + varint_len; } else { #define e...
0
83,735
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit) { png_debug1(1, "in %s retrieval function", "sBIT"); if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT) && sig_bit != NULL) { *sig_bit = &(info_ptr->sig_bit); return (PNG_INFO_sBIT); ...
0
131,298
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: KURL FrameFetchContext::GetSiteForCookies() const { if (IsDetached()) return frozen_state_->site_for_cookies; Document* document = document_ ? document_.Get() : GetFrame()->GetDocument(); return document->SiteForCookies(); } Commit Message: DevTools: send proper resource type in Network.RequestWillBeS...
0
138,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: status_t MPEG4Extractor::parseColorInfo(off64_t offset, size_t size) { if (size < 4 || size == SIZE_MAX || mLastTrack == NULL) { return ERROR_MALFORMED; } uint8_t *buffer = new (std::nothrow) uint8_t[size + 1]; if (buffer == NULL) { return ERROR_MALFORMED; } if (mDataSource->readAt(offset, buffer, size) ...
0
162,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: SignInIsolationBrowserTest() : https_server_(net::EmbeddedTestServer::TYPE_HTTPS) {} Commit Message: Don't preserve NavigationEntry for failed navigations with invalid URLs. The formatting logic may rewrite such URLs into an unsafe state. This is a first step before preventing navigations to invalid UR...
0
143,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: nvme_fc_parse_traddr(struct nvmet_fc_traddr *traddr, char *buf, size_t blen) { char name[2 + NVME_FC_TRADDR_HEXNAMELEN + 1]; substring_t wwn = { name, &name[sizeof(name)-1] }; int nnoffset, pnoffset; /* validate it string one of the 2 allowed formats */ if (strnlen(buf, blen) == NVME_FC_TRADDR_MAXLENGTH && ...
0
93,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: MediaRequestState state(MediaStreamType stream_type) const { return state_[stream_type]; } Commit Message: Make MediaStreamDispatcherHost per-request instead of per-frame. Instead of having RenderFrameHost own a single MSDH to handle all requests from a frame, MSDH objects will be owned by a strong bind...
0
153,217
Analyze the following 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 adjust(LayoutSize& offset) const { LayoutUnit currLogicalLeftOffset = (m_isHorizontal ? m_colRect.x() : m_colRect.y()) - m_logicalLeft; offset += m_isHorizontal ? LayoutSize(currLogicalLeftOffset, m_currLogicalTopOffset) : LayoutSize(m_currLogicalTopOffset, currLogicalLeftOffset); ...
0
116,136
Analyze the following 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 InterstitialPageImpl::OnMessageReceived( RenderFrameHostImpl* render_frame_host, const IPC::Message& message) { if (render_frame_host->GetRenderViewHost() != render_view_host_) { DCHECK(!render_view_host_) << "We expect an interstitial page to have only a single RVH"; return false; ...
0
136,119
Analyze the following 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 activityLoggedAttr1AttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) { TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext()); if (contextData && cont...
0
121,488
Analyze the following 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 FreeArray( _cmsDICarray* a) { if (a ->Name.Offsets != NULL) FreeElem(&a->Name); if (a ->Value.Offsets != NULL) FreeElem(&a ->Value); if (a ->DisplayName.Offsets != NULL) FreeElem(&a->DisplayName); if (a ->DisplayValue.Offsets != NULL) FreeElem(&a ->DisplayValue); } Commit Message: Added an e...
0
70,939
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: PHP_FUNCTION(imagecreatefromgif) { _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GIF, "GIF", gdImageCreateFromGif, gdImageCreateFromGifCtx); } Commit Message: CWE ID: CWE-254
0
15,112
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: InterpolationQuality GraphicsContext::imageInterpolationQuality() const { return InterpolationDefault; } Commit Message: Reviewed by Kevin Ollivier. [wx] Fix strokeArc and fillRoundedRect drawing, and add clipPath support. https://bugs.webkit.org/show_bug.cgi?id=60847 git-svn-id: svn://svn.chrom...
0
100,094
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: unsigned long nr_uninterruptible(void) { unsigned long i, sum = 0; for_each_possible_cpu(i) sum += cpu_rq(i)->nr_uninterruptible; /* * Since we read the counters lockless, it might be slightly * inaccurate. Do not allow it to go below zero though: */ if (unlikely((long)sum < 0)) sum = 0; return ...
0
22,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: 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 (kvm_set_msr(vcpu, &ms...
0
37,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: apprentice_sort(const void *a, const void *b) { const struct magic_entry *ma = CAST(const struct magic_entry *, a); const struct magic_entry *mb = CAST(const struct magic_entry *, b); size_t sa = apprentice_magic_strength(ma->mp); size_t sb = apprentice_magic_strength(mb->mp); if (sa == sb) return 0; else...
0
7,375
Analyze the following 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 Camera2Client::commandPlayRecordingSoundL() { mCameraService->playSound(CameraService::SOUND_RECORDING); return OK; } Commit Message: Camera: Disallow dumping clients directly Camera service dumps should only be initiated through ICameraService::dump. Bug: 26265403 Change-Id: If3ca4718ed74bf33ad8...
0
161,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: AutocompleteEditModel::State::State(bool user_input_in_progress, const string16& user_text, const string16& keyword, bool is_keyword_hint) : user_input_in_progress(user_input_in_progress), user_te...
0
103,868
Analyze the following 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 sycc422_to_rgb(opj_image_t *img) { int *d0, *d1, *d2, *r, *g, *b; const int *y, *cb, *cr; size_t maxw, maxh, max, offx, loopmaxw; int offset, upb; size_t i; upb = (int)img->comps[0].prec; offset = 1<<(upb - 1); upb = (1<<upb)-1; maxw = (size_t)img->comps[0].w; maxh = (size_t)img->comps[0].h...
0
73,871
Analyze the following 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 vmx_handle_exit(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx = to_vmx(vcpu); u32 exit_reason = vmx->exit_reason; u32 vectoring_info = vmx->idt_vectoring_info; trace_kvm_exit(exit_reason, vcpu, KVM_ISA_VMX); /* * Flush logged GPAs PML buffer, this will make dirty_bitmap more * updated. Anoth...
0
48,120
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: iter_recurse (DBusMessageDataIter *iter) { iter->depth += 1; _dbus_assert (iter->depth < _DBUS_MESSAGE_DATA_MAX_NESTING); _dbus_assert (iter->sequence_nos[iter->depth] >= 0); } Commit Message: CWE ID: CWE-399
0
7,499
Analyze the following 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 inet_free_ifa(struct in_ifaddr *ifa) { call_rcu(&ifa->rcu_head, inet_rcu_free_ifa); } Commit Message: ipv4: Don't do expensive useless work during inetdev destroy. When an inetdev is destroyed, every address assigned to the interface is removed. And in this scenerio we do two pointless things whic...
0
54,079
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: jpeg_start_decompress_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo) { if( SETJMP(sp->exit_jmpbuf) ) return 0; else { jpeg_start_decompress(cinfo); return 1; } } Commit Message: * libtiff/tif_ojpeg.c: make OJPEGDecode() early exit in case of failure in OJPEGPreDecode(). This will avoid a divide by...
0
70,329
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: v8::Handle<v8::Object> V8TestNamedConstructor::wrapSlow(PassRefPtr<TestNamedConstructor> impl, v8::Isolate* isolate) { v8::Handle<v8::Object> wrapper; V8Proxy* proxy = 0; wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl.get()); if (UNLIKELY(wrapper.IsEmpty())) return wrapper;...
0
109,513
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: COMPS_HSList* comps_rtree_pairs(COMPS_RTree * rt) { return __comps_rtree_all(rt, 2); } Commit Message: Fix UAF in comps_objmrtree_unite function The added field is not used at all in many places and it is probably the left-over of some copy-paste. CWE ID: CWE-416
0
91,827
Analyze the following 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 Con_DrawNotify (void) { int x, v; short *text; int i; int time; int skip; int currentColor; currentColor = 7; re.SetColor( g_color_table[currentColor] ); v = 0; for (i= con.current-NUM_CON_TIMES+1 ; i<=con.current ; i++) { if (i < 0) continue; time = con.times[i % NUM_CON_TIMES]; i...
0
95,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: void LayoutSVGViewportContainer::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) const { SVGContainerPainter(*this).paint(paintInfo); } Commit Message: Avoid using forced layout to trigger paint invalidation for SVG containers Currently, SVG containers in the LayoutObject hierarchy force l...
0
121,140
Analyze the following 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 tcp_mark_push(struct tcp_sock *tp, struct sk_buff *skb) { TCP_SKB_CB(skb)->tcp_flags |= TCPHDR_PSH; tp->pushed_seq = tp->write_seq; } Commit Message: tcp: initialize rcv_mss to TCP_MIN_MSS instead of 0 When tcp_disconnect() is called, inet_csk_delack_init() sets icsk->icsk_ack.rcv_mss to 0....
0
61,748
Analyze the following 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 update_recv_orders(rdpUpdate* update, wStream* s) { UINT16 numberOrders; if (Stream_GetRemainingLength(s) < 6) { WLog_ERR(TAG, "Stream_GetRemainingLength(s) < 6"); return FALSE; } Stream_Seek_UINT16(s); /* pad2OctetsA (2 bytes) */ Stream_Read_UINT16(s, numberOrders); /* numberOrders (2 byt...
0
83,576
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: nfsd_adjust_nfsd_versions4(void) { unsigned i; for (i = 0; i <= NFSD_SUPPORTED_MINOR_VERSION; i++) { if (nfsd_supported_minorversions[i]) return; } nfsd_vers(4, NFSD_CLEAR); } Commit Message: nfsd: check for oversized NFSv2/v3 arguments A client can append random data to the end of an NFSv2 or NFSv3 R...
0
67,132
Analyze the following 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 instruction * compiler_create_instruction(struct filter_op *fop) { struct instruction *ins; SAFE_CALLOC(ins, 1, sizeof(struct instruction)); /* copy the instruction */ memcpy(&ins->fop, fop, sizeof(struct filter_op)); return ins; } Commit Message: Exit gracefully in case of corrupted ...
0
68,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: void DevToolsWindow::AddNewContents(WebContents* source, WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_rect, bool user_gesture, ...
0
138,373
Analyze the following 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 ScreenOrientationDispatcherHost::OnOrientationChange() { if (provider_) provider_->OnOrientationChange(); } Commit Message: Cleanups in ScreenOrientationDispatcherHost. BUG=None Review URL: https://codereview.chromium.org/408213003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284786 0039d316...
0
111,196
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void dbg_to_reg(struct kvm_vcpu *vcpu, struct sys_reg_params *p, u64 *dbg_reg) { p->regval = *dbg_reg; if (p->is_32bit) p->regval &= 0xffffffffUL; } Commit Message: arm64: KVM: pmu: Fix AArch32 cycle counter access We're missing the handling code for the cycle counter accessed from ...
0
62,876
Analyze the following 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 int_floorlog2(int a) { int l; for (l = 0; a > 1; l++) { a >>= 1; } return l; } Commit Message: pgxtoimage(): fix write stack buffer overflow (#997) CWE ID: CWE-787
0
61,892
Analyze the following 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 perf_pmu_rotate_start(struct pmu *pmu) { struct perf_cpu_context *cpuctx = this_cpu_ptr(pmu->pmu_cpu_context); struct list_head *head = &__get_cpu_var(rotation_list); WARN_ON(!irqs_disabled()); if (list_empty(&cpuctx->rotation_list)) list_add(&cpuctx->rotation_list, head); } Commit Message: p...
0
26,149
Analyze the following 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_apic_match_logical_addr(struct kvm_lapic *apic, u8 mda) { int result = 0; u32 logical_id; if (apic_x2apic_mode(apic)) { logical_id = kvm_apic_get_reg(apic, APIC_LDR); return logical_id & mda; } logical_id = GET_APIC_LOGICAL_ID(kvm_apic_get_reg(apic, APIC_LDR)); switch (kvm_apic_get_reg(apic, ...
0
28,753
Analyze the following 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 PDFiumEngineExports::GetPDFPageSizeByIndex( const void* pdf_buffer, int pdf_buffer_size, int page_number, double* width, double* height) { FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); if (!doc) return false; bool success = FPDF_GetPageSiz...
0
140,338
Analyze the following 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 struct fsnotify_group *inotify_new_group(struct user_struct *user, unsigned int max_events) { struct fsnotify_group *group; group = fsnotify_alloc_group(&inotify_fsnotify_ops); if (IS_ERR(group)) return group; group->max_events = max_events; spin_lock_init(&group->inotify_data.idr_lock); id...
1
165,888
Analyze the following 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 RecordAction(const UserMetricsAction& action) { RecordComputedAction(action.str_); } Commit Message: Convert Uses of base::RepeatingCallback<>::Equals to Use == or != in //base Staging this change because some conversions will have semantic changes. BUG=937566 Change-Id: I2d4950624c0fab00e107814421a161...
0
130,658
Analyze the following 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 ChromeMockRenderThread::set_print_preview_cancel_page_number(int page) { print_preview_cancel_page_number_ = page; } Commit Message: Print preview: Use an ID instead of memory pointer string in WebUI. BUG=144051 Review URL: https://chromiumcodereview.appspot.com/10870003 git-svn-id: svn://svn.chromiu...
0
105,867
Analyze the following 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 grow_pgdat_span(struct pglist_data *pgdat, unsigned long start_pfn, unsigned long end_pfn) { unsigned long old_pgdat_end_pfn = pgdat->node_start_pfn + pgdat->node_spanned_pages; if (start_pfn < pgdat->node_start_pfn) pgdat->node_start_pfn = start_pfn; pgdat->node_spanned_pages = max(ol...
0
18,499
Analyze the following 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 RenderWidgetHostViewGtk::SetHasHorizontalScrollbar( bool has_horizontal_scrollbar) { } Commit Message: Implement TextureImageTransportSurface using texture mailbox This has a couple of advantages: - allow tearing down and recreating the UI parent context without losing the renderer contexts - do not re...
0
114,992
Analyze the following 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 struct pfkey_sock *pfkey_sk(struct sock *sk) { return (struct pfkey_sock *)sk; } Commit Message: af_key: initialize satype in key_notify_policy_flush() This field was left uninitialized. Some user daemons perform check against this field. Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com...
0
31,460
Analyze the following 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 encode_renew(struct xdr_stream *xdr, const struct nfs_client *client_stateid, struct compound_hdr *hdr) { __be32 *p; p = reserve_space(xdr, 12); *p++ = cpu_to_be32(OP_RENEW); xdr_encode_hyper(p, client_stateid->cl_clientid); hdr->nops++; hdr->replen += decode_renew_maxsz; } Commit Message: NFS...
0
23,388
Analyze the following 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 ip6_dev_loopback_xmit(struct sk_buff *newskb) { skb_reset_mac_header(newskb); __skb_pull(newskb, skb_network_offset(newskb)); newskb->pkt_type = PACKET_LOOPBACK; newskb->ip_summed = CHECKSUM_UNNECESSARY; WARN_ON(!skb_dst(newskb)); netif_rx_ni(newskb); return 0; } Commit Message: ipv6: make fra...
0
26,611
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: TabCloseableStateWatcher::TabCloseableStateWatcher() : can_close_tab_(true), signing_off_(false), guest_session_( CommandLine::ForCurrentProcess()->HasSwitch( switches::kGuestSession)), waiting_for_browser_(false) { BrowserList::AddObserver(this); notification_reg...
0
98,026
Analyze the following 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 IsFileType(BlobData::Item::Type type) { switch (type) { case BlobData::Item::TYPE_FILE: case BlobData::Item::TYPE_FILE_FILESYSTEM: return true; default: return false; } } Commit Message: Avoid integer overflows in BlobURLRequestJob. BUG=169685 Review URL: https://chromiumco...
0
115,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: GF_Err ssix_Size(GF_Box *s) { u32 i; GF_SubsegmentIndexBox *ptr = (GF_SubsegmentIndexBox*)s; ptr->size += 4; for (i = 0; i < ptr->subsegment_count; i++) { ptr->size += 4 + 4 * ptr->subsegments[i].range_count; } return GF_OK; } Commit Message: fixed 2 possible heap overflows (inc. #1088) CWE ID: CWE-125
0
80,431
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: SpoolssEnumPrinters_q(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep _U_) { guint32 level, flags; dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data; static const int * hf_flags[] = { &hf_enumprinters_flags_network, &hf_enumprinters_flags_shared...
0
51,952
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: PDFiumEngine::SelectionChangeInvalidator::~SelectionChangeInvalidator() { pp::Point offset = previous_origin_ - engine_->GetVisibleRect().point(); for (auto& old_selection : old_selections_) old_selection.Offset(offset); std::vector<pp::Rect> new_selections = GetVisibleSelections(); for (auto& new_se...
0
146,228
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void V8TestObject::ReflectTestInterfaceAttributeAttributeSetterCallback( const v8::FunctionCallbackInfo<v8::Value>& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_reflectTestInterfaceAttribute_Setter"); v8::Local<v8::Value> v8_value = info[0]; test_object_v8_...
0
135,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 int efx_pm_resume(struct device *dev) { struct pci_dev *pci_dev = to_pci_dev(dev); struct efx_nic *efx = pci_get_drvdata(pci_dev); int rc; rc = pci_set_power_state(pci_dev, PCI_D0); if (rc) return rc; pci_restore_state(pci_dev); rc = pci_enable_device(pci_dev); if (rc) return rc; pci_set_mast...
0
19,400
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: juniper_atm2_print(netdissect_options *ndo, const struct pcap_pkthdr *h, register const u_char *p) { int llc_hdrlen; struct juniper_l2info_t l2info; l2info.pictype = DLT_JUNIPER_ATM2; if (juniper_parse_header(ndo, p, h, &l2info) == 0) return l2info....
0
95,094
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: DXVAVideoDecodeAccelerator::DXVAPictureBuffer::~DXVAPictureBuffer() { if (decoding_surface_) { eglReleaseTexImage( static_cast<EGLDisplay*>(eglGetDisplay(EGL_DEFAULT_DISPLAY)), decoding_surface_, EGL_BACK_BUFFER); eglDestroySurface( static_cast<EGLDisplay*>(eglGetDisplay...
0
106,954
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t syncp_offset) { u64 res = 0; int cpu; for_each_possible_cpu(cpu) { void *bhptr, *userptr; struct u64_stats_sync *syncp; u64 v_bh, v_user; unsigned int start; /* first mib used by softirq context, we must use _bh() accessors */ bhptr = p...
0
18,806
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int rtnetlink_event(struct notifier_block *this, unsigned long event, void *ptr) { struct net_device *dev = netdev_notifier_info_to_dev(ptr); switch (event) { case NETDEV_UP: case NETDEV_DOWN: case NETDEV_PRE_UP: case NETDEV_POST_INIT: case NETDEV_REGISTER: case NETDEV_CHANGE: case NETDEV_PRE_TYP...
0
53,136
Analyze the following 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 RenderWidgetHostViewGtk::LockMouse() { if (mouse_locked_) return true; mouse_locked_ = true; GtkWidget* current_grab_window = gtk_grab_get_current(); if (current_grab_window) { gtk_grab_remove(current_grab_window); LOG(WARNING) << "Locking Mouse with gdk_pointer_grab, " ...
0
114,963
Analyze the following 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 check_stack_read(struct bpf_verifier_env *env, struct bpf_func_state *reg_state /* func where register points to */, int off, int size, int value_regno) { struct bpf_verifier_state *vstate = env->cur_state; struct bpf_func_state *state = vstate->frame[vstate->curframe]; int i, slot = -...
0
91,422
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static irqreturn_t atl2_intr(int irq, void *data) { struct atl2_adapter *adapter = netdev_priv(data); struct atl2_hw *hw = &adapter->hw; u32 status; status = ATL2_READ_REG(hw, REG_ISR); if (0 == status) return IRQ_NONE; /* link event */ if (status & ISR_PHY) atl2_clear_phy_int(adapter); /* clear IS...
0
55,311
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion, arg_type type, int flags, size_t width, int has_precision, size_t precision, int pad_ourselves) { size_t tmp_length; switch (conversion) { case 'd': case 'i': case 'u': # if HAVE_LONG_LONG_IN...
0
76,530
Analyze the following 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 ssl_scan_clienthello_custom_tlsext(SSL *s, const unsigned char *data, const unsigned char *limit, int *al) { unsigned short type, size, len; /* If resumed se...
1
165,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: XRenderExtAddDisplay (XRenderExtInfo *extinfo, Display *dpy, char *ext_name) { XRenderExtDisplayInfo *dpyinfo; dpyinfo = (XRenderExtDisplayInfo *) Xmalloc (sizeof (XRenderExtDisplayInfo)); if (!dpyinfo) return NULL; dpyinfo->display = d...
0
8,274
Analyze the following 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 drm_connector_cleanup(struct drm_connector *connector) { struct drm_device *dev = connector->dev; struct drm_display_mode *mode, *t; list_for_each_entry_safe(mode, t, &connector->probed_modes, head) drm_mode_remove(connector, mode); list_for_each_entry_safe(mode, t, &connector->modes, head) drm_mod...
0
21,860