Dataset Viewer
Auto-converted to Parquet Duplicate
cwe
stringclasses
9 values
id
stringlengths
40
40
source
stringlengths
14
66.9k
label
bool
2 classes
CWE-362
a2b9e6c1a35afcc0973acb72e591c714e78885ff
int x86_emulate_instruction(struct kvm_vcpu *vcpu, unsigned long cr2, int emulation_type, void *insn, int insn_len) { int r; struct x86_emulate_ctxt *ctxt = &vcpu->arch.emulate_ctxt; bool writeback = true; bool write_fault_to_spt = vcpu->arch.write_fault_to_shadow_pgtable; /* * Clear write_fault_to_shadow_pgtable here to ensure it is * never reused. */ vcpu->arch.write_fault_to_shadow_pgtable = false; kvm_clear_exception_queue(vcpu); if (!(emulation_type & EMULTYPE_NO_DECODE)) { init_emulate_ctxt(vcpu); /* * We will reenter on the same instruction since * we do not set complete_userspace_io. This does not * handle watchpoints yet, those would be handled in * the emulate_ops. */ if (kvm_vcpu_check_breakpoint(vcpu, &r)) return r; ctxt->interruptibility = 0; ctxt->have_exception = false; ctxt->exception.vector = -1; ctxt->perm_ok = false; ctxt->ud = emulation_type & EMULTYPE_TRAP_UD; r = x86_decode_insn(ctxt, insn, insn_len); trace_kvm_emulate_insn_start(vcpu); ++vcpu->stat.insn_emulation; if (r != EMULATION_OK) { if (emulation_type & EMULTYPE_TRAP_UD) return EMULATE_FAIL; if (reexecute_instruction(vcpu, cr2, write_fault_to_spt, emulation_type)) return EMULATE_DONE; if (emulation_type & EMULTYPE_SKIP) return EMULATE_FAIL; return handle_emulation_failure(vcpu); } } if (emulation_type & EMULTYPE_SKIP) { kvm_rip_write(vcpu, ctxt->_eip); if (ctxt->eflags & X86_EFLAGS_RF) kvm_set_rflags(vcpu, ctxt->eflags & ~X86_EFLAGS_RF); return EMULATE_DONE; } if (retry_instruction(ctxt, cr2, emulation_type)) return EMULATE_DONE; /* this is needed for vmware backdoor interface to work since it changes registers values during IO operation */ if (vcpu->arch.emulate_regs_need_sync_from_vcpu) { vcpu->arch.emulate_regs_need_sync_from_vcpu = false; emulator_invalidate_register_cache(ctxt); } restart: r = x86_emulate_insn(ctxt); if (r == EMULATION_INTERCEPTED) return EMULATE_DONE; if (r == EMULATION_FAILED) { if (reexecute_instruction(vcpu, cr2, write_fault_to_spt, emulation_type)) return EMULATE_DONE; return handle_emulation_failure(vcpu); } if (ctxt->have_exception) { r = EMULATE_DONE; if (inject_emulated_exception(vcpu)) return r; } else if (vcpu->arch.pio.count) { if (!vcpu->arch.pio.in) { /* FIXME: return into emulator if single-stepping. */ vcpu->arch.pio.count = 0; } else { writeback = false; vcpu->arch.complete_userspace_io = complete_emulated_pio; } r = EMULATE_USER_EXIT; } else if (vcpu->mmio_needed) { if (!vcpu->mmio_is_write) writeback = false; r = EMULATE_USER_EXIT; vcpu->arch.complete_userspace_io = complete_emulated_mmio; } else if (r == EMULATION_RESTART) goto restart; else r = EMULATE_DONE; if (writeback) { unsigned long rflags = kvm_x86_ops->get_rflags(vcpu); toggle_interruptibility(vcpu, ctxt->interruptibility); vcpu->arch.emulate_regs_need_sync_to_vcpu = false; kvm_rip_write(vcpu, ctxt->eip); if (r == EMULATE_DONE) kvm_vcpu_check_singlestep(vcpu, rflags, &r); __kvm_set_rflags(vcpu, ctxt->eflags); /* * For STI, interrupts are shadowed; so KVM_REQ_EVENT will * do nothing, and it will be requested again as soon as * the shadow expires. But we still need to check here, * because POPF has no interrupt shadow. */ if (unlikely((ctxt->eflags & ~rflags) & X86_EFLAGS_IF)) kvm_make_request(KVM_REQ_EVENT, vcpu); } else vcpu->arch.emulate_regs_need_sync_to_vcpu = true; return r; }
false
CWE-119
51e0cb2e5ec18eaf6fb331bc573ff27b743898f4
xmlSaveUriRealloc(xmlChar *ret, int *max) { xmlChar *temp; int tmp; if (*max > MAX_URI_LENGTH) { xmlURIErrMemory("reaching arbitrary MAX_URI_LENGTH limit\n"); return(NULL); } tmp = *max * 2; temp = (xmlChar *) xmlRealloc(ret, (tmp + 1)); if (temp == NULL) { xmlURIErrMemory("saving URI\n"); return(NULL); } *max = tmp; return(temp); }
false
CWE-119
96dbafe288dbe2f0cc45fa3c39daf6d0c37acbab
xsltAttributeInternal(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, xmlNodePtr inst, xsltStylePreCompPtr castedComp, int fromAttributeSet) { #ifdef XSLT_REFACTORED xsltStyleItemAttributePtr comp = (xsltStyleItemAttributePtr) castedComp; #else xsltStylePreCompPtr comp = castedComp; #endif xmlNodePtr targetElem; xmlChar *prop = NULL; const xmlChar *name = NULL, *prefix = NULL, *nsName = NULL; xmlChar *value = NULL; xmlNsPtr ns = NULL; xmlAttrPtr attr; if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE) ) return; /* * A comp->has_name == 0 indicates that we need to skip this instruction, * since it was evaluated to be invalid already during compilation. */ if (!comp->has_name) return; /* * BIG NOTE: This previously used xsltGetSpecialNamespace() and * xsltGetNamespace(), but since both are not appropriate, we * will process namespace lookup here to avoid adding yet another * ns-lookup function to namespaces.c. */ /* * SPEC XSLT 1.0: Error cases: * - Creating nodes other than text nodes during the instantiation of * the content of the xsl:attribute element; implementations may * either signal the error or ignore the offending nodes." */ if (comp == NULL) { xsltTransformError(ctxt, NULL, inst, "Internal error in xsltAttributeInternal(): " "The XSLT 'attribute' instruction was not compiled.\n"); return; } /* * TODO: Shouldn't ctxt->insert == NULL be treated as an internal error? * So report an internal error? */ if (ctxt->insert == NULL) return; /* * SPEC XSLT 1.0: * "Adding an attribute to a node that is not an element; * implementations may either signal the error or ignore the attribute." * * TODO: I think we should signal such errors in the future, and maybe * provide an option to ignore such errors. */ targetElem = ctxt->insert; if (targetElem->type != XML_ELEMENT_NODE) return; /* * SPEC XSLT 1.0: * "Adding an attribute to an element after children have been added * to it; implementations may either signal the error or ignore the * attribute." * * TODO: We should decide whether not to report such errors or * to ignore them; note that we *ignore* if the parent is not an * element, but here we report an error. */ if (targetElem->children != NULL) { /* * NOTE: Ah! This seems to be intended to support streamed * result generation!. */ xsltTransformError(ctxt, NULL, inst, "xsl:attribute: Cannot add attributes to an " "element if children have been already added " "to the element.\n"); return; } /* * Process the name * ---------------- */ #ifdef WITH_DEBUGGER if (ctxt->debugStatus != XSLT_DEBUG_NONE) xslHandleDebugger(inst, contextNode, NULL, ctxt); #endif if (comp->name == NULL) { /* TODO: fix attr acquisition wrt to the XSLT namespace */ prop = xsltEvalAttrValueTemplate(ctxt, inst, (const xmlChar *) "name", XSLT_NAMESPACE); if (prop == NULL) { xsltTransformError(ctxt, NULL, inst, "xsl:attribute: The attribute 'name' is missing.\n"); goto error; } if (xmlValidateQName(prop, 0)) { xsltTransformError(ctxt, NULL, inst, "xsl:attribute: The effective name '%s' is not a " "valid QName.\n", prop); /* we fall through to catch any further errors, if possible */ } /* * Reject a name of "xmlns". */ if (xmlStrEqual(prop, BAD_CAST "xmlns")) { xsltTransformError(ctxt, NULL, inst, "xsl:attribute: The effective name 'xmlns' is not allowed.\n"); xmlFree(prop); goto error; } name = xsltSplitQName(ctxt->dict, prop, &prefix); xmlFree(prop); } else { /* * The "name" value was static. */ #ifdef XSLT_REFACTORED prefix = comp->nsPrefix; name = comp->name; #else name = xsltSplitQName(ctxt->dict, comp->name, &prefix); #endif } /* * Process namespace semantics * --------------------------- * * Evaluate the namespace name. */ if (comp->has_ns) { /* * The "namespace" attribute was existent. */ if (comp->ns != NULL) { /* * No AVT; just plain text for the namespace name. */ if (comp->ns[0] != 0) nsName = comp->ns; } else { xmlChar *tmpNsName; /* * Eval the AVT. */ /* TODO: check attr acquisition wrt to the XSLT namespace */ tmpNsName = xsltEvalAttrValueTemplate(ctxt, inst, (const xmlChar *) "namespace", XSLT_NAMESPACE); /* * This fixes bug #302020: The AVT might also evaluate to the * empty string; this means that the empty string also indicates * "no namespace". * SPEC XSLT 1.0: * "If the string is empty, then the expanded-name of the * attribute has a null namespace URI." */ if ((tmpNsName != NULL) && (tmpNsName[0] != 0)) nsName = xmlDictLookup(ctxt->dict, BAD_CAST tmpNsName, -1); xmlFree(tmpNsName); } if (xmlStrEqual(nsName, BAD_CAST "http://www.w3.org/2000/xmlns/")) { xsltTransformError(ctxt, NULL, inst, "xsl:attribute: Namespace http://www.w3.org/2000/xmlns/ " "forbidden.\n"); goto error; } if (xmlStrEqual(nsName, XML_XML_NAMESPACE)) { prefix = BAD_CAST "xml"; } else if (xmlStrEqual(prefix, BAD_CAST "xml")) { prefix = NULL; } } else if (prefix != NULL) { /* * SPEC XSLT 1.0: * "If the namespace attribute is not present, then the QName is * expanded into an expanded-name using the namespace declarations * in effect for the xsl:attribute element, *not* including any * default namespace declaration." */ ns = xmlSearchNs(inst->doc, inst, prefix); if (ns == NULL) { /* * Note that this is treated as an error now (checked with * Saxon, Xalan-J and MSXML). */ xsltTransformError(ctxt, NULL, inst, "xsl:attribute: The QName '%s:%s' has no " "namespace binding in scope in the stylesheet; " "this is an error, since the namespace was not " "specified by the instruction itself.\n", prefix, name); } else nsName = ns->href; } if (fromAttributeSet) { /* * This tries to ensure that xsl:attribute(s) coming * from an xsl:attribute-set won't override attribute of * literal result elements or of explicit xsl:attribute(s). * URGENT TODO: This might be buggy, since it will miss to * overwrite two equal attributes both from attribute sets. */ attr = xmlHasNsProp(targetElem, name, nsName); if (attr != NULL) return; } /* * Find/create a matching ns-decl in the result tree. */ ns = NULL; #if 0 if (0) { /* * OPTIMIZE TODO: How do we know if we are adding to a * fragment or to the result tree? * * If we are adding to a result tree fragment (i.e., not to the * actual result tree), we'll don't bother searching for the * ns-decl, but just store it in the dummy-doc of the result * tree fragment. */ if (nsName != NULL) { /* * TODO: Get the doc of @targetElem. */ ns = xsltTreeAcquireStoredNs(some doc, nsName, prefix); } } #endif if (nsName != NULL) { /* * Something about ns-prefixes: * SPEC XSLT 1.0: * "XSLT processors may make use of the prefix of the QName specified * in the name attribute when selecting the prefix used for outputting * the created attribute as XML; however, they are not required to do * so and, if the prefix is xmlns, they must not do so" */ /* * xsl:attribute can produce a scenario where the prefix is NULL, * so generate a prefix. */ if ((prefix == NULL) || xmlStrEqual(prefix, BAD_CAST "xmlns")) { xmlChar *pref = xmlStrdup(BAD_CAST "ns_1"); ns = xsltGetSpecialNamespace(ctxt, inst, nsName, pref, targetElem); xmlFree(pref); } else { ns = xsltGetSpecialNamespace(ctxt, inst, nsName, prefix, targetElem); } if (ns == NULL) { xsltTransformError(ctxt, NULL, inst, "Namespace fixup error: Failed to acquire an in-scope " "namespace binding for the generated attribute '{%s}%s'.\n", nsName, name); goto error; } } /* * Construction of the value * ------------------------- */ if (inst->children == NULL) { /* * No content. * TODO: Do we need to put the empty string in ? */ attr = xmlSetNsProp(ctxt->insert, ns, name, (const xmlChar *) ""); } else if ((inst->children->next == NULL) && ((inst->children->type == XML_TEXT_NODE) || (inst->children->type == XML_CDATA_SECTION_NODE))) { xmlNodePtr copyTxt; /* * xmlSetNsProp() will take care of duplicates. */ attr = xmlSetNsProp(ctxt->insert, ns, name, NULL); if (attr == NULL) /* TODO: report error ? */ goto error; /* * This was taken over from xsltCopyText() (transform.c). */ if (ctxt->internalized && (ctxt->insert->doc != NULL) && (ctxt->insert->doc->dict == ctxt->dict)) { copyTxt = xmlNewText(NULL); if (copyTxt == NULL) /* TODO: report error */ goto error; /* * This is a safe scenario where we don't need to lookup * the dict. */ copyTxt->content = inst->children->content; /* * Copy "disable-output-escaping" information. * TODO: Does this have any effect for attribute values * anyway? */ if (inst->children->name == xmlStringTextNoenc) copyTxt->name = xmlStringTextNoenc; } else { /* * Copy the value. */ copyTxt = xmlNewText(inst->children->content); if (copyTxt == NULL) /* TODO: report error */ goto error; } attr->children = attr->last = copyTxt; copyTxt->parent = (xmlNodePtr) attr; copyTxt->doc = attr->doc; /* * Copy "disable-output-escaping" information. * TODO: Does this have any effect for attribute values * anyway? */ if (inst->children->name == xmlStringTextNoenc) copyTxt->name = xmlStringTextNoenc; /* * since we create the attribute without content IDness must be * asserted as a second step */ if ((copyTxt->content != NULL) && (xmlIsID(attr->doc, attr->parent, attr))) xmlAddID(NULL, attr->doc, copyTxt->content, attr); } else { /* * The sequence constructor might be complex, so instantiate it. */ value = xsltEvalTemplateString(ctxt, contextNode, inst); if (value != NULL) { attr = xmlSetNsProp(ctxt->insert, ns, name, value); xmlFree(value); } else { /* * TODO: Do we have to add the empty string to the attr? * TODO: Does a value of NULL indicate an * error in xsltEvalTemplateString() ? */ attr = xmlSetNsProp(ctxt->insert, ns, name, (const xmlChar *) ""); } } error: return; }
false
CWE-200
d5e0d0f607a7a029c6563a0470d88255c89a8d11
static bool vsock_is_accept_queue_empty(struct sock *sk) { struct vsock_sock *vsk = vsock_sk(sk); return list_empty(&vsk->accept_queue); }
false
CWE-119
1f4b49e64adf4623eefda503bca61e253597b9bf
status_t Parcel::write(const FlattenableHelperInterface& val) { status_t err; const size_t len = val.getFlattenedSize(); const size_t fd_count = val.getFdCount(); if ((len > INT32_MAX) || (fd_count >= gMaxFds)) { return BAD_VALUE; } err = this->writeInt32(len); if (err) return err; err = this->writeInt32(fd_count); if (err) return err; void* const buf = this->writeInplace(pad_size(len)); if (buf == NULL) return BAD_VALUE; int* fds = NULL; if (fd_count) { fds = new (std::nothrow) int[fd_count]; if (fds == nullptr) { ALOGE("write: failed to allocate requested %zu fds", fd_count); return BAD_VALUE; } } err = val.flatten(buf, len, fds, fd_count); for (size_t i=0 ; i<fd_count && err==NO_ERROR ; i++) { err = this->writeDupFileDescriptor( fds[i] ); } if (fd_count) { delete [] fds; } return err; }
false
CWE-416
54648cf1ec2d7f4b6a71767799c45676a138ca24
void blk_cleanup_queue(struct request_queue *q) { spinlock_t *lock = q->queue_lock; /* mark @q DYING, no new request or merges will be allowed afterwards */ mutex_lock(&q->sysfs_lock); blk_set_queue_dying(q); spin_lock_irq(lock); /* * A dying queue is permanently in bypass mode till released. Note * that, unlike blk_queue_bypass_start(), we aren't performing * synchronize_rcu() after entering bypass mode to avoid the delay * as some drivers create and destroy a lot of queues while * probing. This is still safe because blk_release_queue() will be * called only after the queue refcnt drops to zero and nothing, * RCU or not, would be traversing the queue by then. */ q->bypass_depth++; queue_flag_set(QUEUE_FLAG_BYPASS, q); queue_flag_set(QUEUE_FLAG_NOMERGES, q); queue_flag_set(QUEUE_FLAG_NOXMERGES, q); queue_flag_set(QUEUE_FLAG_DYING, q); spin_unlock_irq(lock); mutex_unlock(&q->sysfs_lock); /* * Drain all requests queued before DYING marking. Set DEAD flag to * prevent that q->request_fn() gets invoked after draining finished. */ blk_freeze_queue(q); spin_lock_irq(lock); queue_flag_set(QUEUE_FLAG_DEAD, q); spin_unlock_irq(lock); /* * make sure all in-progress dispatch are completed because * blk_freeze_queue() can only complete all requests, and * dispatch may still be in-progress since we dispatch requests * from more than one contexts. * * No need to quiesce queue if it isn't initialized yet since * blk_freeze_queue() should be enough for cases of passthrough * request. */ if (q->mq_ops && blk_queue_init_done(q)) blk_mq_quiesce_queue(q); /* for synchronous bio-based driver finish in-flight integrity i/o */ blk_flush_integrity(); /* @q won't process any more request, flush async actions */ del_timer_sync(&q->backing_dev_info->laptop_mode_wb_timer); blk_sync_queue(q); /* * I/O scheduler exit is only safe after the sysfs scheduler attribute * has been removed. */ WARN_ON_ONCE(q->kobj.state_in_sysfs); /* * Since the I/O scheduler exit code may access cgroup information, * perform I/O scheduler exit before disassociating from the block * cgroup controller. */ if (q->elevator) { ioc_clear_queue(q); elevator_exit(q, q->elevator); q->elevator = NULL; } /* * Remove all references to @q from the block cgroup controller before * restoring @q->queue_lock to avoid that restoring this pointer causes * e.g. blkcg_print_blkgs() to crash. */ blkcg_exit_queue(q); /* * Since the cgroup code may dereference the @q->backing_dev_info * pointer, only decrease its reference count after having removed the * association with the block cgroup controller. */ bdi_put(q->backing_dev_info); if (q->mq_ops) blk_mq_free_queue(q); percpu_ref_exit(&q->q_usage_counter); spin_lock_irq(lock); if (q->queue_lock != &q->__queue_lock) q->queue_lock = &q->__queue_lock; spin_unlock_irq(lock); /* @q is and will stay empty, shutdown and put */ blk_put_queue(q); }
false
CWE-362
5d78b84d39bd34bc9fce9d01c0dcd5a22a330d34
void LayerTreeHost::SetNextCommitForcesRedraw() { next_commit_forces_redraw_ = true; proxy_->SetNeedsUpdateLayers(); }
false
CWE-264
0bfc96cb77224736dfa35c3c555d37b3646ef35e
static int sg_get_version(int __user *p) { static const int sg_version_num = 30527; return put_user(sg_version_num, p); }
false
CWE-119
c13e1da62b5f5f0e6fe8c1f769a5a28415415244
void GLES2DecoderImpl::DoCompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei image_size, const void * data) { TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); if (!info) { SetGLError(GL_INVALID_OPERATION, "glCompressedTexSubImage2D: unknown texture for target"); return; } GLenum type = 0; GLenum internal_format = 0; if (!info->GetLevelType(target, level, &type, &internal_format)) { SetGLError( GL_INVALID_OPERATION, "glCompressdTexSubImage2D: level does not exist."); return; } if (internal_format != format) { SetGLError( GL_INVALID_OPERATION, "glCompressdTexSubImage2D: format does not match internal format."); return; } if (!info->ValidForTexture( target, level, xoffset, yoffset, width, height, format, type)) { SetGLError(GL_INVALID_VALUE, "glCompressdTexSubImage2D: bad dimensions."); return; } glCompressedTexSubImage2D( target, level, xoffset, yoffset, width, height, format, image_size, data); }
false
CWE-189
a5cd335165e31db9dbab636fd29895d41da55dd2
int drm_mode_mmap_dumb_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { struct drm_mode_map_dumb *args = data; /* call driver ioctl to get mmap offset */ if (!dev->driver->dumb_map_offset) return -ENOSYS; return dev->driver->dumb_map_offset(file_priv, dev, args->handle, &args->offset); }
false
CWE-399
84d73cd3fb142bf1298a8c13fd4ca50fd2432372
int __rtnl_link_register(struct rtnl_link_ops *ops) { if (rtnl_link_ops_get(ops->kind)) return -EEXIST; if (!ops->dellink) ops->dellink = unregister_netdevice_queue; list_add_tail(&ops->list, &link_ops); return 0; }
false
CWE-399
318530d771586b39056c0da7b8bdad03469a0dc4
VirtualKeyboardController::~VirtualKeyboardController() { Shell::GetInstance()->RemoveShellObserver(this); ui::DeviceDataManager::GetInstance()->RemoveObserver(this); }
false
CWE-362
fd506b0ac6c7846ae45b5034044fe85c28ee68ac
static WebURLRequest::RequestContext DetermineRequestContextFromNavigationType( const NavigationType navigation_type) { switch (navigation_type) { case kNavigationTypeLinkClicked: return WebURLRequest::kRequestContextHyperlink; case kNavigationTypeOther: return WebURLRequest::kRequestContextLocation; case kNavigationTypeFormResubmitted: case kNavigationTypeFormSubmitted: return WebURLRequest::kRequestContextForm; case kNavigationTypeBackForward: case kNavigationTypeReload: return WebURLRequest::kRequestContextInternal; } NOTREACHED(); return WebURLRequest::kRequestContextHyperlink; }
false
CWE-119
ee7579229ff7e9e5ae28bf53aea069251499d7da
void Framebuffer::OnDidRenderTo() const { for (AttachmentMap::const_iterator it = attachments_.begin(); it != attachments_.end(); ++it) { it->second->OnDidRenderTo(); } }
false
CWE-399
8ea3a5c06218fa42d25c3aa0a4ab57153e178523
PassRefPtr<PopupMenu> ChromeClientImpl::createPopupMenu(Frame& frame, PopupMenuClient* client) const { if (WebViewImpl::useExternalPopupMenus()) return adoptRef(new ExternalPopupMenu(frame, client, *m_webView)); return adoptRef(new PopupMenuChromium(frame, client)); }
false
CWE-399
d0772b70faaf8e9f2013b6c4273d94d5eac8047a
static inline unsigned xfrm6_tunnel_spi_hash_byaddr(xfrm_address_t *addr) { unsigned h; h = (__force u32)(addr->a6[0] ^ addr->a6[1] ^ addr->a6[2] ^ addr->a6[3]); h ^= h >> 16; h ^= h >> 8; h &= XFRM6_TUNNEL_SPI_BYADDR_HSIZE - 1; return h; }
false
CWE-200
4efbc454ba68def5ef285b26ebfcfdb605b52755
void hrtick_start(struct rq *rq, u64 delay) { __hrtimer_start_range_ns(&rq->hrtick_timer, ns_to_ktime(delay), 0, HRTIMER_MODE_REL_PINNED, 0); }
false
CWE-119
96dbafe288dbe2f0cc45fa3c39daf6d0c37acbab
xsltValueOf(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr castedComp) { #ifdef XSLT_REFACTORED xsltStyleItemValueOfPtr comp = (xsltStyleItemValueOfPtr) castedComp; #else xsltStylePreCompPtr comp = castedComp; #endif xmlXPathObjectPtr res = NULL; xmlChar *value = NULL; xmlDocPtr oldXPContextDoc; xmlNsPtr *oldXPNamespaces; xmlNodePtr oldXPContextNode; int oldXPProximityPosition, oldXPContextSize, oldXPNsNr; xmlXPathContextPtr xpctxt; if ((ctxt == NULL) || (node == NULL) || (inst == NULL)) return; if ((comp == NULL) || (comp->select == NULL) || (comp->comp == NULL)) { xsltTransformError(ctxt, NULL, inst, "Internal error in xsltValueOf(): " "The XSLT 'value-of' instruction was not compiled.\n"); return; } #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_VALUE_OF,xsltGenericDebug(xsltGenericDebugContext, "xsltValueOf: select %s\n", comp->select)); #endif xpctxt = ctxt->xpathCtxt; oldXPContextDoc = xpctxt->doc; oldXPContextNode = xpctxt->node; oldXPProximityPosition = xpctxt->proximityPosition; oldXPContextSize = xpctxt->contextSize; oldXPNsNr = xpctxt->nsNr; oldXPNamespaces = xpctxt->namespaces; xpctxt->node = node; if (comp != NULL) { #ifdef XSLT_REFACTORED if (comp->inScopeNs != NULL) { xpctxt->namespaces = comp->inScopeNs->list; xpctxt->nsNr = comp->inScopeNs->xpathNumber; } else { xpctxt->namespaces = NULL; xpctxt->nsNr = 0; } #else xpctxt->namespaces = comp->nsList; xpctxt->nsNr = comp->nsNr; #endif } else { xpctxt->namespaces = NULL; xpctxt->nsNr = 0; } res = xmlXPathCompiledEval(comp->comp, xpctxt); xpctxt->doc = oldXPContextDoc; xpctxt->node = oldXPContextNode; xpctxt->contextSize = oldXPContextSize; xpctxt->proximityPosition = oldXPProximityPosition; xpctxt->nsNr = oldXPNsNr; xpctxt->namespaces = oldXPNamespaces; /* * Cast the XPath object to string. */ if (res != NULL) { value = xmlXPathCastToString(res); if (value == NULL) { xsltTransformError(ctxt, NULL, inst, "Internal error in xsltValueOf(): " "failed to cast an XPath object to string.\n"); ctxt->state = XSLT_STATE_STOPPED; goto error; } if (value[0] != 0) { xsltCopyTextString(ctxt, ctxt->insert, value, comp->noescape); } } else { xsltTransformError(ctxt, NULL, inst, "XPath evaluation returned no result.\n"); ctxt->state = XSLT_STATE_STOPPED; goto error; } #ifdef WITH_XSLT_DEBUG_PROCESS if (value) { XSLT_TRACE(ctxt,XSLT_TRACE_VALUE_OF,xsltGenericDebug(xsltGenericDebugContext, "xsltValueOf: result '%s'\n", value)); } #endif error: if (value != NULL) xmlFree(value); if (res != NULL) xmlXPathFreeObject(res); }
true
CWE-119
7d3e91a89b7adbc2831334def9e494dd9892f9af
static int nfs4_map_errors(int err) { if (err >= -1000) return err; switch (err) { case -NFS4ERR_RESOURCE: return -EREMOTEIO; case -NFS4ERR_WRONGSEC: return -EPERM; case -NFS4ERR_BADOWNER: case -NFS4ERR_BADNAME: return -EINVAL; case -NFS4ERR_SHARE_DENIED: return -EACCES; case -NFS4ERR_MINOR_VERS_MISMATCH: return -EPROTONOSUPPORT; case -NFS4ERR_ACCESS: return -EACCES; default: dprintk("%s could not handle NFSv4 error %d\n", __func__, -err); break; } return -EIO; }
false
CWE-399
4c19b042ea31bd393d2265656f94339d1c3d82ff
bool FileUtilProxy::EnsureFileExists( scoped_refptr<MessageLoopProxy> message_loop_proxy, const FilePath& file_path, EnsureFileExistsCallback* callback) { return Start(FROM_HERE, message_loop_proxy, new RelayEnsureFileExists( message_loop_proxy, file_path, callback)); }
false
CWE-399
415e3d3e90ce9e18727e8843ae343eda5a58fad6
static void inc_inflight(struct unix_sock *usk) { atomic_long_inc(&usk->inflight); }
false
CWE-119
6d104af38b570d37aa32a5803b04c354f8ed513d
static void k90_backlight_work(struct work_struct *work) { int ret; struct k90_led *led = container_of(work, struct k90_led, work); struct device *dev; struct usb_interface *usbif; struct usb_device *usbdev; if (led->removed) return; dev = led->cdev.dev->parent; usbif = to_usb_interface(dev->parent); usbdev = interface_to_usbdev(usbif); ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0), K90_REQUEST_BRIGHTNESS, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, led->brightness, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); if (ret != 0) dev_warn(dev, "Failed to set backlight brightness (error: %d).\n", ret); }
false
CWE-399
2aa406a8b4577103e7b933c75ec0e372830f20fe
WebviewHandler::~WebviewHandler() { }
false
CWE-20
761c75d2d607638ff53c764b4925bcca9be601d8
AutoplayPolicy::Type BaseAudioContext::GetAutoplayPolicy() const { if (RuntimeEnabledFeatures::AutoplayIgnoresWebAudioEnabled()) { #if defined(OS_ANDROID) return AutoplayPolicy::Type::kUserGestureRequired; #else return AutoplayPolicy::Type::kNoUserGestureRequired; #endif } Document* document = GetDocument(); DCHECK(document); return AutoplayPolicy::GetAutoplayPolicyForDocument(*document); }
false
CWE-264
6a60f01228557982e6508c5919cc21fcfddf110b
bool WebRunnerBrowserContext::IsOffTheRecord() const { return data_dir_path_.empty(); }
false
CWE-20
282f53ffdc3b1902da86f6a0791af736837efbf8
void SupervisedUserService::AddObserver( SupervisedUserServiceObserver* observer) { observer_list_.AddObserver(observer); }
false
CWE-362
de9f869616dd95e95c00bdd6b0fcd3421e8a4323
static int get_seg_reg_override_idx(struct insn *insn) { int idx = INAT_SEG_REG_DEFAULT; int num_overrides = 0, i; insn_get_prefixes(insn); /* Look for any segment override prefixes. */ for (i = 0; i < insn->prefixes.nbytes; i++) { insn_attr_t attr; attr = inat_get_opcode_attribute(insn->prefixes.bytes[i]); switch (attr) { case INAT_MAKE_PREFIX(INAT_PFX_CS): idx = INAT_SEG_REG_CS; num_overrides++; break; case INAT_MAKE_PREFIX(INAT_PFX_SS): idx = INAT_SEG_REG_SS; num_overrides++; break; case INAT_MAKE_PREFIX(INAT_PFX_DS): idx = INAT_SEG_REG_DS; num_overrides++; break; case INAT_MAKE_PREFIX(INAT_PFX_ES): idx = INAT_SEG_REG_ES; num_overrides++; break; case INAT_MAKE_PREFIX(INAT_PFX_FS): idx = INAT_SEG_REG_FS; num_overrides++; break; case INAT_MAKE_PREFIX(INAT_PFX_GS): idx = INAT_SEG_REG_GS; num_overrides++; break; /* No default action needed. */ } } /* More than one segment override prefix leads to undefined behavior. */ if (num_overrides > 1) return -EINVAL; return idx; }
false
CWE-264
1ee0a224bc9aad1de496c795f96bc6ba2c394811
static void edge_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old_termios) { struct edgeport_port *edge_port = usb_get_serial_port_data(port); unsigned int cflag; cflag = tty->termios.c_cflag; dev_dbg(&port->dev, "%s - clfag %08x iflag %08x\n", __func__, tty->termios.c_cflag, tty->termios.c_iflag); dev_dbg(&port->dev, "%s - old clfag %08x old iflag %08x\n", __func__, old_termios->c_cflag, old_termios->c_iflag); dev_dbg(&port->dev, "%s - port %d\n", __func__, port->number); if (edge_port == NULL) return; /* change the port settings to the new ones specified */ change_port_settings(tty, edge_port, old_termios); }
false
CWE-399
8ea3a5c06218fa42d25c3aa0a4ab57153e178523
void ChromeClientImpl::show(NavigationPolicy navigationPolicy) { if (!m_webView->client()) return; WebNavigationPolicy policy = static_cast<WebNavigationPolicy>(navigationPolicy); if (policy == WebNavigationPolicyIgnore) policy = getNavigationPolicy(); m_webView->client()->show(policy); }
false
CWE-119
073a80800f341325932c66818ce4302b312909a4
int effect_get_descriptor(effect_handle_t self, effect_descriptor_t *descriptor) { effect_context_t *context = (effect_context_t *)self; if (!effect_exists(context) || (descriptor == NULL)) return -EINVAL; *descriptor = *context->desc; return 0; }
false
CWE-399
a430c9166312e1aa3d80bce32374233bdbfeba32
static int check_rdpmc(struct x86_emulate_ctxt *ctxt) { u64 cr4 = ctxt->ops->get_cr(ctxt, 4); u64 rcx = reg_read(ctxt, VCPU_REGS_RCX); if ((!(cr4 & X86_CR4_PCE) && ctxt->ops->cpl(ctxt)) || ctxt->ops->check_pmc(ctxt, rcx)) return emulate_gp(ctxt, 0); return X86EMUL_CONTINUE; }
false
CWE-200
a209ff12ba9617c10550678ff93d01fb72a33399
static jboolean android_net_wifi_trackSignificantWifiChange( JNIEnv *env, jclass cls, jint iface, jint id, jobject settings) { JNIHelper helper(env); wifi_interface_handle handle = getIfaceHandle(helper, cls, iface); ALOGD("tracking significant wifi change on interface[%d] = %p", iface, handle); wifi_significant_change_params params; memset(&params, 0, sizeof(params)); params.rssi_sample_size = helper.getIntField(settings, "rssiSampleSize"); params.lost_ap_sample_size = helper.getIntField(settings, "lostApSampleSize"); params.min_breaching = helper.getIntField(settings, "minApsBreachingThreshold"); const char *bssid_info_array_type = "[Landroid/net/wifi/WifiScanner$BssidInfo;"; JNIObject<jobjectArray> bssids = helper.getArrayField( settings, "bssidInfos", bssid_info_array_type); params.num_bssid = helper.getArrayLength(bssids); if (params.num_bssid == 0) { ALOGE("Error in accessing array"); return false; } ALOGD("Initialized common fields %d, %d, %d, %d", params.rssi_sample_size, params.lost_ap_sample_size, params.min_breaching, params.num_bssid); for (int i = 0; i < params.num_bssid; i++) { JNIObject<jobject> objAp = helper.getObjectArrayElement(bssids, i); JNIObject<jstring> macAddrString = helper.getStringField(objAp, "bssid"); if (macAddrString == NULL) { ALOGE("Error getting bssid field"); return false; } ScopedUtfChars chars(env, macAddrString.get()); const char *bssid = chars.c_str(); if (bssid == NULL) { ALOGE("Error getting bssid"); return false; } mac_addr addr; parseMacAddress(bssid, addr); memcpy(params.ap[i].bssid, addr, sizeof(mac_addr)); char bssidOut[32]; sprintf(bssidOut, "%02x:%02x:%02x:%02x:%02x:%02x", addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); params.ap[i].low = helper.getIntField(objAp, "low"); params.ap[i].high = helper.getIntField(objAp, "high"); ALOGD("Added bssid %s, [%04d, %04d]", bssidOut, params.ap[i].low, params.ap[i].high); } ALOGD("Added %d bssids", params.num_bssid); wifi_significant_change_handler handler; memset(&handler, 0, sizeof(handler)); handler.on_significant_change = &onSignificantWifiChange; return hal_fn.wifi_set_significant_change_handler(id, handle, params, handler) == WIFI_SUCCESS; }
false
CWE-264
550fd08c2cebad61c548def135f67aba284c6162
static int tun_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t total_len) { struct tun_struct *tun = container_of(sock, struct tun_struct, socket); return tun_get_user(tun, m->msg_iov, total_len, m->msg_flags & MSG_DONTWAIT); }
false
CWE-200
5fe74f831fddb92afa5ddfe46490bb49f083132b
void WebLocalFrameImpl::SetCommittedFirstRealLoad() { DCHECK(GetFrame()); GetFrame()->Loader().StateMachine()->AdvanceTo( FrameLoaderStateMachine::kCommittedMultipleRealLoads); GetFrame()->DidSendResourceTimingInfoToParent(); }
true
CWE-20
56a84aa67bb071a33a48ac1481b555c48e0a9a59
void NavigationControllerImpl::NotifyEntryChanged( const NavigationEntry* entry) { EntryChangedDetails det; det.changed_entry = entry; det.index = GetIndexOfEntry( NavigationEntryImpl::FromNavigationEntry(entry)); delegate_->NotifyNavigationEntryChanged(det); }
false
CWE-264
550fd08c2cebad61c548def135f67aba284c6162
static void tun_poll_controller(struct net_device *dev) { /* * Tun only receives frames when: * 1) the char device endpoint gets data from user space * 2) the tun socket gets a sendmsg call from user space * Since both of those are syncronous operations, we are guaranteed * never to have pending data when we poll for it * so theres nothing to do here but return. * We need this though so netpoll recognizes us as an interface that * supports polling, which enables bridge devices in virt setups to * still use netconsole */ return; }
false
CWE-200
b6878d9e03043695dbf3fa1caa6dfc09db225b16
void md_reload_sb(struct mddev *mddev) { struct md_rdev *rdev, *tmp; rdev_for_each_safe(rdev, tmp, mddev) { rdev->sb_loaded = 0; ClearPageUptodate(rdev->sb_page); } mddev->raid_disks = 0; analyze_sbs(mddev); rdev_for_each_safe(rdev, tmp, mddev) { struct mdp_superblock_1 *sb = page_address(rdev->sb_page); /* since we don't write to faulty devices, we figure out if the * disk is faulty by comparing events */ if (mddev->events > sb->events) set_bit(Faulty, &rdev->flags); } }
false
CWE-416
fd6a5115103b3e6a52ce15858c5ad4956df29300
bool AudioNode::DisconnectFromOutputIfConnected( unsigned output_index, AudioNode& destination, unsigned input_index_of_destination) { AudioNodeOutput& output = Handler().Output(output_index); AudioNodeInput& input = destination.Handler().Input(input_index_of_destination); if (!output.IsConnectedToInput(input)) return false; output.DisconnectInput(input); connected_nodes_[output_index]->erase(&destination); return true; }
false
CWE-416
a4150b688a754d3d10d2ca385155b1c95d77d6ae
error::Error GLES2DecoderPassthroughImpl::DoGetProgramResourceiv( GLuint program, GLenum program_interface, GLuint index, GLsizei prop_count, const GLenum* props, GLsizei bufsize, GLsizei* length, GLint* params) { api()->glGetProgramResourceivFn(GetProgramServiceID(program, resources_), program_interface, index, prop_count, props, bufsize, length, params); return error::kNoError; }
false
CWE-416
11601c08e92732d2883af2057c41c17cba890844
DatabaseImpl::IDBThreadHelper::IDBThreadHelper( std::unique_ptr<IndexedDBConnection> connection, const url::Origin& origin, scoped_refptr<IndexedDBContextImpl> indexed_db_context) : indexed_db_context_(indexed_db_context), connection_(std::move(connection)), origin_(origin), weak_factory_(this) { DCHECK_CURRENTLY_ON(BrowserThread::IO); idb_thread_checker_.DetachFromThread(); }
false
CWE-416
a4150b688a754d3d10d2ca385155b1c95d77d6ae
bool GLES2Implementation::GetSyncivHelper(GLsync sync, GLenum pname, GLsizei bufsize, GLsizei* length, GLint* values) { GLint value = 0; switch (pname) { case GL_OBJECT_TYPE: value = GL_SYNC_FENCE; break; case GL_SYNC_CONDITION: value = GL_SYNC_GPU_COMMANDS_COMPLETE; break; case GL_SYNC_FLAGS: value = 0; break; default: return false; } if (bufsize > 0) { DCHECK(values); *values = value; } if (length) { *length = 1; } return true; }
false
CWE-200
5800dc5c19f34e6e03b5adab1282535cb102fafd
static void native_flush_tlb_global(void) { __native_flush_tlb_global(); }
false
CWE-264
bfdc0b497faa82a0ba2f9dddcf109231dd519fcc
static int _proc_do_string(void* data, int maxlen, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { size_t len; char __user *p; char c; if (!data || !maxlen || !*lenp) { *lenp = 0; return 0; } if (write) { len = 0; p = buffer; while (len < *lenp) { if (get_user(c, p++)) return -EFAULT; if (c == 0 || c == '\n') break; len++; } if (len >= maxlen) len = maxlen-1; if(copy_from_user(data, buffer, len)) return -EFAULT; ((char *) data)[len] = 0; *ppos += *lenp; } else { len = strlen(data); if (len > maxlen) len = maxlen; if (*ppos > len) { *lenp = 0; return 0; } data += *ppos; len -= *ppos; if (len > *lenp) len = *lenp; if (len) if(copy_to_user(buffer, data, len)) return -EFAULT; if (len < *lenp) { if(put_user('\n', ((char __user *) buffer) + len)) return -EFAULT; len++; } *lenp = len; *ppos += len; } return 0; }
false
CWE-264
4943ba16bbc2db05115707b3ff7b4874e9e3c560
int crypto_attr_u32(struct rtattr *rta, u32 *num) { struct crypto_attr_u32 *nu32; if (!rta) return -ENOENT; if (RTA_PAYLOAD(rta) < sizeof(*nu32)) return -EINVAL; if (rta->rta_type != CRYPTOA_U32) return -EINVAL; nu32 = RTA_DATA(rta); *num = nu32->num; return 0; }
false
CWE-119
715230a44310a8cf66fbfb5a46f9a62a9b2de424
static bool tg3_enable_msix(struct tg3 *tp) { int i, rc; struct msix_entry msix_ent[TG3_IRQ_MAX_VECS]; tp->txq_cnt = tp->txq_req; tp->rxq_cnt = tp->rxq_req; if (!tp->rxq_cnt) tp->rxq_cnt = netif_get_num_default_rss_queues(); if (tp->rxq_cnt > tp->rxq_max) tp->rxq_cnt = tp->rxq_max; /* Disable multiple TX rings by default. Simple round-robin hardware * scheduling of the TX rings can cause starvation of rings with * small packets when other rings have TSO or jumbo packets. */ if (!tp->txq_req) tp->txq_cnt = 1; tp->irq_cnt = tg3_irq_count(tp); for (i = 0; i < tp->irq_max; i++) { msix_ent[i].entry = i; msix_ent[i].vector = 0; } rc = pci_enable_msix(tp->pdev, msix_ent, tp->irq_cnt); if (rc < 0) { return false; } else if (rc != 0) { if (pci_enable_msix(tp->pdev, msix_ent, rc)) return false; netdev_notice(tp->dev, "Requested %d MSI-X vectors, received %d\n", tp->irq_cnt, rc); tp->irq_cnt = rc; tp->rxq_cnt = max(rc - 1, 1); if (tp->txq_cnt) tp->txq_cnt = min(tp->rxq_cnt, tp->txq_max); } for (i = 0; i < tp->irq_max; i++) tp->napi[i].irq_vec = msix_ent[i].vector; if (netif_set_real_num_rx_queues(tp->dev, tp->rxq_cnt)) { pci_disable_msix(tp->pdev); return false; } if (tp->irq_cnt == 1) return true; tg3_flag_set(tp, ENABLE_RSS); if (tp->txq_cnt > 1) tg3_flag_set(tp, ENABLE_TSS); netif_set_real_num_tx_queues(tp->dev, tp->txq_cnt); return true; }
false
CWE-416
9e417dae2833230a651989bb4e56b835355dda39
void WaitForState(State state) { while (state_ != state) MessageLoop::current()->RunAllPending(); }
false
CWE-189
b769f49463711205d57286e64cf535ed4daf59e9
int sequencer_open(int dev, struct file *file) { int retval, mode, i; int level, tmp; if (!sequencer_ok) sequencer_init(); level = ((dev & 0x0f) == SND_DEV_SEQ2) ? 2 : 1; dev = dev >> 4; mode = translate_mode(file); DEB(printk("sequencer_open(dev=%d)\n", dev)); if (!sequencer_ok) { /* printk("Sound card: sequencer not initialized\n");*/ return -ENXIO; } if (dev) /* Patch manager device (obsolete) */ return -ENXIO; if(synth_devs[dev] == NULL) request_module("synth0"); if (mode == OPEN_READ) { if (!num_midis) { /*printk("Sequencer: No MIDI devices. Input not possible\n");*/ sequencer_busy = 0; return -ENXIO; } } if (sequencer_busy) { return -EBUSY; } sequencer_busy = 1; obsolete_api_used = 0; max_mididev = num_midis; max_synthdev = num_synths; pre_event_timeout = MAX_SCHEDULE_TIMEOUT; seq_mode = SEQ_1; if (pending_timer != -1) { tmr_no = pending_timer; pending_timer = -1; } if (tmr_no == -1) /* Not selected yet */ { int i, best; best = -1; for (i = 0; i < num_sound_timers; i++) if (sound_timer_devs[i] && sound_timer_devs[i]->priority > best) { tmr_no = i; best = sound_timer_devs[i]->priority; } if (tmr_no == -1) /* Should not be */ tmr_no = 0; } tmr = sound_timer_devs[tmr_no]; if (level == 2) { if (tmr == NULL) { /*printk("sequencer: No timer for level 2\n");*/ sequencer_busy = 0; return -ENXIO; } setup_mode2(); } if (!max_synthdev && !max_mididev) { sequencer_busy=0; return -ENXIO; } synth_open_mask = 0; for (i = 0; i < max_mididev; i++) { midi_opened[i] = 0; midi_written[i] = 0; } for (i = 0; i < max_synthdev; i++) { if (synth_devs[i]==NULL) continue; if (!try_module_get(synth_devs[i]->owner)) continue; if ((tmp = synth_devs[i]->open(i, mode)) < 0) { printk(KERN_WARNING "Sequencer: Warning! Cannot open synth device #%d (%d)\n", i, tmp); if (synth_devs[i]->midi_dev) printk(KERN_WARNING "(Maps to MIDI dev #%d)\n", synth_devs[i]->midi_dev); } else { synth_open_mask |= (1 << i); if (synth_devs[i]->midi_dev) midi_opened[synth_devs[i]->midi_dev] = 1; } } seq_time = jiffies; prev_input_time = 0; prev_event_time = 0; if (seq_mode == SEQ_1 && (mode == OPEN_READ || mode == OPEN_READWRITE)) { /* * Initialize midi input devices */ for (i = 0; i < max_mididev; i++) if (!midi_opened[i] && midi_devs[i]) { if (!try_module_get(midi_devs[i]->owner)) continue; if ((retval = midi_devs[i]->open(i, mode, sequencer_midi_input, sequencer_midi_output)) >= 0) { midi_opened[i] = 1; } } } if (seq_mode == SEQ_2) { if (try_module_get(tmr->owner)) tmr->open(tmr_no, seq_mode); } init_waitqueue_head(&seq_sleeper); init_waitqueue_head(&midi_sleeper); output_threshold = SEQ_MAX_QUEUE / 2; return 0; }
false
CWE-189
bf118a342f10dafe44b14451a1392c3254629a1f
static int nfs4_xdr_dec_setclientid_confirm(struct rpc_rqst *req, struct xdr_stream *xdr, struct nfs_fsinfo *fsinfo) { struct compound_hdr hdr; int status; status = decode_compound_hdr(xdr, &hdr); if (!status) status = decode_setclientid_confirm(xdr); if (!status) status = decode_putrootfh(xdr); if (!status) status = decode_fsinfo(xdr, fsinfo); return status; }
false
CWE-20
f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
static inline struct hlist_head *nl_portid_hashfn(struct nl_portid_hash *hash, u32 portid) { return &hash->table[jhash_1word(portid, hash->rnd) & hash->mask]; }
false
CWE-200
d128139d53e9268e87921e82d89b3f2053cb83fd
bool GLManager::CanWaitUnverifiedSyncToken(const gpu::SyncToken& sync_token) { return false; }
false
CWE-399
f084d7007f67809ef116ee6b11f251bf3c9ed895
void ContainerNode::insertBeforeCommon(Node* nextChild, Node* newChild) { NoEventDispatchAssertion assertNoEventDispatch; ASSERT(newChild); ASSERT(!newChild->parentNode()); // Use insertBefore if you need to handle reparenting (and want DOM mutation events). ASSERT(!newChild->nextSibling()); ASSERT(!newChild->previousSibling()); ASSERT(!newChild->isShadowRoot()); Node* prev = nextChild->previousSibling(); ASSERT(m_lastChild != prev); nextChild->setPreviousSibling(newChild); if (prev) { ASSERT(m_firstChild != nextChild); ASSERT(prev->nextSibling() == nextChild); prev->setNextSibling(newChild); } else { ASSERT(m_firstChild == nextChild); m_firstChild = newChild; } newChild->setParentOrShadowHostNode(this); newChild->setPreviousSibling(prev); newChild->setNextSibling(nextChild); }
false
CWE-119
faaa2fd0a05f1622d9a8806da118d4f3b602e707
void HTMLMediaElement::scheduleNotifyPlaying() { scheduleEvent(EventTypeNames::playing); scheduleResolvePlayPromises(); }
false
CWE-119
715230a44310a8cf66fbfb5a46f9a62a9b2de424
static void tg3_ape_lock_init(struct tg3 *tp) { int i; u32 regbase, bit; if (tg3_asic_rev(tp) == ASIC_REV_5761) regbase = TG3_APE_LOCK_GRANT; else regbase = TG3_APE_PER_LOCK_GRANT; /* Make sure the driver hasn't any stale locks. */ for (i = TG3_APE_LOCK_PHY0; i <= TG3_APE_LOCK_GPIO; i++) { switch (i) { case TG3_APE_LOCK_PHY0: case TG3_APE_LOCK_PHY1: case TG3_APE_LOCK_PHY2: case TG3_APE_LOCK_PHY3: bit = APE_LOCK_GRANT_DRIVER; break; default: if (!tp->pci_fn) bit = APE_LOCK_GRANT_DRIVER; else bit = 1 << tp->pci_fn; } tg3_ape_write32(tp, regbase + 4 * i, bit); } }
false
CWE-20
8262245d384be025f13e2a5b3a03b7e5c98374ce
void RenderView::OnDragTargetDragEnter(const WebDropData& drop_data, const gfx::Point& client_point, const gfx::Point& screen_point, WebDragOperationsMask ops) { WebDragOperation operation = webview()->dragTargetDragEnter( drop_data.ToDragData(), client_point, screen_point, ops); Send(new DragHostMsg_UpdateDragCursor(routing_id_, operation)); }
false
CWE-119
b2b21468c1f7f08b30a7c1755316f6026c50eb2a
LayoutUnit RenderFlexibleBox::mainAxisExtent() const { return isHorizontalFlow() ? width() : height(); }
false
CWE-119
16dcd30c215801941d9890859fd79a234128fc3e
bool ChromeDownloadManagerDelegate::ShouldOpenDownload(DownloadItem* item) { if (download_crx_util::IsExtensionDownload(*item)) { scoped_refptr<CrxInstaller> crx_installer = download_crx_util::OpenChromeExtension(profile_, *item); registrar_.Add(this, chrome::NOTIFICATION_CRX_INSTALLER_DONE, content::Source<CrxInstaller>(crx_installer.get())); crx_installers_[crx_installer.get()] = item->GetId(); item->UpdateObservers(); return false; } if (ShouldOpenWithWebIntents(item)) { OpenWithWebIntent(item); item->DelayedDownloadOpened(true /* did_open */); return false; } return true; }
false
CWE-362
b9a41d21dceadf8104812626ef85dc56ee8a60ed
static int open_table_device(struct table_device *td, dev_t dev, struct mapped_device *md) { static char *_claim_ptr = "I belong to device-mapper"; struct block_device *bdev; int r; BUG_ON(td->dm_dev.bdev); bdev = blkdev_get_by_dev(dev, td->dm_dev.mode | FMODE_EXCL, _claim_ptr); if (IS_ERR(bdev)) return PTR_ERR(bdev); r = bd_link_disk_holder(bdev, dm_disk(md)); if (r) { blkdev_put(bdev, td->dm_dev.mode | FMODE_EXCL); return r; } td->dm_dev.bdev = bdev; td->dm_dev.dax_dev = dax_get_by_host(bdev->bd_disk->disk_name); return 0; }
false
CWE-416
a4150b688a754d3d10d2ca385155b1c95d77d6ae
WebGLRenderingContextBase::CreateWebGraphicsContext3DProvider( CanvasRenderingContextHost* host, const CanvasContextCreationAttributesCore& attributes, Platform::ContextType context_type, bool* using_gpu_compositing) { if (host->IsWebGLBlocked()) { host->SetContextCreationWasBlocked(); host->HostDispatchEvent(WebGLContextEvent::Create( event_type_names::kWebglcontextcreationerror, "Web page caused context loss and was blocked")); return nullptr; } if ((context_type == Platform::kWebGL1ContextType && !host->IsWebGL1Enabled()) || (context_type == Platform::kWebGL2ContextType && !host->IsWebGL2Enabled()) || (context_type == Platform::kWebGL2ComputeContextType && !host->IsWebGL2Enabled())) { host->HostDispatchEvent(WebGLContextEvent::Create( event_type_names::kWebglcontextcreationerror, "disabled by enterprise policy or commandline switch")); return nullptr; } return CreateContextProviderInternal(host, attributes, context_type, using_gpu_compositing); }
false
CWE-20
b2853fd6c2d0f383dbdf7427e263eb576a633867
static void cma_set_loopback(struct sockaddr *addr) { switch (addr->sa_family) { case AF_INET: ((struct sockaddr_in *) addr)->sin_addr.s_addr = htonl(INADDR_LOOPBACK); break; case AF_INET6: ipv6_addr_set(&((struct sockaddr_in6 *) addr)->sin6_addr, 0, 0, 0, htonl(1)); break; default: ib_addr_set(&((struct sockaddr_ib *) addr)->sib_addr, 0, 0, 0, htonl(1)); break; } }
false
CWE-200
9b3e617f3df53822345a8573b6d358f6b9e5ed87
static int __init atm_init(void) { int error; error = proto_register(&vcc_proto, 0); if (error < 0) goto out; error = atmpvc_init(); if (error < 0) { pr_err("atmpvc_init() failed with %d\n", error); goto out_unregister_vcc_proto; } error = atmsvc_init(); if (error < 0) { pr_err("atmsvc_init() failed with %d\n", error); goto out_atmpvc_exit; } error = atm_proc_init(); if (error < 0) { pr_err("atm_proc_init() failed with %d\n", error); goto out_atmsvc_exit; } error = atm_sysfs_init(); if (error < 0) { pr_err("atm_sysfs_init() failed with %d\n", error); goto out_atmproc_exit; } out: return error; out_atmproc_exit: atm_proc_exit(); out_atmsvc_exit: atmsvc_exit(); out_atmpvc_exit: atmsvc_exit(); out_unregister_vcc_proto: proto_unregister(&vcc_proto); goto out; }
false
CWE-20
e89cfcb9090e8c98129ae9160c513f504db74599
InitialLoadObserver::~InitialLoadObserver() { }
false
CWE-416
f2d26633cbd50735ac2af30436888b71ac0abad3
views::View* AutofillPopupItemView::CreateSubtextLabel() { return nullptr; }
false
CWE-200
52f6eb4221430b6248fd5a59bec53bfef9fdd9a7
base::string16 GetHelpUrlWithBoard(const std::string& original_url) { return base::ASCIIToUTF16(original_url + "&b=" + base::SysInfo::GetLsbReleaseBoard()); }
false
CWE-20
5788690fb1395dc672ff9b3385dbfb1180ed710a
void DelegatedFrameHost::OnLostResources() { EvictDelegatedFrame(); idle_frame_subscriber_textures_.clear(); yuv_readback_pipeline_.reset(); }
false
CWE-20
a8d6ae61d266d8bc44c3dd2d08bda32db701e359
std::string GetMimeType(const base::FilePath& path) { std::string mime_type; net::GetMimeTypeFromFile(path, &mime_type); return mime_type; }
false
CWE-189
fc9bbca8f650e5f738af8806317c0a041a48ae4a
static int do_unregister_framebuffer(struct fb_info *fb_info) { struct fb_event event; int i, ret = 0; i = fb_info->node; if (i < 0 || i >= FB_MAX || registered_fb[i] != fb_info) return -EINVAL; if (!lock_fb_info(fb_info)) return -ENODEV; console_lock(); event.info = fb_info; ret = fb_notifier_call_chain(FB_EVENT_FB_UNBIND, &event); console_unlock(); unlock_fb_info(fb_info); if (ret) return -EINVAL; unlink_framebuffer(fb_info); if (fb_info->pixmap.addr && (fb_info->pixmap.flags & FB_PIXMAP_DEFAULT)) kfree(fb_info->pixmap.addr); fb_destroy_modelist(&fb_info->modelist); registered_fb[i] = NULL; num_registered_fb--; fb_cleanup_device(fb_info); event.info = fb_info; console_lock(); fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event); console_unlock(); /* this may free fb info */ put_fb_info(fb_info); return 0; }
false
CWE-20
fae4d7b7d7e5c8a04a8b7a3258c0fc8362afa24c
LRUCanvasResourceProviderCache(int capacity) : resource_providers_( std::make_unique<std::unique_ptr<CanvasResourceProvider>[]>( capacity)), capacity_(capacity) {}
false
CWE-20
ba3b1b344017bbf36283464b51014fad15c2f3f4
void WebContentsImpl::OnDialogClosed(int render_process_id, int render_frame_id, IPC::Message* reply_msg, bool dialog_was_suppressed, bool success, const base::string16& user_input) { RenderFrameHostImpl* rfh = RenderFrameHostImpl::FromID(render_process_id, render_frame_id); last_dialog_suppressed_ = dialog_was_suppressed; if (is_showing_before_unload_dialog_ && !success) { if (rfh && rfh == rfh->frame_tree_node()->current_frame_host()) { rfh->frame_tree_node()->BeforeUnloadCanceled(); controller_.DiscardNonCommittedEntries(); } for (auto& observer : observers_) observer.BeforeUnloadDialogCancelled(); } if (rfh) { rfh->JavaScriptDialogClosed(reply_msg, success, user_input); std::vector<protocol::PageHandler*> page_handlers = protocol::PageHandler::EnabledForWebContents(this); for (auto* handler : page_handlers) handler->DidCloseJavaScriptDialog(success, user_input); } else { delete reply_msg; } is_showing_javascript_dialog_ = false; is_showing_before_unload_dialog_ = false; }
false
CWE-264
096fe9eaea40a17e125569f9e657e34cdb6d73bd
static long encrypted_read(const struct key *key, char __user *buffer, size_t buflen) { struct encrypted_key_payload *epayload; struct key *mkey; const u8 *master_key; size_t master_keylen; char derived_key[HASH_SIZE]; char *ascii_buf; size_t asciiblob_len; int ret; epayload = rcu_dereference_key(key); /* returns the hex encoded iv, encrypted-data, and hmac as ascii */ asciiblob_len = epayload->datablob_len + ivsize + 1 + roundup(epayload->decrypted_datalen, blksize) + (HASH_SIZE * 2); if (!buffer || buflen < asciiblob_len) return asciiblob_len; mkey = request_master_key(epayload, &master_key, &master_keylen); if (IS_ERR(mkey)) return PTR_ERR(mkey); ret = get_derived_key(derived_key, ENC_KEY, master_key, master_keylen); if (ret < 0) goto out; ret = derived_key_encrypt(epayload, derived_key, sizeof derived_key); if (ret < 0) goto out; ret = datablob_hmac_append(epayload, master_key, master_keylen); if (ret < 0) goto out; ascii_buf = datablob_format(epayload, asciiblob_len); if (!ascii_buf) { ret = -ENOMEM; goto out; } up_read(&mkey->sem); key_put(mkey); if (copy_to_user(buffer, ascii_buf, asciiblob_len) != 0) ret = -EFAULT; kfree(ascii_buf); return asciiblob_len; out: up_read(&mkey->sem); key_put(mkey); return ret; }
false
CWE-416
a4150b688a754d3d10d2ca385155b1c95d77d6ae
error::Error GLES2DecoderPassthroughImpl::DoCompileShader(GLuint shader) { api()->glCompileShaderFn(GetShaderServiceID(shader, resources_)); return error::kNoError; }
false
CWE-264
5d26a105b5a73e5635eae0629b42fa0a90e07b7b
static int krng_reset(struct crypto_rng *tfm, u8 *seed, unsigned int slen) { return 0; }
false
CWE-20
338c7dbadd2671189cec7faf64c84d01071b3f96
int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align, struct module *module) { int r; int cpu; r = kvm_arch_init(opaque); if (r) goto out_fail; /* * kvm_arch_init makes sure there's at most one caller * for architectures that support multiple implementations, * like intel and amd on x86. * kvm_arch_init must be called before kvm_irqfd_init to avoid creating * conflicts in case kvm is already setup for another implementation. */ r = kvm_irqfd_init(); if (r) goto out_irqfd; if (!zalloc_cpumask_var(&cpus_hardware_enabled, GFP_KERNEL)) { r = -ENOMEM; goto out_free_0; } r = kvm_arch_hardware_setup(); if (r < 0) goto out_free_0a; for_each_online_cpu(cpu) { smp_call_function_single(cpu, kvm_arch_check_processor_compat, &r, 1); if (r < 0) goto out_free_1; } r = register_cpu_notifier(&kvm_cpu_notifier); if (r) goto out_free_2; register_reboot_notifier(&kvm_reboot_notifier); /* A kmem cache lets us meet the alignment requirements of fx_save. */ if (!vcpu_align) vcpu_align = __alignof__(struct kvm_vcpu); kvm_vcpu_cache = kmem_cache_create("kvm_vcpu", vcpu_size, vcpu_align, 0, NULL); if (!kvm_vcpu_cache) { r = -ENOMEM; goto out_free_3; } r = kvm_async_pf_init(); if (r) goto out_free; kvm_chardev_ops.owner = module; kvm_vm_fops.owner = module; kvm_vcpu_fops.owner = module; r = misc_register(&kvm_dev); if (r) { printk(KERN_ERR "kvm: misc device register failed\n"); goto out_unreg; } register_syscore_ops(&kvm_syscore_ops); kvm_preempt_ops.sched_in = kvm_sched_in; kvm_preempt_ops.sched_out = kvm_sched_out; r = kvm_init_debug(); if (r) { printk(KERN_ERR "kvm: create debugfs files failed\n"); goto out_undebugfs; } return 0; out_undebugfs: unregister_syscore_ops(&kvm_syscore_ops); misc_deregister(&kvm_dev); out_unreg: kvm_async_pf_deinit(); out_free: kmem_cache_destroy(kvm_vcpu_cache); out_free_3: unregister_reboot_notifier(&kvm_reboot_notifier); unregister_cpu_notifier(&kvm_cpu_notifier); out_free_2: out_free_1: kvm_arch_hardware_unsetup(); out_free_0a: free_cpumask_var(cpus_hardware_enabled); out_free_0: kvm_irqfd_exit(); out_irqfd: kvm_arch_exit(); out_fail: return r; }
false
CWE-399
9c895160d25a76c21b65bad141b08e8d4f99afef
int kvm_emulate_halt(struct kvm_vcpu *vcpu) { ++vcpu->stat.halt_exits; if (irqchip_in_kernel(vcpu->kvm)) { vcpu->arch.mp_state = KVM_MP_STATE_HALTED; return 1; } else { vcpu->run->exit_reason = KVM_EXIT_HLT; return 0; } }
false
CWE-399
4ac8bc08e3306f38a5ab3e551aef6ad43753579c
RegionOversetState Element::regionOversetState() const { return hasRareData() ? elementRareData()->regionOversetState() : RegionUndefined; }
false
CWE-399
fdf5af0daf8019cec2396cdef8fb042d80fe71fa
static void tcp_update_cwnd_in_recovery(struct sock *sk, int newly_acked_sacked, int fast_rexmit, int flag) { struct tcp_sock *tp = tcp_sk(sk); int sndcnt = 0; int delta = tp->snd_ssthresh - tcp_packets_in_flight(tp); if (tcp_packets_in_flight(tp) > tp->snd_ssthresh) { u64 dividend = (u64)tp->snd_ssthresh * tp->prr_delivered + tp->prior_cwnd - 1; sndcnt = div_u64(dividend, tp->prior_cwnd) - tp->prr_out; } else { sndcnt = min_t(int, delta, max_t(int, tp->prr_delivered - tp->prr_out, newly_acked_sacked) + 1); } sndcnt = max(sndcnt, (fast_rexmit ? 1 : 0)); tp->snd_cwnd = tcp_packets_in_flight(tp) + sndcnt; }
false
CWE-189
1777aa6484af15014b8691082a8c3075418786f5
bool LayerTreeHostQt::layerTreeTileUpdatesAllowed() const { return !m_isSuspended && !m_waitingForUIProcess; }
false
CWE-119
385508dc888ef15d272cdd2705b17996abc519d6
void BackTexture::Create() { DCHECK_EQ(id(), 0u); ScopedGLErrorSuppressor suppressor("BackTexture::Create", decoder_->state_.GetErrorState()); GLuint id; api()->glGenTexturesFn(1, &id); GLenum target = Target(); ScopedTextureBinder binder(&decoder_->state_, id, target); texture_ref_ = TextureRef::Create(decoder_->texture_manager(), 0, id); decoder_->texture_manager()->SetTarget(texture_ref_.get(), target); decoder_->texture_manager()->SetParameteri( "BackTexture::Create", decoder_->GetErrorState(), texture_ref_.get(), GL_TEXTURE_MAG_FILTER, GL_LINEAR); decoder_->texture_manager()->SetParameteri( "BackTexture::Create", decoder_->GetErrorState(), texture_ref_.get(), GL_TEXTURE_MIN_FILTER, GL_LINEAR); decoder_->texture_manager()->SetParameteri( "BackTexture::Create", decoder_->GetErrorState(), texture_ref_.get(), GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); decoder_->texture_manager()->SetParameteri( "BackTexture::Create", decoder_->GetErrorState(), texture_ref_.get(), GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); }
false
CWE-200
c894aa36be535886a8e5ff02cdbcd07dd24618f6
void AudioFlinger::EffectChain::setDevice_l(audio_devices_t device) { size_t size = mEffects.size(); for (size_t i = 0; i < size; i++) { mEffects[i]->setDevice(device); } }
false
CWE-399
9c895160d25a76c21b65bad141b08e8d4f99afef
static void kvm_del_async_pf_gfn(struct kvm_vcpu *vcpu, gfn_t gfn) { u32 i, j, k; i = j = kvm_async_pf_gfn_slot(vcpu, gfn); while (true) { vcpu->arch.apf.gfns[i] = ~0; do { j = kvm_async_pf_next_probe(j); if (vcpu->arch.apf.gfns[j] == ~0) return; k = kvm_async_pf_hash_fn(vcpu->arch.apf.gfns[j]); /* * k lies cyclically in ]i,j] * | i.k.j | * |....j i.k.| or |.k..j i...| */ } while ((i <= j) ? (i < k && k <= j) : (i < k || k <= j)); vcpu->arch.apf.gfns[i] = vcpu->arch.apf.gfns[j]; i = j; } }
false
CWE-200
bceaa90240b6019ed73b49965eac7d167610be69
int udp_push_pending_frames(struct sock *sk) { struct udp_sock *up = udp_sk(sk); struct inet_sock *inet = inet_sk(sk); struct flowi4 *fl4 = &inet->cork.fl.u.ip4; struct sk_buff *skb; int err = 0; skb = ip_finish_skb(sk, fl4); if (!skb) goto out; err = udp_send_skb(skb, fl4); out: up->len = 0; up->pending = 0; return err; }
false
CWE-200
f43bfaeddc79effbf3d0fcb53ca477cca66f3db8
static int atl2_close(struct net_device *netdev) { struct atl2_adapter *adapter = netdev_priv(netdev); WARN_ON(test_bit(__ATL2_RESETTING, &adapter->flags)); atl2_down(adapter); atl2_free_irq(adapter); atl2_free_ring_resources(adapter); return 0; }
false
CWE-416
a4150b688a754d3d10d2ca385155b1c95d77d6ae
error::Error GLES2DecoderPassthroughImpl::DoDeleteTransformFeedbacks( GLsizei n, const volatile GLuint* ids) { if (n < 0) { InsertError(GL_INVALID_VALUE, "n cannot be negative."); return error::kNoError; } return DeleteHelper(n, ids, &transform_feedback_id_map_, [this](GLsizei n, GLuint* transform_feedbacks) { api()->glDeleteTransformFeedbacksFn( n, transform_feedbacks); }); }
false
CWE-189
20e0fa98b751facf9a1101edaefbc19c82616a68
int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state *state, const nfs4_stateid *stateid) { struct nfs4_exception exception = { }; struct nfs_server *server = NFS_SERVER(state->inode); int err; do { err = _nfs4_open_delegation_recall(ctx, state, stateid); switch (err) { case 0: case -ENOENT: case -ESTALE: goto out; case -NFS4ERR_BADSESSION: case -NFS4ERR_BADSLOT: case -NFS4ERR_BAD_HIGH_SLOT: case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: case -NFS4ERR_DEADSESSION: nfs4_schedule_session_recovery(server->nfs_client->cl_session); goto out; case -NFS4ERR_STALE_CLIENTID: case -NFS4ERR_STALE_STATEID: case -NFS4ERR_EXPIRED: /* Don't recall a delegation if it was lost */ nfs4_schedule_lease_recovery(server->nfs_client); goto out; case -ERESTARTSYS: /* * The show must go on: exit, but mark the * stateid as needing recovery. */ case -NFS4ERR_DELEG_REVOKED: case -NFS4ERR_ADMIN_REVOKED: case -NFS4ERR_BAD_STATEID: nfs_inode_find_state_and_recover(state->inode, stateid); nfs4_schedule_stateid_recovery(server, state); case -EKEYEXPIRED: /* * User RPCSEC_GSS context has expired. * We cannot recover this stateid now, so * skip it and allow recovery thread to * proceed. */ case -ENOMEM: err = 0; goto out; } err = nfs4_handle_exception(server, err, &exception); } while (exception.retry); out: return err; }
false
CWE-264
09ca8e1173bcb12e2a449698c9ae3b86a8a10195
static int hardware_enable_all(void) { int r = 0; raw_spin_lock(&kvm_lock); kvm_usage_count++; if (kvm_usage_count == 1) { atomic_set(&hardware_enable_failed, 0); on_each_cpu(hardware_enable_nolock, NULL, 1); if (atomic_read(&hardware_enable_failed)) { hardware_disable_all_nolock(); r = -EBUSY; } } raw_spin_unlock(&kvm_lock); return r; }
false
CWE-362
49d31c2f389acfe83417083e1208422b4091cd9e
int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry, struct inode **delegated_inode) { struct inode *inode = old_dentry->d_inode; unsigned max_links = dir->i_sb->s_max_links; int error; if (!inode) return -ENOENT; error = may_create(dir, new_dentry); if (error) return error; if (dir->i_sb != inode->i_sb) return -EXDEV; /* * A link to an append-only or immutable file cannot be created. */ if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) return -EPERM; /* * Updating the link count will likely cause i_uid and i_gid to * be writen back improperly if their true value is unknown to * the vfs. */ if (HAS_UNMAPPED_ID(inode)) return -EPERM; if (!dir->i_op->link) return -EPERM; if (S_ISDIR(inode->i_mode)) return -EPERM; error = security_inode_link(old_dentry, dir, new_dentry); if (error) return error; inode_lock(inode); /* Make sure we don't allow creating hardlink to an unlinked file */ if (inode->i_nlink == 0 && !(inode->i_state & I_LINKABLE)) error = -ENOENT; else if (max_links && inode->i_nlink >= max_links) error = -EMLINK; else { error = try_break_deleg(inode, delegated_inode); if (!error) error = dir->i_op->link(old_dentry, dir, new_dentry); } if (!error && (inode->i_state & I_LINKABLE)) { spin_lock(&inode->i_lock); inode->i_state &= ~I_LINKABLE; spin_unlock(&inode->i_lock); } inode_unlock(inode); if (!error) fsnotify_link(dir, inode, new_dentry); return error; }
false
CWE-416
a4150b688a754d3d10d2ca385155b1c95d77d6ae
ScriptValue WebGLRenderingContextBase::getProgramParameter( ScriptState* script_state, WebGLProgram* program, GLenum pname) { if (!ValidateWebGLProgramOrShader("getProgramParamter", program)) { return ScriptValue::CreateNull(script_state); } GLint value = 0; switch (pname) { case GL_DELETE_STATUS: return WebGLAny(script_state, program->MarkedForDeletion()); case GL_VALIDATE_STATUS: ContextGL()->GetProgramiv(ObjectOrZero(program), pname, &value); return WebGLAny(script_state, static_cast<bool>(value)); case GL_LINK_STATUS: return WebGLAny(script_state, program->LinkStatus(this)); case GL_COMPLETION_STATUS_KHR: if (!ExtensionEnabled(kKHRParallelShaderCompileName)) { SynthesizeGLError(GL_INVALID_ENUM, "getProgramParameter", "invalid parameter name"); return ScriptValue::CreateNull(script_state); } return WebGLAny(script_state, program->CompletionStatus(this)); case GL_ACTIVE_UNIFORM_BLOCKS: case GL_TRANSFORM_FEEDBACK_VARYINGS: if (!IsWebGL2OrHigher()) { SynthesizeGLError(GL_INVALID_ENUM, "getProgramParameter", "invalid parameter name"); return ScriptValue::CreateNull(script_state); } FALLTHROUGH; case GL_ATTACHED_SHADERS: case GL_ACTIVE_ATTRIBUTES: case GL_ACTIVE_UNIFORMS: ContextGL()->GetProgramiv(ObjectOrZero(program), pname, &value); return WebGLAny(script_state, value); case GL_TRANSFORM_FEEDBACK_BUFFER_MODE: if (!IsWebGL2OrHigher()) { SynthesizeGLError(GL_INVALID_ENUM, "getProgramParameter", "invalid parameter name"); return ScriptValue::CreateNull(script_state); } ContextGL()->GetProgramiv(ObjectOrZero(program), pname, &value); return WebGLAny(script_state, static_cast<unsigned>(value)); case GL_ACTIVE_ATOMIC_COUNTER_BUFFERS: if (context_type_ == Platform::kWebGL2ComputeContextType) { ContextGL()->GetProgramiv(ObjectOrZero(program), pname, &value); return WebGLAny(script_state, static_cast<unsigned>(value)); } FALLTHROUGH; default: SynthesizeGLError(GL_INVALID_ENUM, "getProgramParameter", "invalid parameter name"); return ScriptValue::CreateNull(script_state); } }
true
CWE-399
6ec82562ffc6f297d0de36d65776cff8e5704867
static int __init dev_proc_init(void) { return register_pernet_subsys(&dev_proc_ops); }
false
CWE-119
35eb28748d45b87695a69eceffaff73a0be476af
content::PageType BackgroundLoaderOffliner::GetPageType( content::WebContents* web_contents) { DCHECK(web_contents->GetController().GetVisibleEntry()) << "An entry must have committed at this WebContents"; return web_contents->GetController().GetVisibleEntry()->GetPageType(); }
false
CWE-119
b98b0bc8c431e3ceb4b26b0dfc8db509518fb290
int __sock_cmsg_send(struct sock *sk, struct msghdr *msg, struct cmsghdr *cmsg, struct sockcm_cookie *sockc) { u32 tsflags; switch (cmsg->cmsg_type) { case SO_MARK: if (!ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN)) return -EPERM; if (cmsg->cmsg_len != CMSG_LEN(sizeof(u32))) return -EINVAL; sockc->mark = *(u32 *)CMSG_DATA(cmsg); break; case SO_TIMESTAMPING: if (cmsg->cmsg_len != CMSG_LEN(sizeof(u32))) return -EINVAL; tsflags = *(u32 *)CMSG_DATA(cmsg); if (tsflags & ~SOF_TIMESTAMPING_TX_RECORD_MASK) return -EINVAL; sockc->tsflags &= ~SOF_TIMESTAMPING_TX_RECORD_MASK; sockc->tsflags |= tsflags; break; /* SCM_RIGHTS and SCM_CREDENTIALS are semantically in SOL_UNIX. */ case SCM_RIGHTS: case SCM_CREDENTIALS: break; default: return -EINVAL; } return 0; }
false
CWE-416
a4150b688a754d3d10d2ca385155b1c95d77d6ae
error::Error GLES2DecoderImpl::HandleGetShaderPrecisionFormat( uint32_t immediate_data_size, const volatile void* cmd_data) { const volatile gles2::cmds::GetShaderPrecisionFormat& c = *static_cast<const volatile gles2::cmds::GetShaderPrecisionFormat*>( cmd_data); GLenum shader_type = static_cast<GLenum>(c.shadertype); GLenum precision_type = static_cast<GLenum>(c.precisiontype); typedef cmds::GetShaderPrecisionFormat::Result Result; Result* result = GetSharedMemoryAs<Result*>( c.result_shm_id, c.result_shm_offset, sizeof(*result)); if (!result) { return error::kOutOfBounds; } if (result->success != 0) { return error::kInvalidArguments; } if (!validators_->shader_type.IsValid(shader_type)) { LOCAL_SET_GL_ERROR_INVALID_ENUM( "glGetShaderPrecisionFormat", shader_type, "shader_type"); return error::kNoError; } if (!validators_->shader_precision.IsValid(precision_type)) { LOCAL_SET_GL_ERROR_INVALID_ENUM( "glGetShaderPrecisionFormat", precision_type, "precision_type"); return error::kNoError; } result->success = 1; // true GLint range[2] = { 0, 0 }; GLint precision = 0; QueryShaderPrecisionFormat(gl_version_info(), shader_type, precision_type, range, &precision); result->min_range = range[0]; result->max_range = range[1]; result->precision = precision; return error::kNoError; }
false
CWE-362
d5aa407f59f5b83d2c50ec88f5bf56d40f1f8978
static int ipip_rcv(struct sk_buff *skb) { struct ip_tunnel *tunnel; const struct iphdr *iph = ip_hdr(skb); rcu_read_lock(); if ((tunnel = ipip_tunnel_lookup(dev_net(skb->dev), iph->saddr, iph->daddr)) != NULL) { if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) { rcu_read_unlock(); kfree_skb(skb); return 0; } secpath_reset(skb); skb->mac_header = skb->network_header; skb_reset_network_header(skb); skb->protocol = htons(ETH_P_IP); skb->pkt_type = PACKET_HOST; tunnel->dev->stats.rx_packets++; tunnel->dev->stats.rx_bytes += skb->len; skb->dev = tunnel->dev; skb_dst_drop(skb); nf_reset(skb); ipip_ecn_decapsulate(iph, skb); netif_rx(skb); rcu_read_unlock(); return 0; } rcu_read_unlock(); return -1; }
false
CWE-189
4cf106cdb83dd6b35d3b26d06cc67d1d2d99041e
png_do_read_interlace(png_structp png_ptr) { png_row_infop row_info = &(png_ptr->row_info); png_bytep row = png_ptr->row_buf + 1; int pass = png_ptr->pass; png_uint_32 transformations = png_ptr->transformations; /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Offset to next interlace block */ PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; png_debug(1, "in png_do_read_interlace"); if (row != NULL && row_info != NULL) { png_uint_32 final_width; final_width = row_info->width * png_pass_inc[pass]; switch (row_info->pixel_depth) { case 1: { png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 3); png_bytep dp = row + (png_size_t)((final_width - 1) >> 3); int sshift, dshift; int s_start, s_end, s_inc; int jstop = png_pass_inc[pass]; png_byte v; png_uint_32 i; int j; #ifdef PNG_READ_PACKSWAP_SUPPORTED if (transformations & PNG_PACKSWAP) { sshift = (int)((row_info->width + 7) & 0x07); dshift = (int)((final_width + 7) & 0x07); s_start = 7; s_end = 0; s_inc = -1; } else #endif { sshift = 7 - (int)((row_info->width + 7) & 0x07); dshift = 7 - (int)((final_width + 7) & 0x07); s_start = 0; s_end = 7; s_inc = 1; } for (i = 0; i < row_info->width; i++) { v = (png_byte)((*sp >> sshift) & 0x01); for (j = 0; j < jstop; j++) { *dp &= (png_byte)((0x7f7f >> (7 - dshift)) & 0xff); *dp |= (png_byte)(v << dshift); if (dshift == s_end) { dshift = s_start; dp--; } else dshift += s_inc; } if (sshift == s_end) { sshift = s_start; sp--; } else sshift += s_inc; } break; } case 2: { png_bytep sp = row + (png_uint_32)((row_info->width - 1) >> 2); png_bytep dp = row + (png_uint_32)((final_width - 1) >> 2); int sshift, dshift; int s_start, s_end, s_inc; int jstop = png_pass_inc[pass]; png_uint_32 i; #ifdef PNG_READ_PACKSWAP_SUPPORTED if (transformations & PNG_PACKSWAP) { sshift = (int)(((row_info->width + 3) & 0x03) << 1); dshift = (int)(((final_width + 3) & 0x03) << 1); s_start = 6; s_end = 0; s_inc = -2; } else #endif { sshift = (int)((3 - ((row_info->width + 3) & 0x03)) << 1); dshift = (int)((3 - ((final_width + 3) & 0x03)) << 1); s_start = 0; s_end = 6; s_inc = 2; } for (i = 0; i < row_info->width; i++) { png_byte v; int j; v = (png_byte)((*sp >> sshift) & 0x03); for (j = 0; j < jstop; j++) { *dp &= (png_byte)((0x3f3f >> (6 - dshift)) & 0xff); *dp |= (png_byte)(v << dshift); if (dshift == s_end) { dshift = s_start; dp--; } else dshift += s_inc; } if (sshift == s_end) { sshift = s_start; sp--; } else sshift += s_inc; } break; } case 4: { png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 1); png_bytep dp = row + (png_size_t)((final_width - 1) >> 1); int sshift, dshift; int s_start, s_end, s_inc; png_uint_32 i; int jstop = png_pass_inc[pass]; #ifdef PNG_READ_PACKSWAP_SUPPORTED if (transformations & PNG_PACKSWAP) { sshift = (int)(((row_info->width + 1) & 0x01) << 2); dshift = (int)(((final_width + 1) & 0x01) << 2); s_start = 4; s_end = 0; s_inc = -4; } else #endif { sshift = (int)((1 - ((row_info->width + 1) & 0x01)) << 2); dshift = (int)((1 - ((final_width + 1) & 0x01)) << 2); s_start = 0; s_end = 4; s_inc = 4; } for (i = 0; i < row_info->width; i++) { png_byte v = (png_byte)((*sp >> sshift) & 0xf); int j; for (j = 0; j < jstop; j++) { *dp &= (png_byte)((0xf0f >> (4 - dshift)) & 0xff); *dp |= (png_byte)(v << dshift); if (dshift == s_end) { dshift = s_start; dp--; } else dshift += s_inc; } if (sshift == s_end) { sshift = s_start; sp--; } else sshift += s_inc; } break; } default: { png_size_t pixel_bytes = (row_info->pixel_depth >> 3); png_bytep sp = row + (png_size_t)(row_info->width - 1) * pixel_bytes; png_bytep dp = row + (png_size_t)(final_width - 1) * pixel_bytes; int jstop = png_pass_inc[pass]; png_uint_32 i; for (i = 0; i < row_info->width; i++) { png_byte v[8]; int j; png_memcpy(v, sp, pixel_bytes); for (j = 0; j < jstop; j++) { png_memcpy(dp, v, pixel_bytes); dp -= pixel_bytes; } sp -= pixel_bytes; } break; } } row_info->width = final_width; row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, final_width); } #ifndef PNG_READ_PACKSWAP_SUPPORTED transformations = transformations; /* Silence compiler warning */ #endif }
false
CWE-119
6fb392b1a63ae36c31f62bc3fc8630b49d602b62
int qeth_init_qdio_queues(struct qeth_card *card) { int i, j; int rc; QETH_DBF_TEXT(SETUP, 2, "initqdqs"); /* inbound queue */ memset(card->qdio.in_q->qdio_bufs, 0, QDIO_MAX_BUFFERS_PER_Q * sizeof(struct qdio_buffer)); qeth_initialize_working_pool_list(card); /*give only as many buffers to hardware as we have buffer pool entries*/ for (i = 0; i < card->qdio.in_buf_pool.buf_count - 1; ++i) qeth_init_input_buffer(card, &card->qdio.in_q->bufs[i]); card->qdio.in_q->next_buf_to_init = card->qdio.in_buf_pool.buf_count - 1; rc = do_QDIO(CARD_DDEV(card), QDIO_FLAG_SYNC_INPUT, 0, 0, card->qdio.in_buf_pool.buf_count - 1); if (rc) { QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc); return rc; } /* completion */ rc = qeth_cq_init(card); if (rc) { return rc; } /* outbound queue */ for (i = 0; i < card->qdio.no_out_queues; ++i) { memset(card->qdio.out_qs[i]->qdio_bufs, 0, QDIO_MAX_BUFFERS_PER_Q * sizeof(struct qdio_buffer)); for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; ++j) { qeth_clear_output_buffer(card->qdio.out_qs[i], card->qdio.out_qs[i]->bufs[j], QETH_QDIO_BUF_EMPTY); } card->qdio.out_qs[i]->card = card; card->qdio.out_qs[i]->next_buf_to_fill = 0; card->qdio.out_qs[i]->do_pack = 0; atomic_set(&card->qdio.out_qs[i]->used_buffers, 0); atomic_set(&card->qdio.out_qs[i]->set_pci_flags_count, 0); atomic_set(&card->qdio.out_qs[i]->state, QETH_OUT_Q_UNLOCKED); } return 0; }
false
CWE-20
e89cfcb9090e8c98129ae9160c513f504db74599
TabStripGtk::DropInfo::DropInfo(int drop_index, bool drop_before, bool point_down) : drop_index(drop_index), drop_before(drop_before), point_down(point_down) { CreateContainer(); drop_arrow = GetDropArrowImage(point_down); }
false
CWE-362
04f5866e41fb70690e28397487d8bd8eea7d712a
SYSCALL_DEFINE1(old_mmap, struct mmap_arg_struct __user *, arg) { struct mmap_arg_struct a; if (copy_from_user(&a, arg, sizeof(a))) return -EFAULT; if (offset_in_page(a.offset)) return -EINVAL; return ksys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT); }
false
CWE-20
fff450abc4e2fb330ba700547a8e6a7b0fb90a6e
bool OutOfProcessInstance::Confirm(const std::string& message) { pp::Var result = ModalDialog(this, "confirm", message, std::string()); return result.is_bool() ? result.AsBool() : false; }
false
CWE-20
8355de453bb4014b74b2db5d7ca38c5664d65d83
void NavigationRequest::OnRequestStarted(base::TimeTicks timestamp) { if (frame_tree_node_->IsMainFrame()) { TRACE_EVENT_ASYNC_END_WITH_TIMESTAMP0( "navigation", "Navigation timeToNetworkStack", navigation_handle_.get(), timestamp); } frame_tree_node_->navigator()->LogResourceRequestTime(timestamp, common_params_.url); }
false
CWE-264
d123966ec156cd2f92fdada36be39694641b479e
void FileAPIMessageFilter::DidFinish(int request_id, base::PlatformFileError result) { if (result == base::PLATFORM_FILE_OK) Send(new FileSystemMsg_DidSucceed(request_id)); else Send(new FileSystemMsg_DidFail(request_id, result)); UnregisterOperation(request_id); }
false
CWE-416
df80cd9b28b9ebaa284a41df611dbf3a2d05ca74
static struct sctp_transport *sctp_addr_id2transport(struct sock *sk, struct sockaddr_storage *addr, sctp_assoc_t id) { struct sctp_association *addr_asoc = NULL, *id_asoc = NULL; struct sctp_af *af = sctp_get_af_specific(addr->ss_family); union sctp_addr *laddr = (union sctp_addr *)addr; struct sctp_transport *transport; if (!af || sctp_verify_addr(sk, laddr, af->sockaddr_len)) return NULL; addr_asoc = sctp_endpoint_lookup_assoc(sctp_sk(sk)->ep, laddr, &transport); if (!addr_asoc) return NULL; id_asoc = sctp_id2assoc(sk, id); if (id_asoc && (id_asoc != addr_asoc)) return NULL; sctp_get_pf_specific(sk->sk_family)->addr_to_user(sctp_sk(sk), (union sctp_addr *)addr); return transport; }
false
CWE-416
11a4cc4a6d6e665d9a118fada4b7c658d6f70d95
void FrameView::paintScrollbar(GraphicsContext* context, Scrollbar* bar, const IntRect& rect) { bool needsBackgorund = bar->isCustomScrollbar() && m_frame->isMainFrame(); if (needsBackgorund) { IntRect toFill = bar->frameRect(); toFill.intersect(rect); context->fillRect(toFill, baseBackgroundColor()); } ScrollView::paintScrollbar(context, bar, rect); }
false
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
4,044

Models trained or fine-tuned on codemetic/curve