cwe
stringclasses
9 values
id
stringlengths
40
40
source
stringlengths
14
66.9k
label
bool
2 classes
CWE-264
f63a8daa5812afef4f06c962351687e1ff9ccb2b
void __perf_event_task_sched_in(struct task_struct *prev, struct task_struct *task) { struct perf_event_context *ctx; int ctxn; for_each_task_context_nr(ctxn) { ctx = task->perf_event_ctxp[ctxn]; if (likely(!ctx)) continue; perf_event_context_sched_in(ctx, task); } /* * if cgroup events exist on this CPU, then we need * to check if we have to switch in PMU state. * cgroup event are system-wide mode only */ if (atomic_read(this_cpu_ptr(&perf_cgroup_events))) perf_cgroup_sched_in(prev, task); /* check for system-wide branch_stack events */ if (atomic_read(this_cpu_ptr(&perf_branch_stack_events))) perf_branch_stack_sched_in(prev, task); }
false
CWE-399
f85a87ec670ad0fce9d98d90c9a705b72a288154
static void voidCallbackFunctionAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); V8TRYCATCH_VOID(ScriptValue, cppValue, ScriptValue(jsValue, info.GetIsolate())); imp->setVoidCallbackFunctionAttribute(cppValue); }
false
CWE-119
c7e50b5ef454efd6ab9527d795442c213eeb6afa
bool PopupContainer::handleMouseReleaseEvent(const PlatformMouseEvent& event) { RefPtr<PopupContainer> protect(this); UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); return m_listBox->handleMouseReleaseEvent( constructRelativeMouseEvent(event, this, m_listBox.get())); }
false
CWE-200
7b07f8eb75aa3097cdfd4f6eac3da49db787381d
static void ccid3_hc_rx_exit(struct sock *sk) { struct ccid3_hc_rx_sock *hc = ccid3_hc_rx_sk(sk); tfrc_rx_hist_purge(&hc->rx_hist); tfrc_lh_cleanup(&hc->rx_li_hist); }
false
CWE-119
faaa2fd0a05f1622d9a8806da118d4f3b602e707
void HTMLMediaElement::changeNetworkStateFromLoadingToIdle() { m_progressEventTimer.stop(); if (webMediaPlayer() && webMediaPlayer()->didLoadingProgress()) scheduleEvent(EventTypeNames::progress); scheduleEvent(EventTypeNames::suspend); setNetworkState(kNetworkIdle); }
false
CWE-284
472271b153c5dc53c28beac55480a8d8434b2d5c
static inline unsigned int flags2pevents(int flags) { unsigned int pevents = 0; if(flags & SOCK_THREAD_FD_WR) pevents |= POLLOUT; if(flags & SOCK_THREAD_FD_RD) pevents |= POLLIN; pevents |= POLL_EXCEPTION_EVENTS; return pevents; }
false
CWE-264
5d26a105b5a73e5635eae0629b42fa0a90e07b7b
static int xts_fallback_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { struct s390_xts_ctx *xts_ctx = crypto_blkcipher_ctx(desc->tfm); struct crypto_blkcipher *tfm; unsigned int ret; tfm = desc->tfm; desc->tfm = xts_ctx->fallback; ret = crypto_blkcipher_decrypt_iv(desc, dst, src, nbytes); desc->tfm = tfm; return ret; }
false
CWE-189
d3bd7413e0ca40b60cf60d4003246d067cafdeda
static bool type_is_refcounted(enum bpf_reg_type type) { return type == PTR_TO_SOCKET; }
false
CWE-362
0048b4837affd153897ed1222283492070027aa9
static unsigned int __blk_mq_get_tag(struct blk_mq_alloc_data *data) { int tag; tag = bt_get(data, &data->hctx->tags->bitmap_tags, data->hctx, &data->ctx->last_tag, data->hctx->tags); if (tag >= 0) return tag + data->hctx->tags->nr_reserved_tags; return BLK_MQ_TAG_FAIL; }
false
CWE-20
36ae3c0a36b7456432fedce38ae2f7bd3e01a563
ioeventfd_check_collision(struct kvm *kvm, struct _ioeventfd *p) { struct _ioeventfd *_p; list_for_each_entry(_p, &kvm->ioeventfds, list) if (_p->bus_idx == p->bus_idx && _p->addr == p->addr && (!_p->length || !p->length || (_p->length == p->length && (_p->wildcard || p->wildcard || _p->datamatch == p->datamatch)))) return true; return false; }
false
CWE-264
5d26a105b5a73e5635eae0629b42fa0a90e07b7b
static int ahash_sha1_init(struct ahash_request *req) { struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); struct hash_ctx *ctx = crypto_ahash_ctx(tfm); ctx->config.data_format = HASH_DATA_8_BITS; ctx->config.algorithm = HASH_ALGO_SHA1; ctx->config.oper_mode = HASH_OPER_MODE_HASH; ctx->digestsize = SHA1_DIGEST_SIZE; return hash_init(req); }
false
CWE-399
a6f7726de20450074a01493e4e85409ce3f2595a
static Editor::Command command(Document* document, const String& commandName, bool userInterface = false) { Frame* frame = document->frame(); if (!frame || frame->document() != document) return Editor::Command(); document->updateStyleIfNeeded(); return frame->editor()->command(commandName, userInterface ? CommandFromDOMWithUserInterface : CommandFromDOM); }
false
CWE-399
dd3b6fe574edad231c01c78e4647a74c38dc4178
bool GDataDirectory::FromProto(const GDataDirectoryProto& proto) { DCHECK(proto.gdata_entry().file_info().is_directory()); DCHECK(!proto.gdata_entry().has_file_specific_info()); for (int i = 0; i < proto.child_files_size(); ++i) { scoped_ptr<GDataFile> file(new GDataFile(NULL, directory_service_)); if (!file->FromProto(proto.child_files(i))) { RemoveChildren(); return false; } AddEntry(file.release()); } for (int i = 0; i < proto.child_directories_size(); ++i) { scoped_ptr<GDataDirectory> dir(new GDataDirectory(NULL, directory_service_)); if (!dir->FromProto(proto.child_directories(i))) { RemoveChildren(); return false; } AddEntry(dir.release()); } if (!GDataEntry::FromProto(proto.gdata_entry())) return false; return true; }
true
CWE-416
69b4b9ef7455753b12c3efe4eec71647e6fb1da1
DataReductionProxyIOData::GetEffectiveConnectionType() const { DCHECK(io_task_runner_->BelongsToCurrentThread()); return effective_connection_type_; }
false
CWE-189
0837e3242c73566fc1c0196b4ec61779c25ffc93
static int power_check_constraints(struct cpu_hw_events *cpuhw, u64 event_id[], unsigned int cflags[], int n_ev) { unsigned long mask, value, nv; unsigned long smasks[MAX_HWEVENTS], svalues[MAX_HWEVENTS]; int n_alt[MAX_HWEVENTS], choice[MAX_HWEVENTS]; int i, j; unsigned long addf = ppmu->add_fields; unsigned long tadd = ppmu->test_adder; if (n_ev > ppmu->n_counter) return -1; /* First see if the events will go on as-is */ for (i = 0; i < n_ev; ++i) { if ((cflags[i] & PPMU_LIMITED_PMC_REQD) && !ppmu->limited_pmc_event(event_id[i])) { ppmu->get_alternatives(event_id[i], cflags[i], cpuhw->alternatives[i]); event_id[i] = cpuhw->alternatives[i][0]; } if (ppmu->get_constraint(event_id[i], &cpuhw->amasks[i][0], &cpuhw->avalues[i][0])) return -1; } value = mask = 0; for (i = 0; i < n_ev; ++i) { nv = (value | cpuhw->avalues[i][0]) + (value & cpuhw->avalues[i][0] & addf); if ((((nv + tadd) ^ value) & mask) != 0 || (((nv + tadd) ^ cpuhw->avalues[i][0]) & cpuhw->amasks[i][0]) != 0) break; value = nv; mask |= cpuhw->amasks[i][0]; } if (i == n_ev) return 0; /* all OK */ /* doesn't work, gather alternatives... */ if (!ppmu->get_alternatives) return -1; for (i = 0; i < n_ev; ++i) { choice[i] = 0; n_alt[i] = ppmu->get_alternatives(event_id[i], cflags[i], cpuhw->alternatives[i]); for (j = 1; j < n_alt[i]; ++j) ppmu->get_constraint(cpuhw->alternatives[i][j], &cpuhw->amasks[i][j], &cpuhw->avalues[i][j]); } /* enumerate all possibilities and see if any will work */ i = 0; j = -1; value = mask = nv = 0; while (i < n_ev) { if (j >= 0) { /* we're backtracking, restore context */ value = svalues[i]; mask = smasks[i]; j = choice[i]; } /* * See if any alternative k for event_id i, * where k > j, will satisfy the constraints. */ while (++j < n_alt[i]) { nv = (value | cpuhw->avalues[i][j]) + (value & cpuhw->avalues[i][j] & addf); if ((((nv + tadd) ^ value) & mask) == 0 && (((nv + tadd) ^ cpuhw->avalues[i][j]) & cpuhw->amasks[i][j]) == 0) break; } if (j >= n_alt[i]) { /* * No feasible alternative, backtrack * to event_id i-1 and continue enumerating its * alternatives from where we got up to. */ if (--i < 0) return -1; } else { /* * Found a feasible alternative for event_id i, * remember where we got up to with this event_id, * go on to the next event_id, and start with * the first alternative for it. */ choice[i] = j; svalues[i] = value; smasks[i] = mask; value = nv; mask |= cpuhw->amasks[i][j]; ++i; j = -1; } } /* OK, we have a feasible combination, tell the caller the solution */ for (i = 0; i < n_ev; ++i) event_id[i] = cpuhw->alternatives[i][choice[i]]; return 0; }
false
CWE-362
d5aa407f59f5b83d2c50ec88f5bf56d40f1f8978
ipip6_tunnel_add_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a, int chg) { struct ip_tunnel_prl_entry *p; int err = 0; if (a->addr == htonl(INADDR_ANY)) return -EINVAL; spin_lock(&ipip6_prl_lock); for (p = t->prl; p; p = p->next) { if (p->addr == a->addr) { if (chg) { p->flags = a->flags; goto out; } err = -EEXIST; goto out; } } if (chg) { err = -ENXIO; goto out; } p = kzalloc(sizeof(struct ip_tunnel_prl_entry), GFP_KERNEL); if (!p) { err = -ENOBUFS; goto out; } INIT_RCU_HEAD(&p->rcu_head); p->next = t->prl; p->addr = a->addr; p->flags = a->flags; t->prl_count++; rcu_assign_pointer(t->prl, p); out: spin_unlock(&ipip6_prl_lock); return err; }
false
CWE-264
03a53d1c7765eeb3af0bc34c3dff02ada1953fbf
void InputDispatcher::dispatchEventLocked(nsecs_t currentTime, EventEntry* eventEntry, const Vector<InputTarget>& inputTargets) { #if DEBUG_DISPATCH_CYCLE ALOGD("dispatchEventToCurrentInputTargets"); #endif ALOG_ASSERT(eventEntry->dispatchInProgress); // should already have been set to true pokeUserActivityLocked(eventEntry); for (size_t i = 0; i < inputTargets.size(); i++) { const InputTarget& inputTarget = inputTargets.itemAt(i); ssize_t connectionIndex = getConnectionIndexLocked(inputTarget.inputChannel); if (connectionIndex >= 0) { sp<Connection> connection = mConnectionsByFd.valueAt(connectionIndex); prepareDispatchCycleLocked(currentTime, connection, eventEntry, &inputTarget); } else { #if DEBUG_FOCUS ALOGD("Dropping event delivery to target with channel '%s' because it " "is no longer registered with the input dispatcher.", inputTarget.inputChannel->getName().string()); #endif } } }
false
CWE-416
1b53cf9815bb4744958d41f3795d5d5a1d365e2d
static int digest_encode(const char *src, int len, char *dst) { int i = 0, bits = 0, ac = 0; char *cp = dst; while (i < len) { ac += (((unsigned char) src[i]) << bits); bits += 8; do { *cp++ = lookup_table[ac & 0x3f]; ac >>= 6; bits -= 6; } while (bits >= 6); i++; } if (bits) *cp++ = lookup_table[ac & 0x3f]; return cp - dst; }
false
CWE-20
108147dfd1ea159fd3632ef92ccc4ab8952980c7
void ContentSecurityPolicy::LogToConsole(const String& message, MessageLevel level) { LogToConsole(ConsoleMessage::Create(kSecurityMessageSource, level, message)); }
false
CWE-284
472271b153c5dc53c28beac55480a8d8434b2d5c
static int uipc_close_ch_locked(tUIPC_CH_ID ch_id) { int wakeup = 0; BTIF_TRACE_EVENT("CLOSE CHANNEL %d", ch_id); if (ch_id >= UIPC_CH_NUM) return -1; if (uipc_main.ch[ch_id].srvfd != UIPC_DISCONNECTED) { BTIF_TRACE_EVENT("CLOSE SERVER (FD %d)", uipc_main.ch[ch_id].srvfd); close(uipc_main.ch[ch_id].srvfd); FD_CLR(uipc_main.ch[ch_id].srvfd, &uipc_main.active_set); uipc_main.ch[ch_id].srvfd = UIPC_DISCONNECTED; wakeup = 1; } if (uipc_main.ch[ch_id].fd != UIPC_DISCONNECTED) { BTIF_TRACE_EVENT("CLOSE CONNECTION (FD %d)", uipc_main.ch[ch_id].fd); close(uipc_main.ch[ch_id].fd); FD_CLR(uipc_main.ch[ch_id].fd, &uipc_main.active_set); uipc_main.ch[ch_id].fd = UIPC_DISCONNECTED; wakeup = 1; } /* notify this connection is closed */ if (uipc_main.ch[ch_id].cback) uipc_main.ch[ch_id].cback(ch_id, UIPC_CLOSE_EVT); /* trigger main thread update if something was updated */ if (wakeup) uipc_wakeup_locked(); return 0; }
false
CWE-119
412b65d15a7f8a93794653968308fc100f2aa87c
static int hns_gmac_get_sset_count(int stringset) { if (stringset == ETH_SS_STATS) return ARRAY_SIZE(g_gmac_stats_string); return 0; }
true
CWE-399
3b0d77670a0613f409110817455d2137576b485a
bool Plugin::NexeIsContentHandler() const { return !mime_type().empty() && mime_type() != kNaClMIMEType; }
false
CWE-20
29734f46c6dc9362783091180c2ee279ad53637f
void V4L2JpegEncodeAccelerator::EncodedInstance::DestroyOutputBuffers() { DCHECK(parent_->encoder_task_runner_->BelongsToCurrentThread()); free_output_buffers_.clear(); if (output_buffer_map_.empty()) return; if (output_streamon_) { __u32 type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; IOCTL_OR_ERROR_RETURN(VIDIOC_STREAMOFF, &type); output_streamon_ = false; } for (const auto& output_record : output_buffer_map_) { device_->Munmap(output_record.address[0], output_record.length[0]); } struct v4l2_requestbuffers reqbufs; memset(&reqbufs, 0, sizeof(reqbufs)); reqbufs.count = 0; reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; reqbufs.memory = V4L2_MEMORY_MMAP; IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs); output_buffer_map_.clear(); }
false
CWE-200
d5e0d0f607a7a029c6563a0470d88255c89a8d11
static int vsock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) { int err; err = sock_queue_rcv_skb(sk, skb); if (err) kfree_skb(skb); return err; }
false
CWE-399
dd3b6fe574edad231c01c78e4647a74c38dc4178
void GDataFileSystem::OnGetDocumentEntry(const FilePath& cache_file_path, const GetFileFromCacheParams& params, GDataErrorCode status, scoped_ptr<base::Value> data) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); GDataFileError error = util::GDataToGDataFileError(status); scoped_ptr<GDataEntry> fresh_entry; if (error == GDATA_FILE_OK) { scoped_ptr<DocumentEntry> doc_entry(DocumentEntry::ExtractAndParse(*data)); if (doc_entry.get()) { fresh_entry.reset( GDataEntry::FromDocumentEntry(NULL, doc_entry.get(), directory_service_.get())); } if (!fresh_entry.get() || !fresh_entry->AsGDataFile()) { LOG(ERROR) << "Got invalid entry from server for " << params.resource_id; error = GDATA_FILE_ERROR_FAILED; } } if (error != GDATA_FILE_OK) { if (!params.get_file_callback.is_null()) { params.get_file_callback.Run(error, cache_file_path, params.mime_type, REGULAR_FILE); } return; } GURL content_url = fresh_entry->content_url(); int64 file_size = fresh_entry->file_info().size; DCHECK_EQ(params.resource_id, fresh_entry->resource_id()); scoped_ptr<GDataFile> fresh_entry_as_file( fresh_entry.release()->AsGDataFile()); directory_service_->RefreshFile(fresh_entry_as_file.Pass()); bool* has_enough_space = new bool(false); util::PostBlockingPoolSequencedTaskAndReply( FROM_HERE, blocking_task_runner_, base::Bind(&GDataCache::FreeDiskSpaceIfNeededFor, base::Unretained(cache_), file_size, has_enough_space), base::Bind(&GDataFileSystem::StartDownloadFileIfEnoughSpace, ui_weak_ptr_, params, content_url, cache_file_path, base::Owned(has_enough_space))); }
true
CWE-20
f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
static void **alloc_pg_vec(struct netlink_sock *nlk, struct nl_mmap_req *req, unsigned int order) { unsigned int block_nr = req->nm_block_nr; unsigned int i; void **pg_vec; pg_vec = kcalloc(block_nr, sizeof(void *), GFP_KERNEL); if (pg_vec == NULL) return NULL; for (i = 0; i < block_nr; i++) { pg_vec[i] = alloc_one_pg_vec_page(order); if (pg_vec[i] == NULL) goto err1; } return pg_vec; err1: free_pg_vec(pg_vec, order, block_nr); return NULL; }
false
CWE-399
5b6698b0e4a37053de35cc24ee695b98a7eb712b
bool batadv_frag_skb_buffer(struct sk_buff **skb, struct batadv_orig_node *orig_node_src) { struct sk_buff *skb_out = NULL; struct hlist_head head = HLIST_HEAD_INIT; bool ret = false; /* Add packet to buffer and table entry if merge is possible. */ if (!batadv_frag_insert_packet(orig_node_src, *skb, &head)) goto out_err; /* Leave if more fragments are needed to merge. */ if (hlist_empty(&head)) goto out; skb_out = batadv_frag_merge_packets(&head, *skb); if (!skb_out) goto out_err; out: *skb = skb_out; ret = true; out_err: return ret; }
false
CWE-20
0720b02e4f303ea6b114d4ae9453e3a7ff55f8dc
bool WebContentsImpl::IsFocusedElementEditable() { RenderFrameHostImpl* frame = GetFocusedFrame(); return frame && frame->has_focused_editable_element(); }
false
CWE-119
b71fc042e1124cda2ab51dfdacc2362da62779a6
bool QueryManager::HavePendingTransferQueries() { return !pending_transfer_queries_.empty(); }
false
CWE-20
86acdca1b63e6890540fa19495cfc708beff3d8b
static int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry) { int error = 0; struct inode *target; /* * If we are going to change the parent - check write permissions, * we'll need to flip '..'. */ if (new_dir != old_dir) { error = inode_permission(old_dentry->d_inode, MAY_WRITE); if (error) return error; } error = security_inode_rename(old_dir, old_dentry, new_dir, new_dentry); if (error) return error; target = new_dentry->d_inode; if (target) { mutex_lock(&target->i_mutex); dentry_unhash(new_dentry); } if (d_mountpoint(old_dentry)||d_mountpoint(new_dentry)) error = -EBUSY; else error = old_dir->i_op->rename(old_dir, old_dentry, new_dir, new_dentry); if (target) { if (!error) target->i_flags |= S_DEAD; mutex_unlock(&target->i_mutex); if (d_unhashed(new_dentry)) d_rehash(new_dentry); dput(new_dentry); } if (!error) if (!(old_dir->i_sb->s_type->fs_flags & FS_RENAME_DOES_D_MOVE)) d_move(old_dentry,new_dentry); return error; }
false
CWE-119
7926aff5c57b577ab0f43364ff0c59d968f6a414
static void fill_skb_pool(rtl8150_t *dev) { struct sk_buff *skb; int i; for (i = 0; i < RX_SKB_POOL_SIZE; i++) { if (dev->rx_skb_pool[i]) continue; skb = dev_alloc_skb(RTL8150_MTU + 2); if (!skb) { return; } skb_reserve(skb, 2); dev->rx_skb_pool[i] = skb; } }
false
CWE-264
04915c26ea193247b8a29aa24bfa34578ef5d39e
bool GraphicsContext3D::makeContextCurrent() { if (!m_private || m_renderStyle == RenderToCurrentGLContext) return false; return m_private->makeCurrentIfNeeded(); }
false
CWE-20
5cd363bc34f508c63b66e653bc41bd1783a4b711
void RenderFrameHostManager::DidChangeOpener( int opener_routing_id, SiteInstance* source_site_instance) { FrameTreeNode* opener = nullptr; if (opener_routing_id != MSG_ROUTING_NONE) { RenderFrameHostImpl* opener_rfhi = RenderFrameHostImpl::FromID( source_site_instance->GetProcess()->GetID(), opener_routing_id); if (opener_rfhi) opener = opener_rfhi->frame_tree_node(); } if (frame_tree_node_->opener() == opener) return; frame_tree_node_->SetOpener(opener); for (const auto& pair : proxy_hosts_) { if (pair.second->GetSiteInstance() == source_site_instance) continue; pair.second->UpdateOpener(); } if (render_frame_host_->GetSiteInstance() != source_site_instance) render_frame_host_->UpdateOpener(); if (speculative_render_frame_host_ && speculative_render_frame_host_->GetSiteInstance() != source_site_instance) { speculative_render_frame_host_->UpdateOpener(); } }
false
CWE-416
12ca6ad2e3a896256f086497a7c7406a547ee373
static void perf_event_for_each_child(struct perf_event *event, void (*func)(struct perf_event *)) { struct perf_event *child; WARN_ON_ONCE(event->ctx->parent_ctx); mutex_lock(&event->child_mutex); func(event); list_for_each_entry(child, &event->child_list, child_list) func(child); mutex_unlock(&event->child_mutex); }
false
CWE-119
62154472bd2c43e1790dd1bd8a527c1db9118d88
void WebBluetoothServiceImpl::RemoteDescriptorWriteValue( const std::string& descriptor_instance_id, const std::vector<uint8_t>& value, RemoteDescriptorWriteValueCallback callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); if (value.size() > 512) { CrashRendererAndClosePipe(bad_message::BDH_INVALID_WRITE_VALUE_LENGTH); return; } const CacheQueryResult query_result = QueryCacheForDescriptor(descriptor_instance_id); if (query_result.outcome == CacheQueryOutcome::BAD_RENDERER) { return; } if (query_result.outcome != CacheQueryOutcome::SUCCESS) { RecordDescriptorWriteValueOutcome(query_result.outcome); std::move(callback).Run(query_result.GetWebResult()); return; } if (BluetoothBlocklist::Get().IsExcludedFromWrites( query_result.descriptor->GetUUID())) { RecordDescriptorWriteValueOutcome(UMAGATTOperationOutcome::BLOCKLISTED); std::move(callback).Run( blink::mojom::WebBluetoothResult::BLOCKLISTED_WRITE); return; } auto copyable_callback = base::AdaptCallbackForRepeating(std::move(callback)); query_result.descriptor->WriteRemoteDescriptor( value, base::Bind(&WebBluetoothServiceImpl::OnDescriptorWriteValueSuccess, weak_ptr_factory_.GetWeakPtr(), copyable_callback), base::Bind(&WebBluetoothServiceImpl::OnDescriptorWriteValueFailed, weak_ptr_factory_.GetWeakPtr(), copyable_callback)); }
false
CWE-20
f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
static int ipxitf_add_local_route(struct ipx_interface *intrfc) { return ipxrtr_add_route(intrfc->if_netnum, intrfc, NULL); }
false
CWE-119
acc192347665943ca674acf117e4f74a88436922
FLAC__StreamDecoderLengthStatus FLACParser::length_callback( const FLAC__StreamDecoder * /* decoder */, FLAC__uint64 *stream_length, void *client_data) { return ((FLACParser *) client_data)->lengthCallback(stream_length); }
false
CWE-264
e21bdfb9c758ac411012ad84f83d26d3f7dd69fb
ExtensionInfoMap* ExtensionSystemImpl::info_map() { return shared_->info_map(); }
false
CWE-20
5fd35e5359c6345b8709695cd71fba307318e6aa
RenderBox::~RenderBox() { }
false
CWE-416
f03ea5a5c2ff26e239dfd23e263b15da2d9cee93
RenderFrameImpl::UniqueNameFrameAdapter::CollectAncestorNames( BeginPoint begin_point, bool (*should_stop)(base::StringPiece)) const { std::vector<base::StringPiece> result; for (blink::WebFrame* frame = begin_point == BeginPoint::kParentFrame ? GetWebFrame()->Parent() : GetWebFrame(); frame; frame = frame->Parent()) { result.push_back(UniqueNameForWebFrame(frame)); if (should_stop(result.back())) break; } return result; }
false
CWE-119
f5364c150aa645b3d7daa21b5c0b9feaa1c9cd6d
static inline int normal_prio(struct task_struct *p) { int prio; if (task_has_dl_policy(p)) prio = MAX_DL_PRIO-1; else if (task_has_rt_policy(p)) prio = MAX_RT_PRIO-1 - p->rt_priority; else prio = __normal_prio(p); return prio; }
false
CWE-189
971548cdca2d4c0a6fedd3db0c94372c2a27eac3
void MediaStreamManager::Opened(MediaStreamType stream_type, int capture_session_id) { DCHECK_CURRENTLY_ON(BrowserThread::IO); DVLOG(1) << "Opened({stream_type = " << stream_type << "} " << "{capture_session_id = " << capture_session_id << "})"; for (const LabeledDeviceRequest& labeled_request : requests_) { const std::string& label = labeled_request.first; DeviceRequest* request = labeled_request.second; for (MediaStreamDevice& device : request->devices) { if (device.type == stream_type && device.session_id == capture_session_id) { CHECK_EQ(request->state(device.type), MEDIA_REQUEST_STATE_OPENING); request->SetState(device.type, MEDIA_REQUEST_STATE_DONE); if (IsAudioInputMediaType(device.type)) { if (device.type != MEDIA_GUM_TAB_AUDIO_CAPTURE) { const MediaStreamDevice* opened_device = audio_input_device_manager_->GetOpenedDeviceById( device.session_id); device.input = opened_device->input; int effects = device.input.effects(); FilterAudioEffects(request->controls, &effects); EnableHotwordEffect(request->controls, &effects); device.input.set_effects(effects); } } if (RequestDone(*request)) HandleRequestDone(label, request); break; } } } }
false
CWE-119
13bf9fbff0e5e099e2b6f003a0ab8ae145436309
nfssvc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd_readdirargs *args) { p = decode_fh(p, &args->fh); if (!p) return 0; args->cookie = ntohl(*p++); args->count = ntohl(*p++); args->count = min_t(u32, args->count, PAGE_SIZE); args->buffer = page_address(*(rqstp->rq_next_page++)); return xdr_argsize_check(rqstp, p); }
false
CWE-119
f6ac1dba5e36f338a490752a2cbef3339096d9fe
bool WebGLRenderingContextBase::ValidateTexFuncDimensions( const char* function_name, TexImageFunctionType function_type, GLenum target, GLint level, GLsizei width, GLsizei height, GLsizei depth) { if (width < 0 || height < 0 || depth < 0) { SynthesizeGLError(GL_INVALID_VALUE, function_name, "width, height or depth < 0"); return false; } switch (target) { case GL_TEXTURE_2D: if (width > (max_texture_size_ >> level) || height > (max_texture_size_ >> level)) { SynthesizeGLError(GL_INVALID_VALUE, function_name, "width or height out of range"); return false; } break; case GL_TEXTURE_CUBE_MAP_POSITIVE_X: case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: if (function_type != kTexSubImage && width != height) { SynthesizeGLError(GL_INVALID_VALUE, function_name, "width != height for cube map"); return false; } if (width > (max_cube_map_texture_size_ >> level)) { SynthesizeGLError(GL_INVALID_VALUE, function_name, "width or height out of range for cube map"); return false; } break; case GL_TEXTURE_3D: if (IsWebGL2OrHigher()) { if (width > (max3d_texture_size_ >> level) || height > (max3d_texture_size_ >> level) || depth > (max3d_texture_size_ >> level)) { SynthesizeGLError(GL_INVALID_VALUE, function_name, "width, height or depth out of range"); return false; } break; } case GL_TEXTURE_2D_ARRAY: if (IsWebGL2OrHigher()) { if (width > (max_texture_size_ >> level) || height > (max_texture_size_ >> level) || depth > max_array_texture_layers_) { SynthesizeGLError(GL_INVALID_VALUE, function_name, "width, height or depth out of range"); return false; } break; } default: SynthesizeGLError(GL_INVALID_ENUM, function_name, "invalid target"); return false; } return true; }
false
CWE-399
a8b0ca17b80e92faab46ee7179ba9e99ccb61233
static void x86_pmu_enable_event(struct perf_event *event) { if (__this_cpu_read(cpu_hw_events.enabled)) __x86_pmu_enable_event(&event->hw, ARCH_PERFMON_EVENTSEL_ENABLE); }
false
CWE-362
30a61ddf8117c26ac5b295e1233eaa9629a94ca3
int truncate_inode_blocks(struct inode *inode, pgoff_t from) { struct f2fs_sb_info *sbi = F2FS_I_SB(inode); int err = 0, cont = 1; int level, offset[4], noffset[4]; unsigned int nofs = 0; struct f2fs_inode *ri; struct dnode_of_data dn; struct page *page; trace_f2fs_truncate_inode_blocks_enter(inode, from); level = get_node_path(inode, from, offset, noffset); page = get_node_page(sbi, inode->i_ino); if (IS_ERR(page)) { trace_f2fs_truncate_inode_blocks_exit(inode, PTR_ERR(page)); return PTR_ERR(page); } set_new_dnode(&dn, inode, page, NULL, 0); unlock_page(page); ri = F2FS_INODE(page); switch (level) { case 0: case 1: nofs = noffset[1]; break; case 2: nofs = noffset[1]; if (!offset[level - 1]) goto skip_partial; err = truncate_partial_nodes(&dn, ri, offset, level); if (err < 0 && err != -ENOENT) goto fail; nofs += 1 + NIDS_PER_BLOCK; break; case 3: nofs = 5 + 2 * NIDS_PER_BLOCK; if (!offset[level - 1]) goto skip_partial; err = truncate_partial_nodes(&dn, ri, offset, level); if (err < 0 && err != -ENOENT) goto fail; break; default: BUG(); } skip_partial: while (cont) { dn.nid = le32_to_cpu(ri->i_nid[offset[0] - NODE_DIR1_BLOCK]); switch (offset[0]) { case NODE_DIR1_BLOCK: case NODE_DIR2_BLOCK: err = truncate_dnode(&dn); break; case NODE_IND1_BLOCK: case NODE_IND2_BLOCK: err = truncate_nodes(&dn, nofs, offset[1], 2); break; case NODE_DIND_BLOCK: err = truncate_nodes(&dn, nofs, offset[1], 3); cont = 0; break; default: BUG(); } if (err < 0 && err != -ENOENT) goto fail; if (offset[1] == 0 && ri->i_nid[offset[0] - NODE_DIR1_BLOCK]) { lock_page(page); BUG_ON(page->mapping != NODE_MAPPING(sbi)); f2fs_wait_on_page_writeback(page, NODE, true); ri->i_nid[offset[0] - NODE_DIR1_BLOCK] = 0; set_page_dirty(page); unlock_page(page); } offset[1] = 0; offset[0]++; nofs += err; } fail: f2fs_put_page(page, 0); trace_f2fs_truncate_inode_blocks_exit(inode, err); return err > 0 ? 0 : err; }
false
CWE-399
f85a87ec670ad0fce9d98d90c9a705b72a288154
static void testInterfaceEmptyAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); V8TRYCATCH_VOID(TestInterfaceEmpty*, cppValue, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), jsValue)); imp->setTestInterfaceEmptyAttribute(WTF::getPtr(cppValue)); }
false
CWE-20
282f53ffdc3b1902da86f6a0791af736837efbf8
void PeopleHandler::OnDidClosePage(const base::ListValue* args) { if (!args->GetList()[0].GetBool() && !IsProfileAuthNeededOrHasErrors()) { MarkFirstSetupComplete(); } CloseSyncSetup(); }
false
CWE-399
3b0d77670a0613f409110817455d2137576b485a
PP_Var GetDocumentURL(PP_Instance instance, PP_URLComponents_Dev* components) { PluginInstance* plugin_instance = host_globals->GetInstance(instance); if (!plugin_instance) return PP_MakeUndefined(); return plugin_instance->GetDocumentURL(instance, components); }
false
CWE-200
eea3300239f0b53e172a320eb8de59d0bea65f27
void DevToolsUIBindings::FileSystemAdded( const DevToolsFileHelper::FileSystem& file_system) { std::unique_ptr<base::DictionaryValue> file_system_value( CreateFileSystemValue(file_system)); CallClientFunction("DevToolsAPI.fileSystemAdded", file_system_value.get(), NULL, NULL); }
false
CWE-362
5c17c861a357e9458001f021a7afa7aab9937439
static struct pid *session_of_pgrp(struct pid *pgrp) { struct task_struct *p; struct pid *sid = NULL; p = pid_task(pgrp, PIDTYPE_PGID); if (p == NULL) p = pid_task(pgrp, PIDTYPE_PID); if (p != NULL) sid = task_session(p); return sid; }
false
CWE-119
5925dff83699508b5e2735afb0297dfb310e159d
void Browser::OpenPrivacyDashboardTabAndActivate() { OpenURL(GURL(kPrivacyDashboardUrl), GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK); window_->Activate(); }
false
CWE-200
bceaa90240b6019ed73b49965eac7d167610be69
static int rawv6_ioctl(struct sock *sk, int cmd, unsigned long arg) { switch (cmd) { case SIOCOUTQ: { int amount = sk_wmem_alloc_get(sk); return put_user(amount, (int __user *)arg); } case SIOCINQ: { struct sk_buff *skb; int amount = 0; spin_lock_bh(&sk->sk_receive_queue.lock); skb = skb_peek(&sk->sk_receive_queue); if (skb != NULL) amount = skb_tail_pointer(skb) - skb_transport_header(skb); spin_unlock_bh(&sk->sk_receive_queue.lock); return put_user(amount, (int __user *)arg); } default: #ifdef CONFIG_IPV6_MROUTE return ip6mr_ioctl(sk, cmd, (void __user *)arg); #else return -ENOIOCTLCMD; #endif } }
false
CWE-200
fea16c8b60ff3d0756d5eb392394963b647bc41a
void ContentSecurityPolicy::addPolicyFromHeaderValue( const String& header, ContentSecurityPolicyHeaderType type, ContentSecurityPolicyHeaderSource source) { if (source == ContentSecurityPolicyHeaderSourceMeta && type == ContentSecurityPolicyHeaderTypeReport) { reportReportOnlyInMeta(header); return; } Vector<UChar> characters; header.appendTo(characters); const UChar* begin = characters.data(); const UChar* end = begin + characters.size(); const UChar* position = begin; while (position < end) { skipUntil<UChar>(position, end, ','); Member<CSPDirectiveList> policy = CSPDirectiveList::create(this, begin, position, type, source); if (!policy->allowEval( 0, SecurityViolationReportingPolicy::SuppressReporting) && m_disableEvalErrorMessage.isNull()) m_disableEvalErrorMessage = policy->evalDisabledErrorMessage(); m_policies.push_back(policy.release()); ASSERT(position == end || *position == ','); skipExactly<UChar>(position, end, ','); begin = position; } }
false
CWE-20
dbcfe72cb16222c9f7e7907fcc5f35b27cc25331
void NetworkActionPredictor::ClearTransitionalMatches() { transitional_matches_.clear(); }
false
CWE-20
36fd3c9a6ba9fce9dd80c442c3ba5decd8e4c065
void set_os_state(shell_integration::DefaultWebClientState value) { os_state_ = value; }
false
CWE-416
4a3482693491ac6bb3dd27d591efa3de1d1f1fcf
static void CreateLoaderAndStart( RenderFrameHost* frame, network::mojom::URLLoaderRequest request, int route_id, int request_id, const network::ResourceRequest& resource_request, network::mojom::URLLoaderClientPtrInfo client) { network::mojom::URLLoaderFactoryPtr factory; frame->GetProcess()->CreateURLLoaderFactory(frame->GetLastCommittedOrigin(), nullptr /* header_client */, mojo::MakeRequest(&factory)); factory->CreateLoaderAndStart( std::move(request), route_id, request_id, network::mojom::kURLLoadOptionNone, resource_request, network::mojom::URLLoaderClientPtr(std::move(client)), net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS)); }
false
CWE-119
33827275411b33371e7bb750cce20f11de85002d
void SelectionEditor::UpdateCachedVisibleSelectionIfNeeded() const { DCHECK_GE(GetDocument().Lifecycle().GetState(), DocumentLifecycle::kAfterPerformLayout); AssertSelectionValid(); if (!NeedsUpdateVisibleSelection()) return; style_version_for_dom_tree_ = GetDocument().StyleVersion(); cached_visible_selection_in_dom_tree_is_dirty_ = false; cached_visible_selection_in_dom_tree_ = CreateVisibleSelection(selection_); if (!cached_visible_selection_in_dom_tree_.IsNone()) return; style_version_for_flat_tree_ = GetDocument().StyleVersion(); cached_visible_selection_in_flat_tree_is_dirty_ = false; cached_visible_selection_in_flat_tree_ = VisibleSelectionInFlatTree(); }
false
CWE-416
a4150b688a754d3d10d2ca385155b1c95d77d6ae
error::Error GLES2DecoderPassthroughImpl::DoCopyTextureCHROMIUM( GLuint source_id, GLint source_level, GLenum dest_target, GLuint dest_id, GLint dest_level, GLint internalformat, GLenum dest_type, GLboolean unpack_flip_y, GLboolean unpack_premultiply_alpha, GLboolean unpack_unmultiply_alpha) { BindPendingImageForClientIDIfNeeded(source_id); api()->glCopyTextureCHROMIUMFn( GetTextureServiceID(api(), source_id, resources_, false), source_level, dest_target, GetTextureServiceID(api(), dest_id, resources_, false), dest_level, internalformat, dest_type, unpack_flip_y, unpack_premultiply_alpha, unpack_unmultiply_alpha); UpdateTextureSizeFromClientID(dest_id); return error::kNoError; }
false
CWE-264
f7ae1f7a918f1973dca241a7a23169906eaf4fe3
void BrowserEventRouter::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { NavigationController* source_controller = content::Source<NavigationController>(source).ptr(); TabUpdated(source_controller->GetWebContents(), true); } else if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { WebContents* contents = content::Source<WebContents>(source).ptr(); registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source<NavigationController>(&contents->GetController())); registrar_.Remove(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, content::Source<WebContents>(contents)); } else { NOTREACHED(); } }
false
CWE-264
bfdc0b497faa82a0ba2f9dddcf109231dd519fcc
int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, HZ, 1000l); }
false
CWE-119
9fd9d629fcf836bb0d6210015d33a299cf6bca34
Browser* InProcessBrowserTest::CreateBrowser(Profile* profile) { Browser* browser = new Browser( Browser::CreateParams(profile, chrome::GetActiveDesktop())); AddBlankTabAndShow(browser); return browser; }
false
CWE-264
f9ed2fe6d61259e779a37d4c2d7edb33a1c1f8ba
status_t OMX::enableGraphicBuffers( node_id node, OMX_U32 port_index, OMX_BOOL enable) { return findInstance(node)->enableGraphicBuffers(port_index, enable); }
false
CWE-399
e40607cbe270a9e8360907cb1e62ddf0736e4864
struct sctp_chunk *sctp_make_cwr(const struct sctp_association *asoc, const __u32 lowest_tsn, const struct sctp_chunk *chunk) { struct sctp_chunk *retval; sctp_cwrhdr_t cwr; cwr.lowest_tsn = htonl(lowest_tsn); retval = sctp_make_control(asoc, SCTP_CID_ECN_CWR, 0, sizeof(sctp_cwrhdr_t)); if (!retval) goto nodata; retval->subh.ecn_cwr_hdr = sctp_addto_chunk(retval, sizeof(cwr), &cwr); /* RFC 2960 6.4 Multi-homed SCTP Endpoints * * An endpoint SHOULD transmit reply chunks (e.g., SACK, * HEARTBEAT ACK, * etc.) to the same destination transport * address from which it * received the DATA or control chunk * to which it is replying. * * [Report a reduced congestion window back to where the ECNE * came from.] */ if (chunk) retval->transport = chunk->transport; nodata: return retval; }
false
CWE-119
c995d4fe5e96f4d6d4a88b7867279b08e72d2579
void ChromeContentBrowserClient::GetQuotaSettings( content::BrowserContext* context, content::StoragePartition* partition, storage::OptionalQuotaSettingsCallback callback) { if (g_default_quota_settings) { std::move(callback).Run(*g_default_quota_settings); return; } storage::GetNominalDynamicSettings( partition->GetPath(), context->IsOffTheRecord(), storage::GetDefaultDiskInfoHelper(), std::move(callback)); }
false
CWE-399
6160968cee8b90a5dd95318d716e31d7775c4ef3
gid_t from_kgid_munged(struct user_namespace *targ, kgid_t kgid) { gid_t gid; gid = from_kgid(targ, kgid); if (gid == (gid_t) -1) gid = overflowgid; return gid; }
false
CWE-189
f8bd2258e2d520dff28c855658bd24bdafb5102d
unsigned long msecs_to_jiffies(const unsigned int m) { /* * Negative value, means infinite timeout: */ if ((int)m < 0) return MAX_JIFFY_OFFSET; #if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ) /* * HZ is equal to or smaller than 1000, and 1000 is a nice * round multiple of HZ, divide with the factor between them, * but round upwards: */ return (m + (MSEC_PER_SEC / HZ) - 1) / (MSEC_PER_SEC / HZ); #elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC) /* * HZ is larger than 1000, and HZ is a nice round multiple of * 1000 - simply multiply with the factor between them. * * But first make sure the multiplication result cannot * overflow: */ if (m > jiffies_to_msecs(MAX_JIFFY_OFFSET)) return MAX_JIFFY_OFFSET; return m * (HZ / MSEC_PER_SEC); #else /* * Generic case - multiply, round and divide. But first * check that if we are doing a net multiplication, that * we wouldn't overflow: */ if (HZ > MSEC_PER_SEC && m > jiffies_to_msecs(MAX_JIFFY_OFFSET)) return MAX_JIFFY_OFFSET; return ((u64)MSEC_TO_HZ_MUL32 * m + MSEC_TO_HZ_ADJ32) >> MSEC_TO_HZ_SHR32; #endif }
false
CWE-200
04aaacb936a08d70862d6d9d7e8354721ae46be8
void AddHost(AppCacheHost* host) { hosts_to_notify_.insert(host->frontend()); }
false
CWE-416
c3957448cfc6e299165196a33cd954b790875fdb
void Document::DidMergeTextNodes(const Text& merged_node, const Text& node_to_be_removed, unsigned old_length) { NodeWithIndex node_to_be_removed_with_index( const_cast<Text&>(node_to_be_removed)); if (!ranges_.IsEmpty()) { for (Range* range : ranges_) range->DidMergeTextNodes(node_to_be_removed_with_index, old_length); } NotifyMergeTextNodes(merged_node, node_to_be_removed_with_index, old_length); }
false
CWE-416
45f6fad84cc305103b28d73482b344d7f5b76f39
static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) { if (skb->protocol == htons(ETH_P_IP)) return tcp_v4_conn_request(sk, skb); if (!ipv6_unicast_destination(skb)) goto drop; return tcp_conn_request(&tcp6_request_sock_ops, &tcp_request_sock_ipv6_ops, sk, skb); drop: NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); return 0; /* don't send reset */ }
false
CWE-20
8262245d384be025f13e2a5b3a03b7e5c98374ce
void BrowserRenderProcessHost::OnSavedPageAsMHTML(int job_id, bool success) { content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> MHTMLGenerated(job_id, success); }
false
CWE-264
0c3b93c8c2027e74af642967eee5c142c8fd185d
bool MediaPlayerService::Client::shouldDropMetadata(media::Metadata::Type code) const { Mutex::Autolock lock(mLock); if (findMetadata(mMetadataDrop, code)) { return true; } if (mMetadataAllow.isEmpty() || findMetadata(mMetadataAllow, code)) { return false; } else { return true; } }
false