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: int64 CreateUnsyncedDirectory(const string& entry_name, const syncable::Id& id) { WriteTransaction wtrans(FROM_HERE, UNITTEST, directory()); MutableEntry entry(&wtrans, syncable::CREATE, wtrans.root_id(), entry_name); EXPECT_TRUE(entry.good()); entry.Put(syncable::IS...
0
105,086
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: sf_read_short (SNDFILE *sndfile, short *ptr, sf_count_t len) { SF_PRIVATE *psf ; sf_count_t count, extra ; VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; if (psf->file.mode == SFM_WRITE) { psf->error = SFE_NOT_READMODE ; return 0 ; } ; if (len % psf->sf.channels) { psf->error = SFE_BAD_READ_ALI...
0
95,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: bool is_inert() const { return is_inert_; } 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 via mechanisms like Filt...
0
143,937
Analyze the following 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(imageconvolution) { zval *SIM, *hash_matrix; zval **var = NULL, **var2 = NULL; gdImagePtr im_src = NULL; double div, offset; int nelem, i, j, res; float matrix[3][3] = {{0,0,0}, {0,0,0}, {0,0,0}}; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "radd", &SIM, &hash_matrix, &div, &offset) ...
0
15,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: AppShortcutManager::~AppShortcutManager() { if (g_browser_process && is_profile_info_cache_observer_) { ProfileManager* profile_manager = g_browser_process->profile_manager(); if (profile_manager) profile_manager->GetProfileInfoCache().RemoveObserver(this); } } Commit Message: Remove --disable-...
0
110,322
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void BluetoothOptionsHandler::ValidateDefaultAdapter( chromeos::BluetoothAdapter* adapter) { if ((adapter == NULL && !default_adapter_id_.empty()) || (adapter != NULL && default_adapter_id_ != adapter->Id())) { VLOG(1) << "unexpected default adapter change from \"" << default_adapter_...
0
107,415
Analyze the following 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 xml_parser_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) { xml_parser *parser = (xml_parser *)rsrc->ptr; if (parser->parser) { XML_ParserFree(parser->parser); } if (parser->ltags) { int inx; for (inx = 0; ((inx < parser->level) && (inx < XML_MAXLEVEL)); inx+...
1
165,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: void WebLocalFrameImpl::SetCanHaveScrollbars(bool can_have_scrollbars) { if (LocalFrameView* view = GetFrameView()) view->SetCanHaveScrollbars(can_have_scrollbars); } Commit Message: Inherit CSP when we inherit the security origin This prevents attacks that use main window navigation to get out of the exi...
0
134,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: v8::Persistent<v8::FunctionTemplate> V8TestInterface::GetTemplate() { V8BindingPerIsolateData* data = V8BindingPerIsolateData::current(); V8BindingPerIsolateData::TemplateMap::iterator result = data->templateMap().find(&info); if (result != data->templateMap().end()) return result->second; ...
0
109,490
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: string16 ToLower(const string16& string) { icu::UnicodeString unicode_string(string.c_str(), string.size()); unicode_string.toLower(); return string16(unicode_string.getBuffer(), unicode_string.length()); } Commit Message: base/i18n: Remove unneeded includes in case_conversion.* These includes are not nee...
0
100,003
Analyze the following 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 usb_host_interface *usb_altnum_to_altsetting( const struct usb_interface *intf, unsigned int altnum) { int i; for (i = 0; i < intf->num_altsetting; i++) { if (intf->altsetting[i].desc.bAlternateSetting == altnum) return &intf->altsetting[i]; } return NULL; } Commit Message: USB: check ...
0
75,538
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: PassRefPtr<Event> DeviceOrientationController::getLastEvent() { return DeviceOrientationEvent::create(EventTypeNames::deviceorientation, DeviceOrientationDispatcher::instance().latestDeviceOrientationData()); } Commit Message: DevTools: remove references to modules/device_orientation from core BUG=3...
0
115,291
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: NO_INLINE void jsExceptionHere_flash(JsExceptionType type, const char *ffmt, ...) { size_t len = flash_strlen(ffmt); char fmt[len+1]; flash_strncpy(fmt, ffmt, len+1); if (jspHasError()) return; jsiConsoleRemoveInputLine(); JsVar *var = jsvNewFromEmptyString(); if (!var) { jspSetError(false); ...
0
82,616
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void ndisc_error_report(struct neighbour *neigh, struct sk_buff *skb) { /* * "The sender MUST return an ICMP * destination unreachable" */ dst_link_failure(skb); kfree_skb(skb); } Commit Message: ipv6: Don't reduce hop limit for an interface A local route may have a lower hop_limit set than glo...
0
43,700
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: WebContentsViewDelegate* ContentBrowserClient::GetWebContentsViewDelegate( WebContents* web_contents) { return NULL; } Commit Message: Ensure extensions and the Chrome Web Store are loaded in new BrowsingInstances. BUG=174943 TEST=Can't post message to CWS. See bug for repro steps. Review URL: https://...
0
115,858
Analyze the following 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 DevToolsHttpHandler::Send200(int connection_id, const std::string& data, const std::string& mime_type) { if (!thread_) return; thread_->task_runner()->PostTask( FROM_HERE, base::BindOnce(&ServerWrapper::Send200, ...
0
148,266
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: ExtensionContextMenuModel::ExtensionContextMenuModel( const Extension* extension, Browser* browser, PopupDelegate* delegate) : ALLOW_THIS_IN_INITIALIZER_LIST(SimpleMenuModel(this)), extension_id_(extension->id()), browser_(browser), profile_(browser->profile()), delegate_(d...
0
107,726
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void bond_arp_send(struct net_device *slave_dev, int arp_op, __be32 dest_ip, __be32 src_ip, unsigned short vlan_id) { struct sk_buff *skb; pr_debug("arp %d on slave %s: dst %x src %x vid %d\n", arp_op, slave_dev->name, dest_ip, src_ip, vlan_id); skb = arp_create(arp_op, ETH_P_ARP, dest_ip, slave_de...
0
23,691
Analyze the following 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::string TestURLLoader::TestBasicPOST() { pp::URLRequestInfo request(instance_); request.SetURL("/echo"); request.SetMethod("POST"); std::string postdata("postdata"); request.AppendDataToBody(postdata.data(), static_cast<uint32_t>(postdata.length())); return LoadAndCompar...
0
156,451
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void *create_server_config(apr_pool_t *p, server_rec *s) { ap_lua_server_cfg *cfg = apr_pcalloc(p, sizeof(ap_lua_server_cfg)); cfg->vm_reslists = apr_hash_make(p); apr_thread_rwlock_create(&cfg->vm_reslists_lock, p); cfg->root_path = NULL; return cfg; } Commit Message: Merge r1642499...
0
35,681
Analyze the following 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 ne2000_mem_writel(NE2000State *s, uint32_t addr, uint32_t val) { addr &= ~1; /* XXX: check exact behaviour if not even */ if (addr < 32 || (addr >= NE2000_PMEM_START && addr + sizeof(uint32_t) <= NE2000_MEM_SIZE)) { stl_le...
0
12,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: bool Range::intersectsNode(Node* refNode, ExceptionCode& ec) { if (!m_start.container()) { ec = INVALID_STATE_ERR; return false; } if (!refNode) { ec = NOT_FOUND_ERR; return false; } if (!refNode->attached() || refNode->document() != m_ownerDocument) { ...
0
100,253
Analyze the following 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 FoFiType1::writeEncoded(char **newEncoding, FoFiOutputFunc outputFunc, void *outputStream) { char buf[512]; char *line, *line2, *p; int i; for (line = (char *)file; line && strncmp(line, "/Encoding", 9); line = getNextLine(line)) ; if (!line) { (*outputFunc)(outputStream,...
0
8,064
Analyze the following 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 bmp_gethdr(jas_stream_t *in, bmp_hdr_t *hdr) { if (bmp_getint16(in, &hdr->magic) || hdr->magic != BMP_MAGIC || bmp_getint32(in, &hdr->siz) || bmp_getint16(in, &hdr->reserved1) || bmp_getint16(in, &hdr->reserved2) || bmp_getint32(in, &hdr->off)) { return -1; } return 0; } Commit Message: The...
0
72,820
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int jpc_ppt_putparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *out) { jpc_ppt_t *ppt = &ms->parms.ppt; /* Eliminate compiler warning about unused variable. */ cstate = 0; if (jpc_putuint8(out, ppt->ind)) { return -1; } if (jas_stream_write(out, (char *) ppt->data, ppt->len) != JAS_CAST(in...
0
72,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: ResourceRequest& DocumentLoader::request() { return m_request; } Commit Message: Unreviewed, rolling out r147402. http://trac.webkit.org/changeset/147402 https://bugs.webkit.org/show_bug.cgi?id=112903 Source/WebCore: * dom/Document.cpp: (WebCore::Document::processHttpEquiv): * loader/DocumentLoader.cpp: (...
0
105,743
Analyze the following 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 jp2_colr_putdata(jp2_box_t *box, jas_stream_t *out) { jp2_colr_t *colr = &box->data.colr; if (jp2_putuint8(out, colr->method) || jp2_putuint8(out, colr->pri) || jp2_putuint8(out, colr->approx)) { return -1; } switch (colr->method) { case JP2_COLR_ENUM: if (jp2_putuint32(out, colr->csid)) { ...
0
67,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: static inline u8 byte(const u32 x, const unsigned n) { return x >> (n << 3); } Commit Message: crypto: prefix module autoloading with "crypto-" This prefixes all crypto module loading with "crypto-" so we never run the risk of exposing module auto-loading to userspace via a crypto API, as demonstrated by Mathi...
0
47,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: static void sock_def_destruct(struct sock *sk) { } Commit Message: net: avoid signed overflows for SO_{SND|RCV}BUFFORCE CAP_NET_ADMIN users should not be allowed to set negative sk_sndbuf or sk_rcvbuf values, as it can lead to various memory corruptions, crashes, OOM... Note that before commit 82981930125a ("n...
0
47,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: void InspectorResourceAgent::didReceiveResourceResponse(LocalFrame* frame, unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response, ResourceLoader* resourceLoader) { if (!loader) return; String requestId = IdentifiersFactory::requestId(identifier); RefPtr<TypeBuilde...
0
114,151
Analyze the following 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 AXObjectCacheImpl::textChanged(AXObject* obj) { if (!obj) return; bool parentAlreadyExists = obj->parentObjectIfExists(); obj->textChanged(); postNotification(obj, AXObjectCacheImpl::AXTextChanged); if (parentAlreadyExists) obj->notifyIfIgnoredValueChanged(); } Commit Message: Switch to e...
0
127,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: validGlxFBConfig(ClientPtr client, __GLXscreen *pGlxScreen, XID id, __GLXconfig **config, int *err) { __GLXconfig *m; for (m = pGlxScreen->fbconfigs; m != NULL; m = m->next) if (m->fbconfigID == id) { *config = m; return TRUE; } client->errorValue = id; *err = __glXError(GLXBadFBC...
0
14,190
Analyze the following 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_datagram_seg(struct mlx5_wqe_datagram_seg *dseg, const struct ib_send_wr *wr) { memcpy(&dseg->av, &to_mah(ud_wr(wr)->ah)->av, sizeof(struct mlx5_av)); dseg->av.dqp_dct = cpu_to_be32(ud_wr(wr)->remote_qpn | MLX5_EXTENDED_UD_AV); dseg->av.key.qkey.qkey = cpu_to_be32(ud_wr(wr)->remote_qkey...
0
92,181
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: AppCacheUpdateJob::~AppCacheUpdateJob() { if (service_) service_->RemoveObserver(this); if (internal_state_ != COMPLETED) Cancel(); DCHECK(!inprogress_cache_.get()); DCHECK(pending_master_entries_.empty()); CHECK(!manifest_fetcher_); CHECK(pending_url_fetches_.empty()); CHECK(master_entry_...
0
151,441
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: u32 rxrpc_kernel_get_abort_code(struct sk_buff *skb) { struct rxrpc_skb_priv *sp = rxrpc_skb(skb); ASSERTCMP(skb->mark, ==, RXRPC_SKB_MARK_REMOTE_ABORT); return sp->call->abort_code; } Commit Message: net: rework recvmsg handler msg_name and msg_namelen logic This patch now always passes msg->msg_namelen a...
0
40,672
Analyze the following 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::OverloadedMethodLMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_overloadedMethodL"); test_object_v8_internal::OverloadedMethodLMethod(info); } Commit Message: bindings: Support "attribute ...
0
134,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: SProcRenderCreateConicalGradient(ClientPtr client) { int len; REQUEST(xRenderCreateConicalGradientReq); REQUEST_AT_LEAST_SIZE(xRenderCreateConicalGradientReq); swaps(&stuff->length); swapl(&stuff->pid); swapl(&stuff->center.x); swapl(&stuff->center.y); swapl(&stuff->angle); s...
0
17,613
Analyze the following 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_vfsmnt(struct mount *mnt) { kfree(mnt->mnt_devname); #ifdef CONFIG_SMP free_percpu(mnt->mnt_pcp); #endif kmem_cache_free(mnt_cache, mnt); } Commit Message: mnt: Correct permission checks in do_remount While invesgiating the issue where in "mount --bind -oremount,ro ..." would result in later...
0
36,201
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: CustomInspectorTest() : InspectorTest() , m_inspectorWindow(0) { } Commit Message: [GTK] Inspector should set a default attached height before being attached https://bugs.webkit.org/show_bug.cgi?id=90767 Reviewed by Xan Lopez. We are currently using the minimum attached height in We...
0
108,903
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: test_run_handler_arg_order (void) { run_handler("sync_spawn echo uvw xyz", "abc def"); assert(uzbl.comm.sync_stdout); /* the result should begin with the standard handler arguments */ gchar *rest = assert_sync_beginswith_stdarg(); /* the rest of the result should be the arguments passed to ...
0
18,313
Analyze the following 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 *insn_get_addr_ref(struct insn *insn, struct pt_regs *regs) { if (!insn || !regs) return (void __user *)-1L; switch (insn->addr_bytes) { case 2: return get_addr_ref_16(insn, regs); case 4: return get_addr_ref_32(insn, regs); case 8: return get_addr_ref_64(insn, regs); default: return ...
0
89,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: _exsltDateParseTime (exsltDateValDatePtr dt, const xmlChar **str) { const xmlChar *cur = *str; unsigned int hour = 0; /* use temp var in case str is not xs:time */ int ret = 0; PARSE_2_DIGITS(hour, cur, VALID_HOUR, ret); if (ret != 0) return ret; if (*cur != ':') return 1; cur++; ...
0
156,586
Analyze the following 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 gitn_Size(GF_Box *s) { u32 i; GroupIdToNameBox *ptr = (GroupIdToNameBox *)s; ptr->size += 2; for (i=0; i<ptr->nb_entries; i++) { ptr->size += 5; if (ptr->entries[i].name) ptr->size += strlen(ptr->entries[i].name); } return GF_OK; } Commit Message: fixed 2 possible heap overflows (inc. #1088) CW...
0
80,142
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: base::TimeTicks RendererSchedulerImpl::IncrementVirtualTimePauseCount() { main_thread_only().virtual_time_pause_count++; ApplyVirtualTimePolicy(); if (virtual_time_domain_) return virtual_time_domain_->Now(); return tick_clock()->NowTicks(); } Commit Message: [scheduler] Remove implicit fallthrough ...
0
143,421
Analyze the following 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(void) gdImageSetPixel (gdImagePtr im, int x, int y, int color) { int p; switch (color) { case gdStyled: if (!im->style) { /* Refuse to draw if no style is set. */ return; } else { p = im->style[im->stylePos++]; } if (p != (gdTransparent)) { gdImageSetPixel (im, x, y, p); } i...
0
73,085
Analyze the following 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 __kprobes int vmalloc_fault(unsigned long address) { pgd_t *pgd, *pgd_ref; pud_t *pud, *pud_ref; pmd_t *pmd, *pmd_ref; pte_t *pte, *pte_ref; /* Make sure we are in vmalloc area: */ if (!(address >= VMALLOC_START && address < VMALLOC_END)) return -1; WARN_ON_ONCE(in_nmi()); /* * Copy...
0
25,953
Analyze the following 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 activityLoggingForAllWorldsPerWorldBindingsVoidMethodMethodForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); imp->activityLoggingForAllWorldsPerWorldBindingsVoidMethod(); } Commit Message: document.location bin...
0
122,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: char *my_asctime(time_t t) { struct tm *tm; char *str; int len; tm = localtime(&t); str = g_strdup(asctime(tm)); len = strlen(str); if (len > 0) str[len-1] = '\0'; return str; } Commit Message: Merge branch 'security' into 'master' Security Closes #10 See merge request !17 CWE ID...
1
168,056
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void mptsas_update_interrupt(MPTSASState *s) { PCIDevice *pci = (PCIDevice *) s; uint32_t state = s->intr_status & ~(s->intr_mask | MPI_HIS_IOP_DOORBELL_STATUS); if (msi_enabled(pci)) { if (state) { trace_mptsas_irq_msi(s); msi_notify(pci, 0); } } ...
0
8,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 ext4_block_write_begin(struct page *page, loff_t pos, unsigned len, get_block_t *get_block) { unsigned from = pos & (PAGE_CACHE_SIZE - 1); unsigned to = from + len; struct inode *inode = page->mapping->host; unsigned block_start, block_end; sector_t block; int err = 0; unsigned blocksize =...
0
56,543
Analyze the following 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 long Track::GetUid() const { return m_info.uid; } Commit Message: external/libvpx/libwebm: Update snapshot Update libwebm snapshot. This update contains security fixes from upstream. Upstream git hash: 229f49347d19b0ca0941e072b199a242ef6c5f2b BUG=23167726 Change-Id: Id3e140e7b31ae11294724b1ecfe...
0
160,819
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: device_linux_md_stop_authorized_cb (Daemon *daemon, Device *device, DBusGMethodInvocation *context, const gchar *action_id, guint num_user_data, ...
0
11,657
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: xsltRegisterExtPrefix(xsltStylesheetPtr style, const xmlChar * prefix, const xmlChar * URI) { xsltExtDefPtr def, ret; if ((style == NULL) || (URI == NULL)) return (-1); #ifdef WITH_XSLT_DEBUG_EXTENSIONS xsltGenericDebug(xsltGenericDebugContext, "Registering extension n...
0
156,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: prologInitProcessor(XML_Parser parser, const char *s, const char *end, const char **nextPtr) { enum XML_Error result = initializeEncoding(parser); if (result != XML_ERROR_NONE) return result; parser->m_processor = prologProcessor; return prol...
0
92,364
Analyze the following 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 smb1cli_conn_activate_signing(struct smbXcli_conn *conn, const DATA_BLOB user_session_key, const DATA_BLOB response) { return smb_signing_activate(conn->smb1.signing, user_session_key, response); } Commit Message: CWE ID: CWE-20
0
2,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: UNCURL_EXPORT void uncurl_free_tls_ctx(struct uncurl_tls_ctx *uc_tls) { if (!uc_tls) return; tlss_free(uc_tls->tlss); free(uc_tls); } Commit Message: origin matching must come at str end CWE ID: CWE-352
0
84,328
Analyze the following 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 in_get_buffer_size(const struct audio_stream *stream) { struct stream_in *in = (struct stream_in *)stream; return get_input_buffer_size(in->requested_rate, in_get_format(stream), audio_channel_count_from_in_mask(in->main_channels),...
0
162,284
Analyze the following 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 GetNumberOfWatchedRenderViewHosts() const { return watched_render_view_hosts_.size(); } Commit Message: Fix issue with pending NavigationEntry being discarded incorrectly This CL fixes an issue where we would attempt to discard a pending NavigationEntry when a cross-process navigation to this Nav...
0
146,855
Analyze the following 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 Textfield::GetTextStyle() const { return (read_only() || !enabled()) ? style::STYLE_DISABLED : style::STYLE_PRIMARY; } Commit Message: MacViews: Enable secure text input for password Textfields. In Cocoa the NSTextInputContext automatically enables secure text input wh...
0
126,355
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: checked_xmalloc (size_t size) { alloc_limit_assert ("checked_xmalloc", size); return xmalloc (size); } Commit Message: Fix integer overflows and harden memory allocator. CWE ID: CWE-190
1
168,357
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: cmsPipeline* DefaultICCintents(cmsContext ContextID, cmsUInt32Number nProfiles, cmsUInt32Number TheIntents[], cmsHPROFILE hProfiles[], cmsBool BPC[], ...
1
167,592
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: nlmsvc_retry_blocked(void) { unsigned long timeout = MAX_SCHEDULE_TIMEOUT; struct nlm_block *block; spin_lock(&nlm_blocked_lock); while (!list_empty(&nlm_blocked) && !kthread_should_stop()) { block = list_entry(nlm_blocked.next, struct nlm_block, b_list); if (block->b_when == NLM_NEVER) break; if (...
0
65,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: bool DatabaseMessageFilter::OnMessageReceived( const IPC::Message& message, bool* message_was_ok) { bool handled = true; IPC_BEGIN_MESSAGE_MAP_EX(DatabaseMessageFilter, message, *message_was_ok) IPC_MESSAGE_HANDLER_DELAY_REPLY(DatabaseHostMsg_OpenFile, OnDatabas...
0
116,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: static SECStatus BadCertHandler(void *arg, PRFileDesc *sock) { struct connectdata *conn = (struct connectdata *)arg; struct Curl_easy *data = conn->data; PRErrorCode err = PR_GetError(); CERTCertificate *cert; /* remember the cert verification result */ data->set.ssl.certverifyresult = err; if(err...
0
50,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: status_t MediaPlayer::setAudioStreamType(audio_stream_type_t type) { ALOGV("MediaPlayer::setAudioStreamType"); Mutex::Autolock _l(mLock); if (mStreamType == type) return NO_ERROR; if (mCurrentState & ( MEDIA_PLAYER_PREPARED | MEDIA_PLAYER_STARTED | MEDIA_PLAYER_PAUSED | MEDIA_PLAYER_PLAYBAC...
0
159,507
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static int nfs4_proc_lookup_common(struct rpc_clnt **clnt, struct inode *dir, struct qstr *name, struct nfs_fh *fhandle, struct nfs_fattr *fattr) { struct nfs4_exception exception = { }; struct rpc_clnt *client = *clnt; int err; do { err = _nfs4_proc_lookup(client, dir, name, fhandle, fattr); ...
0
29,201
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: DownloadManagerImpl::DownloadManagerImpl(BrowserContext* browser_context) : item_factory_(new DownloadItemFactoryImpl()), shutdown_needed_(true), initialized_(false), history_db_initialized_(false), in_progress_cache_initialized_(false), browser_context_(browser_context), d...
0
151,962
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: OMX_ERRORTYPE omx_vdec::enable_extradata(OMX_U32 requested_extradata, bool is_internal, bool enable) { OMX_ERRORTYPE ret = OMX_ErrorNone; struct v4l2_control control; if (m_state != OMX_StateLoaded) { DEBUG_PRINT_ERROR("ERROR: enable extradata allowed in Loaded state only"); return OMX_ErrorIncorr...
0
160,260
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: void RenderProcessHostImpl::OnRegisterAecDumpConsumer(int id) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::BindOnce(&RenderProcessHostImpl::RegisterAecDumpConsumerOnUIThread, weak_factory_.GetWeakPtr(), id)); } Commit Message: Correct mojo::WrapSharedMemoryHan...
0
149,309
Analyze the following 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 do_fault_siginfo(int code, int sig, struct pt_regs *regs, unsigned int insn, int fault_code) { unsigned long addr; siginfo_t info; info.si_code = code; info.si_signo = sig; info.si_errno = 0; if (fault_code & FAULT_CODE_ITLB) addr = regs->tpc; else addr = compute_effective_address(...
0
25,740
Analyze the following 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 ScriptLoader::childrenChanged() { if (!m_parserInserted && m_element->inDocument()) prepareScript(); // FIXME: Provide a real starting line number here. } Commit Message: Apply 'x-content-type-options' check to dynamically inserted script. BUG=348581 Review URL: https://codereview.chromium.org...
0
115,352
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: static void PromiseMethodWithoutExceptionStateMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { ExceptionState exception_state(info.GetIsolate(), ExceptionState::kExecutionContext, "TestObject", "promiseMethodWithoutExceptionState"); ExceptionToRejectPromiseScope reject_promise_scope(info, exception_s...
0
135,030
Analyze the following 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(int) ap_vrprintf(request_rec *r, const char *fmt, va_list va) { apr_size_t written; struct ap_vrprintf_data vd; char vrprintf_buf[AP_IOBUFSIZE]; vd.vbuff.curpos = vrprintf_buf; vd.vbuff.endpos = vrprintf_buf + AP_IOBUFSIZE; vd.r = r; vd.buff = vrprintf_buf; if (r->conn...
0
45,003
Analyze the following 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) { closing_count_++; } Commit Message: Implement a bubble that appears at the top of the screen when a tab enters fullscreen mode via webkitRequestFul...
0
97,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: TabContents* TabStripModel::DetachTabContentsAt(int index) { if (contents_data_.empty()) return NULL; DCHECK(ContainsIndex(index)); TabContents* removed_contents = GetTabContentsAtImpl(index); bool was_selected = IsTabSelected(index); int next_selected_index = order_controller_->DetermineNewSelect...
1
171,517
Analyze the following 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(SplFileInfo, getPathInfo) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); zend_class_entry *ce = intern->info_class; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_han...
1
167,043
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: bool venc_dev::venc_set_param(void *paramData,OMX_INDEXTYPE index ) { DEBUG_PRINT_LOW("venc_set_param:: venc-720p"); struct v4l2_format fmt; struct v4l2_requestbuffers bufreq; int ret; switch ((int)index) { case OMX_IndexParamPortDefinition: { OMX_PARAM_PORTDEFINITIONTYPE *portDefn; ...
0
159,301
Analyze the following 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 omx_vdec::perf_control::load_lib() { char perf_lib_path[PROPERTY_VALUE_MAX] = {0}; if (m_perf_lib) return; if((property_get("ro.vendor.extension_library", perf_lib_path, NULL) <= 0)) { DEBUG_PRINT_ERROR("vendor library not set in ro.vendor.extension_library"); return; } if ((m_perf_lib = dlo...
0
160,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: void TrimT(StringType* str) { str->erase(str->find_last_not_of(GetWhiteSpacesForType<StringType>()) + 1); str->erase(0, str->find_first_not_of(GetWhiteSpacesForType<StringType>())); } Commit Message: Ignore switches following "--" when parsing a command line. BUG=933004 R=wfh@chromium.org Change-Id: I911be...
0
152,667
Analyze the following 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 process_slab(struct loc_track *t, struct kmem_cache *s, struct page *page, enum track_item alloc) { void *addr = page_address(page); DECLARE_BITMAP(map, page->objects); void *p; bitmap_zero(map, page->objects); for_each_free_object(p, s, page->freelist) set_bit(slab_index(p, s, addr), map); ...
0
24,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: bool xmp_parse(XmpPtr xmp, const char *buffer, size_t len) { CHECK_PTR(xmp, false); CHECK_PTR(buffer, false); SXMPMeta *txmp = (SXMPMeta *)xmp; try { txmp->ParseFromBuffer(buffer, len, kXMP_RequireXMPMeta); } catch (const XMP_Error &e) { set_error(e); return false;...
0
16,043
Analyze the following 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::HandleGetUniformLocation( uint32 immediate_data_size, const gles2::GetUniformLocation& c) { uint32 name_size = c.data_size; const char* name = GetSharedMemoryAs<const char*>( c.name_shm_id, c.name_shm_offset, name_size); if (!name) { return error::kOutOfBounds; ...
0
99,264
Analyze the following 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 guid_show(struct device *dev, struct device_attribute *attr, char *buf) { struct bmc_device *bmc = to_bmc_device(dev); bool guid_set; guid_t guid; int rv; rv = bmc_get_device_id(NULL, bmc, NULL, &guid_set, &guid); if (rv) return rv; if (!guid_set) return -ENOENT; return snprintf(b...
0
91,241
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: header_read (SF_PRIVATE *psf, void *ptr, int bytes) { int count = 0 ; if (psf->headindex >= SIGNED_SIZEOF (psf->header)) return psf_fread (ptr, 1, bytes, psf) ; if (psf->headindex + bytes > SIGNED_SIZEOF (psf->header)) { int most ; most = SIGNED_SIZEOF (psf->header) - psf->headend ; psf_fread (psf-...
1
170,061
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: rio_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) { int phy_addr; struct netdev_private *np = netdev_priv(dev); struct mii_data *miidata = (struct mii_data *) &rq->ifr_ifru; struct netdev_desc *desc; int i; phy_addr = np->phy_addr; switch (cmd) { case SIOCDEVPRIVATE: break; case SIOC...
1
165,601
Analyze the following 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 sched_read_attr(struct sched_attr __user *uattr, struct sched_attr *attr, unsigned int usize) { int ret; if (!access_ok(VERIFY_WRITE, uattr, usize)) return -EFAULT; /* * If we're handed a smaller struct than we know of, * ensure all the unknown bits are 0 - i.e. old * user-spac...
1
167,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: static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry, struct inode *inode, struct ext4_dir_entry_2 *de, struct buffer_head *bh) { struct inode *dir = dentry->d_parent->d_inode; const char *name = dentry->d_name.name; int namelen = dentry->d_name.len; unsigned int offset = 0; ...
0
42,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: void Textfield::MoveCaretTo(const gfx::Point& point) { SelectRect(point, point); } Commit Message: MacViews: Enable secure text input for password Textfields. In Cocoa the NSTextInputContext automatically enables secure text input when activated and it's in the secure text entry mode. RenderWidgetHostViewMac...
0
126,374
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: OVS_REQUIRES(ofproto_mutex) { const struct rule_actions *actions = rule_get_actions(rule); /* A rule may not be reinserted. */ ovs_assert(rule->state == RULE_INITIALIZED); if (rule->hard_timeout || rule->idle_timeout) { ovs_list_insert(&ofproto->expirable, &rule->expirable); ...
1
169,024
Analyze the following 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 magicmouse_emit_touch(struct magicmouse_sc *msc, int raw_id, u8 *tdata) { struct input_dev *input = msc->input; int id, x, y, size, orientation, touch_major, touch_minor, state, down; if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) { id = (tdata[6] << 2 | tdata[5] >> 6) & 0xf; x = (td...
0
38,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: void SimpleExtensionLoadPrompt::InstallUIAbort(bool user_initiated) { delete this; } Commit Message: Limit extent of webstore app to just chrome.google.com/webstore. BUG=93497 TEST=Try installing extensions and apps from the webstore, starting both being initially logged in, and not. Review URL: http://code...
0
98,599
Analyze the following 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 OffscreenCanvas::DidDraw(const FloatRect& rect) { if (rect.IsEmpty()) return; if (HasPlaceholderCanvas()) { needs_push_frame_ = true; GetOrCreateResourceDispatcher()->SetNeedsBeginFrame(true); } } Commit Message: Clean up CanvasResourceDispatcher on finalizer We may have pending mojo mes...
0
152,139
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: png_set_read_status_fn(png_structp png_ptr, png_read_status_ptr read_row_fn) { if (png_ptr == NULL) return; png_ptr->read_row_fn = read_row_fn; } Commit Message: third_party/libpng: update to 1.2.54 TBR=darin@chromium.org BUG=560291 Review URL: https://codereview.chromium.org/1467263003 Cr-Commit-...
0
131,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 mdia_del(GF_Box *s) { GF_MediaBox *ptr = (GF_MediaBox *)s; if (ptr == NULL) return; if (ptr->mediaHeader) gf_isom_box_del((GF_Box *)ptr->mediaHeader); if (ptr->information) gf_isom_box_del((GF_Box *)ptr->information); if (ptr->handler) gf_isom_box_del((GF_Box *)ptr->handler); gf_free(ptr); } Commit Me...
0
80,223
Analyze the following 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 i2c_type_bootmode(struct edgeport_serial *serial) { struct device *dev = &serial->serial->dev->dev; int status; u8 *data; data = kmalloc(1, GFP_KERNEL); if (!data) return -ENOMEM; /* Try to read type 2 */ status = ti_vread_sync(serial->serial->dev, UMPC_MEMORY_READ, DTK_ADDR_SPACE_I2C_TY...
0
66,100
Analyze the following 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 RenderBox::baselinePosition(FontBaseline baselineType, bool /*firstLine*/, LineDirectionMode direction, LinePositionMode /*linePositionMode*/) const { if (isReplaced()) { int result = direction == HorizontalLine ? m_marginTop + height() + m_marginBottom : m_marginRight + width() + m_marginLeft; ...
0
101,535
Analyze the following code, commit message, and CWE ID. Determine whether it has a vulnerability. If it does, return '1'; if it doesn't, return '0'.
Code: auth_generate_key(struct sc_card *card, int use_sm, struct sc_cardctl_oberthur_genkey_info *data) { struct sc_apdu apdu; unsigned char sbuf[SC_MAX_APDU_BUFFER_SIZE]; struct sc_path tmp_path; int rv = 0; LOG_FUNC_CALLED(card->ctx); if (data->key_bits < 512 || data->key_bits > 2048 || (data->key_bits%0x...
0
78,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: bool do_notify_parent(struct task_struct *tsk, int sig) { struct siginfo info; unsigned long flags; struct sighand_struct *psig; bool autoreap = false; BUG_ON(sig == -1); /* do_notify_parent_cldstop should have been called instead. */ BUG_ON(task_is_stopped_or_traced(tsk)); BUG_ON(!tsk->ptrace && ...
0
33,716
Analyze the following 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 ResourceDispatcherHostImpl::IsRequestIDInUse( const GlobalRequestID& id) const { if (pending_loaders_.find(id) != pending_loaders_.end()) return true; for (const auto& blocked_loaders : blocked_loaders_map_) { for (const auto& loader : *blocked_loaders.second.get()) { ResourceRequestInf...
0
152,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: const PPB_NaCl_Private* PPB_NaCl_Private_Impl::GetInterface() { return &nacl_interface; } Commit Message: Revert 143656 - Add an IPC channel between the NaCl loader process and the renderer. BUG=116317 TEST=ppapi, nacl tests, manual testing for experimental IPC proxy. Review URL: https://chromiumcodereview.app...
0
103,326