cwe
stringclasses 9
values | id
stringlengths 40
40
| source
stringlengths 14
66.9k
| label
bool 2
classes |
|---|---|---|---|
CWE-399
|
a6f7726de20450074a01493e4e85409ce3f2595a
|
void Document::webkitExitFullscreen()
{
Document* currentDoc = this;
if (m_fullScreenElementStack.isEmpty())
return;
Deque<RefPtr<Document> > descendants;
for (Frame* descendant = frame() ? frame()->tree()->traverseNext() : 0; descendant; descendant = descendant->tree()->traverseNext()) {
if (descendant->document()->webkitFullscreenElement())
descendants.prepend(descendant->document());
}
for (Deque<RefPtr<Document> >::iterator i = descendants.begin(); i != descendants.end(); ++i) {
(*i)->clearFullscreenElementStack();
addDocumentToFullScreenChangeEventQueue(i->get());
}
Element* newTop = 0;
while (currentDoc) {
currentDoc->popFullscreenElementStack();
newTop = currentDoc->webkitFullscreenElement();
if (newTop && (!newTop->inDocument() || newTop->document() != currentDoc))
continue;
addDocumentToFullScreenChangeEventQueue(currentDoc);
if (!newTop && currentDoc->ownerElement()) {
currentDoc = currentDoc->ownerElement()->document();
continue;
}
currentDoc = 0;
}
if (!page())
return;
if (!newTop) {
page()->chrome()->client()->exitFullScreenForElement(m_fullScreenElement.get());
return;
}
page()->chrome()->client()->enterFullScreenForElement(newTop);
}
| false
|
CWE-119
|
7f0126ff011142c8619b10a6e64d04d1745c503a
|
void kickNoResults()
{
kick(-1, -1, WebTextDecorationTypeSpelling);
}
| false
|
CWE-399
|
0b760113a3a155269a3fba93a409c640031dd68f
|
static void rpcproc_encode_null(void *rqstp, struct xdr_stream *xdr, void *obj)
{
}
| false
|
CWE-119
|
33827275411b33371e7bb750cce20f11de85002d
|
static RefPtr<Image> ImageFromNode(const Node& node) {
DCHECK(!node.GetDocument().NeedsLayoutTreeUpdate());
DocumentLifecycle::DisallowTransitionScope disallow_transition(
node.GetDocument().Lifecycle());
LayoutObject* layout_object = node.GetLayoutObject();
if (!layout_object)
return nullptr;
if (layout_object->IsCanvas()) {
return toHTMLCanvasElement(const_cast<Node&>(node))
.CopiedImage(kFrontBuffer, kPreferNoAcceleration,
kSnapshotReasonCopyToClipboard);
}
if (layout_object->IsImage()) {
LayoutImage* layout_image = ToLayoutImage(layout_object);
if (!layout_image)
return nullptr;
ImageResourceContent* cached_image = layout_image->CachedImage();
if (!cached_image || cached_image->ErrorOccurred())
return nullptr;
return cached_image->GetImage();
}
return nullptr;
}
| false
|
CWE-20
|
e89cfcb9090e8c98129ae9160c513f504db74599
|
void Browser::DidEndColorChooser() {
color_chooser_.reset();
}
| false
|
CWE-399
|
a430c9166312e1aa3d80bce32374233bdbfeba32
|
static int read_emulated(struct x86_emulate_ctxt *ctxt,
unsigned long addr, void *dest, unsigned size)
{
int rc;
struct read_cache *mc = &ctxt->mem_read;
if (mc->pos < mc->end)
goto read_cached;
WARN_ON((mc->end + size) >= sizeof(mc->data));
rc = ctxt->ops->read_emulated(ctxt, addr, mc->data + mc->end, size,
&ctxt->exception);
if (rc != X86EMUL_CONTINUE)
return rc;
mc->end += size;
read_cached:
memcpy(dest, mc->data + mc->pos, size);
mc->pos += size;
return X86EMUL_CONTINUE;
}
| false
|
CWE-20
|
8262245d384be025f13e2a5b3a03b7e5c98374ce
|
void RenderView::OnScriptEvalRequest(const string16& frame_xpath,
const string16& jscript,
int id,
bool notify_result) {
EvaluateScript(frame_xpath, jscript, id, notify_result);
}
| false
|
CWE-200
|
eea3300239f0b53e172a320eb8de59d0bea65f27
|
void DevToolsDataSource::OnURLFetchComplete(const net::URLFetcher* source) {
DCHECK(source);
PendingRequestsMap::iterator it = pending_.find(source);
DCHECK(it != pending_.end());
std::string response;
source->GetResponseAsString(&response);
delete source;
it->second.Run(base::RefCountedString::TakeString(&response));
pending_.erase(it);
}
| false
|
CWE-20
|
77c1090f94d1b0b5186fb13a1b71b47b1343f87f
|
static inline int connection_based(struct sock *sk)
{
return sk->sk_type == SOCK_SEQPACKET || sk->sk_type == SOCK_STREAM;
}
| false
|
CWE-119
|
33827275411b33371e7bb750cce20f11de85002d
|
std::pair<int, int> FrameSelection::LayoutSelectionStartEnd() {
return layout_selection_->SelectionStartEnd();
}
| false
|
CWE-264
|
e9841fbdaf41b4a2baaa413f94d5c0197f9261f4
|
bool RemoveUberHost(GURL* url) {
if (url->host() != chrome::kChromeUIUberHost)
return false;
if (url->path().empty() || url->path() == "/")
return false;
const std::string old_path = url->path();
const std::string::size_type separator = old_path.find('/', 1);
std::string new_host;
std::string new_path;
if (separator == std::string::npos) {
new_host = old_path.substr(1);
} else {
new_host = old_path.substr(1, separator - 1);
new_path = old_path.substr(separator);
}
*url = ReplaceURLHostAndPath(*url, new_host, new_path);
return true;
}
| false
|
CWE-119
|
7d3e91a89b7adbc2831334def9e494dd9892f9af
|
static void nfs4_proc_unlink_setup(struct rpc_message *msg, struct inode *dir)
{
struct nfs_server *server = NFS_SERVER(dir);
struct nfs_removeargs *args = msg->rpc_argp;
struct nfs_removeres *res = msg->rpc_resp;
res->server = server;
msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_REMOVE];
nfs41_init_sequence(&args->seq_args, &res->seq_res, 1);
}
| false
|
CWE-119
|
0c319d3a144d4b8f1ea2047fd614d2149b68f889
|
nvmet_fc_tgt_a_put(struct nvmet_fc_tgt_assoc *assoc)
{
kref_put(&assoc->ref, nvmet_fc_target_assoc_free);
}
| false
|
CWE-416
|
a4150b688a754d3d10d2ca385155b1c95d77d6ae
|
error::Error GLES2DecoderPassthroughImpl::DoReleaseTexImage2DCHROMIUM(
GLenum target,
GLint imageId) {
if (target != GL_TEXTURE_2D) {
InsertError(GL_INVALID_ENUM, "Invalid target");
return error::kNoError;
}
const BoundTexture& bound_texture =
bound_textures_[static_cast<size_t>(TextureTarget::k2D)]
[active_texture_unit_];
if (bound_texture.texture == nullptr) {
InsertError(GL_INVALID_OPERATION, "No texture bound");
return error::kNoError;
}
gl::GLImage* image = group_->image_manager()->LookupImage(imageId);
if (image == nullptr) {
InsertError(GL_INVALID_OPERATION, "No image found with the given ID");
return error::kNoError;
}
if (bound_texture.texture->GetLevelImage(target, 0) == image) {
image->ReleaseTexImage(target);
bound_texture.texture->SetLevelImage(target, 0, nullptr);
}
UpdateTextureSizeFromTarget(target);
return error::kNoError;
}
| false
|
CWE-20
|
f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
|
static int pppoe_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt, struct net_device *orig_dev)
{
struct pppoe_hdr *ph;
struct pppox_sock *po;
struct pppoe_net *pn;
int len;
skb = skb_share_check(skb, GFP_ATOMIC);
if (!skb)
goto out;
if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr)))
goto drop;
ph = pppoe_hdr(skb);
len = ntohs(ph->length);
skb_pull_rcsum(skb, sizeof(*ph));
if (skb->len < len)
goto drop;
if (pskb_trim_rcsum(skb, len))
goto drop;
pn = pppoe_pernet(dev_net(dev));
/* Note that get_item does a sock_hold(), so sk_pppox(po)
* is known to be safe.
*/
po = get_item(pn, ph->sid, eth_hdr(skb)->h_source, dev->ifindex);
if (!po)
goto drop;
return sk_receive_skb(sk_pppox(po), skb, 0);
drop:
kfree_skb(skb);
out:
return NET_RX_DROP;
}
| false
|
CWE-20
|
bfd0a56b90005f8c8a004baf407ad90045c2b11e
|
int kvm_mmu_reset_context(struct kvm_vcpu *vcpu)
{
destroy_kvm_mmu(vcpu);
return init_kvm_mmu(vcpu);
}
| false
|
CWE-264
|
4943ba16bbc2db05115707b3ff7b4874e9e3c560
|
static void cryptd_hash_digest(struct crypto_async_request *req_async, int err)
{
struct cryptd_hash_ctx *ctx = crypto_tfm_ctx(req_async->tfm);
struct crypto_shash *child = ctx->child;
struct ahash_request *req = ahash_request_cast(req_async);
struct cryptd_hash_request_ctx *rctx = ahash_request_ctx(req);
struct shash_desc *desc = &rctx->desc;
if (unlikely(err == -EINPROGRESS))
goto out;
desc->tfm = child;
desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
err = shash_ahash_digest(req, desc);
req->base.complete = rctx->complete;
out:
local_bh_disable();
rctx->complete(&req->base, err);
local_bh_enable();
}
| false
|
CWE-399
|
0e9a9a1ad619e7e987815d20262d36a2f95717ca
|
int ext4_orphan_add(handle_t *handle, struct inode *inode)
{
struct super_block *sb = inode->i_sb;
struct ext4_iloc iloc;
int err = 0, rc;
if (!EXT4_SB(sb)->s_journal)
return 0;
mutex_lock(&EXT4_SB(sb)->s_orphan_lock);
if (!list_empty(&EXT4_I(inode)->i_orphan))
goto out_unlock;
/*
* Orphan handling is only valid for files with data blocks
* being truncated, or files being unlinked. Note that we either
* hold i_mutex, or the inode can not be referenced from outside,
* so i_nlink should not be bumped due to race
*/
J_ASSERT((S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
S_ISLNK(inode->i_mode)) || inode->i_nlink == 0);
BUFFER_TRACE(EXT4_SB(sb)->s_sbh, "get_write_access");
err = ext4_journal_get_write_access(handle, EXT4_SB(sb)->s_sbh);
if (err)
goto out_unlock;
err = ext4_reserve_inode_write(handle, inode, &iloc);
if (err)
goto out_unlock;
/*
* Due to previous errors inode may be already a part of on-disk
* orphan list. If so skip on-disk list modification.
*/
if (NEXT_ORPHAN(inode) && NEXT_ORPHAN(inode) <=
(le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count)))
goto mem_insert;
/* Insert this inode at the head of the on-disk orphan list... */
NEXT_ORPHAN(inode) = le32_to_cpu(EXT4_SB(sb)->s_es->s_last_orphan);
EXT4_SB(sb)->s_es->s_last_orphan = cpu_to_le32(inode->i_ino);
err = ext4_handle_dirty_super(handle, sb);
rc = ext4_mark_iloc_dirty(handle, inode, &iloc);
if (!err)
err = rc;
/* Only add to the head of the in-memory list if all the
* previous operations succeeded. If the orphan_add is going to
* fail (possibly taking the journal offline), we can't risk
* leaving the inode on the orphan list: stray orphan-list
* entries can cause panics at unmount time.
*
* This is safe: on error we're going to ignore the orphan list
* anyway on the next recovery. */
mem_insert:
if (!err)
list_add(&EXT4_I(inode)->i_orphan, &EXT4_SB(sb)->s_orphan);
jbd_debug(4, "superblock will point to %lu\n", inode->i_ino);
jbd_debug(4, "orphan inode %lu will point to %d\n",
inode->i_ino, NEXT_ORPHAN(inode));
out_unlock:
mutex_unlock(&EXT4_SB(sb)->s_orphan_lock);
ext4_std_error(inode->i_sb, err);
return err;
}
| false
|
CWE-119
|
295c883fe3105b19bcd0f9e07d54c6b589fc5bff
|
void SimpleSoftOMXComponent::onPortEnable(OMX_U32 portIndex, bool enable) {
CHECK_LT(portIndex, mPorts.size());
PortInfo *port = &mPorts.editItemAt(portIndex);
CHECK_EQ((int)port->mTransition, (int)PortInfo::NONE);
CHECK(port->mDef.bEnabled == !enable);
if (!enable) {
port->mDef.bEnabled = OMX_FALSE;
port->mTransition = PortInfo::DISABLING;
for (size_t i = 0; i < port->mBuffers.size(); ++i) {
BufferInfo *buffer = &port->mBuffers.editItemAt(i);
if (buffer->mOwnedByUs) {
buffer->mOwnedByUs = false;
if (port->mDef.eDir == OMX_DirInput) {
notifyEmptyBufferDone(buffer->mHeader);
} else {
CHECK_EQ(port->mDef.eDir, OMX_DirOutput);
notifyFillBufferDone(buffer->mHeader);
}
}
}
port->mQueue.clear();
} else {
port->mTransition = PortInfo::ENABLING;
}
checkTransitions();
}
| false
|
CWE-264
|
0a57375ad73780e61e1770a9d88b0529b0dbd33b
|
void RenderViewImpl::SyncSelectionIfRequired() {
WebFrame* frame = webview()->focusedFrame();
if (!frame)
return;
string16 text;
size_t offset;
ui::Range range;
if (pepper_helper_->IsPluginFocused()) {
pepper_helper_->GetSurroundingText(&text, &range);
offset = 0; // Pepper API does not support offset reporting.
} else {
size_t location, length;
if (!webview()->caretOrSelectionRange(&location, &length))
return;
range = ui::Range(location, location + length);
if (webview()->textInputType() != WebKit::WebTextInputTypeNone) {
if (location > kExtraCharsBeforeAndAfterSelection)
offset = location - kExtraCharsBeforeAndAfterSelection;
else
offset = 0;
length = location + length - offset + kExtraCharsBeforeAndAfterSelection;
WebRange webrange = WebRange::fromDocumentRange(frame, offset, length);
if (!webrange.isNull())
text = WebRange::fromDocumentRange(frame, offset, length).toPlainText();
} else {
offset = location;
text = frame->selectionAsText();
range.set_end(range.start() + text.length());
}
}
if (selection_text_offset_ != offset ||
selection_range_ != range ||
selection_text_ != text) {
selection_text_ = text;
selection_text_offset_ = offset;
selection_range_ = range;
Send(new ViewHostMsg_SelectionChanged(routing_id_, text, offset, range));
}
}
| false
|
CWE-416
|
1b53cf9815bb4744958d41f3795d5d5a1d365e2d
|
static int determine_cipher_type(struct fscrypt_info *ci, struct inode *inode,
const char **cipher_str_ret, int *keysize_ret)
{
if (S_ISREG(inode->i_mode)) {
if (ci->ci_data_mode == FS_ENCRYPTION_MODE_AES_256_XTS) {
*cipher_str_ret = "xts(aes)";
*keysize_ret = FS_AES_256_XTS_KEY_SIZE;
return 0;
}
pr_warn_once("fscrypto: unsupported contents encryption mode "
"%d for inode %lu\n",
ci->ci_data_mode, inode->i_ino);
return -ENOKEY;
}
if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) {
if (ci->ci_filename_mode == FS_ENCRYPTION_MODE_AES_256_CTS) {
*cipher_str_ret = "cts(cbc(aes))";
*keysize_ret = FS_AES_256_CTS_KEY_SIZE;
return 0;
}
pr_warn_once("fscrypto: unsupported filenames encryption mode "
"%d for inode %lu\n",
ci->ci_filename_mode, inode->i_ino);
return -ENOKEY;
}
pr_warn_once("fscrypto: unsupported file type %d for inode %lu\n",
(inode->i_mode & S_IFMT), inode->i_ino);
return -ENOKEY;
}
| false
|
CWE-20
|
ab5e55ff333def909d025ac45da9ffa0d88a63f2
|
void RTCPeerConnectionHandlerDummy::stop()
{
}
| false
|
CWE-119
|
f81038006b4c59a5a148dcad887371206033c28f
|
void NuPlayer::GenericSource::resetDataSource() {
mHTTPService.clear();
mHttpSource.clear();
mUri.clear();
mUriHeaders.clear();
if (mFd >= 0) {
close(mFd);
mFd = -1;
}
mOffset = 0;
mLength = 0;
setDrmPlaybackStatusIfNeeded(Playback::STOP, 0);
mDecryptHandle = NULL;
mDrmManagerClient = NULL;
mStarted = false;
mStopRead = true;
}
| false
|
CWE-20
|
9eb1fd426a04adac0906c81ed88f1089969702ba
|
bool BeginInstallWithManifestFunction::RunImpl() {
if (!IsWebStoreURL(profile_, source_url())) {
SetResult(PERMISSION_DENIED);
return false;
}
if (!user_gesture() && !ignore_user_gesture_for_tests) {
SetResult(NO_GESTURE);
error_ = kUserGestureRequiredError;
return false;
}
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &id_));
if (!Extension::IdIsValid(id_)) {
SetResult(INVALID_ID);
error_ = kInvalidIdError;
return false;
}
EXTENSION_FUNCTION_VALIDATE(args_->GetString(1, &icon_data_));
EXTENSION_FUNCTION_VALIDATE(args_->GetString(2, &manifest_));
scoped_refptr<SafeBeginInstallHelper> helper =
new SafeBeginInstallHelper(this, icon_data_, manifest_);
helper->Start();
AddRef();
return true;
}
| false
|
CWE-189
|
58936737b65052775b67b1409b87edbbbc09f72b
|
void BlobURLRequestJob::CreateFileStreamReader(size_t index,
int64 additional_offset) {
DCHECK_LT(index, blob_data_->items().size());
const BlobData::Item& item = blob_data_->items().at(index);
DCHECK(IsFileType(item.type()));
DCHECK_EQ(0U, index_to_reader_.count(index));
FileStreamReader* reader = NULL;
switch (item.type()) {
case BlobData::Item::TYPE_FILE:
reader = new LocalFileStreamReader(
file_thread_proxy_,
item.path(),
item.offset() + additional_offset,
item.expected_modification_time());
break;
case BlobData::Item::TYPE_FILE_FILESYSTEM:
reader = file_system_context_->CreateFileStreamReader(
fileapi::FileSystemURL(file_system_context_->CrackURL(item.url())),
item.offset() + additional_offset,
item.expected_modification_time());
break;
default:
NOTREACHED();
}
DCHECK(reader);
index_to_reader_[index] = reader;
}
| false
|
CWE-119
|
f6ac1dba5e36f338a490752a2cbef3339096d9fe
|
void WebGLRenderingContextBase::DrawElementsInstancedANGLE(GLenum mode,
GLsizei count,
GLenum type,
long long offset,
GLsizei primcount) {
if (!ValidateDrawElements("drawElementsInstancedANGLE", type, offset))
return;
if (!bound_vertex_array_object_->IsAllEnabledAttribBufferBound()) {
SynthesizeGLError(GL_INVALID_OPERATION, "drawElementsInstancedANGLE",
"no buffer is bound to enabled attribute");
return;
}
ScopedRGBEmulationColorMask emulation_color_mask(this, color_mask_,
drawing_buffer_.Get());
ClearIfComposited();
ContextGL()->DrawElementsInstancedANGLE(
mode, count, type, reinterpret_cast<void*>(static_cast<intptr_t>(offset)),
primcount);
MarkContextChanged(kCanvasChanged);
}
| false
|
CWE-399
|
84d73cd3fb142bf1298a8c13fd4ca50fd2432372
|
int __rtnl_af_register(struct rtnl_af_ops *ops)
{
list_add_tail(&ops->list, &rtnl_af_ops);
return 0;
}
| false
|
CWE-189
|
971548cdca2d4c0a6fedd3db0c94372c2a27eac3
|
void RenderFrameHostImpl::FrameSizeChanged(const gfx::Size& frame_size) {
frame_size_ = frame_size;
}
| false
|
CWE-264
|
0c3b93c8c2027e74af642967eee5c142c8fd185d
|
status_t MediaPlayerService::Client::setVideoSurfaceTexture(
const sp<IGraphicBufferProducer>& bufferProducer)
{
ALOGV("[%d] setVideoSurfaceTexture(%p)", mConnId, bufferProducer.get());
sp<MediaPlayerBase> p = getPlayer();
if (p == 0) return UNKNOWN_ERROR;
sp<IBinder> binder(IInterface::asBinder(bufferProducer));
if (mConnectedWindowBinder == binder) {
return OK;
}
sp<ANativeWindow> anw;
if (bufferProducer != NULL) {
anw = new Surface(bufferProducer, true /* controlledByApp */);
status_t err = native_window_api_connect(anw.get(),
NATIVE_WINDOW_API_MEDIA);
if (err != OK) {
ALOGE("setVideoSurfaceTexture failed: %d", err);
reset();
disconnectNativeWindow();
return err;
}
}
status_t err = p->setVideoSurfaceTexture(bufferProducer);
disconnectNativeWindow();
mConnectedWindow = anw;
if (err == OK) {
mConnectedWindowBinder = binder;
} else {
disconnectNativeWindow();
}
return err;
}
| false
|
CWE-119
|
f0fe970df3838c202ef6c07a4c2b36838ef0a88b
|
static ssize_t ecryptfs_read_update_atime(struct kiocb *iocb,
struct iov_iter *to)
{
ssize_t rc;
struct path *path;
struct file *file = iocb->ki_filp;
rc = generic_file_read_iter(iocb, to);
if (rc >= 0) {
path = ecryptfs_dentry_to_lower_path(file->f_path.dentry);
touch_atime(path);
}
return rc;
}
| false
|
CWE-416
|
f03ea5a5c2ff26e239dfd23e263b15da2d9cee93
|
void OnRunJavaScriptDialog(const base::string16& message,
const base::string16&,
JavaScriptDialogType,
bool*,
base::string16*) {
callback_.Run(message);
}
| false
|
CWE-20
|
f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
|
static void mISDN_sock_unlink(struct mISDN_sock_list *l, struct sock *sk)
{
write_lock_bh(&l->lock);
sk_del_node_init(sk);
write_unlock_bh(&l->lock);
}
| false
|
CWE-362
|
ea3d7209ca01da209cda6f0dea8be9cc4b7a933b
|
static struct dquot **ext4_get_dquots(struct inode *inode)
{
return EXT4_I(inode)->i_dquot;
}
| false
|
CWE-200
|
b66c5984017533316fd1951770302649baf1aa33
|
static char *scanarg(char *s, char del)
{
char c;
while ((c = *s++) != del) {
if (c == '\\' && *s == 'x') {
s++;
if (!isxdigit(*s++))
return NULL;
if (!isxdigit(*s++))
return NULL;
}
}
return s;
}
| false
|
CWE-20
|
77751427a1ff25b27d47a4c36b12c3c8667855ac
|
static int addrconf_ifid_eui48(u8 *eui, struct net_device *dev)
{
if (dev->addr_len != ETH_ALEN)
return -1;
memcpy(eui, dev->dev_addr, 3);
memcpy(eui + 5, dev->dev_addr + 3, 3);
/*
* The zSeries OSA network cards can be shared among various
* OS instances, but the OSA cards have only one MAC address.
* This leads to duplicate address conflicts in conjunction
* with IPv6 if more than one instance uses the same card.
*
* The driver for these cards can deliver a unique 16-bit
* identifier for each instance sharing the same card. It is
* placed instead of 0xFFFE in the interface identifier. The
* "u" bit of the interface identifier is not inverted in this
* case. Hence the resulting interface identifier has local
* scope according to RFC2373.
*/
if (dev->dev_id) {
eui[3] = (dev->dev_id >> 8) & 0xFF;
eui[4] = dev->dev_id & 0xFF;
} else {
eui[3] = 0xFF;
eui[4] = 0xFE;
eui[0] ^= 2;
}
return 0;
}
| false
|
CWE-200
|
c6f0d22d508a551a40fc8bd7418941b77435aac3
|
bool OmniboxViewViews::OnMouseDragged(const ui::MouseEvent& event) {
if (filter_drag_events_for_unelision_ &&
!ExceededDragThreshold(event.root_location() -
GetLastClickRootLocation())) {
return true;
}
if (HasTextBeingDragged())
CloseOmniboxPopup();
bool handled = views::Textfield::OnMouseDragged(event);
if (HasSelection() || ExceededDragThreshold(event.root_location() -
GetLastClickRootLocation())) {
select_all_on_mouse_release_ = false;
}
return handled;
}
| false
|
CWE-399
|
c50ac050811d6485616a193eb0f37bfbd191cc89
|
static int hugetlb_acct_memory(struct hstate *h, long delta)
{
int ret = -ENOMEM;
spin_lock(&hugetlb_lock);
/*
* When cpuset is configured, it breaks the strict hugetlb page
* reservation as the accounting is done on a global variable. Such
* reservation is completely rubbish in the presence of cpuset because
* the reservation is not checked against page availability for the
* current cpuset. Application can still potentially OOM'ed by kernel
* with lack of free htlb page in cpuset that the task is in.
* Attempt to enforce strict accounting with cpuset is almost
* impossible (or too ugly) because cpuset is too fluid that
* task or memory node can be dynamically moved between cpusets.
*
* The change of semantics for shared hugetlb mapping with cpuset is
* undesirable. However, in order to preserve some of the semantics,
* we fall back to check against current free page availability as
* a best attempt and hopefully to minimize the impact of changing
* semantics that cpuset has.
*/
if (delta > 0) {
if (gather_surplus_pages(h, delta) < 0)
goto out;
if (delta > cpuset_mems_nr(h->free_huge_pages_node)) {
return_unused_surplus_pages(h, delta);
goto out;
}
}
ret = 0;
if (delta < 0)
return_unused_surplus_pages(h, (unsigned long) -delta);
out:
spin_unlock(&hugetlb_lock);
return ret;
}
| false
|
CWE-362
|
21f8aaee0c62708654988ce092838aa7df4d25d8
|
static void ath_tx_set_retry(struct ath_softc *sc, struct ath_txq *txq,
struct sk_buff *skb, int count)
{
struct ath_frame_info *fi = get_frame_info(skb);
struct ath_buf *bf = fi->bf;
struct ieee80211_hdr *hdr;
int prev = fi->retries;
TX_STAT_INC(txq->axq_qnum, a_retries);
fi->retries += count;
if (prev > 0)
return;
hdr = (struct ieee80211_hdr *)skb->data;
hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_RETRY);
dma_sync_single_for_device(sc->dev, bf->bf_buf_addr,
sizeof(*hdr), DMA_TO_DEVICE);
}
| false
|
CWE-20
|
df5b1e1f88e013bc96107cc52c4a4f33a8238444
|
void BackendImpl::FlushForTesting() {
g_internal_cache_thread.Get().FlushForTesting();
}
| false
|
CWE-399
|
c4f40933f2cd7f975af63e56ea4cdcdc6c636f73
|
void TaskManagerTableModel::GetGroupRangeForItem(int item,
views::GroupRange* range) {
TaskManagerModel::GroupRange range_pair =
model_->GetGroupRangeForResource(item);
range->start = range_pair.first;
range->length = range_pair.second;
}
| false
|
CWE-119
|
94d9e646454f6246bf823b6897bd6aea5f08eda3
|
bool ACodec::IdleToExecutingState::onMessageReceived(const sp<AMessage> &msg) {
switch (msg->what()) {
case kWhatSetParameters:
case kWhatShutdown:
{
mCodec->deferMessage(msg);
return true;
}
case kWhatResume:
{
return true;
}
case kWhatFlush:
{
sp<AMessage> notify = mCodec->mNotify->dup();
notify->setInt32("what", CodecBase::kWhatFlushCompleted);
notify->post();
return true;
}
case kWhatSignalEndOfInputStream:
{
mCodec->onSignalEndOfInputStream();
return true;
}
default:
return BaseState::onMessageReceived(msg);
}
}
| false
|
CWE-416
|
45f6fad84cc305103b28d73482b344d7f5b76f39
|
static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
u8 type, u8 code, int offset, __be32 info)
{
const struct ipv6hdr *hdr = (const struct ipv6hdr *)skb->data;
const struct dccp_hdr *dh = (struct dccp_hdr *)(skb->data + offset);
struct dccp_sock *dp;
struct ipv6_pinfo *np;
struct sock *sk;
int err;
__u64 seq;
struct net *net = dev_net(skb->dev);
if (skb->len < offset + sizeof(*dh) ||
skb->len < offset + __dccp_basic_hdr_len(dh)) {
ICMP6_INC_STATS_BH(net, __in6_dev_get(skb->dev),
ICMP6_MIB_INERRORS);
return;
}
sk = __inet6_lookup_established(net, &dccp_hashinfo,
&hdr->daddr, dh->dccph_dport,
&hdr->saddr, ntohs(dh->dccph_sport),
inet6_iif(skb));
if (!sk) {
ICMP6_INC_STATS_BH(net, __in6_dev_get(skb->dev),
ICMP6_MIB_INERRORS);
return;
}
if (sk->sk_state == DCCP_TIME_WAIT) {
inet_twsk_put(inet_twsk(sk));
return;
}
seq = dccp_hdr_seq(dh);
if (sk->sk_state == DCCP_NEW_SYN_RECV)
return dccp_req_err(sk, seq);
bh_lock_sock(sk);
if (sock_owned_by_user(sk))
NET_INC_STATS_BH(net, LINUX_MIB_LOCKDROPPEDICMPS);
if (sk->sk_state == DCCP_CLOSED)
goto out;
dp = dccp_sk(sk);
if ((1 << sk->sk_state) & ~(DCCPF_REQUESTING | DCCPF_LISTEN) &&
!between48(seq, dp->dccps_awl, dp->dccps_awh)) {
NET_INC_STATS_BH(net, LINUX_MIB_OUTOFWINDOWICMPS);
goto out;
}
np = inet6_sk(sk);
if (type == NDISC_REDIRECT) {
struct dst_entry *dst = __sk_dst_check(sk, np->dst_cookie);
if (dst)
dst->ops->redirect(dst, sk, skb);
goto out;
}
if (type == ICMPV6_PKT_TOOBIG) {
struct dst_entry *dst = NULL;
if (!ip6_sk_accept_pmtu(sk))
goto out;
if (sock_owned_by_user(sk))
goto out;
if ((1 << sk->sk_state) & (DCCPF_LISTEN | DCCPF_CLOSED))
goto out;
dst = inet6_csk_update_pmtu(sk, ntohl(info));
if (!dst)
goto out;
if (inet_csk(sk)->icsk_pmtu_cookie > dst_mtu(dst))
dccp_sync_mss(sk, dst_mtu(dst));
goto out;
}
icmpv6_err_convert(type, code, &err);
/* Might be for an request_sock */
switch (sk->sk_state) {
case DCCP_REQUESTING:
case DCCP_RESPOND: /* Cannot happen.
It can, it SYNs are crossed. --ANK */
if (!sock_owned_by_user(sk)) {
DCCP_INC_STATS_BH(DCCP_MIB_ATTEMPTFAILS);
sk->sk_err = err;
/*
* Wake people up to see the error
* (see connect in sock.c)
*/
sk->sk_error_report(sk);
dccp_done(sk);
} else
sk->sk_err_soft = err;
goto out;
}
if (!sock_owned_by_user(sk) && np->recverr) {
sk->sk_err = err;
sk->sk_error_report(sk);
} else
sk->sk_err_soft = err;
out:
bh_unlock_sock(sk);
sock_put(sk);
}
| false
|
CWE-362
|
04f5866e41fb70690e28397487d8bd8eea7d712a
|
int mm_take_all_locks(struct mm_struct *mm)
{
struct vm_area_struct *vma;
struct anon_vma_chain *avc;
BUG_ON(down_read_trylock(&mm->mmap_sem));
mutex_lock(&mm_all_locks_mutex);
for (vma = mm->mmap; vma; vma = vma->vm_next) {
if (signal_pending(current))
goto out_unlock;
if (vma->vm_file && vma->vm_file->f_mapping &&
is_vm_hugetlb_page(vma))
vm_lock_mapping(mm, vma->vm_file->f_mapping);
}
for (vma = mm->mmap; vma; vma = vma->vm_next) {
if (signal_pending(current))
goto out_unlock;
if (vma->vm_file && vma->vm_file->f_mapping &&
!is_vm_hugetlb_page(vma))
vm_lock_mapping(mm, vma->vm_file->f_mapping);
}
for (vma = mm->mmap; vma; vma = vma->vm_next) {
if (signal_pending(current))
goto out_unlock;
if (vma->anon_vma)
list_for_each_entry(avc, &vma->anon_vma_chain, same_vma)
vm_lock_anon_vma(mm, avc->anon_vma);
}
return 0;
out_unlock:
mm_drop_all_locks(mm);
return -EINTR;
}
| false
|
CWE-20
|
e89cfcb9090e8c98129ae9160c513f504db74599
|
void TabStripModel::AppendTabContents(TabContents* contents,
bool foreground) {
int index = order_controller_->DetermineInsertionIndexForAppending();
InsertTabContentsAt(index, contents,
foreground ? (ADD_INHERIT_GROUP | ADD_ACTIVE) :
ADD_NONE);
}
| false
|
CWE-362
|
de9f869616dd95e95c00bdd6b0fcd3421e8a4323
|
static int resolve_seg_reg(struct insn *insn, struct pt_regs *regs, int regoff)
{
int idx;
/*
* In the unlikely event of having to resolve the segment register
* index for rIP, do it first. Segment override prefixes should not
* be used. Hence, it is not necessary to inspect the instruction,
* which may be invalid at this point.
*/
if (regoff == offsetof(struct pt_regs, ip)) {
if (user_64bit_mode(regs))
return INAT_SEG_REG_IGNORE;
else
return INAT_SEG_REG_CS;
}
if (!insn)
return -EINVAL;
if (!check_seg_overrides(insn, regoff))
return resolve_default_seg(insn, regs, regoff);
idx = get_seg_reg_override_idx(insn);
if (idx < 0)
return idx;
if (idx == INAT_SEG_REG_DEFAULT)
return resolve_default_seg(insn, regs, regoff);
/*
* In long mode, segment override prefixes are ignored, except for
* overrides for FS and GS.
*/
if (user_64bit_mode(regs)) {
if (idx != INAT_SEG_REG_FS &&
idx != INAT_SEG_REG_GS)
idx = INAT_SEG_REG_IGNORE;
}
return idx;
}
| false
|
CWE-20
|
cc274e2abe8b2a6698a5c47d8aa4bb45f1f9538d
|
long long Chapters::Atom::GetStartTime(const Chapters* pChapters) const {
return GetTime(pChapters, m_start_timecode);
}
| false
|
CWE-200
|
7558d03e6498e970b761aa44fff6b2c659202d95
|
static OMX_ERRORTYPE unsubscribe_to_events(int fd)
{
OMX_ERRORTYPE eRet = OMX_ErrorNone;
struct v4l2_event_subscription sub;
int array_sz = sizeof(event_type)/sizeof(int);
int i,rc;
if (fd < 0) {
DEBUG_PRINT_ERROR("Invalid input: %d", fd);
return OMX_ErrorBadParameter;
}
for (i = 0; i < array_sz; ++i) {
memset(&sub, 0, sizeof(sub));
sub.type = event_type[i];
rc = ioctl(fd, VIDIOC_UNSUBSCRIBE_EVENT, &sub);
if (rc) {
DEBUG_PRINT_ERROR("Failed to unsubscribe event: 0x%x", sub.type);
break;
}
}
return eRet;
}
| false
|
CWE-284
|
c0569cc04741cccf6548c2169fcc1609d958523f
|
WebstoreBindings::WebstoreBindings(ScriptContext* context)
: ObjectBackedNativeHandler(context) {
RouteFunction("Install",
base::Bind(&WebstoreBindings::Install, base::Unretained(this)));
}
| true
|
CWE-119
|
98095c718d7580b5d6715e5bfd8698234ecb4470
|
void WebGL2RenderingContextBase::DestroyContext() {
WebGLRenderingContextBase::DestroyContext();
}
| false
|
CWE-20
|
5fd35e5359c6345b8709695cd71fba307318e6aa
|
void RenderBox::absoluteRects(Vector<LayoutRect>& rects, const LayoutPoint& accumulatedOffset)
{
rects.append(LayoutRect(accumulatedOffset, size()));
}
| false
|
CWE-399
|
d974baa398f34393db76be45f7d4d04fbdbb4a0a
|
static void fix_pmode_seg(struct kvm_vcpu *vcpu, int seg,
struct kvm_segment *save)
{
if (!emulate_invalid_guest_state) {
/*
* CS and SS RPL should be equal during guest entry according
* to VMX spec, but in reality it is not always so. Since vcpu
* is in the middle of the transition from real mode to
* protected mode it is safe to assume that RPL 0 is a good
* default value.
*/
if (seg == VCPU_SREG_CS || seg == VCPU_SREG_SS)
save->selector &= ~SELECTOR_RPL_MASK;
save->dpl = save->selector & SELECTOR_RPL_MASK;
save->s = 1;
}
vmx_set_segment(vcpu, save, seg);
}
| false
|
CWE-264
|
4943ba16bbc2db05115707b3ff7b4874e9e3c560
|
struct cryptd_aead *cryptd_alloc_aead(const char *alg_name,
u32 type, u32 mask)
{
char cryptd_alg_name[CRYPTO_MAX_ALG_NAME];
struct crypto_aead *tfm;
if (snprintf(cryptd_alg_name, CRYPTO_MAX_ALG_NAME,
"cryptd(%s)", alg_name) >= CRYPTO_MAX_ALG_NAME)
return ERR_PTR(-EINVAL);
tfm = crypto_alloc_aead(cryptd_alg_name, type, mask);
if (IS_ERR(tfm))
return ERR_CAST(tfm);
if (tfm->base.__crt_alg->cra_module != THIS_MODULE) {
crypto_free_aead(tfm);
return ERR_PTR(-EINVAL);
}
return __cryptd_aead_cast(tfm);
}
| false
|
CWE-399
|
87a082c5137a63dedb3fe5b1f48f75dcd1fd780c
|
void Layer::SetBounds(const gfx::Size& size) {
DCHECK(IsPropertyChangeAllowed());
if (bounds() == size)
return;
bounds_ = size;
SetNeedsCommit();
}
| false
|
CWE-399
|
4d77eed905ce1d00361282e8822a2a3be61d25c0
|
Node::InsertionNotificationRequest HTMLFormElement::insertedInto(ContainerNode* insertionPoint)
{
HTMLElement::insertedInto(insertionPoint);
if (insertionPoint->inDocument())
this->document().didAssociateFormControl(this);
return InsertionDone;
}
| false
|
CWE-399
|
dd3b6fe574edad231c01c78e4647a74c38dc4178
|
GDataFileSystem::GetFileFromCacheParams::GetFileFromCacheParams(
const FilePath& virtual_file_path,
const FilePath& local_tmp_path,
const GURL& content_url,
const std::string& resource_id,
const std::string& md5,
const std::string& mime_type,
const GetFileCallback& get_file_callback,
const GetDownloadDataCallback& get_download_data_callback)
: virtual_file_path(virtual_file_path),
local_tmp_path(local_tmp_path),
content_url(content_url),
resource_id(resource_id),
md5(md5),
mime_type(mime_type),
get_file_callback(get_file_callback),
get_download_data_callback(get_download_data_callback) {
}
| false
|
CWE-119
|
51217e69697fba92a06e07e16f55c9a52d8e8945
|
static void logi_dj_recv_forward_report(struct dj_receiver_dev *djrcv_dev,
struct dj_report *dj_report)
{
/* We are called from atomic context (tasklet && djrcv->lock held) */
struct dj_device *dj_device;
dj_device = djrcv_dev->paired_dj_devices[dj_report->device_index];
if (dj_device == NULL) {
dbg_hid("djrcv_dev->paired_dj_devices[dj_report->device_index]"
" is NULL, index %d\n", dj_report->device_index);
kfifo_in(&djrcv_dev->notif_fifo, dj_report, sizeof(struct dj_report));
if (schedule_work(&djrcv_dev->work) == 0) {
dbg_hid("%s: did not schedule the work item, was already "
"queued\n", __func__);
}
return;
}
if ((dj_report->report_type > ARRAY_SIZE(hid_reportid_size_map) - 1) ||
(hid_reportid_size_map[dj_report->report_type] == 0)) {
dbg_hid("invalid report type:%x\n", dj_report->report_type);
return;
}
if (hid_input_report(dj_device->hdev,
HID_INPUT_REPORT, &dj_report->report_type,
hid_reportid_size_map[dj_report->report_type], 1)) {
dbg_hid("hid_input_report error\n");
}
}
| false
|
CWE-20
|
adca986a53b31b6da4cb22f8e755f6856daea89a
|
void RenderFrameHostManager::CommitPendingFramePolicy() {
if (!frame_tree_node_->CommitPendingFramePolicy())
return;
CHECK(frame_tree_node_->parent());
SiteInstance* parent_site_instance =
frame_tree_node_->parent()->current_frame_host()->GetSiteInstance();
for (const auto& pair : proxy_hosts_) {
if (pair.second->GetSiteInstance() != parent_site_instance) {
pair.second->Send(new FrameMsg_DidUpdateFramePolicy(
pair.second->GetRoutingID(),
frame_tree_node_->current_replication_state().sandbox_flags,
frame_tree_node_->current_replication_state().container_policy));
}
}
}
| false
|
CWE-264
|
5d26a105b5a73e5635eae0629b42fa0a90e07b7b
|
static struct crypto_alg *crypto_larval_add(const char *name, u32 type,
u32 mask)
{
struct crypto_alg *alg;
struct crypto_larval *larval;
larval = crypto_larval_alloc(name, type, mask);
if (IS_ERR(larval))
return ERR_CAST(larval);
atomic_set(&larval->alg.cra_refcnt, 2);
down_write(&crypto_alg_sem);
alg = __crypto_alg_lookup(name, type, mask);
if (!alg) {
alg = &larval->alg;
list_add(&alg->cra_list, &crypto_alg_list);
}
up_write(&crypto_alg_sem);
if (alg != &larval->alg) {
kfree(larval);
if (crypto_is_larval(alg))
alg = crypto_larval_wait(alg);
}
return alg;
}
| false
|
CWE-264
|
a4a5ed2835e8ea042868b7401dced3f517cafa76
|
static int __init parse_reservelow(char *p)
{
unsigned long long size;
if (!p)
return -EINVAL;
size = memparse(p, &p);
if (size < 4096)
size = 4096;
if (size > 640*1024)
size = 640*1024;
reserve_low = size;
return 0;
}
| false
|
CWE-264
|
4a1d704194a441bf83c636004a479e01360ec850
|
struct zone_reclaim_stat *mem_cgroup_get_reclaim_stat(struct mem_cgroup *memcg,
struct zone *zone)
{
int nid = zone_to_nid(zone);
int zid = zone_idx(zone);
struct mem_cgroup_per_zone *mz = mem_cgroup_zoneinfo(memcg, nid, zid);
return &mz->reclaim_stat;
}
| false
|
CWE-119
|
0b694217046d6b2bfa5814676e8615c18e6a45ff
|
bool SystemClipboard::IsHTMLAvailable() {
if (!IsValidBufferType(buffer_))
return false;
bool result = false;
clipboard_->IsFormatAvailable(mojom::ClipboardFormat::kHtml, buffer_,
&result);
return result;
}
| false
|
CWE-119
|
412b65d15a7f8a93794653968308fc100f2aa87c
|
void hns_ppe_get_strings(struct hns_ppe_cb *ppe_cb, int stringset, u8 *data)
{
char *buff = (char *)data;
int index = ppe_cb->index;
snprintf(buff, ETH_GSTRING_LEN, "ppe%d_rx_sw_pkt", index);
buff = buff + ETH_GSTRING_LEN;
snprintf(buff, ETH_GSTRING_LEN, "ppe%d_rx_pkt_ok", index);
buff = buff + ETH_GSTRING_LEN;
snprintf(buff, ETH_GSTRING_LEN, "ppe%d_rx_drop_pkt_no_bd", index);
buff = buff + ETH_GSTRING_LEN;
snprintf(buff, ETH_GSTRING_LEN, "ppe%d_rx_alloc_buf_fail", index);
buff = buff + ETH_GSTRING_LEN;
snprintf(buff, ETH_GSTRING_LEN, "ppe%d_rx_alloc_buf_wait", index);
buff = buff + ETH_GSTRING_LEN;
snprintf(buff, ETH_GSTRING_LEN, "ppe%d_rx_pkt_drop_no_buf", index);
buff = buff + ETH_GSTRING_LEN;
snprintf(buff, ETH_GSTRING_LEN, "ppe%d_rx_pkt_err_fifo_full", index);
buff = buff + ETH_GSTRING_LEN;
snprintf(buff, ETH_GSTRING_LEN, "ppe%d_tx_bd", index);
buff = buff + ETH_GSTRING_LEN;
snprintf(buff, ETH_GSTRING_LEN, "ppe%d_tx_pkt", index);
buff = buff + ETH_GSTRING_LEN;
snprintf(buff, ETH_GSTRING_LEN, "ppe%d_tx_pkt_ok", index);
buff = buff + ETH_GSTRING_LEN;
snprintf(buff, ETH_GSTRING_LEN, "ppe%d_tx_pkt_err_fifo_empty", index);
buff = buff + ETH_GSTRING_LEN;
snprintf(buff, ETH_GSTRING_LEN, "ppe%d_tx_pkt_err_csum_fail", index);
}
| false
|
CWE-362
|
de9f869616dd95e95c00bdd6b0fcd3421e8a4323
|
static bool is_string_insn(struct insn *insn)
{
insn_get_opcode(insn);
/* All string instructions have a 1-byte opcode. */
if (insn->opcode.nbytes != 1)
return false;
switch (insn->opcode.bytes[0]) {
case 0x6c ... 0x6f: /* INS, OUTS */
case 0xa4 ... 0xa7: /* MOVS, CMPS */
case 0xaa ... 0xaf: /* STOS, LODS, SCAS */
return true;
default:
return false;
}
}
| false
|
CWE-119
|
1f4b49e64adf4623eefda503bca61e253597b9bf
|
status_t Parcel::writeCharVector(const std::unique_ptr<std::vector<char16_t>>& val)
{
return writeNullableTypedVector(val, &Parcel::writeChar);
}
| false
|
CWE-20
|
282f53ffdc3b1902da86f6a0791af736837efbf8
|
std::string GetSyncErrorAction(sync_ui_util::ActionType action_type) {
switch (action_type) {
case sync_ui_util::REAUTHENTICATE:
return "reauthenticate";
case sync_ui_util::SIGNOUT_AND_SIGNIN:
return "signOutAndSignIn";
case sync_ui_util::UPGRADE_CLIENT:
return "upgradeClient";
case sync_ui_util::ENTER_PASSPHRASE:
return "enterPassphrase";
case sync_ui_util::CONFIRM_SYNC_SETTINGS:
return "confirmSyncSettings";
default:
return "noAction";
}
}
| false
|
CWE-20
|
eb178619f930fa2ba2348de332a1ff1c66a31424
|
xfs_buf_rele(
xfs_buf_t *bp)
{
struct xfs_perag *pag = bp->b_pag;
trace_xfs_buf_rele(bp, _RET_IP_);
if (!pag) {
ASSERT(list_empty(&bp->b_lru));
ASSERT(RB_EMPTY_NODE(&bp->b_rbnode));
if (atomic_dec_and_test(&bp->b_hold))
xfs_buf_free(bp);
return;
}
ASSERT(!RB_EMPTY_NODE(&bp->b_rbnode));
ASSERT(atomic_read(&bp->b_hold) > 0);
if (atomic_dec_and_lock(&bp->b_hold, &pag->pag_buf_lock)) {
if (!(bp->b_flags & XBF_STALE) &&
atomic_read(&bp->b_lru_ref)) {
xfs_buf_lru_add(bp);
spin_unlock(&pag->pag_buf_lock);
} else {
xfs_buf_lru_del(bp);
ASSERT(!(bp->b_flags & _XBF_DELWRI_Q));
rb_erase(&bp->b_rbnode, &pag->pag_buf_tree);
spin_unlock(&pag->pag_buf_lock);
xfs_perag_put(pag);
xfs_buf_free(bp);
}
}
}
| false
|
CWE-200
|
5d2be1422e02ccd697ccfcd45c85b4a26e6178e2
|
static int tipc_nl_compat_media_set(struct sk_buff *skb,
struct tipc_nl_compat_msg *msg)
{
struct nlattr *prop;
struct nlattr *media;
struct tipc_link_config *lc;
lc = (struct tipc_link_config *)TLV_DATA(msg->req);
media = nla_nest_start(skb, TIPC_NLA_MEDIA);
if (!media)
return -EMSGSIZE;
if (nla_put_string(skb, TIPC_NLA_MEDIA_NAME, lc->name))
return -EMSGSIZE;
prop = nla_nest_start(skb, TIPC_NLA_MEDIA_PROP);
if (!prop)
return -EMSGSIZE;
__tipc_add_link_prop(skb, msg, lc);
nla_nest_end(skb, prop);
nla_nest_end(skb, media);
return 0;
}
| false
|
CWE-264
|
f63a8daa5812afef4f06c962351687e1ff9ccb2b
|
static void perf_mmap_open(struct vm_area_struct *vma)
{
struct perf_event *event = vma->vm_file->private_data;
atomic_inc(&event->mmap_count);
atomic_inc(&event->rb->mmap_count);
}
| false
|
CWE-20
|
e89cfcb9090e8c98129ae9160c513f504db74599
|
InsertTabAnimation(TabStripGtk* tabstrip, int index)
: TabAnimation(tabstrip, INSERT),
index_(index) {
int tab_count = tabstrip->GetTabCount();
int end_mini_count = tabstrip->GetMiniTabCount();
int start_mini_count = end_mini_count;
if (index < end_mini_count)
start_mini_count--;
GenerateStartAndEndWidths(tab_count - 1, tab_count, start_mini_count,
end_mini_count);
}
| false
|
CWE-264
|
b04aee833c5cfb6b31b8558350feb14bb1a0f353
|
void Camera3Device::RequestThread::requestExit() {
Thread::requestExit();
mDoPauseSignal.signal();
mRequestSignal.signal();
}
| false
|
CWE-399
|
54a20552e1eae07aa240fa370a0293e006b5faed
|
static int alloc_identity_pagetable(struct kvm *kvm)
{
/* Called with kvm->slots_lock held. */
int r = 0;
BUG_ON(kvm->arch.ept_identity_pagetable_done);
r = __x86_set_memory_region(kvm, IDENTITY_PAGETABLE_PRIVATE_MEMSLOT,
kvm->arch.ept_identity_map_addr, PAGE_SIZE);
return r;
}
| false
|
CWE-399
|
54a20552e1eae07aa240fa370a0293e006b5faed
|
static __init int hardware_setup(void)
{
int r = -ENOMEM, i, msr;
rdmsrl_safe(MSR_EFER, &host_efer);
for (i = 0; i < ARRAY_SIZE(vmx_msr_index); ++i)
kvm_define_shared_msr(i, vmx_msr_index[i]);
vmx_io_bitmap_a = (unsigned long *)__get_free_page(GFP_KERNEL);
if (!vmx_io_bitmap_a)
return r;
vmx_io_bitmap_b = (unsigned long *)__get_free_page(GFP_KERNEL);
if (!vmx_io_bitmap_b)
goto out;
vmx_msr_bitmap_legacy = (unsigned long *)__get_free_page(GFP_KERNEL);
if (!vmx_msr_bitmap_legacy)
goto out1;
vmx_msr_bitmap_legacy_x2apic =
(unsigned long *)__get_free_page(GFP_KERNEL);
if (!vmx_msr_bitmap_legacy_x2apic)
goto out2;
vmx_msr_bitmap_longmode = (unsigned long *)__get_free_page(GFP_KERNEL);
if (!vmx_msr_bitmap_longmode)
goto out3;
vmx_msr_bitmap_longmode_x2apic =
(unsigned long *)__get_free_page(GFP_KERNEL);
if (!vmx_msr_bitmap_longmode_x2apic)
goto out4;
if (nested) {
vmx_msr_bitmap_nested =
(unsigned long *)__get_free_page(GFP_KERNEL);
if (!vmx_msr_bitmap_nested)
goto out5;
}
vmx_vmread_bitmap = (unsigned long *)__get_free_page(GFP_KERNEL);
if (!vmx_vmread_bitmap)
goto out6;
vmx_vmwrite_bitmap = (unsigned long *)__get_free_page(GFP_KERNEL);
if (!vmx_vmwrite_bitmap)
goto out7;
memset(vmx_vmread_bitmap, 0xff, PAGE_SIZE);
memset(vmx_vmwrite_bitmap, 0xff, PAGE_SIZE);
/*
* Allow direct access to the PC debug port (it is often used for I/O
* delays, but the vmexits simply slow things down).
*/
memset(vmx_io_bitmap_a, 0xff, PAGE_SIZE);
clear_bit(0x80, vmx_io_bitmap_a);
memset(vmx_io_bitmap_b, 0xff, PAGE_SIZE);
memset(vmx_msr_bitmap_legacy, 0xff, PAGE_SIZE);
memset(vmx_msr_bitmap_longmode, 0xff, PAGE_SIZE);
if (nested)
memset(vmx_msr_bitmap_nested, 0xff, PAGE_SIZE);
if (setup_vmcs_config(&vmcs_config) < 0) {
r = -EIO;
goto out8;
}
if (boot_cpu_has(X86_FEATURE_NX))
kvm_enable_efer_bits(EFER_NX);
if (!cpu_has_vmx_vpid())
enable_vpid = 0;
if (!cpu_has_vmx_shadow_vmcs())
enable_shadow_vmcs = 0;
if (enable_shadow_vmcs)
init_vmcs_shadow_fields();
if (!cpu_has_vmx_ept() ||
!cpu_has_vmx_ept_4levels()) {
enable_ept = 0;
enable_unrestricted_guest = 0;
enable_ept_ad_bits = 0;
}
if (!cpu_has_vmx_ept_ad_bits())
enable_ept_ad_bits = 0;
if (!cpu_has_vmx_unrestricted_guest())
enable_unrestricted_guest = 0;
if (!cpu_has_vmx_flexpriority())
flexpriority_enabled = 0;
/*
* set_apic_access_page_addr() is used to reload apic access
* page upon invalidation. No need to do anything if not
* using the APIC_ACCESS_ADDR VMCS field.
*/
if (!flexpriority_enabled)
kvm_x86_ops->set_apic_access_page_addr = NULL;
if (!cpu_has_vmx_tpr_shadow())
kvm_x86_ops->update_cr8_intercept = NULL;
if (enable_ept && !cpu_has_vmx_ept_2m_page())
kvm_disable_largepages();
if (!cpu_has_vmx_ple())
ple_gap = 0;
if (!cpu_has_vmx_apicv())
enable_apicv = 0;
if (cpu_has_vmx_tsc_scaling()) {
kvm_has_tsc_control = true;
kvm_max_tsc_scaling_ratio = KVM_VMX_TSC_MULTIPLIER_MAX;
kvm_tsc_scaling_ratio_frac_bits = 48;
}
if (enable_apicv)
kvm_x86_ops->update_cr8_intercept = NULL;
else {
kvm_x86_ops->hwapic_irr_update = NULL;
kvm_x86_ops->hwapic_isr_update = NULL;
kvm_x86_ops->deliver_posted_interrupt = NULL;
kvm_x86_ops->sync_pir_to_irr = vmx_sync_pir_to_irr_dummy;
}
vmx_disable_intercept_for_msr(MSR_FS_BASE, false);
vmx_disable_intercept_for_msr(MSR_GS_BASE, false);
vmx_disable_intercept_for_msr(MSR_KERNEL_GS_BASE, true);
vmx_disable_intercept_for_msr(MSR_IA32_SYSENTER_CS, false);
vmx_disable_intercept_for_msr(MSR_IA32_SYSENTER_ESP, false);
vmx_disable_intercept_for_msr(MSR_IA32_SYSENTER_EIP, false);
vmx_disable_intercept_for_msr(MSR_IA32_BNDCFGS, true);
memcpy(vmx_msr_bitmap_legacy_x2apic,
vmx_msr_bitmap_legacy, PAGE_SIZE);
memcpy(vmx_msr_bitmap_longmode_x2apic,
vmx_msr_bitmap_longmode, PAGE_SIZE);
set_bit(0, vmx_vpid_bitmap); /* 0 is reserved for host */
if (enable_apicv) {
for (msr = 0x800; msr <= 0x8ff; msr++)
vmx_disable_intercept_msr_read_x2apic(msr);
/* According SDM, in x2apic mode, the whole id reg is used.
* But in KVM, it only use the highest eight bits. Need to
* intercept it */
vmx_enable_intercept_msr_read_x2apic(0x802);
/* TMCCT */
vmx_enable_intercept_msr_read_x2apic(0x839);
/* TPR */
vmx_disable_intercept_msr_write_x2apic(0x808);
/* EOI */
vmx_disable_intercept_msr_write_x2apic(0x80b);
/* SELF-IPI */
vmx_disable_intercept_msr_write_x2apic(0x83f);
}
if (enable_ept) {
kvm_mmu_set_mask_ptes(0ull,
(enable_ept_ad_bits) ? VMX_EPT_ACCESS_BIT : 0ull,
(enable_ept_ad_bits) ? VMX_EPT_DIRTY_BIT : 0ull,
0ull, VMX_EPT_EXECUTABLE_MASK);
ept_set_mmio_spte_mask();
kvm_enable_tdp();
} else
kvm_disable_tdp();
update_ple_window_actual_max();
/*
* Only enable PML when hardware supports PML feature, and both EPT
* and EPT A/D bit features are enabled -- PML depends on them to work.
*/
if (!enable_ept || !enable_ept_ad_bits || !cpu_has_vmx_pml())
enable_pml = 0;
if (!enable_pml) {
kvm_x86_ops->slot_enable_log_dirty = NULL;
kvm_x86_ops->slot_disable_log_dirty = NULL;
kvm_x86_ops->flush_log_dirty = NULL;
kvm_x86_ops->enable_log_dirty_pt_masked = NULL;
}
kvm_set_posted_intr_wakeup_handler(wakeup_handler);
return alloc_kvm_area();
out8:
free_page((unsigned long)vmx_vmwrite_bitmap);
out7:
free_page((unsigned long)vmx_vmread_bitmap);
out6:
if (nested)
free_page((unsigned long)vmx_msr_bitmap_nested);
out5:
free_page((unsigned long)vmx_msr_bitmap_longmode_x2apic);
out4:
free_page((unsigned long)vmx_msr_bitmap_longmode);
out3:
free_page((unsigned long)vmx_msr_bitmap_legacy_x2apic);
out2:
free_page((unsigned long)vmx_msr_bitmap_legacy);
out1:
free_page((unsigned long)vmx_io_bitmap_b);
out:
free_page((unsigned long)vmx_io_bitmap_a);
return r;
}
| false
|
CWE-362
|
d5aa407f59f5b83d2c50ec88f5bf56d40f1f8978
|
static int __init ip6_tunnel_init(void)
{
int err;
if (xfrm6_tunnel_register(&ip4ip6_handler, AF_INET)) {
printk(KERN_ERR "ip6_tunnel init: can't register ip4ip6\n");
err = -EAGAIN;
goto out;
}
if (xfrm6_tunnel_register(&ip6ip6_handler, AF_INET6)) {
printk(KERN_ERR "ip6_tunnel init: can't register ip6ip6\n");
err = -EAGAIN;
goto unreg_ip4ip6;
}
err = register_pernet_device(&ip6_tnl_net_ops);
if (err < 0)
goto err_pernet;
return 0;
err_pernet:
xfrm6_tunnel_deregister(&ip6ip6_handler, AF_INET6);
unreg_ip4ip6:
xfrm6_tunnel_deregister(&ip4ip6_handler, AF_INET);
out:
return err;
}
| true
|
CWE-200
|
04aaacb936a08d70862d6d9d7e8354721ae46be8
|
std::string SerializeOrigin(const url::Origin& origin) {
return origin.GetURL().spec();
}
| false
|
CWE-20
|
b944f670bb7a8a919daac497a4ea0536c954c201
|
bool JSFloat64ArrayConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
return getStaticValueSlot<JSFloat64ArrayConstructor, JSDOMWrapper>(exec, &JSFloat64ArrayConstructorTable, jsCast<JSFloat64ArrayConstructor*>(cell), propertyName, slot);
}
| false
|
CWE-416
|
a4150b688a754d3d10d2ca385155b1c95d77d6ae
|
error::Error GLES2DecoderPassthroughImpl::DoPopGroupMarkerEXT() {
api()->glPopGroupMarkerEXTFn();
return error::kNoError;
}
| false
|
CWE-119
|
1c40f9042ae2d6ee7483d72998aabb5e73b2ff60
|
void ResourceLoader::Run() {
StartWith(resource_->GetResourceRequest());
}
| false
|
CWE-399
|
3a2cf7d1376ae33054b878232fb38b8fbed29e31
|
PepperMediaDeviceManager* PepperPlatformAudioInput::GetMediaDeviceManager() {
DCHECK(main_message_loop_proxy_->BelongsToCurrentThread());
RenderFrameImpl* const render_frame =
RenderFrameImpl::FromRoutingID(render_frame_id_);
return render_frame ?
PepperMediaDeviceManager::GetForRenderFrame(render_frame) : NULL;
}
| true
|
CWE-119
|
7f3d85b096f66870a15b37c2f40b219b2e292693
|
png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
#ifdef PNG_pHYs_SUPPORTED
if (info_ptr->valid & PNG_INFO_pHYs)
{
png_debug1(1, "in %s retrieval function", "png_get_y_pixels_per_meter");
if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
return (0);
else
return (info_ptr->y_pixels_per_unit);
}
#else
return (0);
#endif
return (0);
}
| false
|
CWE-416
|
073c516ff73557a8f7315066856c04b50383ac34
|
int open_related_ns(struct ns_common *ns,
struct ns_common *(*get_ns)(struct ns_common *ns))
{
struct path path = {};
struct file *f;
void *err;
int fd;
fd = get_unused_fd_flags(O_CLOEXEC);
if (fd < 0)
return fd;
while (1) {
struct ns_common *relative;
relative = get_ns(ns);
if (IS_ERR(relative)) {
put_unused_fd(fd);
return PTR_ERR(relative);
}
err = __ns_get_path(&path, relative);
if (IS_ERR(err) && PTR_ERR(err) == -EAGAIN)
continue;
break;
}
if (IS_ERR(err)) {
put_unused_fd(fd);
return PTR_ERR(err);
}
f = dentry_open(&path, O_RDONLY, current_cred());
path_put(&path);
if (IS_ERR(f)) {
put_unused_fd(fd);
fd = PTR_ERR(f);
} else
fd_install(fd, f);
return fd;
}
| false
|
CWE-362
|
321027c1fe77f892f4ea07846aeae08cefbbb290
|
static void __perf_addr_filters_adjust(struct perf_event *event, void *data)
{
struct perf_addr_filters_head *ifh = perf_event_addr_filters(event);
struct vm_area_struct *vma = data;
unsigned long off = vma->vm_pgoff << PAGE_SHIFT, flags;
struct file *file = vma->vm_file;
struct perf_addr_filter *filter;
unsigned int restart = 0, count = 0;
if (!has_addr_filter(event))
return;
if (!file)
return;
raw_spin_lock_irqsave(&ifh->lock, flags);
list_for_each_entry(filter, &ifh->list, entry) {
if (perf_addr_filter_match(filter, file, off,
vma->vm_end - vma->vm_start)) {
event->addr_filters_offs[count] = vma->vm_start;
restart++;
}
count++;
}
if (restart)
event->addr_filters_gen++;
raw_spin_unlock_irqrestore(&ifh->lock, flags);
if (restart)
perf_event_stop(event, 1);
}
| false
|
CWE-119
|
c4baad50297d84bde1a7ad45e50c73adae4a2192
|
static void remove_port_data(struct port *port)
{
struct port_buffer *buf;
spin_lock_irq(&port->inbuf_lock);
/* Remove unused data this port might have received. */
discard_port_data(port);
spin_unlock_irq(&port->inbuf_lock);
/* Remove buffers we queued up for the Host to send us data in. */
do {
spin_lock_irq(&port->inbuf_lock);
buf = virtqueue_detach_unused_buf(port->in_vq);
spin_unlock_irq(&port->inbuf_lock);
if (buf)
free_buf(buf, true);
} while (buf);
spin_lock_irq(&port->outvq_lock);
reclaim_consumed_buffers(port);
spin_unlock_irq(&port->outvq_lock);
/* Free pending buffers from the out-queue. */
do {
spin_lock_irq(&port->outvq_lock);
buf = virtqueue_detach_unused_buf(port->out_vq);
spin_unlock_irq(&port->outvq_lock);
if (buf)
free_buf(buf, true);
} while (buf);
}
| false
|
CWE-264
|
c0da7c1c6e9ffe5006e146b6426f987238d4bf2e
|
void DevToolsWindow::ScheduleAction(const DevToolsToggleAction& action) {
action_on_load_ = action;
if (is_loaded_)
DoAction();
}
| false
|
CWE-119
|
7cea5cb64b83d690fe02bc210bbdf08f5a87636f
|
int SoftGSM::DecodeGSM(gsm handle,
int16_t *out, uint8_t *in, size_t inSize) {
int ret = 0;
while (inSize > 0) {
gsm_decode(handle, in, out);
in += 33;
inSize -= 33;
out += 160;
ret += 160;
gsm_decode(handle, in, out);
in += 32;
inSize -= 32;
out += 160;
ret += 160;
}
return ret;
}
| false
|
CWE-20
|
e89cfcb9090e8c98129ae9160c513f504db74599
|
BrowserWindowGtk::~BrowserWindowGtk() {
ui::ActiveWindowWatcherX::RemoveObserver(this);
browser_->tab_strip_model()->RemoveObserver(this);
}
| false
|
CWE-200
|
7558d03e6498e970b761aa44fff6b2c659202d95
|
bool omx_venc::dev_get_vui_timing_info(OMX_U32 *enabled)
{
#ifdef _MSM8974_
return handle->venc_get_vui_timing_info(enabled);
#else
DEBUG_PRINT_ERROR("Get vui timing information is not supported");
return false;
#endif
}
| false
|
CWE-264
|
744c2a2d90c3c9a33c818e1ea4b7ccb5010663a0
|
void ExtensionDevToolsClientHost::InfoBarDestroyed() {
infobar_delegate_ = NULL;
SendDetachedEvent();
Close();
}
| false
|
CWE-20
|
e89cfcb9090e8c98129ae9160c513f504db74599
|
bool TabStripModel::IsTabDiscarded(int index) const {
return contents_data_[index]->discarded;
}
| false
|
CWE-416
|
370bd9b522d2ccd4a3113d6c93d30cdf8ca502ef
|
net::RequestPriority ConvertWebKitPriorityToNetPriority(
const WebURLRequest::Priority& priority) {
switch (priority) {
case WebURLRequest::PriorityVeryHigh:
return net::HIGHEST;
case WebURLRequest::PriorityHigh:
return net::MEDIUM;
case WebURLRequest::PriorityMedium:
return net::LOW;
case WebURLRequest::PriorityLow:
return net::LOWEST;
case WebURLRequest::PriorityVeryLow:
return net::IDLE;
case WebURLRequest::PriorityUnresolved:
default:
NOTREACHED();
return net::LOW;
}
}
| false
|
CWE-119
|
4ab25786c87eb20857bbb715c3ae34ec8fd6a214
|
static int lg_dinovo_mapping(struct hid_input *hi, struct hid_usage *usage,
unsigned long **bit, int *max)
{
if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR)
return 0;
switch (usage->hid & HID_USAGE) {
case 0x00d: lg_map_key_clear(KEY_MEDIA); break;
default:
return 0;
}
return 1;
}
| false
|
CWE-189
|
20e0fa98b751facf9a1101edaefbc19c82616a68
|
static void nfs4_proc_write_rpc_prepare(struct rpc_task *task, struct nfs_write_data *data)
{
if (nfs4_setup_sequence(NFS_SERVER(data->inode),
&data->args.seq_args,
&data->res.seq_res,
task))
return;
rpc_call_start(task);
}
| false
|
CWE-399
|
d0de4dc584ec6aa3b26fffea320a8457827768fc
|
static int inotify_update_watch(struct fsnotify_group *group, struct inode *inode, u32 arg)
{
int ret = 0;
retry:
/* try to update and existing watch with the new arg */
ret = inotify_update_existing_watch(group, inode, arg);
/* no mark present, try to add a new one */
if (ret == -ENOENT)
ret = inotify_new_watch(group, inode, arg);
/*
* inotify_new_watch could race with another thread which did an
* inotify_new_watch between the update_existing and the add watch
* here, go back and try to update an existing mark again.
*/
if (ret == -EEXIST)
goto retry;
return ret;
}
| false
|
CWE-20
|
401d30ef93030afbf7e81e53a11b68fc36194502
|
void Document::dispose()
{
ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun);
m_docType = 0;
m_focusedElement = 0;
m_hoverNode = 0;
m_activeElement = 0;
m_titleElement = 0;
m_documentElement = 0;
m_contextFeatures = ContextFeatures::defaultSwitch();
m_userActionElements.documentDidRemoveLastRef();
m_associatedFormControls.clear();
detachParser();
m_registrationContext.clear();
if (m_import) {
m_import->wasDetachedFromDocument();
m_import = 0;
}
destroyTreeScopeData();
removeDetachedChildren();
m_formController.clear();
m_markers->detach();
m_cssCanvasElements.clear();
if (m_scriptedAnimationController)
m_scriptedAnimationController->clearDocumentPointer();
m_scriptedAnimationController.clear();
if (svgExtensions())
accessSVGExtensions()->pauseAnimations();
m_lifecyle.advanceTo(DocumentLifecycle::Disposed);
lifecycleNotifier()->notifyDocumentWasDisposed();
}
| false
|
CWE-399
|
80742f2ffeb9e90cd85cbee27acb9f924ffebd16
|
void AutofillManager::GetCreditCardSuggestions(FormStructure* form,
const FormField& field,
AutofillFieldType type,
std::vector<string16>* values,
std::vector<string16>* labels,
std::vector<string16>* icons,
std::vector<int>* unique_ids) {
for (std::vector<CreditCard*>::const_iterator iter =
personal_data_->credit_cards().begin();
iter != personal_data_->credit_cards().end(); ++iter) {
CreditCard* credit_card = *iter;
string16 creditcard_field_value = credit_card->GetInfo(type);
if (!creditcard_field_value.empty() &&
StartsWith(creditcard_field_value, field.value, false)) {
if (type == CREDIT_CARD_NUMBER)
creditcard_field_value = credit_card->ObfuscatedNumber();
string16 label;
if (credit_card->number().empty()) {
label = credit_card->GetInfo(CREDIT_CARD_NAME);
} else {
label = kCreditCardPrefix;
label.append(credit_card->LastFourDigits());
}
values->push_back(creditcard_field_value);
labels->push_back(label);
icons->push_back(UTF8ToUTF16(credit_card->type()));
unique_ids->push_back(PackGUIDs(GUIDPair(credit_card->guid(), 0),
GUIDPair(std::string(), 0)));
}
}
}
| false
|
CWE-20
|
8e438e153f661e9df8db0ac41d587e940352df06
|
android::SoftOMXComponent *createSoftOMXComponent(
const char *name, const OMX_CALLBACKTYPE *callbacks,
OMX_PTR appData, OMX_COMPONENTTYPE **component) {
return new android::SoftAAC2(name, callbacks, appData, component);
}
| false
|
CWE-200
|
5fe74f831fddb92afa5ddfe46490bb49f083132b
|
void WebLocalFrameImpl::StartNavigation(const WebURLRequest& request) {
DCHECK(GetFrame());
DCHECK(!request.IsNull());
DCHECK(!request.Url().ProtocolIs("javascript"));
if (GetTextFinder())
GetTextFinder()->ClearActiveFindMatch();
GetFrame()->Loader().StartNavigation(
FrameLoadRequest(
nullptr, request.ToResourceRequest(), /*frame_name=*/AtomicString(),
kCheckContentSecurityPolicy, base::UnguessableToken::Create()),
WebFrameLoadType::kStandard);
}
| false
|
CWE-119
|
f81038006b4c59a5a148dcad887371206033c28f
|
status_t NuPlayer::GenericSource::doSelectTrack(size_t trackIndex, bool select, int64_t timeUs) {
if (trackIndex >= mSources.size()) {
return BAD_INDEX;
}
if (!select) {
Track* track = NULL;
if (mSubtitleTrack.mSource != NULL && trackIndex == mSubtitleTrack.mIndex) {
track = &mSubtitleTrack;
mFetchSubtitleDataGeneration++;
} else if (mTimedTextTrack.mSource != NULL && trackIndex == mTimedTextTrack.mIndex) {
track = &mTimedTextTrack;
mFetchTimedTextDataGeneration++;
}
if (track == NULL) {
return INVALID_OPERATION;
}
track->mSource->stop();
track->mSource = NULL;
track->mPackets->clear();
return OK;
}
const sp<MediaSource> source = mSources.itemAt(trackIndex);
sp<MetaData> meta = source->getFormat();
const char *mime;
CHECK(meta->findCString(kKeyMIMEType, &mime));
if (!strncasecmp(mime, "text/", 5)) {
bool isSubtitle = strcasecmp(mime, MEDIA_MIMETYPE_TEXT_3GPP);
Track *track = isSubtitle ? &mSubtitleTrack : &mTimedTextTrack;
if (track->mSource != NULL && track->mIndex == trackIndex) {
return OK;
}
track->mIndex = trackIndex;
if (track->mSource != NULL) {
track->mSource->stop();
}
track->mSource = mSources.itemAt(trackIndex);
track->mSource->start();
if (track->mPackets == NULL) {
track->mPackets = new AnotherPacketSource(track->mSource->getFormat());
} else {
track->mPackets->clear();
track->mPackets->setFormat(track->mSource->getFormat());
}
if (isSubtitle) {
mFetchSubtitleDataGeneration++;
} else {
mFetchTimedTextDataGeneration++;
}
status_t eosResult; // ignored
if (mSubtitleTrack.mSource != NULL
&& !mSubtitleTrack.mPackets->hasBufferAvailable(&eosResult)) {
sp<AMessage> msg = new AMessage(kWhatFetchSubtitleData, this);
msg->setInt64("timeUs", timeUs);
msg->setInt32("generation", mFetchSubtitleDataGeneration);
msg->post();
}
if (mTimedTextTrack.mSource != NULL
&& !mTimedTextTrack.mPackets->hasBufferAvailable(&eosResult)) {
sp<AMessage> msg = new AMessage(kWhatFetchTimedTextData, this);
msg->setInt64("timeUs", timeUs);
msg->setInt32("generation", mFetchTimedTextDataGeneration);
msg->post();
}
return OK;
} else if (!strncasecmp(mime, "audio/", 6) || !strncasecmp(mime, "video/", 6)) {
bool audio = !strncasecmp(mime, "audio/", 6);
Track *track = audio ? &mAudioTrack : &mVideoTrack;
if (track->mSource != NULL && track->mIndex == trackIndex) {
return OK;
}
sp<AMessage> msg = new AMessage(kWhatChangeAVSource, this);
msg->setInt32("trackIndex", trackIndex);
msg->post();
return OK;
}
return INVALID_OPERATION;
}
| false
|
CWE-119
|
6fb392b1a63ae36c31f62bc3fc8630b49d602b62
|
static int qeth_issue_next_read(struct qeth_card *card)
{
int rc;
struct qeth_cmd_buffer *iob;
QETH_CARD_TEXT(card, 5, "issnxrd");
if (card->read.state != CH_STATE_UP)
return -EIO;
iob = qeth_get_buffer(&card->read);
if (!iob) {
dev_warn(&card->gdev->dev, "The qeth device driver "
"failed to recover an error on the device\n");
QETH_DBF_MESSAGE(2, "%s issue_next_read failed: no iob "
"available\n", dev_name(&card->gdev->dev));
return -ENOMEM;
}
qeth_setup_ccw(&card->read, iob->data, QETH_BUFSIZE);
QETH_CARD_TEXT(card, 6, "noirqpnd");
rc = ccw_device_start(card->read.ccwdev, &card->read.ccw,
(addr_t) iob, 0, 0);
if (rc) {
QETH_DBF_MESSAGE(2, "%s error in starting next read ccw! "
"rc=%i\n", dev_name(&card->gdev->dev), rc);
atomic_set(&card->read.irq_pending, 0);
card->read_or_write_problem = 1;
qeth_schedule_recovery(card);
wake_up(&card->wait_q);
}
return rc;
}
| false
|
CWE-416
|
a4150b688a754d3d10d2ca385155b1c95d77d6ae
|
error::Error GLES2DecoderPassthroughImpl::DoGenQueriesEXT(
GLsizei n,
volatile GLuint* queries) {
return GenHelper(n, queries, &query_id_map_,
[this](GLsizei n, GLuint* queries) {
api()->glGenQueriesFn(n, queries);
});
}
| false
|
CWE-119
|
905ad269c55fc62bee3da29f7b1d1efeba8aa1e1
|
static int proc_set_super(struct super_block *sb, void *data)
{
int err = set_anon_super(sb, NULL);
if (!err) {
struct pid_namespace *ns = (struct pid_namespace *)data;
sb->s_fs_info = get_pid_ns(ns);
}
return err;
}
| false
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.