cwe
stringclasses
9 values
id
stringlengths
40
40
source
stringlengths
14
66.9k
label
bool
2 classes
CWE-20
df5b1e1f88e013bc96107cc52c4a4f33a8238444
int BackendImpl::Init(const CompletionCallback& callback) { background_queue_.Init(callback); return net::ERR_IO_PENDING; }
false
CWE-119
2bceda4948deeaed0a5a99305d0d488eb952f64f
BluetoothRemoteGATTServer::BluetoothRemoteGATTServer(BluetoothDevice* device) : m_device(device), m_connected(false) {}
false
CWE-189
bf118a342f10dafe44b14451a1392c3254629a1f
static void nfs4_proc_read_setup(struct nfs_read_data *data, struct rpc_message *msg) { data->timestamp = jiffies; data->read_done_cb = nfs4_read_done_cb; msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_READ]; }
false
CWE-20
3c8e4852477d5b1e2da877808c998dc57db9460f
Response EmulationHandler::SetGeolocationOverride( Maybe<double> latitude, Maybe<double> longitude, Maybe<double> accuracy) { if (!GetWebContents()) return Response::InternalError(); auto* geolocation_context = GetWebContents()->GetGeolocationContext(); auto geoposition = device::mojom::Geoposition::New(); if (latitude.isJust() && longitude.isJust() && accuracy.isJust()) { geoposition->latitude = latitude.fromJust(); geoposition->longitude = longitude.fromJust(); geoposition->accuracy = accuracy.fromJust(); geoposition->timestamp = base::Time::Now(); if (!device::ValidateGeoposition(*geoposition)) return Response::Error("Invalid geolocation"); } else { geoposition->error_code = device::mojom::Geoposition::ErrorCode::POSITION_UNAVAILABLE; } geolocation_context->SetOverride(std::move(geoposition)); return Response::OK(); }
false
CWE-20
45d901b56f578a74b19ba0d10fa5c4c467f19303
void TabStrip::SetTabData(int model_index, TabRendererData data) { Tab* tab = tab_at(model_index); const bool pinned_state_changed = tab->data().pinned != data.pinned; tab->SetData(std::move(data)); if (HoverCardIsShowingForTab(tab)) UpdateHoverCard(tab, true); if (pinned_state_changed) { if (touch_layout_) { int pinned_tab_count = 0; int start_x = UpdateIdealBoundsForPinnedTabs(&pinned_tab_count); touch_layout_->SetXAndPinnedCount(start_x, pinned_tab_count); } if (GetWidget() && GetWidget()->IsVisible()) StartPinnedTabAnimation(); else DoLayout(); } SwapLayoutIfNecessary(); }
false
CWE-20
0720b02e4f303ea6b114d4ae9453e3a7ff55f8dc
WebContentsImpl::WebContentsTreeNode::WebContentsTreeNode( WebContentsImpl* current_web_contents) : current_web_contents_(current_web_contents), outer_web_contents_(nullptr), outer_contents_frame_tree_node_id_( FrameTreeNode::kFrameTreeNodeInvalidId), focused_web_contents_(current_web_contents) {}
false
CWE-362
c4a4dfb26615b5ef5e9dcc730ef43f70ce9202e2
RenderThreadImpl::GetMediaThreadMessageLoopProxy() { DCHECK(message_loop() == base::MessageLoop::current()); if (!media_thread_) { media_thread_.reset(new base::Thread("Media")); media_thread_->Start(); #if defined(OS_ANDROID) renderer_demuxer_ = new RendererDemuxerAndroid(); AddFilter(renderer_demuxer_.get()); #endif } return media_thread_->message_loop_proxy(); }
false
CWE-416
a4150b688a754d3d10d2ca385155b1c95d77d6ae
gpu::ContextResult GLES2DecoderPassthroughImpl::Initialize( const scoped_refptr<gl::GLSurface>& surface, const scoped_refptr<gl::GLContext>& context, bool offscreen, const DisallowedFeatures& disallowed_features, const ContextCreationAttribs& attrib_helper) { TRACE_EVENT0("gpu", "GLES2DecoderPassthroughImpl::Initialize"); DCHECK(context->IsCurrent(surface.get())); api_ = gl::g_current_gl_context; context_ = context; surface_ = surface; offscreen_ = offscreen; bool log_non_errors = group_->gpu_preferences().enable_gpu_driver_debug_logging; InitializeGLDebugLogging(log_non_errors, PassthroughGLDebugMessageCallback, this); gpu_tracer_.reset(new GPUTracer(this)); gpu_fence_manager_.reset(new GpuFenceManager()); multi_draw_manager_.reset( new MultiDrawManager(MultiDrawManager::IndexStorageType::Pointer)); auto result = group_->Initialize(this, attrib_helper.context_type, disallowed_features); if (result != gpu::ContextResult::kSuccess) { group_ = nullptr; Destroy(true); return result; } if (IsWebGLContextType(attrib_helper.context_type)) { gfx::ExtensionSet requestable_extensions( gl::GetRequestableGLExtensionsFromCurrentContext()); static constexpr const char* kRequiredFunctionalityExtensions[] = { "GL_ANGLE_memory_size", "GL_CHROMIUM_bind_uniform_location", "GL_CHROMIUM_sync_query", "GL_EXT_debug_marker", "GL_KHR_debug", "GL_NV_fence", }; RequestExtensions(api(), requestable_extensions, kRequiredFunctionalityExtensions, base::size(kRequiredFunctionalityExtensions)); if (request_optional_extensions_) { static constexpr const char* kOptionalFunctionalityExtensions[] = { "GL_ANGLE_depth_texture", "GL_ANGLE_framebuffer_blit", "GL_ANGLE_framebuffer_multisample", "GL_ANGLE_instanced_arrays", "GL_ANGLE_pack_reverse_row_order", "GL_ANGLE_texture_compression_dxt1", "GL_ANGLE_texture_compression_dxt3", "GL_ANGLE_texture_compression_dxt5", "GL_ANGLE_texture_usage", "GL_ANGLE_translated_shader_source", "GL_CHROMIUM_framebuffer_mixed_samples", "GL_CHROMIUM_path_rendering", "GL_EXT_blend_minmax", "GL_EXT_discard_framebuffer", "GL_EXT_disjoint_timer_query", "GL_EXT_occlusion_query_boolean", "GL_EXT_sRGB", "GL_EXT_sRGB_write_control", "GL_EXT_texture_compression_dxt1", "GL_EXT_texture_compression_s3tc_srgb", "GL_EXT_texture_format_BGRA8888", "GL_EXT_texture_norm16", "GL_EXT_texture_rg", "GL_EXT_texture_sRGB_decode", "GL_EXT_texture_storage", "GL_EXT_unpack_subimage", "GL_KHR_parallel_shader_compile", "GL_KHR_robust_buffer_access_behavior", "GL_KHR_texture_compression_astc_hdr", "GL_KHR_texture_compression_astc_ldr", "GL_NV_pack_subimage", "GL_OES_compressed_ETC1_RGB8_texture", "GL_OES_depth32", "GL_OES_EGL_image", "GL_OES_EGL_image_external", "GL_OES_EGL_image_external_essl3", "GL_OES_packed_depth_stencil", "GL_OES_rgb8_rgba8", "GL_OES_vertex_array_object", "NV_EGL_stream_consumer_external", }; RequestExtensions(api(), requestable_extensions, kOptionalFunctionalityExtensions, base::size(kOptionalFunctionalityExtensions)); } context->ReinitializeDynamicBindings(); } feature_info_->Initialize(attrib_helper.context_type, true /* is_passthrough_cmd_decoder */, DisallowedFeatures()); #define FAIL_INIT_IF_NOT(feature, message) \ if (!(feature)) { \ Destroy(true); \ LOG(ERROR) << "ContextResult::kFatalFailure: " << (message); \ return gpu::ContextResult::kFatalFailure; \ } FAIL_INIT_IF_NOT(feature_info_->feature_flags().angle_robust_client_memory, "missing GL_ANGLE_robust_client_memory"); FAIL_INIT_IF_NOT( feature_info_->feature_flags().chromium_bind_generates_resource, "missing GL_CHROMIUM_bind_generates_resource"); FAIL_INIT_IF_NOT(feature_info_->feature_flags().chromium_copy_texture, "missing GL_CHROMIUM_copy_texture"); FAIL_INIT_IF_NOT(feature_info_->feature_flags().angle_client_arrays, "missing GL_ANGLE_client_arrays"); FAIL_INIT_IF_NOT(api()->glIsEnabledFn(GL_CLIENT_ARRAYS_ANGLE) == GL_FALSE, "GL_ANGLE_client_arrays shouldn't be enabled"); FAIL_INIT_IF_NOT(feature_info_->feature_flags().angle_webgl_compatibility == IsWebGLContextType(attrib_helper.context_type), "missing GL_ANGLE_webgl_compatibility"); FAIL_INIT_IF_NOT(feature_info_->feature_flags().angle_request_extension, "missing GL_ANGLE_request_extension"); FAIL_INIT_IF_NOT(feature_info_->feature_flags().khr_debug, "missing GL_KHR_debug"); FAIL_INIT_IF_NOT( !IsWebGL2ComputeContextType(attrib_helper.context_type) || feature_info_->feature_flags().khr_robust_buffer_access_behavior, "missing GL_KHR_robust_buffer_access_behavior"); FAIL_INIT_IF_NOT(!attrib_helper.enable_oop_rasterization, "oop rasterization not supported"); #undef FAIL_INIT_IF_NOT bind_generates_resource_ = group_->bind_generates_resource(); resources_ = group_->passthrough_resources(); mailbox_manager_ = group_->mailbox_manager(); GLint num_texture_units = 0; api()->glGetIntegervFn(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &num_texture_units); if (num_texture_units > static_cast<GLint>(kMaxTextureUnits)) { Destroy(true); LOG(ERROR) << "kMaxTextureUnits (" << kMaxTextureUnits << ") must be at least GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS (" << num_texture_units << ")."; return gpu::ContextResult::kFatalFailure; } active_texture_unit_ = 0; bound_buffers_[GL_ARRAY_BUFFER] = 0; bound_buffers_[GL_ELEMENT_ARRAY_BUFFER] = 0; if (feature_info_->gl_version_info().IsAtLeastGLES(3, 0) || feature_info_->feature_flags().ext_pixel_buffer_object) { bound_buffers_[GL_PIXEL_PACK_BUFFER] = 0; bound_buffers_[GL_PIXEL_UNPACK_BUFFER] = 0; } if (feature_info_->gl_version_info().IsAtLeastGLES(3, 0)) { bound_buffers_[GL_COPY_READ_BUFFER] = 0; bound_buffers_[GL_COPY_WRITE_BUFFER] = 0; bound_buffers_[GL_TRANSFORM_FEEDBACK_BUFFER] = 0; bound_buffers_[GL_UNIFORM_BUFFER] = 0; } if (feature_info_->gl_version_info().IsAtLeastGLES(3, 1)) { bound_buffers_[GL_ATOMIC_COUNTER_BUFFER] = 0; bound_buffers_[GL_SHADER_STORAGE_BUFFER] = 0; bound_buffers_[GL_DRAW_INDIRECT_BUFFER] = 0; bound_buffers_[GL_DISPATCH_INDIRECT_BUFFER] = 0; } if (feature_info_->feature_flags().chromium_texture_filtering_hint && feature_info_->feature_flags().is_swiftshader) { api()->glHintFn(GL_TEXTURE_FILTERING_HINT_CHROMIUM, GL_NICEST); } has_robustness_extension_ = feature_info_->feature_flags().khr_robustness || feature_info_->feature_flags().ext_robustness; lose_context_when_out_of_memory_ = attrib_helper.lose_context_when_out_of_memory; api()->glGetIntegervFn(GL_MAX_TEXTURE_SIZE, &max_2d_texture_size_); api()->glGetIntegervFn(GL_MAX_RENDERBUFFER_SIZE, &max_renderbuffer_size_); max_offscreen_framebuffer_size_ = std::min(max_2d_texture_size_, max_renderbuffer_size_); if (offscreen_) { offscreen_single_buffer_ = attrib_helper.single_buffer; offscreen_target_buffer_preserved_ = attrib_helper.buffer_preserved; const bool multisampled_framebuffers_supported = feature_info_->feature_flags().chromium_framebuffer_multisample; if (attrib_helper.samples > 0 && attrib_helper.sample_buffers > 0 && multisampled_framebuffers_supported && !offscreen_single_buffer_) { GLint max_sample_count = 0; api()->glGetIntegervFn(GL_MAX_SAMPLES_EXT, &max_sample_count); emulated_default_framebuffer_format_.samples = std::min(attrib_helper.samples, max_sample_count); } const bool rgb8_supported = feature_info_->feature_flags().oes_rgb8_rgba8; const bool alpha_channel_requested = attrib_helper.alpha_size > 0; if (rgb8_supported && emulated_default_framebuffer_format_.samples > 0) { emulated_default_framebuffer_format_.color_renderbuffer_internal_format = alpha_channel_requested ? GL_RGBA8 : GL_RGB8; } else { emulated_default_framebuffer_format_.samples = 0; } emulated_default_framebuffer_format_.color_texture_internal_format = alpha_channel_requested ? GL_RGBA : GL_RGB; emulated_default_framebuffer_format_.color_texture_format = emulated_default_framebuffer_format_.color_texture_internal_format; emulated_default_framebuffer_format_.color_texture_type = GL_UNSIGNED_BYTE; const bool depth24_stencil8_supported = feature_info_->feature_flags().packed_depth24_stencil8; if ((attrib_helper.depth_size > 0 || attrib_helper.stencil_size > 0) && depth24_stencil8_supported) { emulated_default_framebuffer_format_.depth_stencil_internal_format = GL_DEPTH24_STENCIL8; } else { if (attrib_helper.depth_size > 0) { emulated_default_framebuffer_format_.depth_internal_format = GL_DEPTH_COMPONENT16; } if (attrib_helper.stencil_size > 0) { emulated_default_framebuffer_format_.stencil_internal_format = GL_STENCIL_INDEX8; } } CheckErrorCallbackState(); emulated_back_buffer_ = std::make_unique<EmulatedDefaultFramebuffer>( api(), emulated_default_framebuffer_format_, feature_info_.get(), supports_separate_fbo_bindings_); gfx::Size initial_size( std::max(1, attrib_helper.offscreen_framebuffer_size.width()), std::max(1, attrib_helper.offscreen_framebuffer_size.height())); if (!emulated_back_buffer_->Resize(initial_size, feature_info_.get())) { bool was_lost = CheckResetStatus(); Destroy(true); LOG(ERROR) << (was_lost ? "ContextResult::kTransientFailure: " : "ContextResult::kFatalFailure: ") << "Resize of emulated back buffer failed"; return was_lost ? gpu::ContextResult::kTransientFailure : gpu::ContextResult::kFatalFailure; } if (CheckErrorCallbackState()) { Destroy(true); LOG(ERROR) << "ContextResult::kFatalFailure: " "Creation of the offscreen framebuffer failed because errors were " "generated."; return gpu::ContextResult::kFatalFailure; } framebuffer_id_map_.SetIDMapping( 0, emulated_back_buffer_->framebuffer_service_id); api()->glBindFramebufferEXTFn( GL_FRAMEBUFFER, emulated_back_buffer_->framebuffer_service_id); api()->glViewportFn(0, 0, attrib_helper.offscreen_framebuffer_size.width(), attrib_helper.offscreen_framebuffer_size.height()); } api()->glGetIntegervFn(GL_VIEWPORT, viewport_); api()->glGetIntegervFn(GL_SCISSOR_BOX, scissor_); ApplySurfaceDrawOffset(); set_initialized(); return gpu::ContextResult::kSuccess; }
false
CWE-399
f85a87ec670ad0fce9d98d90c9a705b72a288154
static void readonlyTestInterfaceEmptyAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) { TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); TestObjectPythonV8Internal::readonlyTestInterfaceEmptyAttributeAttributeGetter(info); TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); }
false
CWE-189
f8bd2258e2d520dff28c855658bd24bdafb5102d
static inline struct kmem_cache_order_objects oo_make(int order, unsigned long size) { struct kmem_cache_order_objects x = { (order << 16) + (PAGE_SIZE << order) / size }; return x; }
false
CWE-362
43761473c254b45883a64441dd0bc85a42f3645c
void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr) { struct audit_context *context = current->audit_context; if (attr) memcpy(&context->mq_open.attr, attr, sizeof(struct mq_attr)); else memset(&context->mq_open.attr, 0, sizeof(struct mq_attr)); context->mq_open.oflag = oflag; context->mq_open.mode = mode; context->type = AUDIT_MQ_OPEN; }
false
CWE-20
cc9b17ad29ecaa20bfe426a8d4dbfb94b13ff1cc
void *sock_kmalloc(struct sock *sk, int size, gfp_t priority) { if ((unsigned int)size <= sysctl_optmem_max && atomic_read(&sk->sk_omem_alloc) + size < sysctl_optmem_max) { void *mem; /* First do the add, to avoid the race if kmalloc * might sleep. */ atomic_add(size, &sk->sk_omem_alloc); mem = kmalloc(size, priority); if (mem) return mem; atomic_sub(size, &sk->sk_omem_alloc); } return NULL; }
false
CWE-119
35eb28748d45b87695a69eceffaff73a0be476af
bool is_loading() { return loader_ && stub_->is_loading(); }
false
CWE-119
f5364c150aa645b3d7daa21b5c0b9feaa1c9cd6d
static u64 cpu_cfs_period_read_u64(struct cgroup_subsys_state *css, struct cftype *cft) { return tg_get_cfs_period(css_tg(css)); }
false
CWE-399
f85a87ec670ad0fce9d98d90c9a705b72a288154
static void floatAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); v8SetReturnValue(info, imp->floatAttribute()); }
false
CWE-264
1eefa26e1795192c5a347a1e1e7a99e88c47f9c4
bool ChildProcessSecurityPolicyImpl::IsPseudoScheme( const std::string& scheme) { base::AutoLock lock(lock_); return ContainsKey(pseudo_schemes_, scheme); }
false
CWE-119
98095c718d7580b5d6715e5bfd8698234ecb4470
void WebGL2RenderingContextBase::texImage3D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, MaybeShared<DOMArrayBufferView> pixels, GLuint src_offset) { if (isContextLost()) return; if (bound_pixel_unpack_buffer_) { SynthesizeGLError(GL_INVALID_OPERATION, "texImage3D", "a buffer is bound to PIXEL_UNPACK_BUFFER"); return; } if (unpack_flip_y_ || unpack_premultiply_alpha_) { DCHECK(pixels); SynthesizeGLError( GL_INVALID_OPERATION, "texImage3D", "FLIP_Y or PREMULTIPLY_ALPHA isn't allowed for uploading 3D textures"); return; } TexImageHelperDOMArrayBufferView( kTexImage3D, target, level, internalformat, width, height, depth, border, format, type, 0, 0, 0, pixels.View(), kNullNotReachable, src_offset); }
false
CWE-362
04f5866e41fb70690e28397487d8bd8eea7d712a
static int ib_uverbs_comp_event_fasync(int fd, struct file *filp, int on) { struct ib_uverbs_completion_event_file *comp_ev_file = filp->private_data; return fasync_helper(fd, filp, on, &comp_ev_file->ev_queue.async_queue); }
false
CWE-399
fb5dce12f0462056fc9f66967b0f7b2b7bcd88f5
HIDDetectionView* OobeUI::GetHIDDetectionView() { return hid_detection_view_; }
false
CWE-399
4ab22cfc619ee8ff17a8c50e289ec3b30731ceba
KeyMap::~KeyMap() {}
false
CWE-119
e9c887a80115ddc5c011380f132fe4b36359caf0
ScriptPromise ImageBitmapFactories::createImageBitmap(EventTarget& eventTarget, Blob* blob, int sx, int sy, int sw, int sh, ExceptionState& exceptionState) { if (!blob) { exceptionState.throwTypeError("The blob provided is invalid."); return ScriptPromise(); } if (!sw || !sh) { exceptionState.throwDOMException(IndexSizeError, String::format("The source %s provided is 0.", sw ? "height" : "width")); return ScriptPromise(); } RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(eventTarget.executionContext()); ScriptPromise promise = resolver->promise(); RefPtr<ImageBitmapLoader> loader = ImageBitmapFactories::ImageBitmapLoader::create(from(eventTarget), resolver, IntRect(sx, sy, sw, sh)); from(eventTarget).addLoader(loader); loader->loadBlobAsync(eventTarget.executionContext(), blob); return promise; }
false
CWE-264
73edae623529f04c668268de49d00324b96166a2
PassRefPtr<DocumentFragment> createFragmentFromSource(const String& markup, Element* contextElement, ExceptionCode& ec) { Document* document = contextElement->document(); RefPtr<DocumentFragment> fragment = DocumentFragment::create(document); if (document->isHTMLDocument()) { fragment->parseHTML(markup, contextElement); return fragment; } bool wasValid = fragment->parseXML(markup, contextElement); if (!wasValid) { ec = INVALID_STATE_ERR; return 0; } return fragment.release(); }
true
CWE-416
60a2362f769cf549dc466134efe71c8bf9fbaaba
static ssize_t regulator_status_show(struct device *dev, struct device_attribute *attr, char *buf) { struct regulator_dev *rdev = dev_get_drvdata(dev); int status; char *label; status = rdev->desc->ops->get_status(rdev); if (status < 0) return status; switch (status) { case REGULATOR_STATUS_OFF: label = "off"; break; case REGULATOR_STATUS_ON: label = "on"; break; case REGULATOR_STATUS_ERROR: label = "error"; break; case REGULATOR_STATUS_FAST: label = "fast"; break; case REGULATOR_STATUS_NORMAL: label = "normal"; break; case REGULATOR_STATUS_IDLE: label = "idle"; break; case REGULATOR_STATUS_STANDBY: label = "standby"; break; case REGULATOR_STATUS_BYPASS: label = "bypass"; break; case REGULATOR_STATUS_UNDEFINED: label = "undefined"; break; default: return -ERANGE; } return sprintf(buf, "%s\n", label); }
false
CWE-20
8262245d384be025f13e2a5b3a03b7e5c98374ce
void BrowserRenderProcessHost::ClearTransportDIBCache() { STLDeleteContainerPairSecondPointers( cached_dibs_.begin(), cached_dibs_.end()); cached_dibs_.clear(); }
false
CWE-399
f85a87ec670ad0fce9d98d90c9a705b72a288154
static void perContextEnabledVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); TestObjectPythonV8Internal::perContextEnabledVoidMethodMethod(info); TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); }
false
CWE-20
d2b9d2a5ad5ef04ff978c9923d19730cb05efd55
static long restore_user_regs(struct pt_regs *regs, struct mcontext __user *sr, int sig) { long err; unsigned int save_r2 = 0; unsigned long msr; #ifdef CONFIG_VSX int i; #endif /* * restore general registers but not including MSR or SOFTE. Also * take care of keeping r2 (TLS) intact if not a signal */ if (!sig) save_r2 = (unsigned int)regs->gpr[2]; err = restore_general_regs(regs, sr); regs->trap = 0; err |= __get_user(msr, &sr->mc_gregs[PT_MSR]); if (!sig) regs->gpr[2] = (unsigned long) save_r2; if (err) return 1; /* if doing signal return, restore the previous little-endian mode */ if (sig) regs->msr = (regs->msr & ~MSR_LE) | (msr & MSR_LE); /* * Do this before updating the thread state in * current->thread.fpr/vr/evr. That way, if we get preempted * and another task grabs the FPU/Altivec/SPE, it won't be * tempted to save the current CPU state into the thread_struct * and corrupt what we are writing there. */ discard_lazy_cpu_state(); #ifdef CONFIG_ALTIVEC /* * Force the process to reload the altivec registers from * current->thread when it next does altivec instructions */ regs->msr &= ~MSR_VEC; if (msr & MSR_VEC) { /* restore altivec registers from the stack */ if (__copy_from_user(&current->thread.vr_state, &sr->mc_vregs, sizeof(sr->mc_vregs))) return 1; } else if (current->thread.used_vr) memset(&current->thread.vr_state, 0, ELF_NVRREG * sizeof(vector128)); /* Always get VRSAVE back */ if (__get_user(current->thread.vrsave, (u32 __user *)&sr->mc_vregs[32])) return 1; if (cpu_has_feature(CPU_FTR_ALTIVEC)) mtspr(SPRN_VRSAVE, current->thread.vrsave); #endif /* CONFIG_ALTIVEC */ if (copy_fpr_from_user(current, &sr->mc_fregs)) return 1; #ifdef CONFIG_VSX /* * Force the process to reload the VSX registers from * current->thread when it next does VSX instruction. */ regs->msr &= ~MSR_VSX; if (msr & MSR_VSX) { /* * Restore altivec registers from the stack to a local * buffer, then write this out to the thread_struct */ if (copy_vsx_from_user(current, &sr->mc_vsregs)) return 1; } else if (current->thread.used_vsr) for (i = 0; i < 32 ; i++) current->thread.fp_state.fpr[i][TS_VSRLOWOFFSET] = 0; #endif /* CONFIG_VSX */ /* * force the process to reload the FP registers from * current->thread when it next does FP instructions */ regs->msr &= ~(MSR_FP | MSR_FE0 | MSR_FE1); #ifdef CONFIG_SPE /* force the process to reload the spe registers from current->thread when it next does spe instructions */ regs->msr &= ~MSR_SPE; if (msr & MSR_SPE) { /* restore spe registers from the stack */ if (__copy_from_user(current->thread.evr, &sr->mc_vregs, ELF_NEVRREG * sizeof(u32))) return 1; } else if (current->thread.used_spe) memset(current->thread.evr, 0, ELF_NEVRREG * sizeof(u32)); /* Always get SPEFSCR back */ if (__get_user(current->thread.spefscr, (u32 __user *)&sr->mc_vregs + ELF_NEVRREG)) return 1; #endif /* CONFIG_SPE */ return 0; }
false
CWE-399
7cf563aba8f4b3bab68e9bfe43824d952241dcf7
UrlFetcherTest() : test_server_( net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, FilePath(FILE_PATH_LITERAL("net/data/url_request_unittest"))), io_thread_("TestIOThread"), file_thread_("TestFileThread") { }
false
CWE-20
e89cfcb9090e8c98129ae9160c513f504db74599
PasswordStoreLoginsChangedObserver::~PasswordStoreLoginsChangedObserver() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); }
false
CWE-399
6160968cee8b90a5dd95318d716e31d7775c4ef3
projid_t from_kprojid(struct user_namespace *targ, kprojid_t kprojid) { /* Map the uid from a global kernel uid */ return map_id_up(&targ->projid_map, __kprojid_val(kprojid)); }
false
CWE-399
a8b0ca17b80e92faab46ee7179ba9e99ccb61233
void __init set_handler(unsigned long offset, void *addr, unsigned long size) { memcpy((void *)(ebase + offset), addr, size); local_flush_icache_range(ebase + offset, ebase + offset + size); }
false
CWE-362
d5aa407f59f5b83d2c50ec88f5bf56d40f1f8978
static inline void ipip6_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb) { if (INET_ECN_is_ce(iph->tos)) IP6_ECN_set_ce(ipv6_hdr(skb)); }
false
CWE-189
17d68b763f09a9ce824ae23eb62c9efc57b69271
static bool pv_eoi_get_pending(struct kvm_vcpu *vcpu) { u8 val; if (pv_eoi_get_user(vcpu, &val) < 0) apic_debug("Can't read EOI MSR value: 0x%llx\n", (unsigned long long)vcpi->arch.pv_eoi.msr_val); return val & 0x1; }
false
CWE-416
124751d5e63c823092060074bd0abaae61aaa9c4
static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) { struct mixer_build state; int err; const struct usbmix_ctl_map *map; void *p; memset(&state, 0, sizeof(state)); state.chip = mixer->chip; state.mixer = mixer; state.buffer = mixer->hostif->extra; state.buflen = mixer->hostif->extralen; /* check the mapping table */ for (map = usbmix_ctl_maps; map->id; map++) { if (map->id == state.chip->usb_id) { state.map = map->map; state.selector_map = map->selector_map; mixer->ignore_ctl_error = map->ignore_ctl_error; break; } } p = NULL; while ((p = snd_usb_find_csint_desc(mixer->hostif->extra, mixer->hostif->extralen, p, UAC_OUTPUT_TERMINAL)) != NULL) { if (mixer->protocol == UAC_VERSION_1) { struct uac1_output_terminal_descriptor *desc = p; if (desc->bLength < sizeof(*desc)) continue; /* invalid descriptor? */ /* mark terminal ID as visited */ set_bit(desc->bTerminalID, state.unitbitmap); state.oterm.id = desc->bTerminalID; state.oterm.type = le16_to_cpu(desc->wTerminalType); state.oterm.name = desc->iTerminal; err = parse_audio_unit(&state, desc->bSourceID); if (err < 0 && err != -EINVAL) return err; } else { /* UAC_VERSION_2 */ struct uac2_output_terminal_descriptor *desc = p; if (desc->bLength < sizeof(*desc)) continue; /* invalid descriptor? */ /* mark terminal ID as visited */ set_bit(desc->bTerminalID, state.unitbitmap); state.oterm.id = desc->bTerminalID; state.oterm.type = le16_to_cpu(desc->wTerminalType); state.oterm.name = desc->iTerminal; err = parse_audio_unit(&state, desc->bSourceID); if (err < 0 && err != -EINVAL) return err; /* * For UAC2, use the same approach to also add the * clock selectors */ err = parse_audio_unit(&state, desc->bCSourceID); if (err < 0 && err != -EINVAL) return err; } } return 0; }
false
CWE-264
4a1d704194a441bf83c636004a479e01360ec850
static unsigned long mem_cgroup_margin(struct mem_cgroup *memcg) { unsigned long long margin; margin = res_counter_margin(&memcg->res); if (do_swap_account) margin = min(margin, res_counter_margin(&memcg->memsw)); return margin >> PAGE_SHIFT; }
false
CWE-189
bf118a342f10dafe44b14451a1392c3254629a1f
static int decode_server_caps(struct xdr_stream *xdr, struct nfs4_server_caps_res *res) { __be32 *savep; uint32_t attrlen, bitmap[3] = {0}; int status; if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0) goto xdr_error; if ((status = decode_attr_bitmap(xdr, bitmap)) != 0) goto xdr_error; if ((status = decode_attr_length(xdr, &attrlen, &savep)) != 0) goto xdr_error; if ((status = decode_attr_supported(xdr, bitmap, res->attr_bitmask)) != 0) goto xdr_error; if ((status = decode_attr_link_support(xdr, bitmap, &res->has_links)) != 0) goto xdr_error; if ((status = decode_attr_symlink_support(xdr, bitmap, &res->has_symlinks)) != 0) goto xdr_error; if ((status = decode_attr_aclsupport(xdr, bitmap, &res->acl_bitmask)) != 0) goto xdr_error; status = verify_attr_len(xdr, savep, attrlen); xdr_error: dprintk("%s: xdr returned %d!\n", __func__, -status); return status; }
false
CWE-264
5d26a105b5a73e5635eae0629b42fa0a90e07b7b
static inline void serpent_fpu_end(bool fpu_enabled) { glue_fpu_end(fpu_enabled); }
false
CWE-200
fad67a5b73639d7211b24fd9bdb242e82039b765
void ImageResource::DestroyDecodedDataIfPossible() { GetContent()->DestroyDecodedData(); if (GetContent()->HasImage() && !IsUnusedPreload() && GetContent()->IsRefetchableDataFromDiskCache()) { UMA_HISTOGRAM_MEMORY_KB("Memory.Renderer.EstimatedDroppableEncodedSize", EncodedSize() / 1024); } }
false
CWE-264
a40b30f5c43726120bfe69d41ff5aeb31fe1d02a
status_t BufferQueueConsumer::setDefaultMaxBufferCount(int bufferCount) { ATRACE_CALL(); Mutex::Autolock lock(mCore->mMutex); return mCore->setDefaultMaxBufferCountLocked(bufferCount); }
false
CWE-20
8b74d439e1697110c5e5c600643e823eb1dd0762
void llc_conn_resend_i_pdu_as_cmd(struct sock *sk, u8 nr, u8 first_p_bit) { struct sk_buff *skb; struct llc_pdu_sn *pdu; u16 nbr_unack_pdus; struct llc_sock *llc; u8 howmany_resend = 0; llc_conn_remove_acked_pdus(sk, nr, &nbr_unack_pdus); if (!nbr_unack_pdus) goto out; /* * Process unack PDUs only if unack queue is not empty; remove * appropriate PDUs, fix them up, and put them on mac_pdu_q. */ llc = llc_sk(sk); while ((skb = skb_dequeue(&llc->pdu_unack_q)) != NULL) { pdu = llc_pdu_sn_hdr(skb); llc_pdu_set_cmd_rsp(skb, LLC_PDU_CMD); llc_pdu_set_pf_bit(skb, first_p_bit); skb_queue_tail(&sk->sk_write_queue, skb); first_p_bit = 0; llc->vS = LLC_I_GET_NS(pdu); howmany_resend++; } if (howmany_resend > 0) llc->vS = (llc->vS + 1) % LLC_2_SEQ_NBR_MODULO; /* any PDUs to re-send are queued up; start sending to MAC */ llc_conn_send_pdus(sk); out:; }
false
CWE-399
a8b0ca17b80e92faab46ee7179ba9e99ccb61233
xscale2_pmnc_counter_has_overflowed(unsigned long of_flags, enum xscale_counters counter) { int ret = 0; switch (counter) { case XSCALE_CYCLE_COUNTER: ret = of_flags & XSCALE2_CCOUNT_OVERFLOW; break; case XSCALE_COUNTER0: ret = of_flags & XSCALE2_COUNT0_OVERFLOW; break; case XSCALE_COUNTER1: ret = of_flags & XSCALE2_COUNT1_OVERFLOW; break; case XSCALE_COUNTER2: ret = of_flags & XSCALE2_COUNT2_OVERFLOW; break; case XSCALE_COUNTER3: ret = of_flags & XSCALE2_COUNT3_OVERFLOW; break; default: WARN_ONCE(1, "invalid counter number (%d)\n", counter); } return ret; }
false
CWE-119
2f19869af13bbfdcfd682a55c0d2c61c6e102475
void AuthenticatorBlePairingBeginSheetModel::OnAccept() { dialog_model()->SetCurrentStep( AuthenticatorRequestDialogModel::Step::kBleDeviceSelection); }
false
CWE-200
c6f0d22d508a551a40fc8bd7418941b77435aac3
void OmniboxViewViews::SetFocus() { std::unique_ptr<ImmersiveRevealedLock> focus_reveal_lock; if (location_bar_view_) { focus_reveal_lock.reset( BrowserView::GetBrowserViewForBrowser(location_bar_view_->browser()) ->immersive_mode_controller() ->GetRevealedLock(ImmersiveModeController::ANIMATE_REVEAL_YES)); } RequestFocus(); model()->SetCaretVisibility(true); model()->ConsumeCtrlKey(); }
false
CWE-399
ed6fe9d614fc1bca95eb8c0ccd0e92db00ef9d5d
struct socket *sockfd_lookup(int fd, int *err) { struct file *file; struct socket *sock; file = fget(fd); if (!file) { *err = -EBADF; return NULL; } sock = sock_from_file(file, err); if (!sock) fput(file); return sock; }
false
CWE-399
78f11a255749d09025f54d4e2df4fbcb031530e2
int mincore_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, unsigned long addr, unsigned long end, unsigned char *vec) { int ret = 0; spin_lock(&vma->vm_mm->page_table_lock); if (likely(pmd_trans_huge(*pmd))) { ret = !pmd_trans_splitting(*pmd); spin_unlock(&vma->vm_mm->page_table_lock); if (unlikely(!ret)) wait_split_huge_page(vma->anon_vma, pmd); else { /* * All logical pages in the range are present * if backed by a huge page. */ memset(vec, 1, (end - addr) >> PAGE_SHIFT); } } else spin_unlock(&vma->vm_mm->page_table_lock); return ret; }
false
CWE-189
38803268570f90e97452cd9a30ac831661829091
status_t GraphicBuffer::flatten(void*& buffer, size_t& size, int*& fds, size_t& count) const { size_t sizeNeeded = GraphicBuffer::getFlattenedSize(); if (size < sizeNeeded) return NO_MEMORY; size_t fdCountNeeded = GraphicBuffer::getFdCount(); if (count < fdCountNeeded) return NO_MEMORY; int32_t* buf = static_cast<int32_t*>(buffer); buf[0] = 'GBFR'; buf[1] = width; buf[2] = height; buf[3] = stride; buf[4] = format; buf[5] = usage; buf[6] = static_cast<int32_t>(mId >> 32); buf[7] = static_cast<int32_t>(mId & 0xFFFFFFFFull); buf[8] = 0; buf[9] = 0; if (handle) { buf[8] = handle->numFds; buf[9] = handle->numInts; native_handle_t const* const h = handle; memcpy(fds, h->data, h->numFds*sizeof(int)); memcpy(&buf[10], h->data + h->numFds, h->numInts*sizeof(int)); } buffer = reinterpret_cast<void*>(static_cast<int*>(buffer) + sizeNeeded); size -= sizeNeeded; if (handle) { fds += handle->numFds; count -= handle->numFds; } return NO_ERROR; }
false
CWE-20
401d30ef93030afbf7e81e53a11b68fc36194502
void Document::pushCurrentScript(PassRefPtr<HTMLScriptElement> newCurrentScript) { ASSERT(newCurrentScript); m_currentScriptStack.append(newCurrentScript); }
false
CWE-20
108147dfd1ea159fd3632ef92ccc4ab8952980c7
void ContentSecurityPolicy::CopyStateFrom(const ContentSecurityPolicy* other) { DCHECK(policies_.IsEmpty()); for (const auto& policy : other->policies_) AddAndReportPolicyFromHeaderValue(policy->Header(), policy->HeaderType(), policy->HeaderSource()); }
false
CWE-20
45d901b56f578a74b19ba0d10fa5c4c467f19303
void TabStrip::MoveTab(int from_model_index, int to_model_index, TabRendererData data) { DCHECK_GT(tabs_.view_size(), 0); const Tab* last_tab = GetLastVisibleTab(); tab_at(from_model_index)->SetData(std::move(data)); const int to_view_index = GetIndexOf(tab_at(to_model_index)); ReorderChildView(tab_at(from_model_index), to_view_index); if (touch_layout_) { tabs_.MoveViewOnly(from_model_index, to_model_index); int pinned_count = 0; const int start_x = UpdateIdealBoundsForPinnedTabs(&pinned_count); touch_layout_->MoveTab(from_model_index, to_model_index, controller_->GetActiveIndex(), start_x, pinned_count); } else { tabs_.Move(from_model_index, to_model_index); } selected_tabs_.Move(from_model_index, to_model_index, /*length=*/1); StartMoveTabAnimation(); if (TabDragController::IsAttachedTo(GetDragContext()) && (last_tab != GetLastVisibleTab() || last_tab->dragging())) { new_tab_button_->SetVisible(false); } SwapLayoutIfNecessary(); UpdateAccessibleTabIndices(); for (TabStripObserver& observer : observers_) observer.OnTabMoved(from_model_index, to_model_index); }
false
CWE-20
e89cfcb9090e8c98129ae9160c513f504db74599
void BrowserCommandController::TabDetachedAt(TabContents* contents, int index) { RemoveInterstitialObservers(contents); }
true
CWE-399
87a082c5137a63dedb3fe5b1f48f75dcd1fd780c
void Layer::SetIsRootForIsolatedGroup(bool root) { DCHECK(IsPropertyChangeAllowed()); if (is_root_for_isolated_group_ == root) return; is_root_for_isolated_group_ = root; SetNeedsCommit(); }
false
CWE-399
0b760113a3a155269a3fba93a409c640031dd68f
void rpc_killall_tasks(struct rpc_clnt *clnt) { struct rpc_task *rovr; if (list_empty(&clnt->cl_tasks)) return; dprintk("RPC: killing all tasks for client %p\n", clnt); /* * Spin lock all_tasks to prevent changes... */ spin_lock(&clnt->cl_lock); list_for_each_entry(rovr, &clnt->cl_tasks, tk_task) { if (!RPC_IS_ACTIVATED(rovr)) continue; if (!(rovr->tk_flags & RPC_TASK_KILLED)) { rovr->tk_flags |= RPC_TASK_KILLED; rpc_exit(rovr, -EIO); if (RPC_IS_QUEUED(rovr)) rpc_wake_up_queued_task(rovr->tk_waitqueue, rovr); } } spin_unlock(&clnt->cl_lock); }
false
CWE-119
23a52bd208885df236cde3ad2cd162b094c0bbe4
bool ChromeContentRendererClient::HandleGetCookieRequest( content::RenderView* sender, const GURL& url, const GURL& first_party_for_cookies, std::string* cookies) { if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kChromeFrame)) { IPC::SyncMessage* msg = new ChromeViewHostMsg_GetCookies( MSG_ROUTING_NONE, url, first_party_for_cookies, cookies); sender->Send(msg); return true; } return false; }
false
CWE-264
03a53d1c7765eeb3af0bc34c3dff02ada1953fbf
InputDispatcherThread::~InputDispatcherThread() { }
false
CWE-264
0bd1a6ddb5fb23dfea3e72d60e5e8df4cf5826bc
void BackingStoreGtk::ScrollBackingStore(int dx, int dy, const gfx::Rect& clip_rect, const gfx::Size& view_size) { if (!display_) return; DCHECK(dx == 0 || dy == 0); if (dy) { if (abs(dy) < clip_rect.height()) { XCopyArea(display_, pixmap_, pixmap_, static_cast<GC>(pixmap_gc_), clip_rect.x() /* source x */, std::max(clip_rect.y(), clip_rect.y() - dy), clip_rect.width(), clip_rect.height() - abs(dy), clip_rect.x() /* dest x */, std::max(clip_rect.y(), clip_rect.y() + dy) /* dest y */); } } else if (dx) { if (abs(dx) < clip_rect.width()) { XCopyArea(display_, pixmap_, pixmap_, static_cast<GC>(pixmap_gc_), std::max(clip_rect.x(), clip_rect.x() - dx), clip_rect.y() /* source y */, clip_rect.width() - abs(dx), clip_rect.height(), std::max(clip_rect.x(), clip_rect.x() + dx) /* dest x */, clip_rect.y() /* dest x */); } } }
false
CWE-264
09ca8e1173bcb12e2a449698c9ae3b86a8a10195
void kvm_put_kvm(struct kvm *kvm) { if (atomic_dec_and_test(&kvm->users_count)) kvm_destroy_vm(kvm); }
false
CWE-20
94036902775aa96ea74db583135f4080a125fab9
AppModalDialog::AppModalDialog(WebContents* web_contents, const string16& title) : valid_(true), native_dialog_(NULL), title_(title), web_contents_(web_contents) { }
true
CWE-399
d974baa398f34393db76be45f7d4d04fbdbb4a0a
static void vmcs_clear_bits(unsigned long field, u32 mask) { vmcs_writel(field, vmcs_readl(field) & ~mask); }
false
CWE-399
dd3b6fe574edad231c01c78e4647a74c38dc4178
void GDataDirectoryService::FindEntryByPathAndRunSync( const FilePath& search_file_path, const FindEntryCallback& callback) { GDataEntry* entry = FindEntryByPathSync(search_file_path); callback.Run(entry ? GDATA_FILE_OK : GDATA_FILE_ERROR_NOT_FOUND, entry); }
false
CWE-264
550fd08c2cebad61c548def135f67aba284c6162
static void isdn_net_tx_timeout(struct net_device * ndev) { isdn_net_local *lp = netdev_priv(ndev); printk(KERN_WARNING "isdn_tx_timeout dev %s dialstate %d\n", ndev->name, lp->dialstate); if (!lp->dialstate){ lp->stats.tx_errors++; /* * There is a certain probability that this currently * works at all because if we always wake up the interface, * then upper layer will try to send the next packet * immediately. And then, the old clean_up logic in the * driver will hopefully continue to work as it used to do. * * This is rather primitive right know, we better should * clean internal queues here, in particular for multilink and * ppp, and reset HL driver's channel, too. --HE * * actually, this may not matter at all, because ISDN hardware * should not see transmitter hangs at all IMO * changed KERN_DEBUG to KERN_WARNING to find out if this is * ever called --KG */ } ndev->trans_start = jiffies; netif_wake_queue(ndev); }
false
CWE-362
70340ce072cee8a0bdcddb5f312d32567b2269f6
bool VaapiVideoDecodeAccelerator::VaapiH264Accelerator::SubmitFrameMetadata( const H264SPS* sps, const H264PPS* pps, const H264DPB& dpb, const H264Picture::Vector& ref_pic_listp0, const H264Picture::Vector& ref_pic_listb0, const H264Picture::Vector& ref_pic_listb1, const scoped_refptr<H264Picture>& pic) { VAPictureParameterBufferH264 pic_param; memset(&pic_param, 0, sizeof(pic_param)); #define FROM_SPS_TO_PP(a) pic_param.a = sps->a #define FROM_SPS_TO_PP2(a, b) pic_param.b = sps->a FROM_SPS_TO_PP2(pic_width_in_mbs_minus1, picture_width_in_mbs_minus1); FROM_SPS_TO_PP2(pic_height_in_map_units_minus1, picture_height_in_mbs_minus1); FROM_SPS_TO_PP(bit_depth_luma_minus8); FROM_SPS_TO_PP(bit_depth_chroma_minus8); #undef FROM_SPS_TO_PP #undef FROM_SPS_TO_PP2 #define FROM_SPS_TO_PP_SF(a) pic_param.seq_fields.bits.a = sps->a #define FROM_SPS_TO_PP_SF2(a, b) pic_param.seq_fields.bits.b = sps->a FROM_SPS_TO_PP_SF(chroma_format_idc); FROM_SPS_TO_PP_SF2(separate_colour_plane_flag, residual_colour_transform_flag); FROM_SPS_TO_PP_SF(gaps_in_frame_num_value_allowed_flag); FROM_SPS_TO_PP_SF(frame_mbs_only_flag); FROM_SPS_TO_PP_SF(mb_adaptive_frame_field_flag); FROM_SPS_TO_PP_SF(direct_8x8_inference_flag); pic_param.seq_fields.bits.MinLumaBiPredSize8x8 = (sps->level_idc >= 31); FROM_SPS_TO_PP_SF(log2_max_frame_num_minus4); FROM_SPS_TO_PP_SF(pic_order_cnt_type); FROM_SPS_TO_PP_SF(log2_max_pic_order_cnt_lsb_minus4); FROM_SPS_TO_PP_SF(delta_pic_order_always_zero_flag); #undef FROM_SPS_TO_PP_SF #undef FROM_SPS_TO_PP_SF2 #define FROM_PPS_TO_PP(a) pic_param.a = pps->a FROM_PPS_TO_PP(pic_init_qp_minus26); FROM_PPS_TO_PP(pic_init_qs_minus26); FROM_PPS_TO_PP(chroma_qp_index_offset); FROM_PPS_TO_PP(second_chroma_qp_index_offset); #undef FROM_PPS_TO_PP #define FROM_PPS_TO_PP_PF(a) pic_param.pic_fields.bits.a = pps->a #define FROM_PPS_TO_PP_PF2(a, b) pic_param.pic_fields.bits.b = pps->a FROM_PPS_TO_PP_PF(entropy_coding_mode_flag); FROM_PPS_TO_PP_PF(weighted_pred_flag); FROM_PPS_TO_PP_PF(weighted_bipred_idc); FROM_PPS_TO_PP_PF(transform_8x8_mode_flag); pic_param.pic_fields.bits.field_pic_flag = 0; FROM_PPS_TO_PP_PF(constrained_intra_pred_flag); FROM_PPS_TO_PP_PF2(bottom_field_pic_order_in_frame_present_flag, pic_order_present_flag); FROM_PPS_TO_PP_PF(deblocking_filter_control_present_flag); FROM_PPS_TO_PP_PF(redundant_pic_cnt_present_flag); pic_param.pic_fields.bits.reference_pic_flag = pic->ref; #undef FROM_PPS_TO_PP_PF #undef FROM_PPS_TO_PP_PF2 pic_param.frame_num = pic->frame_num; InitVAPicture(&pic_param.CurrPic); FillVAPicture(&pic_param.CurrPic, pic); for (int i = 0; i < 16; ++i) InitVAPicture(&pic_param.ReferenceFrames[i]); FillVARefFramesFromDPB(dpb, pic_param.ReferenceFrames, arraysize(pic_param.ReferenceFrames)); pic_param.num_ref_frames = sps->max_num_ref_frames; if (!vaapi_wrapper_->SubmitBuffer(VAPictureParameterBufferType, sizeof(pic_param), &pic_param)) return false; VAIQMatrixBufferH264 iq_matrix_buf; memset(&iq_matrix_buf, 0, sizeof(iq_matrix_buf)); if (pps->pic_scaling_matrix_present_flag) { for (int i = 0; i < 6; ++i) { for (int j = 0; j < 16; ++j) iq_matrix_buf.ScalingList4x4[i][kZigzagScan4x4[j]] = pps->scaling_list4x4[i][j]; } for (int i = 0; i < 2; ++i) { for (int j = 0; j < 64; ++j) iq_matrix_buf.ScalingList8x8[i][kZigzagScan8x8[j]] = pps->scaling_list8x8[i][j]; } } else { for (int i = 0; i < 6; ++i) { for (int j = 0; j < 16; ++j) iq_matrix_buf.ScalingList4x4[i][kZigzagScan4x4[j]] = sps->scaling_list4x4[i][j]; } for (int i = 0; i < 2; ++i) { for (int j = 0; j < 64; ++j) iq_matrix_buf.ScalingList8x8[i][kZigzagScan8x8[j]] = sps->scaling_list8x8[i][j]; } } return vaapi_wrapper_->SubmitBuffer(VAIQMatrixBufferType, sizeof(iq_matrix_buf), &iq_matrix_buf); }
true
CWE-399
a8b0ca17b80e92faab46ee7179ba9e99ccb61233
static inline void irq_time_write_end(void) { }
false
CWE-119
7572777eef78ebdee1ecb7c258c0ef94d35bad16
static int fuse_file_mmap(struct file *file, struct vm_area_struct *vma) { if ((vma->vm_flags & VM_SHARED) && (vma->vm_flags & VM_MAYWRITE)) { struct inode *inode = file->f_dentry->d_inode; struct fuse_conn *fc = get_fuse_conn(inode); struct fuse_inode *fi = get_fuse_inode(inode); struct fuse_file *ff = file->private_data; /* * file may be written through mmap, so chain it onto the * inodes's write_file list */ spin_lock(&fc->lock); if (list_empty(&ff->write_entry)) list_add(&ff->write_entry, &fi->write_files); spin_unlock(&fc->lock); } file_accessed(file); vma->vm_ops = &fuse_file_vm_ops; return 0; }
false
CWE-399
248a92c21c20c14b5983680c50e1d8b73fc79a2f
void RenderBlock::linkToEndLineIfNeeded(LineLayoutState& layoutState) { if (layoutState.endLine()) { if (layoutState.endLineMatched()) { bool paginated = view()->layoutState() && view()->layoutState()->isPaginated(); LayoutUnit delta = logicalHeight() - layoutState.endLineLogicalTop(); for (RootInlineBox* line = layoutState.endLine(); line; line = line->nextRootBox()) { line->attachLine(); if (paginated) { delta -= line->paginationStrut(); adjustLinePositionForPagination(line, delta, layoutState.flowThread()); } if (delta) { layoutState.updateRepaintRangeFromBox(line, delta); line->adjustBlockDirectionPosition(delta); } if (layoutState.flowThread()) line->setContainingRegion(regionAtBlockOffset(line->lineTopWithLeading())); if (Vector<RenderBox*>* cleanLineFloats = line->floatsPtr()) { Vector<RenderBox*>::iterator end = cleanLineFloats->end(); for (Vector<RenderBox*>::iterator f = cleanLineFloats->begin(); f != end; ++f) { FloatingObject* floatingObject = insertFloatingObject(*f); ASSERT(!floatingObject->originatingLine()); floatingObject->setOriginatingLine(line); setLogicalHeight(logicalTopForChild(*f) - marginBeforeForChild(*f) + delta); positionNewFloats(); } } } setLogicalHeight(lastRootBox()->lineBottomWithLeading()); } else { deleteLineRange(layoutState, layoutState.endLine()); } } if (m_floatingObjects && (layoutState.checkForFloatsFromLastLine() || positionNewFloats()) && lastRootBox()) { if (layoutState.checkForFloatsFromLastLine()) { LayoutUnit bottomVisualOverflow = lastRootBox()->logicalBottomVisualOverflow(); LayoutUnit bottomLayoutOverflow = lastRootBox()->logicalBottomLayoutOverflow(); TrailingFloatsRootInlineBox* trailingFloatsLineBox = new TrailingFloatsRootInlineBox(this); m_lineBoxes.appendLineBox(trailingFloatsLineBox); trailingFloatsLineBox->setConstructed(); GlyphOverflowAndFallbackFontsMap textBoxDataMap; VerticalPositionCache verticalPositionCache; LayoutUnit blockLogicalHeight = logicalHeight(); trailingFloatsLineBox->alignBoxesInBlockDirection(blockLogicalHeight, textBoxDataMap, verticalPositionCache); trailingFloatsLineBox->setLineTopBottomPositions(blockLogicalHeight, blockLogicalHeight, blockLogicalHeight, blockLogicalHeight); trailingFloatsLineBox->setPaginatedLineWidth(availableLogicalWidthForContent(blockLogicalHeight)); LayoutRect logicalLayoutOverflow(0, blockLogicalHeight, 1, bottomLayoutOverflow - blockLogicalHeight); LayoutRect logicalVisualOverflow(0, blockLogicalHeight, 1, bottomVisualOverflow - blockLogicalHeight); trailingFloatsLineBox->setOverflowFromLogicalRects(logicalLayoutOverflow, logicalVisualOverflow, trailingFloatsLineBox->lineTop(), trailingFloatsLineBox->lineBottom()); if (layoutState.flowThread()) trailingFloatsLineBox->setContainingRegion(regionAtBlockOffset(trailingFloatsLineBox->lineTopWithLeading())); } const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); FloatingObjectSetIterator it = floatingObjectSet.begin(); FloatingObjectSetIterator end = floatingObjectSet.end(); if (layoutState.lastFloat()) { FloatingObjectSetIterator lastFloatIterator = floatingObjectSet.find(layoutState.lastFloat()); ASSERT(lastFloatIterator != end); ++lastFloatIterator; it = lastFloatIterator; } for (; it != end; ++it) appendFloatingObjectToLastLine(*it); layoutState.setLastFloat(!floatingObjectSet.isEmpty() ? floatingObjectSet.last() : 0); } }
false
CWE-362
2b472611a32a72f4a118c069c2d62a1a3f087afd
static void stable_tree_append(struct rmap_item *rmap_item, struct stable_node *stable_node) { rmap_item->head = stable_node; rmap_item->address |= STABLE_FLAG; hlist_add_head(&rmap_item->hlist, &stable_node->hlist); if (rmap_item->hlist.next) ksm_pages_sharing++; else ksm_pages_shared++; }
false
CWE-264
c0da7c1c6e9ffe5006e146b6426f987238d4bf2e
void InjectBeforeUnloadListener(content::WebContents* web_contents) { ASSERT_TRUE(content::ExecuteScript(web_contents->GetRenderViewHost(), "window.addEventListener('beforeunload'," "function(event) { event.returnValue = 'Foo'; });")); }
false
CWE-399
4ac8bc08e3306f38a5ab3e551aef6ad43753579c
bool Element::webkitMatchesSelector(const String& selector, ExceptionCode& ec) { if (selector.isEmpty()) { ec = SYNTAX_ERR; return false; } SelectorQuery* selectorQuery = document()->selectorQueryCache()->add(selector, document(), ec); if (!selectorQuery) return false; return selectorQuery->matches(this); }
false
CWE-189
971548cdca2d4c0a6fedd3db0c94372c2a27eac3
void SpeechRecognitionManagerImpl::OnSoundEnd(int session_id) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (!SessionExists(session_id)) return; if (SpeechRecognitionEventListener* delegate_listener = GetDelegateListener()) delegate_listener->OnSoundEnd(session_id); if (SpeechRecognitionEventListener* listener = GetListener(session_id)) listener->OnSoundEnd(session_id); }
false
CWE-264
4c8b008f055f79e622344627fed7f820375a4f01
void Document::nodeChildrenWillBeRemoved(ContainerNode& container) { EventDispatchForbiddenScope assertNoEventDispatch; for (Range* range : m_ranges) range->nodeChildrenWillBeRemoved(container); for (NodeIterator* ni : m_nodeIterators) { for (Node& n : NodeTraversal::childrenOf(container)) ni->nodeWillBeRemoved(n); } if (LocalFrame* frame = this->frame()) { for (Node& n : NodeTraversal::childrenOf(container)) { frame->eventHandler().nodeWillBeRemoved(n); frame->selection().nodeWillBeRemoved(n); frame->page()->dragCaretController().nodeWillBeRemoved(n); } } }
false
CWE-189
b1bb5b49373b61bf9d2c73a4d30058ba6f069e4c
static void oz_urb_cancel(struct oz_port *port, u8 ep_num, struct urb *urb) { struct oz_urb_link *urbl = NULL; struct list_head *e; struct oz_hcd *ozhcd; unsigned long irq_state; u8 ix; if (port == NULL) { oz_dbg(ON, "%s: ERROR: (%p) port is null\n", __func__, urb); return; } ozhcd = port->ozhcd; if (ozhcd == NULL) { oz_dbg(ON, "%s; ERROR: (%p) ozhcd is null\n", __func__, urb); return; } /* Look in the tasklet queue. */ spin_lock_irqsave(&g_tasklet_lock, irq_state); list_for_each(e, &ozhcd->urb_cancel_list) { urbl = list_entry(e, struct oz_urb_link, link); if (urb == urbl->urb) { list_del_init(e); spin_unlock_irqrestore(&g_tasklet_lock, irq_state); goto out2; } } spin_unlock_irqrestore(&g_tasklet_lock, irq_state); urbl = NULL; /* Look in the orphanage. */ spin_lock_irqsave(&ozhcd->hcd_lock, irq_state); list_for_each(e, &ozhcd->orphanage) { urbl = list_entry(e, struct oz_urb_link, link); if (urbl->urb == urb) { list_del(e); oz_dbg(ON, "Found urb in orphanage\n"); goto out; } } ix = (ep_num & 0xf); urbl = NULL; if ((ep_num & USB_DIR_IN) && ix) urbl = oz_remove_urb(port->in_ep[ix], urb); else urbl = oz_remove_urb(port->out_ep[ix], urb); out: spin_unlock_irqrestore(&ozhcd->hcd_lock, irq_state); out2: if (urbl) { urb->actual_length = 0; oz_free_urb_link(urbl); oz_complete_urb(ozhcd->hcd, urb, -EPIPE); } }
false
CWE-416
3aa02cb664c5fb1042958c8d1aa8c35055a2ebc4
void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k, const struct snd_interval *b, struct snd_interval *c) { unsigned int r; if (a->empty || b->empty) { snd_interval_none(c); return; } c->empty = 0; c->min = muldiv32(a->min, k, b->max, &r); c->openmin = (r || a->openmin || b->openmax); if (b->min > 0) { c->max = muldiv32(a->max, k, b->min, &r); if (r) { c->max++; c->openmax = 1; } else c->openmax = (a->openmax || b->openmin); } else { c->max = UINT_MAX; c->openmax = 0; } c->integer = 0; }
false
CWE-264
03a53d1c7765eeb3af0bc34c3dff02ada1953fbf
static bool isValidKeyAction(int32_t action) { switch (action) { case AKEY_EVENT_ACTION_DOWN: case AKEY_EVENT_ACTION_UP: return true; default: return false; } }
false
CWE-399
4c19b042ea31bd393d2265656f94339d1c3d82ff
bool FileUtilProxy::GetFileInfoFromPlatformFile( scoped_refptr<MessageLoopProxy> message_loop_proxy, PlatformFile file, GetFileInfoCallback* callback) { return Start(FROM_HERE, message_loop_proxy, new RelayGetFileInfoFromPlatformFile(file, callback)); }
false
CWE-416
1fd819ecb90cc9b822cd84d3056ddba315d3340f
struct sk_buff *__alloc_skb_head(gfp_t gfp_mask, int node) { struct sk_buff *skb; /* Get the HEAD */ skb = kmem_cache_alloc_node(skbuff_head_cache, gfp_mask & ~__GFP_DMA, node); if (!skb) goto out; /* * Only clear those fields we need to clear, not those that we will * actually initialise below. Hence, don't put any more fields after * the tail pointer in struct sk_buff! */ memset(skb, 0, offsetof(struct sk_buff, tail)); skb->head = NULL; skb->truesize = sizeof(struct sk_buff); atomic_set(&skb->users, 1); skb->mac_header = (typeof(skb->mac_header))~0U; out: return skb; }
false
CWE-20
bfd0a56b90005f8c8a004baf407ad90045c2b11e
static int vmx_interrupt_allowed(struct kvm_vcpu *vcpu) { if (is_guest_mode(vcpu)) { struct vmcs12 *vmcs12 = get_vmcs12(vcpu); if (to_vmx(vcpu)->nested.nested_run_pending) return 0; if (nested_exit_on_intr(vcpu)) { nested_vmx_vmexit(vcpu); vmcs12->vm_exit_reason = EXIT_REASON_EXTERNAL_INTERRUPT; vmcs12->vm_exit_intr_info = 0; /* * fall through to normal code, but now in L1, not L2 */ } } return (vmcs_readl(GUEST_RFLAGS) & X86_EFLAGS_IF) && !(vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & (GUEST_INTR_STATE_STI | GUEST_INTR_STATE_MOV_SS)); }
false
CWE-399
9c895160d25a76c21b65bad141b08e8d4f99afef
int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) { int r; sigset_t sigsaved; if (vcpu->sigset_active) sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved); if (unlikely(vcpu->arch.mp_state == KVM_MP_STATE_UNINITIALIZED)) { kvm_vcpu_block(vcpu); clear_bit(KVM_REQ_UNHALT, &vcpu->requests); r = -EAGAIN; goto out; } if (vcpu->mmio_needed) { memcpy(vcpu->mmio_data, kvm_run->mmio.data, 8); kvm_set_mmio_data(vcpu); vcpu->mmio_read_completed = 1; vcpu->mmio_needed = 0; } r = __vcpu_run(vcpu, kvm_run); out: if (vcpu->sigset_active) sigprocmask(SIG_SETMASK, &sigsaved, NULL); return r; }
false
CWE-20
263b4509ec4d47e0da3e753f85a39ea12d1eff24
static void nfs_redirty_request(struct nfs_page *req) { nfs_mark_request_dirty(req); nfs_unlock_request(req); nfs_end_page_writeback(req->wb_page); nfs_release_request(req); }
false
CWE-362
603af455b5641671b18d7d7d166630341d71b63f
bool TranslateInfoBarDelegate::ShouldAlwaysTranslate() { return ui_delegate_.ShouldAlwaysTranslate(); }
false
CWE-119
51e0cb2e5ec18eaf6fb331bc573ff27b743898f4
xmlParse3986Port(xmlURIPtr uri, const char **str) { const char *cur = *str; unsigned port = 0; /* unsigned for defined overflow behavior */ if (ISA_DIGIT(cur)) { while (ISA_DIGIT(cur)) { port = port * 10 + (*cur - '0'); cur++; } if (uri != NULL) uri->port = port & INT_MAX; /* port value modulo INT_MAX+1 */ *str = cur; return(0); } return(1); }
true
CWE-189
9438fabb73eb48055b58b89fc51e0bc4db22fabd
CIFSSMBEcho(struct TCP_Server_Info *server) { ECHO_REQ *smb; int rc = 0; struct kvec iov; cFYI(1, "In echo request"); rc = small_smb_init(SMB_COM_ECHO, 0, NULL, (void **)&smb); if (rc) return rc; /* set up echo request */ smb->hdr.Tid = 0xffff; smb->hdr.WordCount = 1; put_unaligned_le16(1, &smb->EchoCount); put_bcc(1, &smb->hdr); smb->Data[0] = 'a'; inc_rfc1001_len(smb, 3); iov.iov_base = smb; iov.iov_len = be32_to_cpu(smb->hdr.smb_buf_length) + 4; rc = cifs_call_async(server, &iov, 1, cifs_echo_callback, server, true); if (rc) cFYI(1, "Echo request failed: %d", rc); cifs_small_buf_release(smb); return rc; }
false
CWE-119
f8675cbb337440a11bf9afb10ea11bae42bb92cb
TestObserver() {}
false
CWE-20
282f53ffdc3b1902da86f6a0791af736837efbf8
void DiceTurnSyncOnHelper::SyncStartupFailed() { DCHECK(sync_startup_tracker_); sync_startup_tracker_.reset(); ShowSyncConfirmationUI(); }
false
CWE-189
4c46d7a5b0af9b7d320e709291b270ab7cf07e83
xmlXPtrEvalXPtrPart(xmlXPathParserContextPtr ctxt, xmlChar *name) { xmlChar *buffer, *cur; int len; int level; if (name == NULL) name = xmlXPathParseName(ctxt); if (name == NULL) XP_ERROR(XPATH_EXPR_ERROR); if (CUR != '(') XP_ERROR(XPATH_EXPR_ERROR); NEXT; level = 1; len = xmlStrlen(ctxt->cur); len++; buffer = (xmlChar *) xmlMallocAtomic(len * sizeof (xmlChar)); if (buffer == NULL) { xmlXPtrErrMemory("allocating buffer"); return; } cur = buffer; while (CUR != 0) { if (CUR == ')') { level--; if (level == 0) { NEXT; break; } *cur++ = CUR; } else if (CUR == '(') { level++; *cur++ = CUR; } else if (CUR == '^') { NEXT; if ((CUR == ')') || (CUR == '(') || (CUR == '^')) { *cur++ = CUR; } else { *cur++ = '^'; *cur++ = CUR; } } else { *cur++ = CUR; } NEXT; } *cur = 0; if ((level != 0) && (CUR == 0)) { xmlFree(buffer); XP_ERROR(XPTR_SYNTAX_ERROR); } if (xmlStrEqual(name, (xmlChar *) "xpointer")) { const xmlChar *left = CUR_PTR; CUR_PTR = buffer; /* * To evaluate an xpointer scheme element (4.3) we need: * context initialized to the root * context position initalized to 1 * context size initialized to 1 */ ctxt->context->node = (xmlNodePtr)ctxt->context->doc; ctxt->context->proximityPosition = 1; ctxt->context->contextSize = 1; xmlXPathEvalExpr(ctxt); CUR_PTR=left; } else if (xmlStrEqual(name, (xmlChar *) "element")) { const xmlChar *left = CUR_PTR; xmlChar *name2; CUR_PTR = buffer; if (buffer[0] == '/') { xmlXPathRoot(ctxt); xmlXPtrEvalChildSeq(ctxt, NULL); } else { name2 = xmlXPathParseName(ctxt); if (name2 == NULL) { CUR_PTR = left; xmlFree(buffer); XP_ERROR(XPATH_EXPR_ERROR); } xmlXPtrEvalChildSeq(ctxt, name2); } CUR_PTR = left; #ifdef XPTR_XMLNS_SCHEME } else if (xmlStrEqual(name, (xmlChar *) "xmlns")) { const xmlChar *left = CUR_PTR; xmlChar *prefix; xmlChar *URI; xmlURIPtr value; CUR_PTR = buffer; prefix = xmlXPathParseNCName(ctxt); if (prefix == NULL) { xmlFree(buffer); xmlFree(name); XP_ERROR(XPTR_SYNTAX_ERROR); } SKIP_BLANKS; if (CUR != '=') { xmlFree(prefix); xmlFree(buffer); xmlFree(name); XP_ERROR(XPTR_SYNTAX_ERROR); } NEXT; SKIP_BLANKS; /* @@ check escaping in the XPointer WD */ value = xmlParseURI((const char *)ctxt->cur); if (value == NULL) { xmlFree(prefix); xmlFree(buffer); xmlFree(name); XP_ERROR(XPTR_SYNTAX_ERROR); } URI = xmlSaveUri(value); xmlFreeURI(value); if (URI == NULL) { xmlFree(prefix); xmlFree(buffer); xmlFree(name); XP_ERROR(XPATH_MEMORY_ERROR); } xmlXPathRegisterNs(ctxt->context, prefix, URI); CUR_PTR = left; xmlFree(URI); xmlFree(prefix); #endif /* XPTR_XMLNS_SCHEME */ } else { xmlXPtrErr(ctxt, XML_XPTR_UNKNOWN_SCHEME, "unsupported scheme '%s'\n", name); } xmlFree(buffer); xmlFree(name); }
true
CWE-416
05c619eb6e7dac046afc72c0d5381856f87fb421
views::NonClientFrameView* ShellSurface::CreateNonClientFrameView( views::Widget* widget) { return new CustomFrameView(widget); }
false
CWE-119
6e94e0cfb0887e4013b3b930fa6ab1fe6bb6ba91
check_entry(const struct ip6t_entry *e) { const struct xt_entry_target *t; if (!ip6_checkentry(&e->ipv6)) return -EINVAL; if (e->target_offset + sizeof(struct xt_entry_target) > e->next_offset) return -EINVAL; t = ip6t_get_target_c(e); if (e->target_offset + t->u.target_size > e->next_offset) return -EINVAL; return 0; }
false
CWE-20
2172fa709ab32ca60e86179dc67d0857be8e2c98
static int convert_context(u32 key, struct context *c, void *p) { struct convert_context_args *args; struct context oldc; struct ocontext *oc; struct mls_range *range; struct role_datum *role; struct type_datum *typdatum; struct user_datum *usrdatum; char *s; u32 len; int rc = 0; if (key <= SECINITSID_NUM) goto out; args = p; if (c->str) { struct context ctx; rc = -ENOMEM; s = kstrdup(c->str, GFP_KERNEL); if (!s) goto out; rc = string_to_context_struct(args->newp, NULL, s, c->len, &ctx, SECSID_NULL); kfree(s); if (!rc) { printk(KERN_INFO "SELinux: Context %s became valid (mapped).\n", c->str); /* Replace string with mapped representation. */ kfree(c->str); memcpy(c, &ctx, sizeof(*c)); goto out; } else if (rc == -EINVAL) { /* Retain string representation for later mapping. */ rc = 0; goto out; } else { /* Other error condition, e.g. ENOMEM. */ printk(KERN_ERR "SELinux: Unable to map context %s, rc = %d.\n", c->str, -rc); goto out; } } rc = context_cpy(&oldc, c); if (rc) goto out; /* Convert the user. */ rc = -EINVAL; usrdatum = hashtab_search(args->newp->p_users.table, sym_name(args->oldp, SYM_USERS, c->user - 1)); if (!usrdatum) goto bad; c->user = usrdatum->value; /* Convert the role. */ rc = -EINVAL; role = hashtab_search(args->newp->p_roles.table, sym_name(args->oldp, SYM_ROLES, c->role - 1)); if (!role) goto bad; c->role = role->value; /* Convert the type. */ rc = -EINVAL; typdatum = hashtab_search(args->newp->p_types.table, sym_name(args->oldp, SYM_TYPES, c->type - 1)); if (!typdatum) goto bad; c->type = typdatum->value; /* Convert the MLS fields if dealing with MLS policies */ if (args->oldp->mls_enabled && args->newp->mls_enabled) { rc = mls_convert_context(args->oldp, args->newp, c); if (rc) goto bad; } else if (args->oldp->mls_enabled && !args->newp->mls_enabled) { /* * Switching between MLS and non-MLS policy: * free any storage used by the MLS fields in the * context for all existing entries in the sidtab. */ mls_context_destroy(c); } else if (!args->oldp->mls_enabled && args->newp->mls_enabled) { /* * Switching between non-MLS and MLS policy: * ensure that the MLS fields of the context for all * existing entries in the sidtab are filled in with a * suitable default value, likely taken from one of the * initial SIDs. */ oc = args->newp->ocontexts[OCON_ISID]; while (oc && oc->sid[0] != SECINITSID_UNLABELED) oc = oc->next; rc = -EINVAL; if (!oc) { printk(KERN_ERR "SELinux: unable to look up" " the initial SIDs list\n"); goto bad; } range = &oc->context[0].range; rc = mls_range_set(c, range); if (rc) goto bad; } /* Check the validity of the new context. */ if (!policydb_context_isvalid(args->newp, c)) { rc = convert_context_handle_invalid_context(&oldc); if (rc) goto bad; } context_destroy(&oldc); rc = 0; out: return rc; bad: /* Map old representation to string and save it. */ rc = context_struct_to_string(&oldc, &s, &len); if (rc) return rc; context_destroy(&oldc); context_destroy(c); c->str = s; c->len = len; printk(KERN_INFO "SELinux: Context %s became invalid (unmapped).\n", c->str); rc = 0; goto out; }
false
CWE-416
a4150b688a754d3d10d2ca385155b1c95d77d6ae
void GLES2DecoderPassthroughImpl::EmulatedDefaultFramebuffer::Destroy( bool have_context) { if (have_context) { api->glDeleteFramebuffersEXTFn(1, &framebuffer_service_id); framebuffer_service_id = 0; api->glDeleteRenderbuffersEXTFn(1, &color_buffer_service_id); color_buffer_service_id = 0; api->glDeleteRenderbuffersEXTFn(1, &depth_stencil_buffer_service_id); color_buffer_service_id = 0; api->glDeleteRenderbuffersEXTFn(1, &depth_buffer_service_id); depth_buffer_service_id = 0; api->glDeleteRenderbuffersEXTFn(1, &stencil_buffer_service_id); stencil_buffer_service_id = 0; } if (color_texture) { color_texture->Destroy(have_context); } }
false
CWE-20
7614790c80996d32a28218f4d1605b0908e9ddf6
void SynchronizeVisualPropertiesMessageFilter::OnSynchronizeVisualProperties( const viz::LocalSurfaceId& local_surface_id, const viz::FrameSinkId& frame_sink_id, const FrameVisualProperties& resize_params) { gfx::Rect screen_space_rect_in_dip = resize_params.screen_space_rect; if (IsUseZoomForDSFEnabled()) { screen_space_rect_in_dip = gfx::Rect(gfx::ScaleToFlooredPoint( resize_params.screen_space_rect.origin(), 1.f / resize_params.screen_info.device_scale_factor), gfx::ScaleToCeiledSize( resize_params.screen_space_rect.size(), 1.f / resize_params.screen_info.device_scale_factor)); } content::BrowserThread::PostTask( content::BrowserThread::UI, FROM_HERE, base::BindOnce( &SynchronizeVisualPropertiesMessageFilter::OnUpdatedFrameRectOnUI, this, screen_space_rect_in_dip)); content::BrowserThread::PostTask( content::BrowserThread::UI, FROM_HERE, base::BindOnce( &SynchronizeVisualPropertiesMessageFilter::OnUpdatedSurfaceIdOnUI, this, local_surface_id)); frame_sink_id_ = frame_sink_id; if (!frame_sink_id_.is_valid()) return; content::BrowserThread::GetTaskRunnerForThread(content::BrowserThread::UI) ->PostTask(FROM_HERE, base::BindOnce(&SynchronizeVisualPropertiesMessageFilter:: OnUpdatedFrameSinkIdOnUI, this)); }
false
CWE-399
c50ac050811d6485616a193eb0f37bfbd191cc89
static ssize_t nr_hugepages_mempolicy_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t len) { return nr_hugepages_store_common(true, kobj, attr, buf, len); }
false
CWE-200
07678eca2cf9c9a18584e546c2b2a0d0c9a3150c
static void vmw_user_surface_base_release(struct ttm_base_object **p_base) { struct ttm_base_object *base = *p_base; struct vmw_user_surface *user_srf = container_of(base, struct vmw_user_surface, prime.base); struct vmw_resource *res = &user_srf->srf.res; *p_base = NULL; if (user_srf->backup_base) ttm_base_object_unref(&user_srf->backup_base); vmw_resource_unreference(&res); }
false
CWE-189
503bea2643350c6378de5f7a268b85cf2480e1ac
AudioRendererHost::AudioEntry* AudioRendererHost::LookupById(int stream_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); AudioEntryMap::iterator i = audio_entries_.find(stream_id); if (i != audio_entries_.end() && !i->second->pending_close) return i->second; return NULL; }
false
CWE-399
4d77eed905ce1d00361282e8822a2a3be61d25c0
String HTMLFormElement::action() const { return getAttribute(actionAttr); }
false
CWE-416
bf6a6765d44b09c64b8c75d749efb84742a250e7
void PDFiumEngine::GetPasswordAndLoad() { getting_password_ = true; DCHECK(!doc_ && FPDF_GetLastError() == FPDF_ERR_PASSWORD); client_->GetDocumentPassword(password_factory_.NewCallbackWithOutput( &PDFiumEngine::OnGetPasswordComplete)); }
false
CWE-399
f85a87ec670ad0fce9d98d90c9a705b72a288154
static void treatReturnedNullStringAsNullStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); v8SetReturnValueStringOrNull(info, imp->treatReturnedNullStringAsNullStringAttribute(), info.GetIsolate()); }
false
CWE-20
c90c6ca59378d7e86d1a2f28fe96bada35df1508
void Browser::TabDeselectedAt(TabContentsWrapper* contents, int index) { if (instant()) instant()->DestroyPreviewContents(); window_->GetLocationBar()->SaveStateToContents(contents->tab_contents()); }
false
CWE-20
7614790c80996d32a28218f4d1605b0908e9ddf6
void MainThreadFrameObserver::Wait() { DCHECK_CURRENTLY_ON(BrowserThread::UI); render_widget_host_->Send(new ViewMsg_WaitForNextFrameForTests( render_widget_host_->GetRoutingID(), routing_id_)); run_loop_.reset(new base::RunLoop()); run_loop_->Run(); run_loop_.reset(nullptr); }
false
CWE-399
c442b3eda2f1fdd4d1d4864c34c43cbaf223acae
void ChromeBrowserMainPartsChromeos::PostProfileInit() { if (parsed_command_line().HasSwitch(switches::kLoginUser) && !parsed_command_line().HasSwitch(switches::kLoginPassword)) { g_browser_process->browser_policy_connector()->SetUserPolicyTokenService( profile()->GetTokenService()); } if (!parameters().ui_task) OptionallyRunChromeOSLoginManager(parsed_command_line(), profile()); ChromeBrowserMainPartsLinux::PostProfileInit(); }
false
CWE-399
d974baa398f34393db76be45f7d4d04fbdbb4a0a
static int handle_ept_misconfig(struct kvm_vcpu *vcpu) { u64 sptes[4]; int nr_sptes, i, ret; gpa_t gpa; gpa = vmcs_read64(GUEST_PHYSICAL_ADDRESS); if (!kvm_io_bus_write(vcpu->kvm, KVM_FAST_MMIO_BUS, gpa, 0, NULL)) { skip_emulated_instruction(vcpu); return 1; } ret = handle_mmio_page_fault_common(vcpu, gpa, true); if (likely(ret == RET_MMIO_PF_EMULATE)) return x86_emulate_instruction(vcpu, gpa, 0, NULL, 0) == EMULATE_DONE; if (unlikely(ret == RET_MMIO_PF_INVALID)) return kvm_mmu_page_fault(vcpu, gpa, 0, NULL, 0); if (unlikely(ret == RET_MMIO_PF_RETRY)) return 1; /* It is the real ept misconfig */ printk(KERN_ERR "EPT: Misconfiguration.\n"); printk(KERN_ERR "EPT: GPA: 0x%llx\n", gpa); nr_sptes = kvm_mmu_get_spte_hierarchy(vcpu, gpa, sptes); for (i = PT64_ROOT_LEVEL; i > PT64_ROOT_LEVEL - nr_sptes; --i) ept_misconfig_inspect_spte(vcpu, sptes[i-1], i); vcpu->run->exit_reason = KVM_EXIT_UNKNOWN; vcpu->run->hw.hardware_exit_reason = EXIT_REASON_EPT_MISCONFIG; return 0; }
false
CWE-119
3475f5e448ddf5e48888f3d0563245cc46e3c98b
void LauncherView::LauncherItemMoved(int start_index, int target_index) { view_model_->Move(start_index, target_index); AnimateToIdealBounds(); }
false
CWE-362
fcd3a7a671ecf2d5f46ea34787d27507a914d2f5
void RemoveFlagsSwitches( std::map<std::string, CommandLine::StringType>* switch_list) { FlagsState::GetInstance()->RemoveFlagsSwitches(switch_list); }
false
CWE-20
0720b02e4f303ea6b114d4ae9453e3a7ff55f8dc
bool PrintJobWorker::Start() { bool result = thread_.Start(); task_runner_ = thread_.task_runner(); return result; }
false