CVE ID
stringlengths
13
43
CVE Page
stringlengths
45
48
CWE ID
stringclasses
90 values
codeLink
stringlengths
46
139
commit_id
stringlengths
6
81
commit_message
stringlengths
3
13.3k
func_after
stringlengths
14
241k
func_before
stringlengths
14
241k
lang
stringclasses
3 values
project
stringclasses
309 values
vul
int8
0
1
CVE-2019-5829
https://www.cvedetails.com/cve/CVE-2019-5829/
CWE-416
https://github.com/chromium/chromium/commit/17368442aec0f48859a3561ae5e441175c7041ba
17368442aec0f48859a3561ae5e441175c7041ba
Early return if a download Id is already used when creating a download This is protect against download Id overflow and use-after-free issue. BUG=958533 Change-Id: I2c183493cb09106686df9822b3987bfb95bcf720 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1591485 Reviewed-by: Xing Liu <xingliu@chromium.org> Commit-Queue: Min Qin <qinmin@chromium.org> Cr-Commit-Position: refs/heads/master@{#656910}
void DownloadManagerImpl::OnHistoryNextIdRetrived(uint32_t next_id) { DCHECK_CURRENTLY_ON(BrowserThread::UI); is_history_download_id_retrieved_ = true; if (next_id == download::DownloadItem::kInvalidId) next_id++; else should_persist_new_download_ = true; SetNextId(next_id); }
void DownloadManagerImpl::OnHistoryNextIdRetrived(uint32_t next_id) { DCHECK_CURRENTLY_ON(BrowserThread::UI); is_history_download_id_retrieved_ = true; if (next_id == download::DownloadItem::kInvalidId) next_id++; else should_persist_new_download_ = true; SetNextId(next_id); }
C
Chrome
0
CVE-2013-1819
https://www.cvedetails.com/cve/CVE-2013-1819/
CWE-20
https://github.com/torvalds/linux/commit/eb178619f930fa2ba2348de332a1ff1c66a31424
eb178619f930fa2ba2348de332a1ff1c66a31424
xfs: fix _xfs_buf_find oops on blocks beyond the filesystem end When _xfs_buf_find is passed an out of range address, it will fail to find a relevant struct xfs_perag and oops with a null dereference. This can happen when trying to walk a filesystem with a metadata inode that has a partially corrupted extent map (i.e. the block number returned is corrupt, but is otherwise intact) and we try to read from the corrupted block address. In this case, just fail the lookup. If it is readahead being issued, it will simply not be done, but if it is real read that fails we will get an error being reported. Ideally this case should result in an EFSCORRUPTED error being reported, but we cannot return an error through xfs_buf_read() or xfs_buf_get() so this lookup failure may result in ENOMEM or EIO errors being reported instead. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Ben Myers <bpm@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
xfs_buf_unlock( struct xfs_buf *bp) { XB_CLEAR_OWNER(bp); up(&bp->b_sema); trace_xfs_buf_unlock(bp, _RET_IP_); }
xfs_buf_unlock( struct xfs_buf *bp) { XB_CLEAR_OWNER(bp); up(&bp->b_sema); trace_xfs_buf_unlock(bp, _RET_IP_); }
C
linux
0
CVE-2016-6156
https://www.cvedetails.com/cve/CVE-2016-6156/
CWE-362
https://github.com/torvalds/linux/commit/096cdc6f52225835ff503f987a0d68ef770bb78e
096cdc6f52225835ff503f987a0d68ef770bb78e
platform/chrome: cros_ec_dev - double fetch bug in ioctl We verify "u_cmd.outsize" and "u_cmd.insize" but we need to make sure that those values have not changed between the two copy_from_user() calls. Otherwise it could lead to a buffer overflow. Additionally, cros_ec_cmd_xfer() can set s_cmd->insize to a lower value. We should use the new smaller value so we don't copy too much data to the user. Reported-by: Pengfei Wang <wpengfeinudt@gmail.com> Fixes: a841178445bb ('mfd: cros_ec: Use a zero-length array for command data') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Kees Cook <keescook@chromium.org> Tested-by: Gwendal Grignou <gwendal@chromium.org> Cc: <stable@vger.kernel.org> # v4.2+ Signed-off-by: Olof Johansson <olof@lixom.net>
static int ec_device_open(struct inode *inode, struct file *filp) { struct cros_ec_dev *ec = container_of(inode->i_cdev, struct cros_ec_dev, cdev); filp->private_data = ec; nonseekable_open(inode, filp); return 0; }
static int ec_device_open(struct inode *inode, struct file *filp) { struct cros_ec_dev *ec = container_of(inode->i_cdev, struct cros_ec_dev, cdev); filp->private_data = ec; nonseekable_open(inode, filp); return 0; }
C
linux
0
CVE-2016-9120
https://www.cvedetails.com/cve/CVE-2016-9120/
CWE-416
https://github.com/torvalds/linux/commit/9590232bb4f4cc824f3425a6e1349afbe6d6d2b7
9590232bb4f4cc824f3425a6e1349afbe6d6d2b7
staging/android/ion : fix a race condition in the ion driver There is a use-after-free problem in the ion driver. This is caused by a race condition in the ion_ioctl() function. A handle has ref count of 1 and two tasks on different cpus calls ION_IOC_FREE simultaneously. cpu 0 cpu 1 ------------------------------------------------------- ion_handle_get_by_id() (ref == 2) ion_handle_get_by_id() (ref == 3) ion_free() (ref == 2) ion_handle_put() (ref == 1) ion_free() (ref == 0 so ion_handle_destroy() is called and the handle is freed.) ion_handle_put() is called and it decreases the slub's next free pointer The problem is detected as an unaligned access in the spin lock functions since it uses load exclusive instruction. In some cases it corrupts the slub's free pointer which causes a mis-aligned access to the next free pointer.(kmalloc returns a pointer like ffffc0745b4580aa). And it causes lots of other hard-to-debug problems. This symptom is caused since the first member in the ion_handle structure is the reference count and the ion driver decrements the reference after it has been freed. To fix this problem client->lock mutex is extended to protect all the codes that uses the handle. Signed-off-by: Eun Taik Lee <eun.taik.lee@samsung.com> Reviewed-by: Laura Abbott <labbott@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
void *ion_map_kernel(struct ion_client *client, struct ion_handle *handle) { struct ion_buffer *buffer; void *vaddr; mutex_lock(&client->lock); if (!ion_handle_validate(client, handle)) { pr_err("%s: invalid handle passed to map_kernel.\n", __func__); mutex_unlock(&client->lock); return ERR_PTR(-EINVAL); } buffer = handle->buffer; if (!handle->buffer->heap->ops->map_kernel) { pr_err("%s: map_kernel is not implemented by this heap.\n", __func__); mutex_unlock(&client->lock); return ERR_PTR(-ENODEV); } mutex_lock(&buffer->lock); vaddr = ion_handle_kmap_get(handle); mutex_unlock(&buffer->lock); mutex_unlock(&client->lock); return vaddr; }
void *ion_map_kernel(struct ion_client *client, struct ion_handle *handle) { struct ion_buffer *buffer; void *vaddr; mutex_lock(&client->lock); if (!ion_handle_validate(client, handle)) { pr_err("%s: invalid handle passed to map_kernel.\n", __func__); mutex_unlock(&client->lock); return ERR_PTR(-EINVAL); } buffer = handle->buffer; if (!handle->buffer->heap->ops->map_kernel) { pr_err("%s: map_kernel is not implemented by this heap.\n", __func__); mutex_unlock(&client->lock); return ERR_PTR(-ENODEV); } mutex_lock(&buffer->lock); vaddr = ion_handle_kmap_get(handle); mutex_unlock(&buffer->lock); mutex_unlock(&client->lock); return vaddr; }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/3a353ebdb7753a3fbeb401c4c0e0f3358ccbb90b
3a353ebdb7753a3fbeb401c4c0e0f3358ccbb90b
Support pausing media when a context is frozen. Media is resumed when the context is unpaused. This feature will be used for bfcache and pausing iframes feature policy. BUG=907125 Change-Id: Ic3925ea1a4544242b7bf0b9ad8c9cb9f63976bbd Reviewed-on: https://chromium-review.googlesource.com/c/1410126 Commit-Queue: Dave Tapuska <dtapuska@chromium.org> Reviewed-by: Kentaro Hara <haraken@chromium.org> Reviewed-by: Mounir Lamouri <mlamouri@chromium.org> Cr-Commit-Position: refs/heads/master@{#623319}
void HTMLMediaElement::SetShouldDelayLoadEvent(bool should_delay) { if (should_delay_load_event_ == should_delay) return; BLINK_MEDIA_LOG << "setShouldDelayLoadEvent(" << (void*)this << ", " << BoolString(should_delay) << ")"; should_delay_load_event_ = should_delay; if (should_delay) GetDocument().IncrementLoadEventDelayCount(); else GetDocument().DecrementLoadEventDelayCount(); }
void HTMLMediaElement::SetShouldDelayLoadEvent(bool should_delay) { if (should_delay_load_event_ == should_delay) return; BLINK_MEDIA_LOG << "setShouldDelayLoadEvent(" << (void*)this << ", " << BoolString(should_delay) << ")"; should_delay_load_event_ = should_delay; if (should_delay) GetDocument().IncrementLoadEventDelayCount(); else GetDocument().DecrementLoadEventDelayCount(); }
C
Chrome
0
CVE-2011-3055
https://www.cvedetails.com/cve/CVE-2011-3055/
null
https://github.com/chromium/chromium/commit/e9372a1bfd3588a80fcf49aa07321f0971dd6091
e9372a1bfd3588a80fcf49aa07321f0971dd6091
[V8] Pass Isolate to throwNotEnoughArgumentsError() https://bugs.webkit.org/show_bug.cgi?id=86983 Reviewed by Adam Barth. The objective is to pass Isolate around in V8 bindings. This patch passes Isolate to throwNotEnoughArgumentsError(). No tests. No change in behavior. * bindings/scripts/CodeGeneratorV8.pm: (GenerateArgumentsCountCheck): (GenerateEventConstructorCallback): * bindings/scripts/test/V8/V8Float64Array.cpp: (WebCore::Float64ArrayV8Internal::fooCallback): * bindings/scripts/test/V8/V8TestActiveDOMObject.cpp: (WebCore::TestActiveDOMObjectV8Internal::excitingFunctionCallback): (WebCore::TestActiveDOMObjectV8Internal::postMessageCallback): * bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp: (WebCore::TestCustomNamedGetterV8Internal::anotherFunctionCallback): * bindings/scripts/test/V8/V8TestEventConstructor.cpp: (WebCore::V8TestEventConstructor::constructorCallback): * bindings/scripts/test/V8/V8TestEventTarget.cpp: (WebCore::TestEventTargetV8Internal::itemCallback): (WebCore::TestEventTargetV8Internal::dispatchEventCallback): * bindings/scripts/test/V8/V8TestInterface.cpp: (WebCore::TestInterfaceV8Internal::supplementalMethod2Callback): (WebCore::V8TestInterface::constructorCallback): * bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp: (WebCore::TestMediaQueryListListenerV8Internal::methodCallback): * bindings/scripts/test/V8/V8TestNamedConstructor.cpp: (WebCore::V8TestNamedConstructorConstructorCallback): * bindings/scripts/test/V8/V8TestObj.cpp: (WebCore::TestObjV8Internal::voidMethodWithArgsCallback): (WebCore::TestObjV8Internal::intMethodWithArgsCallback): (WebCore::TestObjV8Internal::objMethodWithArgsCallback): (WebCore::TestObjV8Internal::methodWithSequenceArgCallback): (WebCore::TestObjV8Internal::methodReturningSequenceCallback): (WebCore::TestObjV8Internal::methodThatRequiresAllArgsAndThrowsCallback): (WebCore::TestObjV8Internal::serializedValueCallback): (WebCore::TestObjV8Internal::idbKeyCallback): (WebCore::TestObjV8Internal::optionsObjectCallback): (WebCore::TestObjV8Internal::methodWithNonOptionalArgAndOptionalArgCallback): (WebCore::TestObjV8Internal::methodWithNonOptionalArgAndTwoOptionalArgsCallback): (WebCore::TestObjV8Internal::methodWithCallbackArgCallback): (WebCore::TestObjV8Internal::methodWithNonCallbackArgAndCallbackArgCallback): (WebCore::TestObjV8Internal::overloadedMethod1Callback): (WebCore::TestObjV8Internal::overloadedMethod2Callback): (WebCore::TestObjV8Internal::overloadedMethod3Callback): (WebCore::TestObjV8Internal::overloadedMethod4Callback): (WebCore::TestObjV8Internal::overloadedMethod5Callback): (WebCore::TestObjV8Internal::overloadedMethod6Callback): (WebCore::TestObjV8Internal::overloadedMethod7Callback): (WebCore::TestObjV8Internal::overloadedMethod11Callback): (WebCore::TestObjV8Internal::overloadedMethod12Callback): (WebCore::TestObjV8Internal::enabledAtRuntimeMethod1Callback): (WebCore::TestObjV8Internal::enabledAtRuntimeMethod2Callback): (WebCore::TestObjV8Internal::convert1Callback): (WebCore::TestObjV8Internal::convert2Callback): (WebCore::TestObjV8Internal::convert3Callback): (WebCore::TestObjV8Internal::convert4Callback): (WebCore::TestObjV8Internal::convert5Callback): (WebCore::TestObjV8Internal::strictFunctionCallback): (WebCore::V8TestObj::constructorCallback): * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp: (WebCore::TestSerializedScriptValueInterfaceV8Internal::acceptTransferListCallback): (WebCore::V8TestSerializedScriptValueInterface::constructorCallback): * bindings/v8/ScriptController.cpp: (WebCore::setValueAndClosePopupCallback): * bindings/v8/V8Proxy.cpp: (WebCore::V8Proxy::throwNotEnoughArgumentsError): * bindings/v8/V8Proxy.h: (V8Proxy): * bindings/v8/custom/V8AudioContextCustom.cpp: (WebCore::V8AudioContext::constructorCallback): * bindings/v8/custom/V8DataViewCustom.cpp: (WebCore::V8DataView::getInt8Callback): (WebCore::V8DataView::getUint8Callback): (WebCore::V8DataView::setInt8Callback): (WebCore::V8DataView::setUint8Callback): * bindings/v8/custom/V8DirectoryEntryCustom.cpp: (WebCore::V8DirectoryEntry::getDirectoryCallback): (WebCore::V8DirectoryEntry::getFileCallback): * bindings/v8/custom/V8IntentConstructor.cpp: (WebCore::V8Intent::constructorCallback): * bindings/v8/custom/V8SVGLengthCustom.cpp: (WebCore::V8SVGLength::convertToSpecifiedUnitsCallback): * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp: (WebCore::getObjectParameter): (WebCore::V8WebGLRenderingContext::getAttachedShadersCallback): (WebCore::V8WebGLRenderingContext::getExtensionCallback): (WebCore::V8WebGLRenderingContext::getFramebufferAttachmentParameterCallback): (WebCore::V8WebGLRenderingContext::getParameterCallback): (WebCore::V8WebGLRenderingContext::getProgramParameterCallback): (WebCore::V8WebGLRenderingContext::getShaderParameterCallback): (WebCore::V8WebGLRenderingContext::getUniformCallback): (WebCore::vertexAttribAndUniformHelperf): (WebCore::uniformHelperi): (WebCore::uniformMatrixHelper): * bindings/v8/custom/V8WebKitMutationObserverCustom.cpp: (WebCore::V8WebKitMutationObserver::constructorCallback): (WebCore::V8WebKitMutationObserver::observeCallback): * bindings/v8/custom/V8WebSocketCustom.cpp: (WebCore::V8WebSocket::constructorCallback): (WebCore::V8WebSocket::sendCallback): * bindings/v8/custom/V8XMLHttpRequestCustom.cpp: (WebCore::V8XMLHttpRequest::openCallback): git-svn-id: svn://svn.chromium.org/blink/trunk@117736 bbb929c8-8fbe-4397-9dbb-9b2b20218538
static v8::Handle<v8::Value> longLongAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.TestObj.longLongAttr._get"); TestObj* imp = V8TestObj::toNative(info.Holder()); return v8::Number::New(static_cast<double>(imp->longLongAttr())); }
static v8::Handle<v8::Value> longLongAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.TestObj.longLongAttr._get"); TestObj* imp = V8TestObj::toNative(info.Holder()); return v8::Number::New(static_cast<double>(imp->longLongAttr())); }
C
Chrome
0
CVE-2019-5818
https://www.cvedetails.com/cve/CVE-2019-5818/
CWE-200
https://github.com/chromium/chromium/commit/929f77d4173022a731ae91218ce6894d20f87f35
929f77d4173022a731ae91218ce6894d20f87f35
Cleanup media BitReader ReadBits() calls Initialize temporary values, check return values. Small tweaks to solution proposed by adtolbar@microsoft.com. Bug: 929962 Change-Id: Iaa7da7534174882d040ec7e4c353ba5cd0da5735 Reviewed-on: https://chromium-review.googlesource.com/c/1481085 Commit-Queue: Chrome Cunningham <chcunningham@chromium.org> Reviewed-by: Dan Sanders <sandersd@chromium.org> Cr-Commit-Position: refs/heads/master@{#634889}
static int Read16(const uint8_t* p) { return p[0] << 8 | p[1]; }
static int Read16(const uint8_t* p) { return p[0] << 8 | p[1]; }
C
Chrome
0
CVE-2011-2918
https://www.cvedetails.com/cve/CVE-2011-2918/
CWE-399
https://github.com/torvalds/linux/commit/a8b0ca17b80e92faab46ee7179ba9e99ccb61233
a8b0ca17b80e92faab46ee7179ba9e99ccb61233
perf: Remove the nmi parameter from the swevent and overflow interface The nmi parameter indicated if we could do wakeups from the current context, if not, we would set some state and self-IPI and let the resulting interrupt do the wakeup. For the various event classes: - hardware: nmi=0; PMI is in fact an NMI or we run irq_work_run from the PMI-tail (ARM etc.) - tracepoint: nmi=0; since tracepoint could be from NMI context. - software: nmi=[0,1]; some, like the schedule thing cannot perform wakeups, and hence need 0. As one can see, there is very little nmi=1 usage, and the down-side of not using it is that on some platforms some software events can have a jiffy delay in wakeup (when arch_irq_work_raise isn't implemented). The up-side however is that we can remove the nmi parameter and save a bunch of conditionals in fast paths. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Michael Cree <mcree@orcon.net.nz> Cc: Will Deacon <will.deacon@arm.com> Cc: Deng-Cheng Zhu <dengcheng.zhu@gmail.com> Cc: Anton Blanchard <anton@samba.org> Cc: Eric B Munson <emunson@mgebm.net> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Paul Mundt <lethal@linux-sh.org> Cc: David S. Miller <davem@davemloft.net> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jason Wessel <jason.wessel@windriver.com> Cc: Don Zickus <dzickus@redhat.com> Link: http://lkml.kernel.org/n/tip-agjev8eu666tvknpb3iaj0fg@git.kernel.org Signed-off-by: Ingo Molnar <mingo@elte.hu>
static void sample_hbp_handler(struct perf_event *bp, int nmi, static void sample_hbp_handler(struct perf_event *bp, struct perf_sample_data *data, struct pt_regs *regs) { printk(KERN_INFO "%s value is changed\n", ksym_name); dump_stack(); printk(KERN_INFO "Dump stack from sample_hbp_handler\n"); }
static void sample_hbp_handler(struct perf_event *bp, int nmi, struct perf_sample_data *data, struct pt_regs *regs) { printk(KERN_INFO "%s value is changed\n", ksym_name); dump_stack(); printk(KERN_INFO "Dump stack from sample_hbp_handler\n"); }
C
linux
1
CVE-2018-11645
https://www.cvedetails.com/cve/CVE-2018-11645/
CWE-200
http://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=b60d50b7567369ad856cebe1efb6cd7dd2284219
b60d50b7567369ad856cebe1efb6cd7dd2284219
null
lib_file_open_search_with_no_combine(gs_file_path_ptr lib_path, const gs_memory_t *mem, i_ctx_t *i_ctx_p, const char *fname, uint flen, char *buffer, int blen, uint *pclen, ref *pfile, gx_io_device *iodev, bool starting_arg_file, char *fmode) { stream *s; uint blen1 = blen; struct stat fstat; if (gp_file_name_reduce(fname, flen, buffer, &blen1) != gp_combine_success) goto skip; if (starting_arg_file || check_file_permissions_aux(i_ctx_p, buffer, blen1) >= 0) { if (iodev_os_open_file(iodev, (const char *)buffer, blen1, (const char *)fmode, &s, (gs_memory_t *)mem) == 0) { *pclen = blen1; make_stream_file(pfile, s, "r"); return 0; } } else { /* If we are not allowed to open the file by check_file_permissions_aux() * and if the file exists, throw an error....... * Otherwise, keep searching. */ if ((*iodev->procs.file_status)(iodev, buffer, &fstat) >= 0) { return_error(gs_error_invalidfileaccess); } } skip: return 1; }
lib_file_open_search_with_no_combine(gs_file_path_ptr lib_path, const gs_memory_t *mem, i_ctx_t *i_ctx_p, const char *fname, uint flen, char *buffer, int blen, uint *pclen, ref *pfile, gx_io_device *iodev, bool starting_arg_file, char *fmode) { stream *s; uint blen1 = blen; struct stat fstat; if (gp_file_name_reduce(fname, flen, buffer, &blen1) != gp_combine_success) goto skip; if (starting_arg_file || check_file_permissions_aux(i_ctx_p, buffer, blen1) >= 0) { if (iodev_os_open_file(iodev, (const char *)buffer, blen1, (const char *)fmode, &s, (gs_memory_t *)mem) == 0) { *pclen = blen1; make_stream_file(pfile, s, "r"); return 0; } } else { /* If we are not allowed to open the file by check_file_permissions_aux() * and if the file exists, throw an error....... * Otherwise, keep searching. */ if ((*iodev->procs.file_status)(iodev, buffer, &fstat) >= 0) { return_error(gs_error_invalidfileaccess); } } skip: return 1; }
C
ghostscript
0
CVE-2018-6158
https://www.cvedetails.com/cve/CVE-2018-6158/
CWE-362
https://github.com/chromium/chromium/commit/20b65d00ca3d8696430e22efad7485366f8c3a21
20b65d00ca3d8696430e22efad7485366f8c3a21
[oilpan] Fix GCInfoTable for multiple threads Previously, grow and access from different threads could lead to a race on the table backing; see bug. - Rework the table to work on an existing reservation. - Commit upon growing, avoiding any copies. Drive-by: Fix over-allocation of table. Bug: chromium:841280 Change-Id: I329cb6f40091e14e8c05334ba1104a9440c31d43 Reviewed-on: https://chromium-review.googlesource.com/1061525 Commit-Queue: Michael Lippautz <mlippautz@chromium.org> Reviewed-by: Kentaro Hara <haraken@chromium.org> Cr-Commit-Position: refs/heads/master@{#560434}
void GCInfoTable::EnsureGCInfoIndex(const GCInfo* gc_info, size_t* gc_info_index_slot) { DCHECK(gc_info); DCHECK(gc_info_index_slot); // Ensuring a new index involves current index adjustment as well // as potentially resizing the table, both operations that require // a lock. MutexLocker locker(table_mutex_); if (*gc_info_index_slot) return; int index = ++current_index_; size_t gc_info_index = static_cast<size_t>(index); CHECK(gc_info_index < GCInfoTable::kMaxIndex); if (current_index_ >= limit_) Resize(); table_[gc_info_index] = gc_info; ReleaseStore(reinterpret_cast<int*>(gc_info_index_slot), index); }
void GCInfoTable::EnsureGCInfoIndex(const GCInfo* gc_info, size_t* gc_info_index_slot) { DCHECK(gc_info); DCHECK(gc_info_index_slot); DEFINE_THREAD_SAFE_STATIC_LOCAL(Mutex, mutex, ()); MutexLocker locker(mutex); if (*gc_info_index_slot) return; int index = ++gc_info_index_; size_t gc_info_index = static_cast<size_t>(index); CHECK(gc_info_index < GCInfoTable::kMaxIndex); if (gc_info_index >= gc_info_table_size_) Resize(); g_gc_info_table[gc_info_index] = gc_info; ReleaseStore(reinterpret_cast<int*>(gc_info_index_slot), index); }
C
Chrome
1
CVE-2017-5122
https://www.cvedetails.com/cve/CVE-2017-5122/
CWE-119
https://github.com/chromium/chromium/commit/f8675cbb337440a11bf9afb10ea11bae42bb92cb
f8675cbb337440a11bf9afb10ea11bae42bb92cb
cros: Enable some tests in //ash/wm in ash_unittests --mash For the ones that fail, disable them via filter file instead of in the code, per our disablement policy. Bug: 698085, 695556, 698878, 698888, 698093, 698894 Test: ash_unittests --mash Change-Id: Ic145ab6a95508968d6884d14fac2a3ca08888d26 Reviewed-on: https://chromium-review.googlesource.com/752423 Commit-Queue: James Cook <jamescook@chromium.org> Reviewed-by: Steven Bennetts <stevenjb@chromium.org> Cr-Commit-Position: refs/heads/master@{#513836}
virtual ~PanelWindowResizerTransientTest() {}
virtual ~PanelWindowResizerTransientTest() {}
C
Chrome
0
CVE-2016-5219
https://www.cvedetails.com/cve/CVE-2016-5219/
CWE-416
https://github.com/chromium/chromium/commit/a4150b688a754d3d10d2ca385155b1c95d77d6ae
a4150b688a754d3d10d2ca385155b1c95d77d6ae
Add GL_PROGRAM_COMPLETION_QUERY_CHROMIUM This makes the query of GL_COMPLETION_STATUS_KHR to programs much cheaper by minimizing the round-trip to the GPU thread. Bug: 881152, 957001 Change-Id: Iadfa798af29225e752c710ca5c25f50b3dd3101a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1586630 Commit-Queue: Kenneth Russell <kbr@chromium.org> Reviewed-by: Kentaro Hara <haraken@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Cr-Commit-Position: refs/heads/master@{#657568}
error::Error GLES2DecoderPassthroughImpl::DoBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format) { api()->glBindImageTextureEXTFn( unit, GetTextureServiceID(api(), texture, resources_, bind_generates_resource_), level, layered, layer, access, format); return error::kNoError; }
error::Error GLES2DecoderPassthroughImpl::DoBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format) { api()->glBindImageTextureEXTFn( unit, GetTextureServiceID(api(), texture, resources_, bind_generates_resource_), level, layered, layer, access, format); return error::kNoError; }
C
Chrome
0
CVE-2011-3964
https://www.cvedetails.com/cve/CVE-2011-3964/
null
https://github.com/chromium/chromium/commit/0c14577c9905bd8161159ec7eaac810c594508d0
0c14577c9905bd8161159ec7eaac810c594508d0
Change omnibox behavior when stripping javascript schema to navigate after stripping the schema on drag drop. BUG=109245 TEST=N/A Review URL: http://codereview.chromium.org/9116016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116692 0039d316-1c4b-4281-b951-d872f2087c98
LRESULT OmniboxViewWin::OnGetObject(UINT message, WPARAM wparam, LPARAM lparam) { if (lparam == OBJID_CLIENT) { return LresultFromObject(IID_IAccessible, wparam, native_view_host_->GetNativeViewAccessible()); } return 0; }
LRESULT OmniboxViewWin::OnGetObject(UINT message, WPARAM wparam, LPARAM lparam) { if (lparam == OBJID_CLIENT) { return LresultFromObject(IID_IAccessible, wparam, native_view_host_->GetNativeViewAccessible()); } return 0; }
C
Chrome
0
CVE-2016-3713
https://www.cvedetails.com/cve/CVE-2016-3713/
CWE-284
https://github.com/torvalds/linux/commit/9842df62004f366b9fed2423e24df10542ee0dc5
9842df62004f366b9fed2423e24df10542ee0dc5
KVM: MTRR: remove MSR 0x2f8 MSR 0x2f8 accessed the 124th Variable Range MTRR ever since MTRR support was introduced by 9ba075a664df ("KVM: MTRR support"). 0x2f8 became harmful when 910a6aae4e2e ("KVM: MTRR: exactly define the size of variable MTRRs") shrinked the array of VR MTRRs from 256 to 8, which made access to index 124 out of bounds. The surrounding code only WARNs in this situation, thus the guest gained a limited read/write access to struct kvm_arch_vcpu. 0x2f8 is not a valid VR MTRR MSR, because KVM has/advertises only 16 VR MTRR MSRs, 0x200-0x20f. Every VR MTRR is set up using two MSRs, 0x2f8 was treated as a PHYSBASE and 0x2f9 would be its PHYSMASK, but 0x2f9 was not implemented in KVM, therefore 0x2f8 could never do anything useful and getting rid of it is safe. This fixes CVE-2016-3713. Fixes: 910a6aae4e2e ("KVM: MTRR: exactly define the size of variable MTRRs") Cc: stable@vger.kernel.org Reported-by: David Matlack <dmatlack@google.com> Signed-off-by: Andy Honig <ahonig@google.com> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
static int fixed_mtrr_addr_seg_to_range_index(u64 addr, int seg) { struct fixed_mtrr_segment *mtrr_seg; int index; mtrr_seg = &fixed_seg_table[seg]; index = mtrr_seg->range_start; index += (addr - mtrr_seg->start) >> mtrr_seg->range_shift; return index; }
static int fixed_mtrr_addr_seg_to_range_index(u64 addr, int seg) { struct fixed_mtrr_segment *mtrr_seg; int index; mtrr_seg = &fixed_seg_table[seg]; index = mtrr_seg->range_start; index += (addr - mtrr_seg->start) >> mtrr_seg->range_shift; return index; }
C
linux
0
CVE-2013-2878
https://www.cvedetails.com/cve/CVE-2013-2878/
CWE-119
https://github.com/chromium/chromium/commit/09fbb829eab7ee25e90bb4e9c2f4973c6c62d0f3
09fbb829eab7ee25e90bb4e9c2f4973c6c62d0f3
Upgrade a TextIterator ASSERT to a RELEASE_ASSERT as a defensive measure. BUG=156930,177197 R=inferno@chromium.org Review URL: https://codereview.chromium.org/15057010 git-svn-id: svn://svn.chromium.org/blink/trunk@150123 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void TextIterator::emitCharacter(UChar c, Node* textNode, Node* offsetBaseNode, int textStartOffset, int textEndOffset) { m_hasEmitted = true; m_positionNode = textNode; m_positionOffsetBaseNode = offsetBaseNode; m_positionStartOffset = textStartOffset; m_positionEndOffset = textEndOffset; m_singleCharacterBuffer = c; m_textCharacters = &m_singleCharacterBuffer; m_textLength = 1; m_lastTextNodeEndedWithCollapsedSpace = false; m_lastCharacter = c; }
void TextIterator::emitCharacter(UChar c, Node* textNode, Node* offsetBaseNode, int textStartOffset, int textEndOffset) { m_hasEmitted = true; m_positionNode = textNode; m_positionOffsetBaseNode = offsetBaseNode; m_positionStartOffset = textStartOffset; m_positionEndOffset = textEndOffset; m_singleCharacterBuffer = c; m_textCharacters = &m_singleCharacterBuffer; m_textLength = 1; m_lastTextNodeEndedWithCollapsedSpace = false; m_lastCharacter = c; }
C
Chrome
0
CVE-2016-5200
https://www.cvedetails.com/cve/CVE-2016-5200/
CWE-119
https://github.com/chromium/chromium/commit/2f19869af13bbfdcfd682a55c0d2c61c6e102475
2f19869af13bbfdcfd682a55c0d2c61c6e102475
chrome/browser/ui/webauthn: long domains may cause a line break. As requested by UX in [1], allow long host names to split a title into two lines. This allows us to show more of the name before eliding, although sufficiently long names will still trigger elision. Screenshot at https://drive.google.com/open?id=1_V6t2CeZDAVazy3Px-OET2LnB__aEW1r. [1] https://docs.google.com/presentation/d/1TtxkPUchyVZulqgdMcfui-68B0W-DWaFFVJEffGIbLA/edit#slide=id.g5913c4105f_1_12 Change-Id: I70f6541e0db3e9942239304de43b487a7561ca34 Bug: 870892 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1601812 Auto-Submit: Adam Langley <agl@chromium.org> Commit-Queue: Nina Satragno <nsatragno@chromium.org> Reviewed-by: Nina Satragno <nsatragno@chromium.org> Cr-Commit-Position: refs/heads/master@{#658114}
AuthenticatorGenericErrorSheetModel::ForMissingResidentKeysSupport( AuthenticatorRequestDialogModel* dialog_model) { return base::WrapUnique(new AuthenticatorGenericErrorSheetModel( dialog_model, l10n_util::GetStringUTF16(IDS_WEBAUTHN_ERROR_MISSING_CAPABILITY_TITLE), l10n_util::GetStringUTF16(IDS_WEBAUTHN_MISSING_RESIDENT_KEYS_DESC))); }
AuthenticatorGenericErrorSheetModel::ForMissingResidentKeysSupport( AuthenticatorRequestDialogModel* dialog_model) { return base::WrapUnique(new AuthenticatorGenericErrorSheetModel( dialog_model, l10n_util::GetStringUTF16(IDS_WEBAUTHN_ERROR_MISSING_CAPABILITY_TITLE), l10n_util::GetStringUTF16(IDS_WEBAUTHN_MISSING_RESIDENT_KEYS_DESC))); }
C
Chrome
0
CVE-2013-2908
https://www.cvedetails.com/cve/CVE-2013-2908/
null
https://github.com/chromium/chromium/commit/7edf2c655761e7505950013e62c89e3bd2f7e6dc
7edf2c655761e7505950013e62c89e3bd2f7e6dc
Call didAccessInitialDocument when javascript: URLs are used. BUG=265221 TEST=See bug for repro. Review URL: https://chromiumcodereview.appspot.com/22572004 git-svn-id: svn://svn.chromium.org/blink/trunk@155790 bbb929c8-8fbe-4397-9dbb-9b2b20218538
static String resourceString(const v8::Handle<v8::Function> function) { String resourceName; int lineNumber; resourceInfo(function, resourceName, lineNumber); StringBuilder builder; builder.append(resourceName); builder.append(':'); builder.appendNumber(lineNumber); return builder.toString(); }
static String resourceString(const v8::Handle<v8::Function> function) { String resourceName; int lineNumber; resourceInfo(function, resourceName, lineNumber); StringBuilder builder; builder.append(resourceName); builder.append(':'); builder.appendNumber(lineNumber); return builder.toString(); }
C
Chrome
0
CVE-2012-5143
https://www.cvedetails.com/cve/CVE-2012-5143/
CWE-190
https://github.com/chromium/chromium/commit/ad103a1564365c95f4ee4f10261f9604f91f686a
ad103a1564365c95f4ee4f10261f9604f91f686a
Security fix: integer overflow on checking image size Test is left in another CL (codereview.chromiu,.org/11274036) to avoid conflict there. Hope it's fine. BUG=160926 Review URL: https://chromiumcodereview.appspot.com/11410081 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167882 0039d316-1c4b-4281-b951-d872f2087c98
skia::PlatformCanvas* ImageDataPlatformBackend::GetPlatformCanvas() { return mapped_canvas_.get(); }
skia::PlatformCanvas* ImageDataPlatformBackend::GetPlatformCanvas() { return mapped_canvas_.get(); }
C
Chrome
0
CVE-2011-4930
https://www.cvedetails.com/cve/CVE-2011-4930/
CWE-134
https://htcondor-git.cs.wisc.edu/?p=condor.git;a=commitdiff;h=5e5571d1a431eb3c61977b6dd6ec90186ef79867
5e5571d1a431eb3c61977b6dd6ec90186ef79867
null
check_params() { #if defined( HPUX ) char* tmp; if( !(tmp = param("ARCH")) ) { fprintf( stderr, "ERROR: %s must know if you are running " "on an HPPA1 or an HPPA2 CPU.\n", myDistro->Get() ); fprintf( stderr, "Normally, we look in %s for your model.\n", "/opt/langtools/lib/sched.models" ); fprintf( stderr, "This file lists all HP models and the " "corresponding CPU type. However,\n" ); fprintf( stderr, "this file does not exist on your machine " "or your model (%s)\n", sysapi_uname_arch() ); fprintf( stderr, "was not listed. You should either explicitly " "set the ARCH parameter\n" ); fprintf( stderr, "in your config source, or install the " "sched.models file.\n" ); exit( 1 ); } else { free( tmp ); } #endif }
check_params() { #if defined( HPUX ) char* tmp; if( !(tmp = param("ARCH")) ) { fprintf( stderr, "ERROR: %s must know if you are running " "on an HPPA1 or an HPPA2 CPU.\n", myDistro->Get() ); fprintf( stderr, "Normally, we look in %s for your model.\n", "/opt/langtools/lib/sched.models" ); fprintf( stderr, "This file lists all HP models and the " "corresponding CPU type. However,\n" ); fprintf( stderr, "this file does not exist on your machine " "or your model (%s)\n", sysapi_uname_arch() ); fprintf( stderr, "was not listed. You should either explicitly " "set the ARCH parameter\n" ); fprintf( stderr, "in your config source, or install the " "sched.models file.\n" ); exit( 1 ); } else { free( tmp ); } #endif }
CPP
htcondor
0
CVE-2013-3231
https://www.cvedetails.com/cve/CVE-2013-3231/
CWE-200
https://github.com/torvalds/linux/commit/c77a4b9cffb6215a15196ec499490d116dfad181
c77a4b9cffb6215a15196ec499490d116dfad181
llc: Fix missing msg_namelen update in llc_ui_recvmsg() For stream sockets the code misses to update the msg_namelen member to 0 and therefore makes net/socket.c leak the local, uninitialized sockaddr_storage variable to userland -- 128 bytes of kernel stack memory. The msg_namelen update is also missing for datagram sockets in case the socket is shutting down during receive. Fix both issues by setting msg_namelen to 0 early. It will be updated later if we're going to fill the msg_name member. Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> Signed-off-by: Mathias Krause <minipli@googlemail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
static inline u8 llc_ui_header_len(struct sock *sk, struct sockaddr_llc *addr) { u8 rc = LLC_PDU_LEN_U; if (addr->sllc_test || addr->sllc_xid) rc = LLC_PDU_LEN_U; else if (sk->sk_type == SOCK_STREAM) rc = LLC_PDU_LEN_I; return rc; }
static inline u8 llc_ui_header_len(struct sock *sk, struct sockaddr_llc *addr) { u8 rc = LLC_PDU_LEN_U; if (addr->sllc_test || addr->sllc_xid) rc = LLC_PDU_LEN_U; else if (sk->sk_type == SOCK_STREAM) rc = LLC_PDU_LEN_I; return rc; }
C
linux
0
CVE-2017-5075
https://www.cvedetails.com/cve/CVE-2017-5075/
CWE-200
https://github.com/chromium/chromium/commit/fea16c8b60ff3d0756d5eb392394963b647bc41a
fea16c8b60ff3d0756d5eb392394963b647bc41a
CSP: Strip the fragment from reported URLs. We should have been stripping the fragment from the URL we report for CSP violations, but we weren't. Now we are, by running the URLs through `stripURLForUseInReport()`, which implements the stripping algorithm from CSP2: https://www.w3.org/TR/CSP2/#strip-uri-for-reporting Eventually, we will migrate more completely to the CSP3 world that doesn't require such detailed stripping, as it exposes less data to the reports, but we're not there yet. BUG=678776 Review-Url: https://codereview.chromium.org/2619783002 Cr-Commit-Position: refs/heads/master@{#458045}
void ContentSecurityPolicy::reportInvalidSandboxFlags( const String& invalidFlags) { logToConsole( "Error while parsing the 'sandbox' Content Security Policy directive: " + invalidFlags); }
void ContentSecurityPolicy::reportInvalidSandboxFlags( const String& invalidFlags) { logToConsole( "Error while parsing the 'sandbox' Content Security Policy directive: " + invalidFlags); }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/fc790462b4f248712bbc8c3734664dd6b05f80f2
fc790462b4f248712bbc8c3734664dd6b05f80f2
Set the job name for the print job on the Mac. BUG=http://crbug.com/29188 TEST=as in bug Review URL: http://codereview.chromium.org/1997016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47056 0039d316-1c4b-4281-b951-d872f2087c98
explicit WriteClipboardTask(Clipboard::ObjectMap* objects) : objects_(objects) {}
explicit WriteClipboardTask(Clipboard::ObjectMap* objects) : objects_(objects) {}
C
Chrome
0
CVE-2016-2485
https://www.cvedetails.com/cve/CVE-2016-2485/
CWE-119
https://android.googlesource.com/platform/frameworks/av/+/7cea5cb64b83d690fe02bc210bbdf08f5a87636f
7cea5cb64b83d690fe02bc210bbdf08f5a87636f
codecs: check OMX buffer size before use in (gsm|g711)dec Bug: 27793163 Bug: 27793367 Change-Id: Iec3de8a237ee2379d87a8371c13e543878c6652c
android::SoftOMXComponent *createSoftOMXComponent( const char *name, const OMX_CALLBACKTYPE *callbacks, OMX_PTR appData, OMX_COMPONENTTYPE **component) { return new android::SoftGSM(name, callbacks, appData, component); }
android::SoftOMXComponent *createSoftOMXComponent( const char *name, const OMX_CALLBACKTYPE *callbacks, OMX_PTR appData, OMX_COMPONENTTYPE **component) { return new android::SoftGSM(name, callbacks, appData, component); }
C
Android
0
CVE-2016-2184
https://www.cvedetails.com/cve/CVE-2016-2184/
null
https://github.com/torvalds/linux/commit/0f886ca12765d20124bd06291c82951fd49a33be
0f886ca12765d20124bd06291c82951fd49a33be
ALSA: usb-audio: Fix NULL dereference in create_fixed_stream_quirk() create_fixed_stream_quirk() may cause a NULL-pointer dereference by accessing the non-existing endpoint when a USB device with a malformed USB descriptor is used. This patch avoids it simply by adding a sanity check of bNumEndpoints before the accesses. Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=971125 Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
static int create_std_midi_quirk(struct snd_usb_audio *chip, struct usb_interface *iface, struct usb_driver *driver, struct usb_host_interface *alts) { struct usb_ms_header_descriptor *mshd; struct usb_ms_endpoint_descriptor *msepd; /* must have the MIDIStreaming interface header descriptor*/ mshd = (struct usb_ms_header_descriptor *)alts->extra; if (alts->extralen < 7 || mshd->bLength < 7 || mshd->bDescriptorType != USB_DT_CS_INTERFACE || mshd->bDescriptorSubtype != USB_MS_HEADER) return -ENODEV; /* must have the MIDIStreaming endpoint descriptor*/ msepd = (struct usb_ms_endpoint_descriptor *)alts->endpoint[0].extra; if (alts->endpoint[0].extralen < 4 || msepd->bLength < 4 || msepd->bDescriptorType != USB_DT_CS_ENDPOINT || msepd->bDescriptorSubtype != UAC_MS_GENERAL || msepd->bNumEmbMIDIJack < 1 || msepd->bNumEmbMIDIJack > 16) return -ENODEV; return create_any_midi_quirk(chip, iface, driver, NULL); }
static int create_std_midi_quirk(struct snd_usb_audio *chip, struct usb_interface *iface, struct usb_driver *driver, struct usb_host_interface *alts) { struct usb_ms_header_descriptor *mshd; struct usb_ms_endpoint_descriptor *msepd; /* must have the MIDIStreaming interface header descriptor*/ mshd = (struct usb_ms_header_descriptor *)alts->extra; if (alts->extralen < 7 || mshd->bLength < 7 || mshd->bDescriptorType != USB_DT_CS_INTERFACE || mshd->bDescriptorSubtype != USB_MS_HEADER) return -ENODEV; /* must have the MIDIStreaming endpoint descriptor*/ msepd = (struct usb_ms_endpoint_descriptor *)alts->endpoint[0].extra; if (alts->endpoint[0].extralen < 4 || msepd->bLength < 4 || msepd->bDescriptorType != USB_DT_CS_ENDPOINT || msepd->bDescriptorSubtype != UAC_MS_GENERAL || msepd->bNumEmbMIDIJack < 1 || msepd->bNumEmbMIDIJack > 16) return -ENODEV; return create_any_midi_quirk(chip, iface, driver, NULL); }
C
linux
0
CVE-2017-16939
https://www.cvedetails.com/cve/CVE-2017-16939/
CWE-416
https://github.com/torvalds/linux/commit/1137b5e2529a8f5ca8ee709288ecba3e68044df2
1137b5e2529a8f5ca8ee709288ecba3e68044df2
ipsec: Fix aborted xfrm policy dump crash An independent security researcher, Mohamed Ghannam, has reported this vulnerability to Beyond Security's SecuriTeam Secure Disclosure program. The xfrm_dump_policy_done function expects xfrm_dump_policy to have been called at least once or it will crash. This can be triggered if a dump fails because the target socket's receive buffer is full. This patch fixes it by using the cb->start mechanism to ensure that the initialisation is always done regardless of the buffer situation. Fixes: 12a169e7d8f4 ("ipsec: Put dumpers on the dump list") Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
static int build_acquire(struct sk_buff *skb, struct xfrm_state *x, struct xfrm_tmpl *xt, struct xfrm_policy *xp) { __u32 seq = xfrm_get_acqseq(); struct xfrm_user_acquire *ua; struct nlmsghdr *nlh; int err; nlh = nlmsg_put(skb, 0, 0, XFRM_MSG_ACQUIRE, sizeof(*ua), 0); if (nlh == NULL) return -EMSGSIZE; ua = nlmsg_data(nlh); memcpy(&ua->id, &x->id, sizeof(ua->id)); memcpy(&ua->saddr, &x->props.saddr, sizeof(ua->saddr)); memcpy(&ua->sel, &x->sel, sizeof(ua->sel)); copy_to_user_policy(xp, &ua->policy, XFRM_POLICY_OUT); ua->aalgos = xt->aalgos; ua->ealgos = xt->ealgos; ua->calgos = xt->calgos; ua->seq = x->km.seq = seq; err = copy_to_user_tmpl(xp, skb); if (!err) err = copy_to_user_state_sec_ctx(x, skb); if (!err) err = copy_to_user_policy_type(xp->type, skb); if (!err) err = xfrm_mark_put(skb, &xp->mark); if (err) { nlmsg_cancel(skb, nlh); return err; } nlmsg_end(skb, nlh); return 0; }
static int build_acquire(struct sk_buff *skb, struct xfrm_state *x, struct xfrm_tmpl *xt, struct xfrm_policy *xp) { __u32 seq = xfrm_get_acqseq(); struct xfrm_user_acquire *ua; struct nlmsghdr *nlh; int err; nlh = nlmsg_put(skb, 0, 0, XFRM_MSG_ACQUIRE, sizeof(*ua), 0); if (nlh == NULL) return -EMSGSIZE; ua = nlmsg_data(nlh); memcpy(&ua->id, &x->id, sizeof(ua->id)); memcpy(&ua->saddr, &x->props.saddr, sizeof(ua->saddr)); memcpy(&ua->sel, &x->sel, sizeof(ua->sel)); copy_to_user_policy(xp, &ua->policy, XFRM_POLICY_OUT); ua->aalgos = xt->aalgos; ua->ealgos = xt->ealgos; ua->calgos = xt->calgos; ua->seq = x->km.seq = seq; err = copy_to_user_tmpl(xp, skb); if (!err) err = copy_to_user_state_sec_ctx(x, skb); if (!err) err = copy_to_user_policy_type(xp->type, skb); if (!err) err = xfrm_mark_put(skb, &xp->mark); if (err) { nlmsg_cancel(skb, nlh); return err; } nlmsg_end(skb, nlh); return 0; }
C
linux
0
CVE-2017-15994
https://www.cvedetails.com/cve/CVE-2017-15994/
CWE-354
https://git.samba.org/?p=rsync.git;a=commit;h=c252546ceeb0925eb8a4061315e3ff0a8c55b48b
c252546ceeb0925eb8a4061315e3ff0a8c55b48b
null
int csum_len_for_type(int cst) { switch (cst) { case CSUM_NONE: return 1; case CSUM_MD4_ARCHAIC: return 2; case CSUM_MD4: case CSUM_MD4_OLD: case CSUM_MD4_BUSTED: return MD4_DIGEST_LEN; case CSUM_MD5: return MD5_DIGEST_LEN; } return 0; }
int csum_len_for_type(int cst) { switch (cst) { case CSUM_NONE: return 1; case CSUM_MD4_ARCHAIC: return 2; case CSUM_MD4: case CSUM_MD4_OLD: case CSUM_MD4_BUSTED: return MD4_DIGEST_LEN; case CSUM_MD5: return MD5_DIGEST_LEN; } return 0; }
C
samba
0
CVE-2017-15423
https://www.cvedetails.com/cve/CVE-2017-15423/
CWE-310
https://github.com/chromium/chromium/commit/a263d1cf62a9c75be6aaafdec88aacfcef1e8fd2
a263d1cf62a9c75be6aaafdec88aacfcef1e8fd2
Roll src/third_party/boringssl/src 664e99a64..696c13bd6 https://boringssl.googlesource.com/boringssl/+log/664e99a6486c293728097c661332f92bf2d847c6..696c13bd6ab78011adfe7b775519c8b7cc82b604 BUG=778101 Change-Id: I8dda4f3db952597148e3c7937319584698d00e1c Reviewed-on: https://chromium-review.googlesource.com/747941 Reviewed-by: Avi Drissman <avi@chromium.org> Reviewed-by: David Benjamin <davidben@chromium.org> Commit-Queue: Steven Valdez <svaldez@chromium.org> Cr-Commit-Position: refs/heads/master@{#513774}
static void Initialize() { display::win::ScreenWin::SetRequestHDRStatusCallback( base::Bind(&HDRProxy::RequestHDRStatus)); }
static void Initialize() { display::win::ScreenWin::SetRequestHDRStatusCallback( base::Bind(&HDRProxy::RequestHDRStatus)); }
C
Chrome
0
CVE-2016-5147
https://www.cvedetails.com/cve/CVE-2016-5147/
CWE-79
https://github.com/chromium/chromium/commit/5472db1c7eca35822219d03be5c817d9a9258c11
5472db1c7eca35822219d03be5c817d9a9258c11
Always call UpdateCompositedScrollOffset, not just for the root layer Bug: 927560 Change-Id: I1d5522aae4f11dd3f5b8947bb089bac1bf19bdb4 Reviewed-on: https://chromium-review.googlesource.com/c/1452701 Reviewed-by: Chris Harrelson <chrishtr@chromium.org> Commit-Queue: Mason Freed <masonfreed@chromium.org> Cr-Commit-Position: refs/heads/master@{#628942}
LayoutBox* PaintLayerScrollableArea::GetLayoutBox() const { return layer_ ? layer_->GetLayoutBox() : nullptr; }
LayoutBox* PaintLayerScrollableArea::GetLayoutBox() const { return layer_ ? layer_->GetLayoutBox() : nullptr; }
C
Chrome
0
CVE-2012-2895
https://www.cvedetails.com/cve/CVE-2012-2895/
CWE-119
https://github.com/chromium/chromium/commit/3475f5e448ddf5e48888f3d0563245cc46e3c98b
3475f5e448ddf5e48888f3d0563245cc46e3c98b
ash: Add launcher overflow bubble. - Host a LauncherView in bubble to display overflown items; - Mouse wheel and two-finger scroll to scroll the LauncherView in bubble in case overflow bubble is overflown; - Fit bubble when items are added/removed; - Keep launcher bar on screen when the bubble is shown; BUG=128054 TEST=Verify launcher overflown items are in a bubble instead of menu. Review URL: https://chromiumcodereview.appspot.com/10659003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146460 0039d316-1c4b-4281-b951-d872f2087c98
bool ShelfLayoutManager::IsVisible() const { return status_->IsVisible() && (state_.visibility_state == VISIBLE || (state_.visibility_state == AUTO_HIDE && state_.auto_hide_state == AUTO_HIDE_SHOWN)); }
bool ShelfLayoutManager::IsVisible() const { return status_->IsVisible() && (state_.visibility_state == VISIBLE || (state_.visibility_state == AUTO_HIDE && state_.auto_hide_state == AUTO_HIDE_SHOWN)); }
C
Chrome
0
CVE-2011-3099
https://www.cvedetails.com/cve/CVE-2011-3099/
CWE-399
https://github.com/chromium/chromium/commit/3bbc818ed1a7b63b8290bbde9ae975956748cb8a
3bbc818ed1a7b63b8290bbde9ae975956748cb8a
[GTK] Inspector should set a default attached height before being attached https://bugs.webkit.org/show_bug.cgi?id=90767 Reviewed by Xan Lopez. We are currently using the minimum attached height in WebKitWebViewBase as the default height for the inspector when attached. It would be easier for WebKitWebViewBase and embedders implementing attach() if the inspector already had an attached height set when it's being attached. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseContainerAdd): Don't initialize inspectorViewHeight. (webkitWebViewBaseSetInspectorViewHeight): Allow to set the inspector view height before having an inpector view, but only queue a resize when the view already has an inspector view. * UIProcess/API/gtk/tests/TestInspector.cpp: (testInspectorDefault): (testInspectorManualAttachDetach): * UIProcess/gtk/WebInspectorProxyGtk.cpp: (WebKit::WebInspectorProxy::platformAttach): Set the default attached height before attach the inspector view. git-svn-id: svn://svn.chromium.org/blink/trunk@124479 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void WebInspectorProxy::platformDidClose() { if (m_inspectorView) g_signal_handlers_disconnect_by_func(m_inspectorView, reinterpret_cast<void*>(inspectorViewDestroyed), this); m_client.didClose(this); if (m_inspectorWindow) { gtk_widget_destroy(m_inspectorWindow); m_inspectorWindow = 0; } m_inspectorView = 0; }
void WebInspectorProxy::platformDidClose() { if (m_inspectorView) g_signal_handlers_disconnect_by_func(m_inspectorView, reinterpret_cast<void*>(inspectorViewDestroyed), this); m_client.didClose(this); if (m_inspectorWindow) { gtk_widget_destroy(m_inspectorWindow); m_inspectorWindow = 0; } m_inspectorView = 0; }
C
Chrome
0
CVE-2018-17206
https://www.cvedetails.com/cve/CVE-2018-17206/
null
https://github.com/openvswitch/ovs/commit/9237a63c47bd314b807cda0bd2216264e82edbe8
9237a63c47bd314b807cda0bd2216264e82edbe8
ofp-actions: Avoid buffer overread in BUNDLE action decoding. Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9052 Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
ofpacts_copy_all(struct ofpbuf *out, const struct ofpbuf *in, bool (*filter)(const struct ofpact *)) { const struct ofpact *a; OFPACT_FOR_EACH (a, in->data, in->size) { if (filter(a)) { ofpact_copy(out, a); } } }
ofpacts_copy_all(struct ofpbuf *out, const struct ofpbuf *in, bool (*filter)(const struct ofpact *)) { const struct ofpact *a; OFPACT_FOR_EACH (a, in->data, in->size) { if (filter(a)) { ofpact_copy(out, a); } } }
C
ovs
0
CVE-2016-0809
https://www.cvedetails.com/cve/CVE-2016-0809/
CWE-264
https://android.googlesource.com/platform/hardware/broadcom/wlan/+/2c5a4fac8bc8198f6a2635ede776f8de40a0c3e1
2c5a4fac8bc8198f6a2635ede776f8de40a0c3e1
Fix use-after-free in wifi_cleanup() Release reference to cmd only after possibly calling getType(). BUG: 25753768 Change-Id: Id2156ce51acec04e8364706cf7eafc7d4adae9eb (cherry picked from commit d7f3cb9915d9ac514393d0ad7767662958054b8f https://googleplex-android-review.git.corp.google.com/#/c/815223)
virtual int handleResponse(WifiEvent& reply) { struct nlattr **tb = reply.attributes(); struct genlmsghdr *gnlh = reply.header(); struct nlattr *mcgrp = NULL; int i; if (!tb[CTRL_ATTR_MCAST_GROUPS]) { ALOGI("No multicast groups found"); return NL_SKIP; } else { } for_each_attr(mcgrp, tb[CTRL_ATTR_MCAST_GROUPS], i) { struct nlattr *tb2[CTRL_ATTR_MCAST_GRP_MAX + 1]; nla_parse(tb2, CTRL_ATTR_MCAST_GRP_MAX, (nlattr *)nla_data(mcgrp), nla_len(mcgrp), NULL); if (!tb2[CTRL_ATTR_MCAST_GRP_NAME] || !tb2[CTRL_ATTR_MCAST_GRP_ID]) { continue; } char *grpName = (char *)nla_data(tb2[CTRL_ATTR_MCAST_GRP_NAME]); int grpNameLen = nla_len(tb2[CTRL_ATTR_MCAST_GRP_NAME]); if (strncmp(grpName, mGroup, grpNameLen) != 0) continue; mId = nla_get_u32(tb2[CTRL_ATTR_MCAST_GRP_ID]); break; } return NL_SKIP; }
virtual int handleResponse(WifiEvent& reply) { struct nlattr **tb = reply.attributes(); struct genlmsghdr *gnlh = reply.header(); struct nlattr *mcgrp = NULL; int i; if (!tb[CTRL_ATTR_MCAST_GROUPS]) { ALOGI("No multicast groups found"); return NL_SKIP; } else { } for_each_attr(mcgrp, tb[CTRL_ATTR_MCAST_GROUPS], i) { struct nlattr *tb2[CTRL_ATTR_MCAST_GRP_MAX + 1]; nla_parse(tb2, CTRL_ATTR_MCAST_GRP_MAX, (nlattr *)nla_data(mcgrp), nla_len(mcgrp), NULL); if (!tb2[CTRL_ATTR_MCAST_GRP_NAME] || !tb2[CTRL_ATTR_MCAST_GRP_ID]) { continue; } char *grpName = (char *)nla_data(tb2[CTRL_ATTR_MCAST_GRP_NAME]); int grpNameLen = nla_len(tb2[CTRL_ATTR_MCAST_GRP_NAME]); if (strncmp(grpName, mGroup, grpNameLen) != 0) continue; mId = nla_get_u32(tb2[CTRL_ATTR_MCAST_GRP_ID]); break; } return NL_SKIP; }
C
Android
0
CVE-2019-5826
null
null
https://github.com/chromium/chromium/commit/eaf2e8bce3855d362e53034bd83f0e3aff8714e4
eaf2e8bce3855d362e53034bd83f0e3aff8714e4
[IndexedDB] Fixed force close during pending connection open During a force close of the database, the connections to that database are iterated and force closed. The iteration method was not safe to modification, and if there was a pending connection waiting to open, that request would execute once all the other connections were destroyed and create a new connection. This change changes the iteration method to account for new connections that are added during the iteration. R=cmp@chromium.org Bug: 941746 Change-Id: If1b3137237dc2920ad369d6ac99c963ed9c57d0c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1522330 Commit-Queue: Daniel Murphy <dmurph@chromium.org> Reviewed-by: Chase Phillips <cmp@chromium.org> Cr-Commit-Position: refs/heads/master@{#640604}
void IndexedDBDatabase::AddObjectStore( IndexedDBObjectStoreMetadata object_store, int64_t new_max_object_store_id) { DCHECK(metadata_.object_stores.find(object_store.id) == metadata_.object_stores.end()); if (new_max_object_store_id != IndexedDBObjectStoreMetadata::kInvalidId) { DCHECK_LT(metadata_.max_object_store_id, new_max_object_store_id); metadata_.max_object_store_id = new_max_object_store_id; } metadata_.object_stores[object_store.id] = std::move(object_store); }
void IndexedDBDatabase::AddObjectStore( IndexedDBObjectStoreMetadata object_store, int64_t new_max_object_store_id) { DCHECK(metadata_.object_stores.find(object_store.id) == metadata_.object_stores.end()); if (new_max_object_store_id != IndexedDBObjectStoreMetadata::kInvalidId) { DCHECK_LT(metadata_.max_object_store_id, new_max_object_store_id); metadata_.max_object_store_id = new_max_object_store_id; } metadata_.object_stores[object_store.id] = std::move(object_store); }
C
Chrome
0
CVE-2016-10048
https://www.cvedetails.com/cve/CVE-2016-10048/
CWE-22
https://github.com/ImageMagick/ImageMagick/commit/fc6080f1321fd21e86ef916195cc110b05d9effb
fc6080f1321fd21e86ef916195cc110b05d9effb
Coder path traversal is not authorized, bug report provided by Masaaki Chida
MagickExport XMLTreeInfo *PruneTagFromXMLTree(XMLTreeInfo *xml_info) { XMLTreeInfo *node; assert(xml_info != (XMLTreeInfo *) NULL); assert((xml_info->signature == MagickSignature) || (((XMLTreeRoot *) xml_info)->signature == MagickSignature)); if (xml_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"..."); if (xml_info->next != (XMLTreeInfo *) NULL) xml_info->next->sibling=xml_info->sibling; if (xml_info->parent != (XMLTreeInfo *) NULL) { node=xml_info->parent->child; if (node == xml_info) xml_info->parent->child=xml_info->ordered; else { while (node->ordered != xml_info) node=node->ordered; node->ordered=node->ordered->ordered; node=xml_info->parent->child; if (strcmp(node->tag,xml_info->tag) != 0) { while (strcmp(node->sibling->tag,xml_info->tag) != 0) node=node->sibling; if (node->sibling != xml_info) node=node->sibling; else node->sibling=(xml_info->next != (XMLTreeInfo *) NULL) ? xml_info->next : node->sibling->sibling; } while ((node->next != (XMLTreeInfo *) NULL) && (node->next != xml_info)) node=node->next; if (node->next != (XMLTreeInfo *) NULL) node->next=node->next->next; } } xml_info->ordered=(XMLTreeInfo *) NULL; xml_info->sibling=(XMLTreeInfo *) NULL; xml_info->next=(XMLTreeInfo *) NULL; return(xml_info); }
MagickExport XMLTreeInfo *PruneTagFromXMLTree(XMLTreeInfo *xml_info) { XMLTreeInfo *node; assert(xml_info != (XMLTreeInfo *) NULL); assert((xml_info->signature == MagickSignature) || (((XMLTreeRoot *) xml_info)->signature == MagickSignature)); if (xml_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"..."); if (xml_info->next != (XMLTreeInfo *) NULL) xml_info->next->sibling=xml_info->sibling; if (xml_info->parent != (XMLTreeInfo *) NULL) { node=xml_info->parent->child; if (node == xml_info) xml_info->parent->child=xml_info->ordered; else { while (node->ordered != xml_info) node=node->ordered; node->ordered=node->ordered->ordered; node=xml_info->parent->child; if (strcmp(node->tag,xml_info->tag) != 0) { while (strcmp(node->sibling->tag,xml_info->tag) != 0) node=node->sibling; if (node->sibling != xml_info) node=node->sibling; else node->sibling=(xml_info->next != (XMLTreeInfo *) NULL) ? xml_info->next : node->sibling->sibling; } while ((node->next != (XMLTreeInfo *) NULL) && (node->next != xml_info)) node=node->next; if (node->next != (XMLTreeInfo *) NULL) node->next=node->next->next; } } xml_info->ordered=(XMLTreeInfo *) NULL; xml_info->sibling=(XMLTreeInfo *) NULL; xml_info->next=(XMLTreeInfo *) NULL; return(xml_info); }
C
ImageMagick
0
CVE-2016-6787
https://www.cvedetails.com/cve/CVE-2016-6787/
CWE-264
https://github.com/torvalds/linux/commit/f63a8daa5812afef4f06c962351687e1ff9ccb2b
f63a8daa5812afef4f06c962351687e1ff9ccb2b
perf: Fix event->ctx locking There have been a few reported issues wrt. the lack of locking around changing event->ctx. This patch tries to address those. It avoids the whole rwsem thing; and while it appears to work, please give it some thought in review. What I did fail at is sensible runtime checks on the use of event->ctx, the RCU use makes it very hard. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: http://lkml.kernel.org/r/20150123125834.209535886@infradead.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
event_sched_in(struct perf_event *event, struct perf_cpu_context *cpuctx, struct perf_event_context *ctx) { u64 tstamp = perf_event_time(event); int ret = 0; lockdep_assert_held(&ctx->lock); if (event->state <= PERF_EVENT_STATE_OFF) return 0; event->state = PERF_EVENT_STATE_ACTIVE; event->oncpu = smp_processor_id(); /* * Unthrottle events, since we scheduled we might have missed several * ticks already, also for a heavily scheduling task there is little * guarantee it'll get a tick in a timely manner. */ if (unlikely(event->hw.interrupts == MAX_INTERRUPTS)) { perf_log_throttle(event, 1); event->hw.interrupts = 0; } /* * The new state must be visible before we turn it on in the hardware: */ smp_wmb(); perf_pmu_disable(event->pmu); if (event->pmu->add(event, PERF_EF_START)) { event->state = PERF_EVENT_STATE_INACTIVE; event->oncpu = -1; ret = -EAGAIN; goto out; } event->tstamp_running += tstamp - event->tstamp_stopped; perf_set_shadow_time(event, ctx, tstamp); if (!is_software_event(event)) cpuctx->active_oncpu++; ctx->nr_active++; if (event->attr.freq && event->attr.sample_freq) ctx->nr_freq++; if (event->attr.exclusive) cpuctx->exclusive = 1; if (is_orphaned_child(event)) schedule_orphans_remove(ctx); out: perf_pmu_enable(event->pmu); return ret; }
event_sched_in(struct perf_event *event, struct perf_cpu_context *cpuctx, struct perf_event_context *ctx) { u64 tstamp = perf_event_time(event); int ret = 0; lockdep_assert_held(&ctx->lock); if (event->state <= PERF_EVENT_STATE_OFF) return 0; event->state = PERF_EVENT_STATE_ACTIVE; event->oncpu = smp_processor_id(); /* * Unthrottle events, since we scheduled we might have missed several * ticks already, also for a heavily scheduling task there is little * guarantee it'll get a tick in a timely manner. */ if (unlikely(event->hw.interrupts == MAX_INTERRUPTS)) { perf_log_throttle(event, 1); event->hw.interrupts = 0; } /* * The new state must be visible before we turn it on in the hardware: */ smp_wmb(); perf_pmu_disable(event->pmu); if (event->pmu->add(event, PERF_EF_START)) { event->state = PERF_EVENT_STATE_INACTIVE; event->oncpu = -1; ret = -EAGAIN; goto out; } event->tstamp_running += tstamp - event->tstamp_stopped; perf_set_shadow_time(event, ctx, tstamp); if (!is_software_event(event)) cpuctx->active_oncpu++; ctx->nr_active++; if (event->attr.freq && event->attr.sample_freq) ctx->nr_freq++; if (event->attr.exclusive) cpuctx->exclusive = 1; if (is_orphaned_child(event)) schedule_orphans_remove(ctx); out: perf_pmu_enable(event->pmu); return ret; }
C
linux
0
CVE-2016-2550
https://www.cvedetails.com/cve/CVE-2016-2550/
CWE-399
https://github.com/torvalds/linux/commit/415e3d3e90ce9e18727e8843ae343eda5a58fad6
415e3d3e90ce9e18727e8843ae343eda5a58fad6
unix: correctly track in-flight fds in sending process user_struct The commit referenced in the Fixes tag incorrectly accounted the number of in-flight fds over a unix domain socket to the original opener of the file-descriptor. This allows another process to arbitrary deplete the original file-openers resource limit for the maximum of open files. Instead the sending processes and its struct cred should be credited. To do so, we add a reference counted struct user_struct pointer to the scm_fp_list and use it to account for the number of inflight unix fds. Fixes: 712f4aad406bb1 ("unix: properly account for FDs passed over unix sockets") Reported-by: David Herrmann <dh.herrmann@gmail.com> Cc: David Herrmann <dh.herrmann@gmail.com> Cc: Willy Tarreau <w@1wt.eu> Cc: Linus Torvalds <torvalds@linux-foundation.org> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: David S. Miller <davem@davemloft.net>
void unix_inflight(struct file *fp) void unix_inflight(struct user_struct *user, struct file *fp) { struct sock *s = unix_get_socket(fp); spin_lock(&unix_gc_lock); if (s) { struct unix_sock *u = unix_sk(s); if (atomic_long_inc_return(&u->inflight) == 1) { BUG_ON(!list_empty(&u->link)); list_add_tail(&u->link, &gc_inflight_list); } else { BUG_ON(list_empty(&u->link)); } unix_tot_inflight++; } user->unix_inflight++; spin_unlock(&unix_gc_lock); }
void unix_inflight(struct file *fp) { struct sock *s = unix_get_socket(fp); spin_lock(&unix_gc_lock); if (s) { struct unix_sock *u = unix_sk(s); if (atomic_long_inc_return(&u->inflight) == 1) { BUG_ON(!list_empty(&u->link)); list_add_tail(&u->link, &gc_inflight_list); } else { BUG_ON(list_empty(&u->link)); } unix_tot_inflight++; } fp->f_cred->user->unix_inflight++; spin_unlock(&unix_gc_lock); }
C
linux
1
CVE-2016-8577
https://www.cvedetails.com/cve/CVE-2016-8577/
CWE-399
https://git.qemu.org/?p=qemu.git;a=commit;h=e95c9a493a5a8d6f969e86c9f19f80ffe6587e19
e95c9a493a5a8d6f969e86c9f19f80ffe6587e19
null
static int v9fs_mark_fids_unreclaim(V9fsPDU *pdu, V9fsPath *path) { int err; V9fsState *s = pdu->s; V9fsFidState *fidp, head_fid; head_fid.next = s->fid_list; for (fidp = s->fid_list; fidp; fidp = fidp->next) { if (fidp->path.size != path->size) { continue; } if (!memcmp(fidp->path.data, path->data, path->size)) { /* Mark the fid non reclaimable. */ fidp->flags |= FID_NON_RECLAIMABLE; /* reopen the file/dir if already closed */ err = v9fs_reopen_fid(pdu, fidp); if (err < 0) { return -1; } /* * Go back to head of fid list because * the list could have got updated when * switched to the worker thread */ if (err == 0) { fidp = &head_fid; } } } return 0; }
static int v9fs_mark_fids_unreclaim(V9fsPDU *pdu, V9fsPath *path) { int err; V9fsState *s = pdu->s; V9fsFidState *fidp, head_fid; head_fid.next = s->fid_list; for (fidp = s->fid_list; fidp; fidp = fidp->next) { if (fidp->path.size != path->size) { continue; } if (!memcmp(fidp->path.data, path->data, path->size)) { /* Mark the fid non reclaimable. */ fidp->flags |= FID_NON_RECLAIMABLE; /* reopen the file/dir if already closed */ err = v9fs_reopen_fid(pdu, fidp); if (err < 0) { return -1; } /* * Go back to head of fid list because * the list could have got updated when * switched to the worker thread */ if (err == 0) { fidp = &head_fid; } } } return 0; }
C
qemu
0
CVE-2014-9766
https://www.cvedetails.com/cve/CVE-2014-9766/
CWE-189
https://cgit.freedesktop.org/pixman/commit/?id=857e40f3d2bc2cfb714913e0cd7e6184cf69aca3
857e40f3d2bc2cfb714913e0cd7e6184cf69aca3
null
create_bits_image_internal (pixman_format_code_t format, int width, int height, uint32_t * bits, int rowstride_bytes, pixman_bool_t clear) { pixman_image_t *image; /* must be a whole number of uint32_t's */ return_val_if_fail ( bits == NULL || (rowstride_bytes % sizeof (uint32_t)) == 0, NULL); return_val_if_fail (PIXMAN_FORMAT_BPP (format) >= PIXMAN_FORMAT_DEPTH (format), NULL); image = _pixman_image_allocate (); if (!image) return NULL; if (!_pixman_bits_image_init (image, format, width, height, bits, rowstride_bytes / (int) sizeof (uint32_t), clear)) { free (image); return NULL; } return image; }
create_bits_image_internal (pixman_format_code_t format, int width, int height, uint32_t * bits, int rowstride_bytes, pixman_bool_t clear) { pixman_image_t *image; /* must be a whole number of uint32_t's */ return_val_if_fail ( bits == NULL || (rowstride_bytes % sizeof (uint32_t)) == 0, NULL); return_val_if_fail (PIXMAN_FORMAT_BPP (format) >= PIXMAN_FORMAT_DEPTH (format), NULL); image = _pixman_image_allocate (); if (!image) return NULL; if (!_pixman_bits_image_init (image, format, width, height, bits, rowstride_bytes / (int) sizeof (uint32_t), clear)) { free (image); return NULL; } return image; }
C
pixman
0
CVE-2018-6096
https://www.cvedetails.com/cve/CVE-2018-6096/
null
https://github.com/chromium/chromium/commit/36f801fdbec07d116a6f4f07bb363f10897d6a51
36f801fdbec07d116a6f4f07bb363f10897d6a51
If a page calls |window.focus()|, kick it out of fullscreen. BUG=776418, 800056 Change-Id: I1880fe600e4814c073f247c43b1c1ac80c8fc017 Reviewed-on: https://chromium-review.googlesource.com/852378 Reviewed-by: Nasko Oskov <nasko@chromium.org> Reviewed-by: Philip Jägenstedt <foolip@chromium.org> Commit-Queue: Avi Drissman <avi@chromium.org> Cr-Commit-Position: refs/heads/master@{#533790}
std::string last_message() { return last_message_; }
std::string last_message() { return last_message_; }
C
Chrome
0
CVE-2013-0895
https://www.cvedetails.com/cve/CVE-2013-0895/
CWE-22
https://github.com/chromium/chromium/commit/23803a58e481e464a787e4b2c461af9e62f03905
23803a58e481e464a787e4b2c461af9e62f03905
Fix creating target paths in file_util_posix CopyDirectory. BUG=167840 Review URL: https://chromiumcodereview.appspot.com/11773018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176659 0039d316-1c4b-4281-b951-d872f2087c98
bool GetInode(const FilePath& path, ino_t* inode) { base::ThreadRestrictions::AssertIOAllowed(); // For call to stat(). struct stat buffer; int result = stat(path.value().c_str(), &buffer); if (result < 0) return false; *inode = buffer.st_ino; return true; }
bool GetInode(const FilePath& path, ino_t* inode) { base::ThreadRestrictions::AssertIOAllowed(); // For call to stat(). struct stat buffer; int result = stat(path.value().c_str(), &buffer); if (result < 0) return false; *inode = buffer.st_ino; return true; }
C
Chrome
0
CVE-2019-1547
https://www.cvedetails.com/cve/CVE-2019-1547/
CWE-311
https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=7c1709c2da5414f5b6133d00a03fc8c5bf996c7a
7c1709c2da5414f5b6133d00a03fc8c5bf996c7a
null
int ERR_load_EC_strings(void) { #ifndef OPENSSL_NO_ERR if (ERR_func_error_string(EC_str_functs[0].error) == NULL) { ERR_load_strings(0, EC_str_functs); ERR_load_strings(0, EC_str_reasons); } #endif return 1; }
int ERR_load_EC_strings(void) { #ifndef OPENSSL_NO_ERR if (ERR_func_error_string(EC_str_functs[0].error) == NULL) { ERR_load_strings(0, EC_str_functs); ERR_load_strings(0, EC_str_reasons); } #endif return 1; }
C
openssl
0
CVE-2013-2870
https://www.cvedetails.com/cve/CVE-2013-2870/
CWE-399
https://github.com/chromium/chromium/commit/ca8cc70b2de822b939f87effc7c2b83bac280a44
ca8cc70b2de822b939f87effc7c2b83bac280a44
Revert a workaround commit for a Use-After-Free crash. Revert a workaround commit r20158 for a Use-After-Free issue (http://crbug.com/244746) because a cleaner CL r207218 is landed. URLRequestContext does not inherit SupportsWeakPtr now. R=mmenke BUG=244746 Review URL: https://chromiumcodereview.appspot.com/16870008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207811 0039d316-1c4b-4281-b951-d872f2087c98
int SocketStream::DoReadTunnelHeadersComplete(int result) { DCHECK_EQ(kTunnelProxy, proxy_mode_); if (result < 0) { next_state_ = STATE_CLOSE; return result; } if (result == 0) { next_state_ = STATE_CLOSE; return ERR_CONNECTION_CLOSED; } tunnel_response_headers_len_ += result; DCHECK(tunnel_response_headers_len_ <= tunnel_response_headers_capacity_); int eoh = HttpUtil::LocateEndOfHeaders( tunnel_response_headers_->headers(), tunnel_response_headers_len_, 0); if (eoh == -1) { if (tunnel_response_headers_len_ >= kMaxTunnelResponseHeadersSize) { next_state_ = STATE_CLOSE; return ERR_RESPONSE_HEADERS_TOO_BIG; } next_state_ = STATE_READ_TUNNEL_HEADERS; return OK; } scoped_refptr<HttpResponseHeaders> headers; headers = new HttpResponseHeaders( HttpUtil::AssembleRawHeaders(tunnel_response_headers_->headers(), eoh)); if (headers->GetParsedHttpVersion() < HttpVersion(1, 0)) { next_state_ = STATE_CLOSE; return ERR_TUNNEL_CONNECTION_FAILED; } switch (headers->response_code()) { case 200: // OK if (is_secure()) { DCHECK_EQ(eoh, tunnel_response_headers_len_); next_state_ = STATE_SSL_CONNECT; } else { result = DidEstablishConnection(); if (result < 0) { next_state_ = STATE_CLOSE; return result; } if ((eoh < tunnel_response_headers_len_) && delegate_) delegate_->OnReceivedData( this, tunnel_response_headers_->headers() + eoh, tunnel_response_headers_len_ - eoh); } return OK; case 407: // Proxy Authentication Required. if (proxy_mode_ != kTunnelProxy) return ERR_UNEXPECTED_PROXY_AUTH; result = proxy_auth_controller_->HandleAuthChallenge( headers, false, true, net_log_); if (result != OK) return result; DCHECK(!proxy_info_.is_empty()); next_state_ = STATE_AUTH_REQUIRED; if (proxy_auth_controller_->HaveAuth()) { base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&SocketStream::DoRestartWithAuth, this)); return ERR_IO_PENDING; } if (delegate_) { base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&SocketStream::DoAuthRequired, this)); return ERR_IO_PENDING; } break; default: break; } next_state_ = STATE_CLOSE; return ERR_TUNNEL_CONNECTION_FAILED; }
int SocketStream::DoReadTunnelHeadersComplete(int result) { DCHECK_EQ(kTunnelProxy, proxy_mode_); if (result < 0) { next_state_ = STATE_CLOSE; return result; } if (result == 0) { next_state_ = STATE_CLOSE; return ERR_CONNECTION_CLOSED; } tunnel_response_headers_len_ += result; DCHECK(tunnel_response_headers_len_ <= tunnel_response_headers_capacity_); int eoh = HttpUtil::LocateEndOfHeaders( tunnel_response_headers_->headers(), tunnel_response_headers_len_, 0); if (eoh == -1) { if (tunnel_response_headers_len_ >= kMaxTunnelResponseHeadersSize) { next_state_ = STATE_CLOSE; return ERR_RESPONSE_HEADERS_TOO_BIG; } next_state_ = STATE_READ_TUNNEL_HEADERS; return OK; } scoped_refptr<HttpResponseHeaders> headers; headers = new HttpResponseHeaders( HttpUtil::AssembleRawHeaders(tunnel_response_headers_->headers(), eoh)); if (headers->GetParsedHttpVersion() < HttpVersion(1, 0)) { next_state_ = STATE_CLOSE; return ERR_TUNNEL_CONNECTION_FAILED; } switch (headers->response_code()) { case 200: // OK if (is_secure()) { DCHECK_EQ(eoh, tunnel_response_headers_len_); next_state_ = STATE_SSL_CONNECT; } else { result = DidEstablishConnection(); if (result < 0) { next_state_ = STATE_CLOSE; return result; } if ((eoh < tunnel_response_headers_len_) && delegate_) delegate_->OnReceivedData( this, tunnel_response_headers_->headers() + eoh, tunnel_response_headers_len_ - eoh); } return OK; case 407: // Proxy Authentication Required. if (proxy_mode_ != kTunnelProxy) return ERR_UNEXPECTED_PROXY_AUTH; result = proxy_auth_controller_->HandleAuthChallenge( headers, false, true, net_log_); if (result != OK) return result; DCHECK(!proxy_info_.is_empty()); next_state_ = STATE_AUTH_REQUIRED; if (proxy_auth_controller_->HaveAuth()) { base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&SocketStream::DoRestartWithAuth, this)); return ERR_IO_PENDING; } if (delegate_) { base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&SocketStream::DoAuthRequired, this)); return ERR_IO_PENDING; } break; default: break; } next_state_ = STATE_CLOSE; return ERR_TUNNEL_CONNECTION_FAILED; }
C
Chrome
0
CVE-2018-20843
https://www.cvedetails.com/cve/CVE-2018-20843/
CWE-611
https://github.com/libexpat/libexpat/pull/262/commits/11f8838bf99ea0a6f0b76f9760c43704d00c4ff6
11f8838bf99ea0a6f0b76f9760c43704d00c4ff6
xmlparse.c: Fix extraction of namespace prefix from XML name (#186)
normalizeLines(XML_Char *s) { XML_Char *p; for (;; s++) { if (*s == XML_T('\0')) return; if (*s == 0xD) break; } p = s; do { if (*s == 0xD) { *p++ = 0xA; if (*++s == 0xA) s++; } else *p++ = *s++; } while (*s); *p = XML_T('\0'); }
normalizeLines(XML_Char *s) { XML_Char *p; for (;; s++) { if (*s == XML_T('\0')) return; if (*s == 0xD) break; } p = s; do { if (*s == 0xD) { *p++ = 0xA; if (*++s == 0xA) s++; } else *p++ = *s++; } while (*s); *p = XML_T('\0'); }
C
libexpat
0
CVE-2011-2840
https://www.cvedetails.com/cve/CVE-2011-2840/
CWE-20
https://github.com/chromium/chromium/commit/2db5a2048dfcacfe5ad4311c2b1e435c4c67febc
2db5a2048dfcacfe5ad4311c2b1e435c4c67febc
chromeos: fix bug where "aw snap" page replaces first tab if it was a NTP when closing window with > 1 tab. BUG=chromium-os:12088 TEST=verify bug per bug report. Review URL: http://codereview.chromium.org/6882058 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83031 0039d316-1c4b-4281-b951-d872f2087c98
void TabStripModel::MoveTabNext() { int new_index = std::min(active_index() + 1, count() - 1); MoveTabContentsAt(active_index(), new_index, true); }
void TabStripModel::MoveTabNext() { int new_index = std::min(active_index() + 1, count() - 1); MoveTabContentsAt(active_index(), new_index, true); }
C
Chrome
0
CVE-2017-18241
https://www.cvedetails.com/cve/CVE-2017-18241/
CWE-476
https://github.com/torvalds/linux/commit/d4fdf8ba0e5808ba9ad6b44337783bd9935e0982
d4fdf8ba0e5808ba9ad6b44337783bd9935e0982
f2fs: fix a panic caused by NULL flush_cmd_control Mount fs with option noflush_merge, boot failed for illegal address fcc in function f2fs_issue_flush: if (!test_opt(sbi, FLUSH_MERGE)) { ret = submit_flush_wait(sbi); atomic_inc(&fcc->issued_flush); -> Here, fcc illegal return ret; } Signed-off-by: Yunlei He <heyunlei@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
static void do_write_page(struct f2fs_summary *sum, struct f2fs_io_info *fio) { int type = __get_segment_type(fio); int err; reallocate: allocate_data_block(fio->sbi, fio->page, fio->old_blkaddr, &fio->new_blkaddr, sum, type, fio, true); /* writeout dirty page into bdev */ err = f2fs_submit_page_write(fio); if (err == -EAGAIN) { fio->old_blkaddr = fio->new_blkaddr; goto reallocate; } }
static void do_write_page(struct f2fs_summary *sum, struct f2fs_io_info *fio) { int type = __get_segment_type(fio); int err; reallocate: allocate_data_block(fio->sbi, fio->page, fio->old_blkaddr, &fio->new_blkaddr, sum, type, fio, true); /* writeout dirty page into bdev */ err = f2fs_submit_page_write(fio); if (err == -EAGAIN) { fio->old_blkaddr = fio->new_blkaddr; goto reallocate; } }
C
linux
0
CVE-2017-18200
https://www.cvedetails.com/cve/CVE-2017-18200/
CWE-20
https://github.com/torvalds/linux/commit/638164a2718f337ea224b747cf5977ef143166a4
638164a2718f337ea224b747cf5977ef143166a4
f2fs: fix potential panic during fstrim As Ju Hyung Park reported: "When 'fstrim' is called for manual trim, a BUG() can be triggered randomly with this patch. I'm seeing this issue on both x86 Desktop and arm64 Android phone. On x86 Desktop, this was caused during Ubuntu boot-up. I have a cronjob installed which calls 'fstrim -v /' during boot. On arm64 Android, this was caused during GC looping with 1ms gc_min_sleep_time & gc_max_sleep_time." Root cause of this issue is that f2fs_wait_discard_bios can only be used by f2fs_put_super, because during put_super there must be no other referrers, so it can ignore discard entry's reference count when removing the entry, otherwise in other caller we will hit bug_on in __remove_discard_cmd as there may be other issuer added reference count in discard entry. Thread A Thread B - issue_discard_thread - f2fs_ioc_fitrim - f2fs_trim_fs - f2fs_wait_discard_bios - __issue_discard_cmd - __submit_discard_cmd - __wait_discard_cmd - dc->ref++ - __wait_one_discard_bio - __wait_discard_cmd - __remove_discard_cmd - f2fs_bug_on(sbi, dc->ref) Fixes: 969d1b180d987c2be02de890d0fff0f66a0e80de Reported-by: Ju Hyung Park <qkrwngud825@gmail.com> Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
static int f2fs_show_options(struct seq_file *seq, struct dentry *root) { struct f2fs_sb_info *sbi = F2FS_SB(root->d_sb); if (!f2fs_readonly(sbi->sb) && test_opt(sbi, BG_GC)) { if (test_opt(sbi, FORCE_FG_GC)) seq_printf(seq, ",background_gc=%s", "sync"); else seq_printf(seq, ",background_gc=%s", "on"); } else { seq_printf(seq, ",background_gc=%s", "off"); } if (test_opt(sbi, DISABLE_ROLL_FORWARD)) seq_puts(seq, ",disable_roll_forward"); if (test_opt(sbi, DISCARD)) seq_puts(seq, ",discard"); if (test_opt(sbi, NOHEAP)) seq_puts(seq, ",no_heap"); else seq_puts(seq, ",heap"); #ifdef CONFIG_F2FS_FS_XATTR if (test_opt(sbi, XATTR_USER)) seq_puts(seq, ",user_xattr"); else seq_puts(seq, ",nouser_xattr"); if (test_opt(sbi, INLINE_XATTR)) seq_puts(seq, ",inline_xattr"); else seq_puts(seq, ",noinline_xattr"); #endif #ifdef CONFIG_F2FS_FS_POSIX_ACL if (test_opt(sbi, POSIX_ACL)) seq_puts(seq, ",acl"); else seq_puts(seq, ",noacl"); #endif if (test_opt(sbi, DISABLE_EXT_IDENTIFY)) seq_puts(seq, ",disable_ext_identify"); if (test_opt(sbi, INLINE_DATA)) seq_puts(seq, ",inline_data"); else seq_puts(seq, ",noinline_data"); if (test_opt(sbi, INLINE_DENTRY)) seq_puts(seq, ",inline_dentry"); else seq_puts(seq, ",noinline_dentry"); if (!f2fs_readonly(sbi->sb) && test_opt(sbi, FLUSH_MERGE)) seq_puts(seq, ",flush_merge"); if (test_opt(sbi, NOBARRIER)) seq_puts(seq, ",nobarrier"); if (test_opt(sbi, FASTBOOT)) seq_puts(seq, ",fastboot"); if (test_opt(sbi, EXTENT_CACHE)) seq_puts(seq, ",extent_cache"); else seq_puts(seq, ",noextent_cache"); if (test_opt(sbi, DATA_FLUSH)) seq_puts(seq, ",data_flush"); seq_puts(seq, ",mode="); if (test_opt(sbi, ADAPTIVE)) seq_puts(seq, "adaptive"); else if (test_opt(sbi, LFS)) seq_puts(seq, "lfs"); seq_printf(seq, ",active_logs=%u", sbi->active_logs); if (F2FS_IO_SIZE_BITS(sbi)) seq_printf(seq, ",io_size=%uKB", F2FS_IO_SIZE_KB(sbi)); #ifdef CONFIG_F2FS_FAULT_INJECTION if (test_opt(sbi, FAULT_INJECTION)) seq_printf(seq, ",fault_injection=%u", sbi->fault_info.inject_rate); #endif #ifdef CONFIG_QUOTA if (test_opt(sbi, QUOTA)) seq_puts(seq, ",quota"); if (test_opt(sbi, USRQUOTA)) seq_puts(seq, ",usrquota"); if (test_opt(sbi, GRPQUOTA)) seq_puts(seq, ",grpquota"); if (test_opt(sbi, PRJQUOTA)) seq_puts(seq, ",prjquota"); #endif f2fs_show_quota_options(seq, sbi->sb); return 0; }
static int f2fs_show_options(struct seq_file *seq, struct dentry *root) { struct f2fs_sb_info *sbi = F2FS_SB(root->d_sb); if (!f2fs_readonly(sbi->sb) && test_opt(sbi, BG_GC)) { if (test_opt(sbi, FORCE_FG_GC)) seq_printf(seq, ",background_gc=%s", "sync"); else seq_printf(seq, ",background_gc=%s", "on"); } else { seq_printf(seq, ",background_gc=%s", "off"); } if (test_opt(sbi, DISABLE_ROLL_FORWARD)) seq_puts(seq, ",disable_roll_forward"); if (test_opt(sbi, DISCARD)) seq_puts(seq, ",discard"); if (test_opt(sbi, NOHEAP)) seq_puts(seq, ",no_heap"); else seq_puts(seq, ",heap"); #ifdef CONFIG_F2FS_FS_XATTR if (test_opt(sbi, XATTR_USER)) seq_puts(seq, ",user_xattr"); else seq_puts(seq, ",nouser_xattr"); if (test_opt(sbi, INLINE_XATTR)) seq_puts(seq, ",inline_xattr"); else seq_puts(seq, ",noinline_xattr"); #endif #ifdef CONFIG_F2FS_FS_POSIX_ACL if (test_opt(sbi, POSIX_ACL)) seq_puts(seq, ",acl"); else seq_puts(seq, ",noacl"); #endif if (test_opt(sbi, DISABLE_EXT_IDENTIFY)) seq_puts(seq, ",disable_ext_identify"); if (test_opt(sbi, INLINE_DATA)) seq_puts(seq, ",inline_data"); else seq_puts(seq, ",noinline_data"); if (test_opt(sbi, INLINE_DENTRY)) seq_puts(seq, ",inline_dentry"); else seq_puts(seq, ",noinline_dentry"); if (!f2fs_readonly(sbi->sb) && test_opt(sbi, FLUSH_MERGE)) seq_puts(seq, ",flush_merge"); if (test_opt(sbi, NOBARRIER)) seq_puts(seq, ",nobarrier"); if (test_opt(sbi, FASTBOOT)) seq_puts(seq, ",fastboot"); if (test_opt(sbi, EXTENT_CACHE)) seq_puts(seq, ",extent_cache"); else seq_puts(seq, ",noextent_cache"); if (test_opt(sbi, DATA_FLUSH)) seq_puts(seq, ",data_flush"); seq_puts(seq, ",mode="); if (test_opt(sbi, ADAPTIVE)) seq_puts(seq, "adaptive"); else if (test_opt(sbi, LFS)) seq_puts(seq, "lfs"); seq_printf(seq, ",active_logs=%u", sbi->active_logs); if (F2FS_IO_SIZE_BITS(sbi)) seq_printf(seq, ",io_size=%uKB", F2FS_IO_SIZE_KB(sbi)); #ifdef CONFIG_F2FS_FAULT_INJECTION if (test_opt(sbi, FAULT_INJECTION)) seq_printf(seq, ",fault_injection=%u", sbi->fault_info.inject_rate); #endif #ifdef CONFIG_QUOTA if (test_opt(sbi, QUOTA)) seq_puts(seq, ",quota"); if (test_opt(sbi, USRQUOTA)) seq_puts(seq, ",usrquota"); if (test_opt(sbi, GRPQUOTA)) seq_puts(seq, ",grpquota"); if (test_opt(sbi, PRJQUOTA)) seq_puts(seq, ",prjquota"); #endif f2fs_show_quota_options(seq, sbi->sb); return 0; }
C
linux
0
CVE-2014-3173
https://www.cvedetails.com/cve/CVE-2014-3173/
CWE-119
https://github.com/chromium/chromium/commit/ee7579229ff7e9e5ae28bf53aea069251499d7da
ee7579229ff7e9e5ae28bf53aea069251499d7da
Framebuffer clear() needs to consider the situation some draw buffers are disabled. This is when we expose DrawBuffers extension. BUG=376951 TEST=the attached test case, webgl conformance R=kbr@chromium.org,bajones@chromium.org Review URL: https://codereview.chromium.org/315283002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275338 0039d316-1c4b-4281-b951-d872f2087c98
error::Error GLES2DecoderImpl::HandleBindAttribLocationBucket( uint32 immediate_data_size, const cmds::BindAttribLocationBucket& c) { GLuint program = static_cast<GLuint>(c.program); GLuint index = static_cast<GLuint>(c.index); Bucket* bucket = GetBucket(c.name_bucket_id); if (!bucket || bucket->size() == 0) { return error::kInvalidArguments; } std::string name_str; if (!bucket->GetAsString(&name_str)) { return error::kInvalidArguments; } DoBindAttribLocation(program, index, name_str.c_str()); return error::kNoError; }
error::Error GLES2DecoderImpl::HandleBindAttribLocationBucket( uint32 immediate_data_size, const cmds::BindAttribLocationBucket& c) { GLuint program = static_cast<GLuint>(c.program); GLuint index = static_cast<GLuint>(c.index); Bucket* bucket = GetBucket(c.name_bucket_id); if (!bucket || bucket->size() == 0) { return error::kInvalidArguments; } std::string name_str; if (!bucket->GetAsString(&name_str)) { return error::kInvalidArguments; } DoBindAttribLocation(program, index, name_str.c_str()); return error::kNoError; }
C
Chrome
0
CVE-2015-8382
https://www.cvedetails.com/cve/CVE-2015-8382/
CWE-119
https://git.php.net/?p=php-src.git;a=commit;h=c351b47ce85a3a147cfa801fa9f0149ab4160834
c351b47ce85a3a147cfa801fa9f0149ab4160834
null
static PHP_GINIT_FUNCTION(pcre) /* {{{ */ { zend_hash_init(&pcre_globals->pcre_cache, 0, NULL, php_free_pcre_cache, 1); pcre_globals->backtrack_limit = 0; pcre_globals->recursion_limit = 0; pcre_globals->error_code = PHP_PCRE_NO_ERROR; } /* }}} */
static PHP_GINIT_FUNCTION(pcre) /* {{{ */ { zend_hash_init(&pcre_globals->pcre_cache, 0, NULL, php_free_pcre_cache, 1); pcre_globals->backtrack_limit = 0; pcre_globals->recursion_limit = 0; pcre_globals->error_code = PHP_PCRE_NO_ERROR; } /* }}} */
C
php
0
CVE-2018-18839
https://www.cvedetails.com/cve/CVE-2018-18839/
CWE-200
https://github.com/netdata/netdata/commit/92327c9ec211bd1616315abcb255861b130b97ca
92327c9ec211bd1616315abcb255861b130b97ca
fixed vulnerabilities identified by red4sec.com (#4521)
inline uint32_t web_client_api_request_v1_data_google_format(char *name) { uint32_t hash = simple_hash(name); int i; for(i = 0; api_v1_data_google_formats[i].name ; i++) { if (unlikely(hash == api_v1_data_google_formats[i].hash && !strcmp(name, api_v1_data_google_formats[i].name))) { return api_v1_data_google_formats[i].value; } } return DATASOURCE_JSON; }
inline uint32_t web_client_api_request_v1_data_google_format(char *name) { uint32_t hash = simple_hash(name); int i; for(i = 0; api_v1_data_google_formats[i].name ; i++) { if (unlikely(hash == api_v1_data_google_formats[i].hash && !strcmp(name, api_v1_data_google_formats[i].name))) { return api_v1_data_google_formats[i].value; } } return DATASOURCE_JSON; }
C
netdata
0
CVE-2010-2527
https://www.cvedetails.com/cve/CVE-2010-2527/
CWE-119
https://git.savannah.gnu.org/cgit/freetype/freetype2-demos.git/commit/?id=b995299b73ba4cd259f221f500d4e63095508bec
b995299b73ba4cd259f221f500d4e63095508bec
null
grid_status_init( GridStatus st, FTDemo_Display* display ) { st->scale = 1.0; st->x_origin = display->bitmap->width / 4; st->y_origin = display->bitmap->rows / 4; st->margin = 0.05; st->axis_color = grFindColor( display->bitmap, 0, 0, 0, 255 ); st->grid_color = grFindColor( display->bitmap, 192, 192, 192, 255 ); st->outline_color = grFindColor( display->bitmap, 255, 0, 0, 255 ); st->on_color = grFindColor( display->bitmap, 64, 64, 255, 255 ); st->conic_color = grFindColor( display->bitmap, 0, 128, 0, 255 ); st->cubic_color = grFindColor( display->bitmap, 255, 64, 255, 255 ); st->disp_width = display->bitmap->width; st->disp_height = display->bitmap->rows; st->disp_bitmap = display->bitmap; st->do_horz_hints = 1; st->do_vert_hints = 1; st->do_blue_hints = 1; st->do_dots = 1; st->do_outline = 1; st->Num = 0; st->gamma = 1.0; st->header = ""; }
grid_status_init( GridStatus st, FTDemo_Display* display ) { st->scale = 1.0; st->x_origin = display->bitmap->width / 4; st->y_origin = display->bitmap->rows / 4; st->margin = 0.05; st->axis_color = grFindColor( display->bitmap, 0, 0, 0, 255 ); st->grid_color = grFindColor( display->bitmap, 192, 192, 192, 255 ); st->outline_color = grFindColor( display->bitmap, 255, 0, 0, 255 ); st->on_color = grFindColor( display->bitmap, 64, 64, 255, 255 ); st->conic_color = grFindColor( display->bitmap, 0, 128, 0, 255 ); st->cubic_color = grFindColor( display->bitmap, 255, 64, 255, 255 ); st->disp_width = display->bitmap->width; st->disp_height = display->bitmap->rows; st->disp_bitmap = display->bitmap; st->do_horz_hints = 1; st->do_vert_hints = 1; st->do_blue_hints = 1; st->do_dots = 1; st->do_outline = 1; st->Num = 0; st->gamma = 1.0; st->header = ""; }
C
savannah
0
CVE-2013-1826
https://www.cvedetails.com/cve/CVE-2013-1826/
null
https://github.com/torvalds/linux/commit/864745d291b5ba80ea0bd0edcbe67273de368836
864745d291b5ba80ea0bd0edcbe67273de368836
xfrm_user: return error pointer instead of NULL When dump_one_state() returns an error, e.g. because of a too small buffer to dump the whole xfrm state, xfrm_state_netlink() returns NULL instead of an error pointer. But its callers expect an error pointer and therefore continue to operate on a NULL skbuff. This could lead to a privilege escalation (execution of user code in kernel context) if the attacker has CAP_NET_ADMIN and is able to map address 0. Signed-off-by: Mathias Krause <minipli@googlemail.com> Acked-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: David S. Miller <davem@davemloft.net>
static int copy_from_user_policy_type(u8 *tp, struct nlattr **attrs) { struct nlattr *rt = attrs[XFRMA_POLICY_TYPE]; struct xfrm_userpolicy_type *upt; u8 type = XFRM_POLICY_TYPE_MAIN; int err; if (rt) { upt = nla_data(rt); type = upt->type; } err = verify_policy_type(type); if (err) return err; *tp = type; return 0; }
static int copy_from_user_policy_type(u8 *tp, struct nlattr **attrs) { struct nlattr *rt = attrs[XFRMA_POLICY_TYPE]; struct xfrm_userpolicy_type *upt; u8 type = XFRM_POLICY_TYPE_MAIN; int err; if (rt) { upt = nla_data(rt); type = upt->type; } err = verify_policy_type(type); if (err) return err; *tp = type; return 0; }
C
linux
0
CVE-2017-7184
https://www.cvedetails.com/cve/CVE-2017-7184/
null
https://github.com/torvalds/linux/commit/f843ee6dd019bcece3e74e76ad9df0155655d0df
f843ee6dd019bcece3e74e76ad9df0155655d0df
xfrm_user: validate XFRM_MSG_NEWAE incoming ESN size harder Kees Cook has pointed out that xfrm_replay_state_esn_len() is subject to wrapping issues. To ensure we are correctly ensuring that the two ESN structures are the same size compare both the overall size as reported by xfrm_replay_state_esn_len() and the internal length are the same. CVE-2017-7184 Signed-off-by: Andy Whitcroft <apw@canonical.com> Acked-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh, struct nlattr **attrs) { struct net *net = sock_net(skb->sk); struct xfrm_policy *xp; struct xfrm_userpolicy_id *p; u8 type = XFRM_POLICY_TYPE_MAIN; int err; struct km_event c; int delete; struct xfrm_mark m; u32 mark = xfrm_mark_get(attrs, &m); p = nlmsg_data(nlh); delete = nlh->nlmsg_type == XFRM_MSG_DELPOLICY; err = copy_from_user_policy_type(&type, attrs); if (err) return err; err = verify_policy_dir(p->dir); if (err) return err; if (p->index) xp = xfrm_policy_byid(net, mark, type, p->dir, p->index, delete, &err); else { struct nlattr *rt = attrs[XFRMA_SEC_CTX]; struct xfrm_sec_ctx *ctx; err = verify_sec_ctx_len(attrs); if (err) return err; ctx = NULL; if (rt) { struct xfrm_user_sec_ctx *uctx = nla_data(rt); err = security_xfrm_policy_alloc(&ctx, uctx, GFP_KERNEL); if (err) return err; } xp = xfrm_policy_bysel_ctx(net, mark, type, p->dir, &p->sel, ctx, delete, &err); security_xfrm_policy_free(ctx); } if (xp == NULL) return -ENOENT; if (!delete) { struct sk_buff *resp_skb; resp_skb = xfrm_policy_netlink(skb, xp, p->dir, nlh->nlmsg_seq); if (IS_ERR(resp_skb)) { err = PTR_ERR(resp_skb); } else { err = nlmsg_unicast(net->xfrm.nlsk, resp_skb, NETLINK_CB(skb).portid); } } else { xfrm_audit_policy_delete(xp, err ? 0 : 1, true); if (err != 0) goto out; c.data.byid = p->index; c.event = nlh->nlmsg_type; c.seq = nlh->nlmsg_seq; c.portid = nlh->nlmsg_pid; km_policy_notify(xp, p->dir, &c); } out: xfrm_pol_put(xp); if (delete && err == 0) xfrm_garbage_collect(net); return err; }
static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh, struct nlattr **attrs) { struct net *net = sock_net(skb->sk); struct xfrm_policy *xp; struct xfrm_userpolicy_id *p; u8 type = XFRM_POLICY_TYPE_MAIN; int err; struct km_event c; int delete; struct xfrm_mark m; u32 mark = xfrm_mark_get(attrs, &m); p = nlmsg_data(nlh); delete = nlh->nlmsg_type == XFRM_MSG_DELPOLICY; err = copy_from_user_policy_type(&type, attrs); if (err) return err; err = verify_policy_dir(p->dir); if (err) return err; if (p->index) xp = xfrm_policy_byid(net, mark, type, p->dir, p->index, delete, &err); else { struct nlattr *rt = attrs[XFRMA_SEC_CTX]; struct xfrm_sec_ctx *ctx; err = verify_sec_ctx_len(attrs); if (err) return err; ctx = NULL; if (rt) { struct xfrm_user_sec_ctx *uctx = nla_data(rt); err = security_xfrm_policy_alloc(&ctx, uctx, GFP_KERNEL); if (err) return err; } xp = xfrm_policy_bysel_ctx(net, mark, type, p->dir, &p->sel, ctx, delete, &err); security_xfrm_policy_free(ctx); } if (xp == NULL) return -ENOENT; if (!delete) { struct sk_buff *resp_skb; resp_skb = xfrm_policy_netlink(skb, xp, p->dir, nlh->nlmsg_seq); if (IS_ERR(resp_skb)) { err = PTR_ERR(resp_skb); } else { err = nlmsg_unicast(net->xfrm.nlsk, resp_skb, NETLINK_CB(skb).portid); } } else { xfrm_audit_policy_delete(xp, err ? 0 : 1, true); if (err != 0) goto out; c.data.byid = p->index; c.event = nlh->nlmsg_type; c.seq = nlh->nlmsg_seq; c.portid = nlh->nlmsg_pid; km_policy_notify(xp, p->dir, &c); } out: xfrm_pol_put(xp); if (delete && err == 0) xfrm_garbage_collect(net); return err; }
C
linux
0
CVE-2017-14604
https://www.cvedetails.com/cve/CVE-2017-14604/
CWE-20
https://github.com/GNOME/nautilus/commit/1630f53481f445ada0a455e9979236d31a8d3bb0
1630f53481f445ada0a455e9979236d31a8d3bb0
mime-actions: use file metadata for trusting desktop files Currently we only trust desktop files that have the executable bit set, and don't replace the displayed icon or the displayed name until it's trusted, which prevents for running random programs by a malicious desktop file. However, the executable permission is preserved if the desktop file comes from a compressed file. To prevent this, add a metadata::trusted metadata to the file once the user acknowledges the file as trusted. This adds metadata to the file, which cannot be added unless it has access to the computer. Also remove the SHEBANG "trusted" content we were putting inside the desktop file, since that doesn't add more security since it can come with the file itself. https://bugzilla.gnome.org/show_bug.cgi?id=777991
mark_inode_as_seen (DeepCountState *state, GFileInfo *info) { guint64 inode; inode = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_UNIX_INODE); if (inode != 0) { g_array_append_val (state->seen_deep_count_inodes, inode); } }
mark_inode_as_seen (DeepCountState *state, GFileInfo *info) { guint64 inode; inode = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_UNIX_INODE); if (inode != 0) { g_array_append_val (state->seen_deep_count_inodes, inode); } }
C
nautilus
0
null
null
null
https://github.com/chromium/chromium/commit/b9866ebc631655c593a2ac60a3c7cf7d217ccf5d
b9866ebc631655c593a2ac60a3c7cf7d217ccf5d
Use the lock when accessing the buffer object. BUG=69195 TEST=play Z-Type for hours :) Review URL: http://codereview.chromium.org/6157007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71211 0039d316-1c4b-4281-b951-d872f2087c98
scoped_refptr<AudioOutputController> AudioOutputController::CreateLowLatency( EventHandler* event_handler, AudioParameters params, SyncReader* sync_reader) { DCHECK(sync_reader); if (!CheckParameters(params)) return NULL; if (!AudioManager::GetAudioManager()) return NULL; scoped_refptr<AudioOutputController> controller(new AudioOutputController( event_handler, 0, sync_reader)); controller->message_loop_ = AudioManager::GetAudioManager()->GetMessageLoop(); controller->message_loop_->PostTask( FROM_HERE, NewRunnableMethod(controller.get(), &AudioOutputController::DoCreate, params)); return controller; }
scoped_refptr<AudioOutputController> AudioOutputController::CreateLowLatency( EventHandler* event_handler, AudioParameters params, SyncReader* sync_reader) { DCHECK(sync_reader); if (!CheckParameters(params)) return NULL; if (!AudioManager::GetAudioManager()) return NULL; scoped_refptr<AudioOutputController> controller(new AudioOutputController( event_handler, 0, sync_reader)); controller->message_loop_ = AudioManager::GetAudioManager()->GetMessageLoop(); controller->message_loop_->PostTask( FROM_HERE, NewRunnableMethod(controller.get(), &AudioOutputController::DoCreate, params)); return controller; }
C
Chrome
0
CVE-2016-5204
https://www.cvedetails.com/cve/CVE-2016-5204/
CWE-79
https://github.com/chromium/chromium/commit/e1e67d5d341d82c61cab2c41ff4163f17caf14ae
e1e67d5d341d82c61cab2c41ff4163f17caf14ae
Add boolean to UserIntiatedInfo noting if an input event led to navigation. Also refactor UkmPageLoadMetricsObserver to use this new boolean to report the user initiated metric in RecordPageLoadExtraInfoMetrics, so that it works correctly in the case when the page load failed. Bug: 925104 Change-Id: Ie08e7d3912cb1da484190d838005e95e57a209ff Reviewed-on: https://chromium-review.googlesource.com/c/1450460 Commit-Queue: Annie Sullivan <sullivan@chromium.org> Reviewed-by: Bryan McQuade <bmcquade@chromium.org> Cr-Commit-Position: refs/heads/master@{#630870}
void MetricsWebContentsObserver::RenderProcessGone( base::TerminationStatus status) { if (status == base::TERMINATION_STATUS_NORMAL_TERMINATION || status == base::TERMINATION_STATUS_STILL_RUNNING) { return; } if (committed_load_) { committed_load_->NotifyPageEnd(END_RENDER_PROCESS_GONE, UserInitiatedInfo::NotUserInitiated(), base::TimeTicks::Now(), true); } committed_load_.reset(); aborted_provisional_loads_.clear(); }
void MetricsWebContentsObserver::RenderProcessGone( base::TerminationStatus status) { if (status == base::TERMINATION_STATUS_NORMAL_TERMINATION || status == base::TERMINATION_STATUS_STILL_RUNNING) { return; } if (committed_load_) { committed_load_->NotifyPageEnd(END_RENDER_PROCESS_GONE, UserInitiatedInfo::NotUserInitiated(), base::TimeTicks::Now(), true); } committed_load_.reset(); aborted_provisional_loads_.clear(); }
C
Chrome
0
CVE-2019-5837
https://www.cvedetails.com/cve/CVE-2019-5837/
CWE-200
https://github.com/chromium/chromium/commit/04aaacb936a08d70862d6d9d7e8354721ae46be8
04aaacb936a08d70862d6d9d7e8354721ae46be8
Reland "AppCache: Add padding to cross-origin responses." This is a reland of 85b389caa7d725cdd31f59e9a2b79ff54804b7b7 Initialized CacheRecord::padding_size to 0. Original change's description: > AppCache: Add padding to cross-origin responses. > > Bug: 918293 > Change-Id: I4f16640f06feac009d6bbbb624951da6d2669f6c > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1488059 > Commit-Queue: Staphany Park <staphany@chromium.org> > Reviewed-by: Victor Costan <pwnall@chromium.org> > Reviewed-by: Marijn Kruisselbrink <mek@chromium.org> > Cr-Commit-Position: refs/heads/master@{#644624} Bug: 918293 Change-Id: Ie1d3f99c7e8a854d33255a4d66243da2ce16441c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1539906 Reviewed-by: Victor Costan <pwnall@chromium.org> Commit-Queue: Staphany Park <staphany@chromium.org> Cr-Commit-Position: refs/heads/master@{#644719}
bool IsEvictableError(AppCacheUpdateJob::ResultType result, const blink::mojom::AppCacheErrorDetails& details) { switch (result) { case AppCacheUpdateJob::DB_ERROR: case AppCacheUpdateJob::DISKCACHE_ERROR: case AppCacheUpdateJob::QUOTA_ERROR: case AppCacheUpdateJob::NETWORK_ERROR: case AppCacheUpdateJob::CANCELLED_ERROR: return false; case AppCacheUpdateJob::REDIRECT_ERROR: case AppCacheUpdateJob::SERVER_ERROR: case AppCacheUpdateJob::SECURITY_ERROR: return true; case AppCacheUpdateJob::MANIFEST_ERROR: return details.reason == blink::mojom::AppCacheErrorReason::APPCACHE_SIGNATURE_ERROR; default: NOTREACHED(); return true; } }
bool IsEvictableError(AppCacheUpdateJob::ResultType result, const blink::mojom::AppCacheErrorDetails& details) { switch (result) { case AppCacheUpdateJob::DB_ERROR: case AppCacheUpdateJob::DISKCACHE_ERROR: case AppCacheUpdateJob::QUOTA_ERROR: case AppCacheUpdateJob::NETWORK_ERROR: case AppCacheUpdateJob::CANCELLED_ERROR: return false; case AppCacheUpdateJob::REDIRECT_ERROR: case AppCacheUpdateJob::SERVER_ERROR: case AppCacheUpdateJob::SECURITY_ERROR: return true; case AppCacheUpdateJob::MANIFEST_ERROR: return details.reason == blink::mojom::AppCacheErrorReason::APPCACHE_SIGNATURE_ERROR; default: NOTREACHED(); return true; } }
C
Chrome
0
CVE-2018-1091
https://www.cvedetails.com/cve/CVE-2018-1091/
CWE-119
https://github.com/torvalds/linux/commit/c1fa0768a8713b135848f78fd43ffc208d8ded70
c1fa0768a8713b135848f78fd43ffc208d8ded70
powerpc/tm: Flush TM only if CPU has TM feature Commit cd63f3c ("powerpc/tm: Fix saving of TM SPRs in core dump") added code to access TM SPRs in flush_tmregs_to_thread(). However flush_tmregs_to_thread() does not check if TM feature is available on CPU before trying to access TM SPRs in order to copy live state to thread structures. flush_tmregs_to_thread() is indeed guarded by CONFIG_PPC_TRANSACTIONAL_MEM but it might be the case that kernel was compiled with CONFIG_PPC_TRANSACTIONAL_MEM enabled and ran on a CPU without TM feature available, thus rendering the execution of TM instructions that are treated by the CPU as illegal instructions. The fix is just to add proper checking in flush_tmregs_to_thread() if CPU has the TM feature before accessing any TM-specific resource, returning immediately if TM is no available on the CPU. Adding that checking in flush_tmregs_to_thread() instead of in places where it is called, like in vsr_get() and vsr_set(), is better because avoids the same problem cropping up elsewhere. Cc: stable@vger.kernel.org # v4.13+ Fixes: cd63f3c ("powerpc/tm: Fix saving of TM SPRs in core dump") Signed-off-by: Gustavo Romero <gromero@linux.vnet.ibm.com> Reviewed-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
static int set_dac(struct task_struct *child, struct ppc_hw_breakpoint *bp_info) { int byte_enable = (bp_info->condition_mode >> PPC_BREAKPOINT_CONDITION_BE_SHIFT) & 0xf; int condition_mode = bp_info->condition_mode & PPC_BREAKPOINT_CONDITION_MODE; int slot; if (byte_enable && (condition_mode == 0)) return -EINVAL; if (bp_info->addr >= TASK_SIZE) return -EIO; if ((dbcr_dac(child) & (DBCR_DAC1R | DBCR_DAC1W)) == 0) { slot = 1; if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_READ) dbcr_dac(child) |= DBCR_DAC1R; if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_WRITE) dbcr_dac(child) |= DBCR_DAC1W; child->thread.debug.dac1 = (unsigned long)bp_info->addr; #if CONFIG_PPC_ADV_DEBUG_DVCS > 0 if (byte_enable) { child->thread.debug.dvc1 = (unsigned long)bp_info->condition_value; child->thread.debug.dbcr2 |= ((byte_enable << DBCR2_DVC1BE_SHIFT) | (condition_mode << DBCR2_DVC1M_SHIFT)); } #endif #ifdef CONFIG_PPC_ADV_DEBUG_DAC_RANGE } else if (child->thread.debug.dbcr2 & DBCR2_DAC12MODE) { /* Both dac1 and dac2 are part of a range */ return -ENOSPC; #endif } else if ((dbcr_dac(child) & (DBCR_DAC2R | DBCR_DAC2W)) == 0) { slot = 2; if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_READ) dbcr_dac(child) |= DBCR_DAC2R; if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_WRITE) dbcr_dac(child) |= DBCR_DAC2W; child->thread.debug.dac2 = (unsigned long)bp_info->addr; #if CONFIG_PPC_ADV_DEBUG_DVCS > 0 if (byte_enable) { child->thread.debug.dvc2 = (unsigned long)bp_info->condition_value; child->thread.debug.dbcr2 |= ((byte_enable << DBCR2_DVC2BE_SHIFT) | (condition_mode << DBCR2_DVC2M_SHIFT)); } #endif } else return -ENOSPC; child->thread.debug.dbcr0 |= DBCR0_IDM; child->thread.regs->msr |= MSR_DE; return slot + 4; }
static int set_dac(struct task_struct *child, struct ppc_hw_breakpoint *bp_info) { int byte_enable = (bp_info->condition_mode >> PPC_BREAKPOINT_CONDITION_BE_SHIFT) & 0xf; int condition_mode = bp_info->condition_mode & PPC_BREAKPOINT_CONDITION_MODE; int slot; if (byte_enable && (condition_mode == 0)) return -EINVAL; if (bp_info->addr >= TASK_SIZE) return -EIO; if ((dbcr_dac(child) & (DBCR_DAC1R | DBCR_DAC1W)) == 0) { slot = 1; if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_READ) dbcr_dac(child) |= DBCR_DAC1R; if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_WRITE) dbcr_dac(child) |= DBCR_DAC1W; child->thread.debug.dac1 = (unsigned long)bp_info->addr; #if CONFIG_PPC_ADV_DEBUG_DVCS > 0 if (byte_enable) { child->thread.debug.dvc1 = (unsigned long)bp_info->condition_value; child->thread.debug.dbcr2 |= ((byte_enable << DBCR2_DVC1BE_SHIFT) | (condition_mode << DBCR2_DVC1M_SHIFT)); } #endif #ifdef CONFIG_PPC_ADV_DEBUG_DAC_RANGE } else if (child->thread.debug.dbcr2 & DBCR2_DAC12MODE) { /* Both dac1 and dac2 are part of a range */ return -ENOSPC; #endif } else if ((dbcr_dac(child) & (DBCR_DAC2R | DBCR_DAC2W)) == 0) { slot = 2; if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_READ) dbcr_dac(child) |= DBCR_DAC2R; if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_WRITE) dbcr_dac(child) |= DBCR_DAC2W; child->thread.debug.dac2 = (unsigned long)bp_info->addr; #if CONFIG_PPC_ADV_DEBUG_DVCS > 0 if (byte_enable) { child->thread.debug.dvc2 = (unsigned long)bp_info->condition_value; child->thread.debug.dbcr2 |= ((byte_enable << DBCR2_DVC2BE_SHIFT) | (condition_mode << DBCR2_DVC2M_SHIFT)); } #endif } else return -ENOSPC; child->thread.debug.dbcr0 |= DBCR0_IDM; child->thread.regs->msr |= MSR_DE; return slot + 4; }
C
linux
0
CVE-2018-13405
https://www.cvedetails.com/cve/CVE-2018-13405/
CWE-269
https://github.com/torvalds/linux/commit/0fa3ecd87848c9c93c2c828ef4c3a8ca36ce46c7
0fa3ecd87848c9c93c2c828ef4c3a8ca36ce46c7
Fix up non-directory creation in SGID directories sgid directories have special semantics, making newly created files in the directory belong to the group of the directory, and newly created subdirectories will also become sgid. This is historically used for group-shared directories. But group directories writable by non-group members should not imply that such non-group members can magically join the group, so make sure to clear the sgid bit on non-directories for non-members (but remember that sgid without group execute means "mandatory locking", just to confuse things even more). Reported-by: Jann Horn <jannh@google.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
void __init inode_init(void) { /* inode slab cache */ inode_cachep = kmem_cache_create("inode_cache", sizeof(struct inode), 0, (SLAB_RECLAIM_ACCOUNT|SLAB_PANIC| SLAB_MEM_SPREAD|SLAB_ACCOUNT), init_once); /* Hash may have been set up in inode_init_early */ if (!hashdist) return; inode_hashtable = alloc_large_system_hash("Inode-cache", sizeof(struct hlist_head), ihash_entries, 14, HASH_ZERO, &i_hash_shift, &i_hash_mask, 0, 0); }
void __init inode_init(void) { /* inode slab cache */ inode_cachep = kmem_cache_create("inode_cache", sizeof(struct inode), 0, (SLAB_RECLAIM_ACCOUNT|SLAB_PANIC| SLAB_MEM_SPREAD|SLAB_ACCOUNT), init_once); /* Hash may have been set up in inode_init_early */ if (!hashdist) return; inode_hashtable = alloc_large_system_hash("Inode-cache", sizeof(struct hlist_head), ihash_entries, 14, HASH_ZERO, &i_hash_shift, &i_hash_mask, 0, 0); }
C
linux
0
CVE-2018-6096
https://www.cvedetails.com/cve/CVE-2018-6096/
null
https://github.com/chromium/chromium/commit/36f801fdbec07d116a6f4f07bb363f10897d6a51
36f801fdbec07d116a6f4f07bb363f10897d6a51
If a page calls |window.focus()|, kick it out of fullscreen. BUG=776418, 800056 Change-Id: I1880fe600e4814c073f247c43b1c1ac80c8fc017 Reviewed-on: https://chromium-review.googlesource.com/852378 Reviewed-by: Nasko Oskov <nasko@chromium.org> Reviewed-by: Philip Jägenstedt <foolip@chromium.org> Commit-Queue: Avi Drissman <avi@chromium.org> Cr-Commit-Position: refs/heads/master@{#533790}
void DOMWindow::close(LocalDOMWindow* incumbent_window) { if (!GetFrame() || !GetFrame()->IsMainFrame()) return; Page* page = GetFrame()->GetPage(); if (!page) return; Document* active_document = nullptr; if (incumbent_window) { DCHECK(IsMainThread()); active_document = incumbent_window->document(); if (!active_document) return; if (!active_document->GetFrame() || !active_document->GetFrame()->CanNavigate(*GetFrame())) return; } Settings* settings = GetFrame()->GetSettings(); bool allow_scripts_to_close_windows = settings && settings->GetAllowScriptsToCloseWindows(); if (!page->OpenedByDOM() && GetFrame()->Client()->BackForwardLength() > 1 && !allow_scripts_to_close_windows) { if (active_document) { active_document->domWindow()->GetFrameConsole()->AddMessage( ConsoleMessage::Create( kJSMessageSource, kWarningMessageLevel, "Scripts may close only the windows that were opened by it.")); } return; } if (!GetFrame()->ShouldClose()) return; ExecutionContext* execution_context = nullptr; if (IsLocalDOMWindow()) { execution_context = blink::ToLocalDOMWindow(this)->GetExecutionContext(); } probe::breakableLocation(execution_context, "DOMWindow.close"); page->CloseSoon(); window_is_closing_ = true; }
void DOMWindow::close(LocalDOMWindow* incumbent_window) { if (!GetFrame() || !GetFrame()->IsMainFrame()) return; Page* page = GetFrame()->GetPage(); if (!page) return; Document* active_document = nullptr; if (incumbent_window) { DCHECK(IsMainThread()); active_document = incumbent_window->document(); if (!active_document) return; if (!active_document->GetFrame() || !active_document->GetFrame()->CanNavigate(*GetFrame())) return; } Settings* settings = GetFrame()->GetSettings(); bool allow_scripts_to_close_windows = settings && settings->GetAllowScriptsToCloseWindows(); if (!page->OpenedByDOM() && GetFrame()->Client()->BackForwardLength() > 1 && !allow_scripts_to_close_windows) { if (active_document) { active_document->domWindow()->GetFrameConsole()->AddMessage( ConsoleMessage::Create( kJSMessageSource, kWarningMessageLevel, "Scripts may close only the windows that were opened by it.")); } return; } if (!GetFrame()->ShouldClose()) return; ExecutionContext* execution_context = nullptr; if (IsLocalDOMWindow()) { execution_context = blink::ToLocalDOMWindow(this)->GetExecutionContext(); } probe::breakableLocation(execution_context, "DOMWindow.close"); page->CloseSoon(); window_is_closing_ = true; }
C
Chrome
0
CVE-2011-4328
https://www.cvedetails.com/cve/CVE-2011-4328/
CWE-264
https://git.savannah.gnu.org/gitweb/?p=gnash.git;a=commitdiff;h=fa481c116e65ccf9137c7ddc8abc3cf05dc12f55
fa481c116e65ccf9137c7ddc8abc3cf05dc12f55
null
nsPluginInstance::getDocumentProp(const std::string& propname) const { std::string rv; if (!HasScripting()) { LOG_ONCE( gnash::log_debug("Browser doesn't support scripting") ); return rv; } NPObject* windowobj; NPError err = NPN_GetValue(_instance, NPNVWindowNPObject, &windowobj); if (err != NPERR_NO_ERROR || !windowobj) { return rv; } boost::shared_ptr<NPObject> window_obj(windowobj, NPN_ReleaseObject); NPIdentifier doc_id = NPN_GetStringIdentifier("document"); NPVariant docvar; if(! NPN_GetProperty(_instance, windowobj, doc_id, &docvar) ) { return rv; } boost::shared_ptr<NPVariant> doc_var(&docvar, NPN_ReleaseVariantValue); if (!NPVARIANT_IS_OBJECT(docvar)) { return rv; } NPObject* doc_obj = NPVARIANT_TO_OBJECT(docvar); NPIdentifier prop_id = NPN_GetStringIdentifier(propname.c_str()); NPVariant propvar; if (!NPN_GetProperty(_instance, doc_obj, prop_id, &propvar)) { return rv; } boost::shared_ptr<NPVariant> prop_var(&propvar, NPN_ReleaseVariantValue); if (!NPVARIANT_IS_STRING(propvar)) { return rv; } const NPString& prop_str = NPVARIANT_TO_STRING(propvar); rv = NPStringToString(prop_str); return rv; }
nsPluginInstance::getDocumentProp(const std::string& propname) const { std::string rv; if (!HasScripting()) { LOG_ONCE( gnash::log_debug("Browser doesn't support scripting") ); return rv; } NPObject* windowobj; NPError err = NPN_GetValue(_instance, NPNVWindowNPObject, &windowobj); if (err != NPERR_NO_ERROR || !windowobj) { return rv; } boost::shared_ptr<NPObject> window_obj(windowobj, NPN_ReleaseObject); NPIdentifier doc_id = NPN_GetStringIdentifier("document"); NPVariant docvar; if(! NPN_GetProperty(_instance, windowobj, doc_id, &docvar) ) { return rv; } boost::shared_ptr<NPVariant> doc_var(&docvar, NPN_ReleaseVariantValue); if (!NPVARIANT_IS_OBJECT(docvar)) { return rv; } NPObject* doc_obj = NPVARIANT_TO_OBJECT(docvar); NPIdentifier prop_id = NPN_GetStringIdentifier(propname.c_str()); NPVariant propvar; if (!NPN_GetProperty(_instance, doc_obj, prop_id, &propvar)) { return rv; } boost::shared_ptr<NPVariant> prop_var(&propvar, NPN_ReleaseVariantValue); if (!NPVARIANT_IS_STRING(propvar)) { return rv; } const NPString& prop_str = NPVARIANT_TO_STRING(propvar); rv = NPStringToString(prop_str); return rv; }
CPP
savannah
0
CVE-2011-4112
https://www.cvedetails.com/cve/CVE-2011-4112/
CWE-264
https://github.com/torvalds/linux/commit/550fd08c2cebad61c548def135f67aba284c6162
550fd08c2cebad61c548def135f67aba284c6162
net: Audit drivers to identify those needing IFF_TX_SKB_SHARING cleared After the last patch, We are left in a state in which only drivers calling ether_setup have IFF_TX_SKB_SHARING set (we assume that drivers touching real hardware call ether_setup for their net_devices and don't hold any state in their skbs. There are a handful of drivers that violate this assumption of course, and need to be fixed up. This patch identifies those drivers, and marks them as not being able to support the safe transmission of skbs by clearning the IFF_TX_SKB_SHARING flag in priv_flags Signed-off-by: Neil Horman <nhorman@tuxdriver.com> CC: Karsten Keil <isdn@linux-pingi.de> CC: "David S. Miller" <davem@davemloft.net> CC: Jay Vosburgh <fubar@us.ibm.com> CC: Andy Gospodarek <andy@greyhouse.net> CC: Patrick McHardy <kaber@trash.net> CC: Krzysztof Halasa <khc@pm.waw.pl> CC: "John W. Linville" <linville@tuxdriver.com> CC: Greg Kroah-Hartman <gregkh@suse.de> CC: Marcel Holtmann <marcel@holtmann.org> CC: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: David S. Miller <davem@davemloft.net>
isdn_net_findif(char *name) { isdn_net_dev *p = dev->netdev; while (p) { if (!strcmp(p->dev->name, name)) return p; p = (isdn_net_dev *) p->next; } return (isdn_net_dev *) NULL; }
isdn_net_findif(char *name) { isdn_net_dev *p = dev->netdev; while (p) { if (!strcmp(p->dev->name, name)) return p; p = (isdn_net_dev *) p->next; } return (isdn_net_dev *) NULL; }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/fc790462b4f248712bbc8c3734664dd6b05f80f2
fc790462b4f248712bbc8c3734664dd6b05f80f2
Set the job name for the print job on the Mac. BUG=http://crbug.com/29188 TEST=as in bug Review URL: http://codereview.chromium.org/1997016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47056 0039d316-1c4b-4281-b951-d872f2087c98
void ResourceMessageFilter::OnOpenChannelToPlugin(const GURL& url, const std::string& mime_type, const std::wstring& locale, IPC::Message* reply_msg) { plugin_service_->OpenChannelToPlugin( this, url, mime_type, locale, reply_msg); }
void ResourceMessageFilter::OnOpenChannelToPlugin(const GURL& url, const std::string& mime_type, const std::wstring& locale, IPC::Message* reply_msg) { plugin_service_->OpenChannelToPlugin( this, url, mime_type, locale, reply_msg); }
C
Chrome
0
CVE-2017-18594
https://www.cvedetails.com/cve/CVE-2017-18594/
CWE-415
https://github.com/nmap/nmap/commit/350bbe0597d37ad67abe5fef8fba984707b4e9ad
350bbe0597d37ad67abe5fef8fba984707b4e9ad
Avoid a crash (double-free) when SSH connection fails
static int l_read_publickey (lua_State *L) { FILE *fd; char c; const char* publickeyfile = luaL_checkstring(L, 1); luaL_Buffer publickey_data; fd = fopen(publickeyfile, "r"); if (!fd) return luaL_error(L, "Error reading file"); luaL_buffinit(L, &publickey_data); while (fread(&c, 1, 1, fd) && c!= '\r' && c != '\n' && c != ' ') { continue; } while (fread(&c, 1, 1, fd) && c!= '\r' && c != '\n' && c != ' ') { luaL_addchar(&publickey_data, c); } fclose(fd); lua_getglobal(L, "require"); lua_pushstring(L, "base64"); lua_call(L, 1, 1); lua_getfield(L, -1, "dec"); luaL_pushresult(&publickey_data); lua_call(L, 1, 1); return 1; }
static int l_read_publickey (lua_State *L) { FILE *fd; char c; const char* publickeyfile = luaL_checkstring(L, 1); luaL_Buffer publickey_data; fd = fopen(publickeyfile, "r"); if (!fd) return luaL_error(L, "Error reading file"); luaL_buffinit(L, &publickey_data); while (fread(&c, 1, 1, fd) && c!= '\r' && c != '\n' && c != ' ') { continue; } while (fread(&c, 1, 1, fd) && c!= '\r' && c != '\n' && c != ' ') { luaL_addchar(&publickey_data, c); } fclose(fd); lua_getglobal(L, "require"); lua_pushstring(L, "base64"); lua_call(L, 1, 1); lua_getfield(L, -1, "dec"); luaL_pushresult(&publickey_data); lua_call(L, 1, 1); return 1; }
C
nmap
0
CVE-2011-4112
https://www.cvedetails.com/cve/CVE-2011-4112/
CWE-264
https://github.com/torvalds/linux/commit/550fd08c2cebad61c548def135f67aba284c6162
550fd08c2cebad61c548def135f67aba284c6162
net: Audit drivers to identify those needing IFF_TX_SKB_SHARING cleared After the last patch, We are left in a state in which only drivers calling ether_setup have IFF_TX_SKB_SHARING set (we assume that drivers touching real hardware call ether_setup for their net_devices and don't hold any state in their skbs. There are a handful of drivers that violate this assumption of course, and need to be fixed up. This patch identifies those drivers, and marks them as not being able to support the safe transmission of skbs by clearning the IFF_TX_SKB_SHARING flag in priv_flags Signed-off-by: Neil Horman <nhorman@tuxdriver.com> CC: Karsten Keil <isdn@linux-pingi.de> CC: "David S. Miller" <davem@davemloft.net> CC: Jay Vosburgh <fubar@us.ibm.com> CC: Andy Gospodarek <andy@greyhouse.net> CC: Patrick McHardy <kaber@trash.net> CC: Krzysztof Halasa <khc@pm.waw.pl> CC: "John W. Linville" <linville@tuxdriver.com> CC: Greg Kroah-Hartman <gregkh@suse.de> CC: Marcel Holtmann <marcel@holtmann.org> CC: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: David S. Miller <davem@davemloft.net>
static void airo_networks_free(struct airo_info *ai) { kfree(ai->networks); ai->networks = NULL; }
static void airo_networks_free(struct airo_info *ai) { kfree(ai->networks); ai->networks = NULL; }
C
linux
0
CVE-2019-17541
https://www.cvedetails.com/cve/CVE-2019-17541/
null
https://github.com/ImageMagick/ImageMagick/commit/39f226a9c137f547e12afde972eeba7551124493
39f226a9c137f547e12afde972eeba7551124493
https://github.com/ImageMagick/ImageMagick/issues/1641
static Image *ReadJPEGImage(const ImageInfo *image_info, ExceptionInfo *exception) { char value[MagickPathExtent]; const char *dct_method, *option; ErrorManager error_manager; Image *image; JSAMPLE *volatile jpeg_pixels; JSAMPROW scanline[1]; MagickBooleanType debug, status; MagickSizeType number_pixels; MemoryInfo *memory_info; Quantum index; register ssize_t i; struct jpeg_decompress_struct jpeg_info; struct jpeg_error_mgr jpeg_error; struct jpeg_progress_mgr jpeg_progress; register JSAMPLE *p; size_t units; ssize_t y; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); debug=IsEventLogging(); (void) debug; image=AcquireImage(image_info,exception); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } /* Verify that file size large enough to contain a JPEG datastream. */ if (GetBlobSize(image) < 107) ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile"); /* Initialize JPEG parameters. */ (void) memset(&error_manager,0,sizeof(error_manager)); (void) memset(&jpeg_info,0,sizeof(jpeg_info)); (void) memset(&jpeg_error,0,sizeof(jpeg_error)); (void) memset(&jpeg_progress,0,sizeof(jpeg_progress)); jpeg_info.err=jpeg_std_error(&jpeg_error); jpeg_info.err->emit_message=(void (*)(j_common_ptr,int)) JPEGWarningHandler; jpeg_info.err->error_exit=(void (*)(j_common_ptr)) JPEGErrorHandler; memory_info=(MemoryInfo *) NULL; error_manager.exception=exception; error_manager.image=image; if (setjmp(error_manager.error_recovery) != 0) { jpeg_destroy_decompress(&jpeg_info); if (error_manager.profile != (StringInfo *) NULL) error_manager.profile=DestroyStringInfo(error_manager.profile); (void) CloseBlob(image); number_pixels=(MagickSizeType) image->columns*image->rows; if (number_pixels != 0) return(GetFirstImageInList(image)); return(DestroyImage(image)); } jpeg_info.client_data=(void *) &error_manager; jpeg_create_decompress(&jpeg_info); if (GetMaxMemoryRequest() != ~0UL) jpeg_info.mem->max_memory_to_use=(long) GetMaxMemoryRequest(); jpeg_progress.progress_monitor=(void (*)(j_common_ptr)) JPEGProgressHandler; jpeg_info.progress=(&jpeg_progress); JPEGSourceManager(&jpeg_info,image); jpeg_set_marker_processor(&jpeg_info,JPEG_COM,ReadComment); option=GetImageOption(image_info,"profile:skip"); if (IsOptionMember("ICC",option) == MagickFalse) jpeg_set_marker_processor(&jpeg_info,ICC_MARKER,ReadICCProfile); if (IsOptionMember("IPTC",option) == MagickFalse) jpeg_set_marker_processor(&jpeg_info,IPTC_MARKER,ReadIPTCProfile); for (i=1; i < 16; i++) if ((i != 2) && (i != 13) && (i != 14)) if (IsOptionMember("APP",option) == MagickFalse) jpeg_set_marker_processor(&jpeg_info,(int) (JPEG_APP0+i),ReadProfile); i=(ssize_t) jpeg_read_header(&jpeg_info,TRUE); if ((image_info->colorspace == YCbCrColorspace) || (image_info->colorspace == Rec601YCbCrColorspace) || (image_info->colorspace == Rec709YCbCrColorspace)) jpeg_info.out_color_space=JCS_YCbCr; /* Set image resolution. */ units=0; if ((jpeg_info.saw_JFIF_marker != 0) && (jpeg_info.X_density != 1) && (jpeg_info.Y_density != 1)) { image->resolution.x=(double) jpeg_info.X_density; image->resolution.y=(double) jpeg_info.Y_density; units=(size_t) jpeg_info.density_unit; } if (units == 1) image->units=PixelsPerInchResolution; if (units == 2) image->units=PixelsPerCentimeterResolution; number_pixels=(MagickSizeType) image->columns*image->rows; option=GetImageOption(image_info,"jpeg:size"); if ((option != (const char *) NULL) && (jpeg_info.out_color_space != JCS_YCbCr)) { double scale_factor; GeometryInfo geometry_info; MagickStatusType flags; /* Scale the image. */ flags=ParseGeometry(option,&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=geometry_info.rho; jpeg_calc_output_dimensions(&jpeg_info); image->magick_columns=jpeg_info.output_width; image->magick_rows=jpeg_info.output_height; scale_factor=1.0; if (geometry_info.rho != 0.0) scale_factor=jpeg_info.output_width/geometry_info.rho; if ((geometry_info.sigma != 0.0) && (scale_factor > (jpeg_info.output_height/geometry_info.sigma))) scale_factor=jpeg_info.output_height/geometry_info.sigma; jpeg_info.scale_num=1U; jpeg_info.scale_denom=(unsigned int) scale_factor; jpeg_calc_output_dimensions(&jpeg_info); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "Scale factor: %.20g",(double) scale_factor); } #if (JPEG_LIB_VERSION >= 61) && defined(D_PROGRESSIVE_SUPPORTED) #if defined(D_LOSSLESS_SUPPORTED) image->interlace=jpeg_info.process == JPROC_PROGRESSIVE ? JPEGInterlace : NoInterlace; image->compression=jpeg_info.process == JPROC_LOSSLESS ? LosslessJPEGCompression : JPEGCompression; if (jpeg_info.data_precision > 8) (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "12-bit JPEG not supported. Reducing pixel data to 8 bits","`%s'", image->filename); if (jpeg_info.data_precision == 16) jpeg_info.data_precision=12; #else image->interlace=jpeg_info.progressive_mode != 0 ? JPEGInterlace : NoInterlace; image->compression=JPEGCompression; #endif #else image->compression=JPEGCompression; image->interlace=JPEGInterlace; #endif option=GetImageOption(image_info,"jpeg:colors"); if (option != (const char *) NULL) { /* Let the JPEG library quantize the image. */ jpeg_info.quantize_colors=TRUE; jpeg_info.desired_number_of_colors=(int) StringToUnsignedLong(option); } option=GetImageOption(image_info,"jpeg:block-smoothing"); if (option != (const char *) NULL) jpeg_info.do_block_smoothing=IsStringTrue(option) != MagickFalse ? TRUE : FALSE; dct_method=GetImageOption(image_info,"jpeg:dct-method"); if (dct_method != (const char *) NULL) switch (*dct_method) { case 'D': case 'd': { if (LocaleCompare(dct_method,"default") == 0) jpeg_info.dct_method=JDCT_DEFAULT; break; } case 'F': case 'f': { if (LocaleCompare(dct_method,"fastest") == 0) jpeg_info.dct_method=JDCT_FASTEST; if (LocaleCompare(dct_method,"float") == 0) jpeg_info.dct_method=JDCT_FLOAT; break; } case 'I': case 'i': { if (LocaleCompare(dct_method,"ifast") == 0) jpeg_info.dct_method=JDCT_IFAST; if (LocaleCompare(dct_method,"islow") == 0) jpeg_info.dct_method=JDCT_ISLOW; break; } } option=GetImageOption(image_info,"jpeg:fancy-upsampling"); if (option != (const char *) NULL) jpeg_info.do_fancy_upsampling=IsStringTrue(option) != MagickFalse ? TRUE : FALSE; jpeg_calc_output_dimensions(&jpeg_info); image->columns=jpeg_info.output_width; image->rows=jpeg_info.output_height; image->depth=(size_t) jpeg_info.data_precision; switch (jpeg_info.out_color_space) { case JCS_RGB: default: { (void) SetImageColorspace(image,sRGBColorspace,exception); break; } case JCS_GRAYSCALE: { (void) SetImageColorspace(image,GRAYColorspace,exception); break; } case JCS_YCbCr: { (void) SetImageColorspace(image,YCbCrColorspace,exception); break; } case JCS_CMYK: { (void) SetImageColorspace(image,CMYKColorspace,exception); break; } } if (IsITUFaxImage(image) != MagickFalse) { (void) SetImageColorspace(image,LabColorspace,exception); jpeg_info.out_color_space=JCS_YCbCr; } option=GetImageOption(image_info,"jpeg:colors"); if (option != (const char *) NULL) if (AcquireImageColormap(image,StringToUnsignedLong(option),exception) == MagickFalse) { jpeg_destroy_decompress(&jpeg_info); ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); } if ((jpeg_info.output_components == 1) && (jpeg_info.quantize_colors == 0)) { size_t colors; colors=(size_t) GetQuantumRange(image->depth)+1; if (AcquireImageColormap(image,colors,exception) == MagickFalse) { jpeg_destroy_decompress(&jpeg_info); ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); } } if (image->debug != MagickFalse) { if (image->interlace != NoInterlace) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "Interlace: progressive"); else (void) LogMagickEvent(CoderEvent,GetMagickModule(), "Interlace: nonprogressive"); (void) LogMagickEvent(CoderEvent,GetMagickModule(),"Data precision: %d", (int) jpeg_info.data_precision); (void) LogMagickEvent(CoderEvent,GetMagickModule(),"Geometry: %dx%d", (int) jpeg_info.output_width,(int) jpeg_info.output_height); } JPEGSetImageQuality(&jpeg_info,image); JPEGSetImageSamplingFactor(&jpeg_info,image,exception); (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double) jpeg_info.out_color_space); (void) SetImageProperty(image,"jpeg:colorspace",value,exception); #if defined(D_ARITH_CODING_SUPPORTED) if (jpeg_info.arith_code == TRUE) (void) SetImageProperty(image,"jpeg:coding","arithmetic",exception); #endif if (image_info->ping != MagickFalse) { jpeg_destroy_decompress(&jpeg_info); (void) CloseBlob(image); return(GetFirstImageInList(image)); } status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) { jpeg_destroy_decompress(&jpeg_info); return(DestroyImageList(image)); } (void) jpeg_start_decompress(&jpeg_info); if ((jpeg_info.output_components != 1) && (jpeg_info.output_components != 3) && (jpeg_info.output_components != 4)) { jpeg_destroy_decompress(&jpeg_info); ThrowReaderException(CorruptImageError,"ImageTypeNotSupported"); } memory_info=AcquireVirtualMemory((size_t) image->columns, jpeg_info.output_components*sizeof(*jpeg_pixels)); if (memory_info == (MemoryInfo *) NULL) { jpeg_destroy_decompress(&jpeg_info); ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); } jpeg_pixels=(JSAMPLE *) GetVirtualMemoryBlob(memory_info); (void) memset(jpeg_pixels,0,image->columns* jpeg_info.output_components*sizeof(*jpeg_pixels)); /* Convert JPEG pixels to pixel packets. */ if (setjmp(error_manager.error_recovery) != 0) { if (memory_info != (MemoryInfo *) NULL) memory_info=RelinquishVirtualMemory(memory_info); jpeg_destroy_decompress(&jpeg_info); (void) CloseBlob(image); number_pixels=(MagickSizeType) image->columns*image->rows; if (number_pixels != 0) return(GetFirstImageInList(image)); return(DestroyImage(image)); } if (jpeg_info.quantize_colors != 0) { image->colors=(size_t) jpeg_info.actual_number_of_colors; if (jpeg_info.out_color_space == JCS_GRAYSCALE) for (i=0; i < (ssize_t) image->colors; i++) { image->colormap[i].red=(double) ScaleCharToQuantum( jpeg_info.colormap[0][i]); image->colormap[i].green=image->colormap[i].red; image->colormap[i].blue=image->colormap[i].red; image->colormap[i].alpha=(MagickRealType) OpaqueAlpha; } else for (i=0; i < (ssize_t) image->colors; i++) { image->colormap[i].red=(double) ScaleCharToQuantum( jpeg_info.colormap[0][i]); image->colormap[i].green=(double) ScaleCharToQuantum( jpeg_info.colormap[1][i]); image->colormap[i].blue=(double) ScaleCharToQuantum( jpeg_info.colormap[2][i]); image->colormap[i].alpha=(MagickRealType) OpaqueAlpha; } } scanline[0]=(JSAMPROW) jpeg_pixels; for (y=0; y < (ssize_t) image->rows; y++) { register ssize_t x; register Quantum *magick_restrict q; if (jpeg_read_scanlines(&jpeg_info,scanline,1) != 1) { (void) ThrowMagickException(exception,GetMagickModule(), CorruptImageWarning,"SkipToSyncByte","`%s'",image->filename); continue; } p=jpeg_pixels; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; if (jpeg_info.data_precision > 8) { unsigned short scale; scale=65535/(unsigned short) GetQuantumRange((size_t) jpeg_info.data_precision); if (jpeg_info.output_components == 1) for (x=0; x < (ssize_t) image->columns; x++) { ssize_t pixel; pixel=(ssize_t) (scale*GETJSAMPLE(*p)); index=(Quantum) ConstrainColormapIndex(image,pixel,exception); SetPixelIndex(image,index,q); SetPixelViaPixelInfo(image,image->colormap+(ssize_t) index,q); p++; q+=GetPixelChannels(image); } else if (image->colorspace != CMYKColorspace) for (x=0; x < (ssize_t) image->columns; x++) { SetPixelRed(image,ScaleShortToQuantum( (unsigned short) (scale*GETJSAMPLE(*p++))),q); SetPixelGreen(image,ScaleShortToQuantum( (unsigned short) (scale*GETJSAMPLE(*p++))),q); SetPixelBlue(image,ScaleShortToQuantum( (unsigned short) (scale*GETJSAMPLE(*p++))),q); SetPixelAlpha(image,OpaqueAlpha,q); q+=GetPixelChannels(image); } else for (x=0; x < (ssize_t) image->columns; x++) { SetPixelCyan(image,QuantumRange-ScaleShortToQuantum( (unsigned short) (scale*GETJSAMPLE(*p++))),q); SetPixelMagenta(image,QuantumRange-ScaleShortToQuantum( (unsigned short) (scale*GETJSAMPLE(*p++))),q); SetPixelYellow(image,QuantumRange-ScaleShortToQuantum( (unsigned short) (scale*GETJSAMPLE(*p++))),q); SetPixelBlack(image,QuantumRange-ScaleShortToQuantum( (unsigned short) (scale*GETJSAMPLE(*p++))),q); SetPixelAlpha(image,OpaqueAlpha,q); q+=GetPixelChannels(image); } } else if (jpeg_info.output_components == 1) for (x=0; x < (ssize_t) image->columns; x++) { ssize_t pixel; pixel=(ssize_t) GETJSAMPLE(*p); index=(Quantum) ConstrainColormapIndex(image,pixel,exception); SetPixelIndex(image,index,q); SetPixelViaPixelInfo(image,image->colormap+(ssize_t) index,q); p++; q+=GetPixelChannels(image); } else if (image->colorspace != CMYKColorspace) for (x=0; x < (ssize_t) image->columns; x++) { SetPixelRed(image,ScaleCharToQuantum((unsigned char) GETJSAMPLE(*p++)),q); SetPixelGreen(image,ScaleCharToQuantum((unsigned char) GETJSAMPLE(*p++)),q); SetPixelBlue(image,ScaleCharToQuantum((unsigned char) GETJSAMPLE(*p++)),q); SetPixelAlpha(image,OpaqueAlpha,q); q+=GetPixelChannels(image); } else for (x=0; x < (ssize_t) image->columns; x++) { SetPixelCyan(image,QuantumRange-ScaleCharToQuantum( (unsigned char) GETJSAMPLE(*p++)),q); SetPixelMagenta(image,QuantumRange-ScaleCharToQuantum( (unsigned char) GETJSAMPLE(*p++)),q); SetPixelYellow(image,QuantumRange-ScaleCharToQuantum( (unsigned char) GETJSAMPLE(*p++)),q); SetPixelBlack(image,QuantumRange-ScaleCharToQuantum( (unsigned char) GETJSAMPLE(*p++)),q); SetPixelAlpha(image,OpaqueAlpha,q); q+=GetPixelChannels(image); } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) { jpeg_abort_decompress(&jpeg_info); break; } } if (status != MagickFalse) { error_manager.finished=MagickTrue; if (setjmp(error_manager.error_recovery) == 0) (void) jpeg_finish_decompress(&jpeg_info); } /* Free jpeg resources. */ jpeg_destroy_decompress(&jpeg_info); memory_info=RelinquishVirtualMemory(memory_info); (void) CloseBlob(image); return(GetFirstImageInList(image)); }
static Image *ReadJPEGImage(const ImageInfo *image_info, ExceptionInfo *exception) { char value[MagickPathExtent]; const char *dct_method, *option; ErrorManager error_manager; Image *image; JSAMPLE *volatile jpeg_pixels; JSAMPROW scanline[1]; MagickBooleanType debug, status; MagickSizeType number_pixels; MemoryInfo *memory_info; Quantum index; register ssize_t i; struct jpeg_decompress_struct jpeg_info; struct jpeg_error_mgr jpeg_error; struct jpeg_progress_mgr jpeg_progress; register JSAMPLE *p; size_t units; ssize_t y; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); debug=IsEventLogging(); (void) debug; image=AcquireImage(image_info,exception); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } /* Verify that file size large enough to contain a JPEG datastream. */ if (GetBlobSize(image) < 107) ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile"); /* Initialize JPEG parameters. */ (void) memset(&error_manager,0,sizeof(error_manager)); (void) memset(&jpeg_info,0,sizeof(jpeg_info)); (void) memset(&jpeg_error,0,sizeof(jpeg_error)); (void) memset(&jpeg_progress,0,sizeof(jpeg_progress)); jpeg_info.err=jpeg_std_error(&jpeg_error); jpeg_info.err->emit_message=(void (*)(j_common_ptr,int)) JPEGWarningHandler; jpeg_info.err->error_exit=(void (*)(j_common_ptr)) JPEGErrorHandler; memory_info=(MemoryInfo *) NULL; error_manager.exception=exception; error_manager.image=image; if (setjmp(error_manager.error_recovery) != 0) { jpeg_destroy_decompress(&jpeg_info); if (error_manager.profile != (StringInfo *) NULL) error_manager.profile=DestroyStringInfo(error_manager.profile); (void) CloseBlob(image); number_pixels=(MagickSizeType) image->columns*image->rows; if (number_pixels != 0) return(GetFirstImageInList(image)); return(DestroyImage(image)); } jpeg_info.client_data=(void *) &error_manager; jpeg_create_decompress(&jpeg_info); if (GetMaxMemoryRequest() != ~0UL) jpeg_info.mem->max_memory_to_use=(long) GetMaxMemoryRequest(); jpeg_progress.progress_monitor=(void (*)(j_common_ptr)) JPEGProgressHandler; jpeg_info.progress=(&jpeg_progress); JPEGSourceManager(&jpeg_info,image); jpeg_set_marker_processor(&jpeg_info,JPEG_COM,ReadComment); option=GetImageOption(image_info,"profile:skip"); if (IsOptionMember("ICC",option) == MagickFalse) jpeg_set_marker_processor(&jpeg_info,ICC_MARKER,ReadICCProfile); if (IsOptionMember("IPTC",option) == MagickFalse) jpeg_set_marker_processor(&jpeg_info,IPTC_MARKER,ReadIPTCProfile); for (i=1; i < 16; i++) if ((i != 2) && (i != 13) && (i != 14)) if (IsOptionMember("APP",option) == MagickFalse) jpeg_set_marker_processor(&jpeg_info,(int) (JPEG_APP0+i),ReadProfile); i=(ssize_t) jpeg_read_header(&jpeg_info,TRUE); if ((image_info->colorspace == YCbCrColorspace) || (image_info->colorspace == Rec601YCbCrColorspace) || (image_info->colorspace == Rec709YCbCrColorspace)) jpeg_info.out_color_space=JCS_YCbCr; /* Set image resolution. */ units=0; if ((jpeg_info.saw_JFIF_marker != 0) && (jpeg_info.X_density != 1) && (jpeg_info.Y_density != 1)) { image->resolution.x=(double) jpeg_info.X_density; image->resolution.y=(double) jpeg_info.Y_density; units=(size_t) jpeg_info.density_unit; } if (units == 1) image->units=PixelsPerInchResolution; if (units == 2) image->units=PixelsPerCentimeterResolution; number_pixels=(MagickSizeType) image->columns*image->rows; option=GetImageOption(image_info,"jpeg:size"); if ((option != (const char *) NULL) && (jpeg_info.out_color_space != JCS_YCbCr)) { double scale_factor; GeometryInfo geometry_info; MagickStatusType flags; /* Scale the image. */ flags=ParseGeometry(option,&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=geometry_info.rho; jpeg_calc_output_dimensions(&jpeg_info); image->magick_columns=jpeg_info.output_width; image->magick_rows=jpeg_info.output_height; scale_factor=1.0; if (geometry_info.rho != 0.0) scale_factor=jpeg_info.output_width/geometry_info.rho; if ((geometry_info.sigma != 0.0) && (scale_factor > (jpeg_info.output_height/geometry_info.sigma))) scale_factor=jpeg_info.output_height/geometry_info.sigma; jpeg_info.scale_num=1U; jpeg_info.scale_denom=(unsigned int) scale_factor; jpeg_calc_output_dimensions(&jpeg_info); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "Scale factor: %.20g",(double) scale_factor); } #if (JPEG_LIB_VERSION >= 61) && defined(D_PROGRESSIVE_SUPPORTED) #if defined(D_LOSSLESS_SUPPORTED) image->interlace=jpeg_info.process == JPROC_PROGRESSIVE ? JPEGInterlace : NoInterlace; image->compression=jpeg_info.process == JPROC_LOSSLESS ? LosslessJPEGCompression : JPEGCompression; if (jpeg_info.data_precision > 8) (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "12-bit JPEG not supported. Reducing pixel data to 8 bits","`%s'", image->filename); if (jpeg_info.data_precision == 16) jpeg_info.data_precision=12; #else image->interlace=jpeg_info.progressive_mode != 0 ? JPEGInterlace : NoInterlace; image->compression=JPEGCompression; #endif #else image->compression=JPEGCompression; image->interlace=JPEGInterlace; #endif option=GetImageOption(image_info,"jpeg:colors"); if (option != (const char *) NULL) { /* Let the JPEG library quantize the image. */ jpeg_info.quantize_colors=TRUE; jpeg_info.desired_number_of_colors=(int) StringToUnsignedLong(option); } option=GetImageOption(image_info,"jpeg:block-smoothing"); if (option != (const char *) NULL) jpeg_info.do_block_smoothing=IsStringTrue(option) != MagickFalse ? TRUE : FALSE; dct_method=GetImageOption(image_info,"jpeg:dct-method"); if (dct_method != (const char *) NULL) switch (*dct_method) { case 'D': case 'd': { if (LocaleCompare(dct_method,"default") == 0) jpeg_info.dct_method=JDCT_DEFAULT; break; } case 'F': case 'f': { if (LocaleCompare(dct_method,"fastest") == 0) jpeg_info.dct_method=JDCT_FASTEST; if (LocaleCompare(dct_method,"float") == 0) jpeg_info.dct_method=JDCT_FLOAT; break; } case 'I': case 'i': { if (LocaleCompare(dct_method,"ifast") == 0) jpeg_info.dct_method=JDCT_IFAST; if (LocaleCompare(dct_method,"islow") == 0) jpeg_info.dct_method=JDCT_ISLOW; break; } } option=GetImageOption(image_info,"jpeg:fancy-upsampling"); if (option != (const char *) NULL) jpeg_info.do_fancy_upsampling=IsStringTrue(option) != MagickFalse ? TRUE : FALSE; jpeg_calc_output_dimensions(&jpeg_info); image->columns=jpeg_info.output_width; image->rows=jpeg_info.output_height; image->depth=(size_t) jpeg_info.data_precision; switch (jpeg_info.out_color_space) { case JCS_RGB: default: { (void) SetImageColorspace(image,sRGBColorspace,exception); break; } case JCS_GRAYSCALE: { (void) SetImageColorspace(image,GRAYColorspace,exception); break; } case JCS_YCbCr: { (void) SetImageColorspace(image,YCbCrColorspace,exception); break; } case JCS_CMYK: { (void) SetImageColorspace(image,CMYKColorspace,exception); break; } } if (IsITUFaxImage(image) != MagickFalse) { (void) SetImageColorspace(image,LabColorspace,exception); jpeg_info.out_color_space=JCS_YCbCr; } option=GetImageOption(image_info,"jpeg:colors"); if (option != (const char *) NULL) if (AcquireImageColormap(image,StringToUnsignedLong(option),exception) == MagickFalse) { jpeg_destroy_decompress(&jpeg_info); ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); } if ((jpeg_info.output_components == 1) && (jpeg_info.quantize_colors == 0)) { size_t colors; colors=(size_t) GetQuantumRange(image->depth)+1; if (AcquireImageColormap(image,colors,exception) == MagickFalse) { jpeg_destroy_decompress(&jpeg_info); ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); } } if (image->debug != MagickFalse) { if (image->interlace != NoInterlace) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "Interlace: progressive"); else (void) LogMagickEvent(CoderEvent,GetMagickModule(), "Interlace: nonprogressive"); (void) LogMagickEvent(CoderEvent,GetMagickModule(),"Data precision: %d", (int) jpeg_info.data_precision); (void) LogMagickEvent(CoderEvent,GetMagickModule(),"Geometry: %dx%d", (int) jpeg_info.output_width,(int) jpeg_info.output_height); } JPEGSetImageQuality(&jpeg_info,image); JPEGSetImageSamplingFactor(&jpeg_info,image,exception); (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double) jpeg_info.out_color_space); (void) SetImageProperty(image,"jpeg:colorspace",value,exception); #if defined(D_ARITH_CODING_SUPPORTED) if (jpeg_info.arith_code == TRUE) (void) SetImageProperty(image,"jpeg:coding","arithmetic",exception); #endif if (image_info->ping != MagickFalse) { jpeg_destroy_decompress(&jpeg_info); (void) CloseBlob(image); return(GetFirstImageInList(image)); } status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) { jpeg_destroy_decompress(&jpeg_info); return(DestroyImageList(image)); } (void) jpeg_start_decompress(&jpeg_info); if ((jpeg_info.output_components != 1) && (jpeg_info.output_components != 3) && (jpeg_info.output_components != 4)) { jpeg_destroy_decompress(&jpeg_info); ThrowReaderException(CorruptImageError,"ImageTypeNotSupported"); } memory_info=AcquireVirtualMemory((size_t) image->columns, jpeg_info.output_components*sizeof(*jpeg_pixels)); if (memory_info == (MemoryInfo *) NULL) { jpeg_destroy_decompress(&jpeg_info); ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); } jpeg_pixels=(JSAMPLE *) GetVirtualMemoryBlob(memory_info); (void) memset(jpeg_pixels,0,image->columns* jpeg_info.output_components*sizeof(*jpeg_pixels)); /* Convert JPEG pixels to pixel packets. */ if (setjmp(error_manager.error_recovery) != 0) { if (memory_info != (MemoryInfo *) NULL) memory_info=RelinquishVirtualMemory(memory_info); jpeg_destroy_decompress(&jpeg_info); (void) CloseBlob(image); number_pixels=(MagickSizeType) image->columns*image->rows; if (number_pixels != 0) return(GetFirstImageInList(image)); return(DestroyImage(image)); } if (jpeg_info.quantize_colors != 0) { image->colors=(size_t) jpeg_info.actual_number_of_colors; if (jpeg_info.out_color_space == JCS_GRAYSCALE) for (i=0; i < (ssize_t) image->colors; i++) { image->colormap[i].red=(double) ScaleCharToQuantum( jpeg_info.colormap[0][i]); image->colormap[i].green=image->colormap[i].red; image->colormap[i].blue=image->colormap[i].red; image->colormap[i].alpha=(MagickRealType) OpaqueAlpha; } else for (i=0; i < (ssize_t) image->colors; i++) { image->colormap[i].red=(double) ScaleCharToQuantum( jpeg_info.colormap[0][i]); image->colormap[i].green=(double) ScaleCharToQuantum( jpeg_info.colormap[1][i]); image->colormap[i].blue=(double) ScaleCharToQuantum( jpeg_info.colormap[2][i]); image->colormap[i].alpha=(MagickRealType) OpaqueAlpha; } } scanline[0]=(JSAMPROW) jpeg_pixels; for (y=0; y < (ssize_t) image->rows; y++) { register ssize_t x; register Quantum *magick_restrict q; if (jpeg_read_scanlines(&jpeg_info,scanline,1) != 1) { (void) ThrowMagickException(exception,GetMagickModule(), CorruptImageWarning,"SkipToSyncByte","`%s'",image->filename); continue; } p=jpeg_pixels; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; if (jpeg_info.data_precision > 8) { unsigned short scale; scale=65535/(unsigned short) GetQuantumRange((size_t) jpeg_info.data_precision); if (jpeg_info.output_components == 1) for (x=0; x < (ssize_t) image->columns; x++) { ssize_t pixel; pixel=(ssize_t) (scale*GETJSAMPLE(*p)); index=(Quantum) ConstrainColormapIndex(image,pixel,exception); SetPixelIndex(image,index,q); SetPixelViaPixelInfo(image,image->colormap+(ssize_t) index,q); p++; q+=GetPixelChannels(image); } else if (image->colorspace != CMYKColorspace) for (x=0; x < (ssize_t) image->columns; x++) { SetPixelRed(image,ScaleShortToQuantum( (unsigned short) (scale*GETJSAMPLE(*p++))),q); SetPixelGreen(image,ScaleShortToQuantum( (unsigned short) (scale*GETJSAMPLE(*p++))),q); SetPixelBlue(image,ScaleShortToQuantum( (unsigned short) (scale*GETJSAMPLE(*p++))),q); SetPixelAlpha(image,OpaqueAlpha,q); q+=GetPixelChannels(image); } else for (x=0; x < (ssize_t) image->columns; x++) { SetPixelCyan(image,QuantumRange-ScaleShortToQuantum( (unsigned short) (scale*GETJSAMPLE(*p++))),q); SetPixelMagenta(image,QuantumRange-ScaleShortToQuantum( (unsigned short) (scale*GETJSAMPLE(*p++))),q); SetPixelYellow(image,QuantumRange-ScaleShortToQuantum( (unsigned short) (scale*GETJSAMPLE(*p++))),q); SetPixelBlack(image,QuantumRange-ScaleShortToQuantum( (unsigned short) (scale*GETJSAMPLE(*p++))),q); SetPixelAlpha(image,OpaqueAlpha,q); q+=GetPixelChannels(image); } } else if (jpeg_info.output_components == 1) for (x=0; x < (ssize_t) image->columns; x++) { ssize_t pixel; pixel=(ssize_t) GETJSAMPLE(*p); index=(Quantum) ConstrainColormapIndex(image,pixel,exception); SetPixelIndex(image,index,q); SetPixelViaPixelInfo(image,image->colormap+(ssize_t) index,q); p++; q+=GetPixelChannels(image); } else if (image->colorspace != CMYKColorspace) for (x=0; x < (ssize_t) image->columns; x++) { SetPixelRed(image,ScaleCharToQuantum((unsigned char) GETJSAMPLE(*p++)),q); SetPixelGreen(image,ScaleCharToQuantum((unsigned char) GETJSAMPLE(*p++)),q); SetPixelBlue(image,ScaleCharToQuantum((unsigned char) GETJSAMPLE(*p++)),q); SetPixelAlpha(image,OpaqueAlpha,q); q+=GetPixelChannels(image); } else for (x=0; x < (ssize_t) image->columns; x++) { SetPixelCyan(image,QuantumRange-ScaleCharToQuantum( (unsigned char) GETJSAMPLE(*p++)),q); SetPixelMagenta(image,QuantumRange-ScaleCharToQuantum( (unsigned char) GETJSAMPLE(*p++)),q); SetPixelYellow(image,QuantumRange-ScaleCharToQuantum( (unsigned char) GETJSAMPLE(*p++)),q); SetPixelBlack(image,QuantumRange-ScaleCharToQuantum( (unsigned char) GETJSAMPLE(*p++)),q); SetPixelAlpha(image,OpaqueAlpha,q); q+=GetPixelChannels(image); } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) { jpeg_abort_decompress(&jpeg_info); break; } } if (status != MagickFalse) { error_manager.finished=MagickTrue; if (setjmp(error_manager.error_recovery) == 0) (void) jpeg_finish_decompress(&jpeg_info); } /* Free jpeg resources. */ jpeg_destroy_decompress(&jpeg_info); memory_info=RelinquishVirtualMemory(memory_info); (void) CloseBlob(image); return(GetFirstImageInList(image)); }
C
ImageMagick
0
CVE-2012-2875
https://www.cvedetails.com/cve/CVE-2012-2875/
null
https://github.com/chromium/chromium/commit/1266ba494530a267ec8a21442ea1b5cae94da4fb
1266ba494530a267ec8a21442ea1b5cae94da4fb
Introduce XGetImage() for GrabWindowSnapshot() in ChromeOS. BUG=119492 TEST=manually done Review URL: https://chromiumcodereview.appspot.com/10386124 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137556 0039d316-1c4b-4281-b951-d872f2087c98
void RootWindow::ReleaseCapture(Window* window) { if (capture_window_ != window) return; SetCapture(NULL); }
void RootWindow::ReleaseCapture(Window* window) { if (capture_window_ != window) return; SetCapture(NULL); }
C
Chrome
0
CVE-2016-5158
https://www.cvedetails.com/cve/CVE-2016-5158/
CWE-190
https://github.com/chromium/chromium/commit/6a310d99a741f9ba5e4e537c5ec49d3adbe5876f
6a310d99a741f9ba5e4e537c5ec49d3adbe5876f
Position info (item n of m) incorrect if hidden focusable items in list Bug: 836997 Change-Id: I971fa7076f72d51829b36af8e379260d48ca25ec Reviewed-on: https://chromium-review.googlesource.com/c/1450235 Commit-Queue: Aaron Leventhal <aleventhal@chromium.org> Reviewed-by: Nektarios Paisios <nektar@chromium.org> Cr-Commit-Position: refs/heads/master@{#628890}
bool IsNewNode(const AXNode* node) { return new_nodes.find(node) != new_nodes.end(); }
bool IsNewNode(const AXNode* node) { return new_nodes.find(node) != new_nodes.end(); }
C
Chrome
0
CVE-2016-10066
https://www.cvedetails.com/cve/CVE-2016-10066/
CWE-119
https://github.com/ImageMagick/ImageMagick/commit/f6e9d0d9955e85bdd7540b251cd50d598dacc5e6
f6e9d0d9955e85bdd7540b251cd50d598dacc5e6
null
static MagickBooleanType IsEMF(const unsigned char *magick,const size_t length) { if (length < 48) return(MagickFalse); if (memcmp(magick+40,"\040\105\115\106\000\000\001\000",8) == 0) return(MagickTrue); return(MagickFalse); }
static MagickBooleanType IsEMF(const unsigned char *magick,const size_t length) { if (length < 48) return(MagickFalse); if (memcmp(magick+40,"\040\105\115\106\000\000\001\000",8) == 0) return(MagickTrue); return(MagickFalse); }
C
ImageMagick
0
null
null
null
https://github.com/chromium/chromium/commit/961d0cda4cfc3bcf04aa48ccc32772d63af12d9b
961d0cda4cfc3bcf04aa48ccc32772d63af12d9b
Extract generation logic from the accessory controller into a separate one This change adds a controller that is responsible for mediating communication between ChromePasswordManagerClient and PasswordAccessoryController for password generation. It is also responsible for managing the modal dialog used to present the generated password. In the future it will make it easier to add manual generation to the password accessory. Bug: 845458 Change-Id: I0adbb2de9b9f5012745ae3963154f7d3247b3051 Reviewed-on: https://chromium-review.googlesource.com/c/1448181 Commit-Queue: Ioana Pandele <ioanap@chromium.org> Reviewed-by: Fabio Tirelo <ftirelo@chromium.org> Reviewed-by: Vasilii Sukhanov <vasilii@chromium.org> Reviewed-by: Friedrich [CET] <fhorschig@chromium.org> Cr-Commit-Position: refs/heads/master@{#629542}
void ChromePasswordManagerClient::LogPasswordReuseDetectedEvent() { safe_browsing::PasswordProtectionService* pps = GetPasswordProtectionService(); if (pps) { pps->MaybeLogPasswordReuseDetectedEvent(web_contents()); } }
void ChromePasswordManagerClient::LogPasswordReuseDetectedEvent() { safe_browsing::PasswordProtectionService* pps = GetPasswordProtectionService(); if (pps) { pps->MaybeLogPasswordReuseDetectedEvent(web_contents()); } }
C
Chrome
0
CVE-2015-6575
https://www.cvedetails.com/cve/CVE-2015-6575/
CWE-189
https://android.googlesource.com/platform/frameworks/av/+/cf1581c66c2ad8c5b1aaca2e43e350cf5974f46d
cf1581c66c2ad8c5b1aaca2e43e350cf5974f46d
Fix several ineffective integer overflow checks Commit edd4a76 (which addressed bugs 15328708, 15342615, 15342751) added several integer overflow checks. Unfortunately, those checks fail to take into account integer promotion rules and are thus themselves subject to an integer overflow. Cast the sizeof() operator to a uint64_t to force promotion while multiplying. Bug: 20139950 (cherry picked from commit e2e812e58e8d2716b00d7d82db99b08d3afb4b32) Change-Id: I080eb3fa147601f18cedab86e0360406c3963d7b
status_t SampleTable::getMaxSampleSize(size_t *max_size) { Mutex::Autolock autoLock(mLock); *max_size = 0; for (uint32_t i = 0; i < mNumSampleSizes; ++i) { size_t sample_size; status_t err = getSampleSize_l(i, &sample_size); if (err != OK) { return err; } if (sample_size > *max_size) { *max_size = sample_size; } } return OK; }
status_t SampleTable::getMaxSampleSize(size_t *max_size) { Mutex::Autolock autoLock(mLock); *max_size = 0; for (uint32_t i = 0; i < mNumSampleSizes; ++i) { size_t sample_size; status_t err = getSampleSize_l(i, &sample_size); if (err != OK) { return err; } if (sample_size > *max_size) { *max_size = sample_size; } } return OK; }
C
Android
0
CVE-2018-6096
https://www.cvedetails.com/cve/CVE-2018-6096/
null
https://github.com/chromium/chromium/commit/36f801fdbec07d116a6f4f07bb363f10897d6a51
36f801fdbec07d116a6f4f07bb363f10897d6a51
If a page calls |window.focus()|, kick it out of fullscreen. BUG=776418, 800056 Change-Id: I1880fe600e4814c073f247c43b1c1ac80c8fc017 Reviewed-on: https://chromium-review.googlesource.com/852378 Reviewed-by: Nasko Oskov <nasko@chromium.org> Reviewed-by: Philip Jägenstedt <foolip@chromium.org> Commit-Queue: Avi Drissman <avi@chromium.org> Cr-Commit-Position: refs/heads/master@{#533790}
void HandleChromeDebugURL(const GURL& url) { DCHECK(IsRendererDebugURL(url) && !url.SchemeIs(url::kJavaScriptScheme)); if (url == kChromeUIBadCastCrashURL) { LOG(ERROR) << "Intentionally crashing (with bad cast)" << " because user navigated to " << url.spec(); internal::BadCastCrashIntentionally(); } else if (url == kChromeUICrashURL) { LOG(ERROR) << "Intentionally crashing (with null pointer dereference)" << " because user navigated to " << url.spec(); internal::CrashIntentionally(); } else if (url == kChromeUIDumpURL) { base::debug::DumpWithoutCrashing(); } else if (url == kChromeUIKillURL) { LOG(ERROR) << "Intentionally issuing kill signal to current process" << " because user navigated to " << url.spec(); base::Process::Current().Terminate(1, false); } else if (url == kChromeUIHangURL) { LOG(ERROR) << "Intentionally hanging ourselves with sleep infinite loop" << " because user navigated to " << url.spec(); for (;;) { base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(1)); } } else if (url == kChromeUIShorthangURL) { LOG(ERROR) << "Intentionally sleeping renderer for 20 seconds" << " because user navigated to " << url.spec(); base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(20)); } else if (url == kChromeUIMemoryExhaustURL) { LOG(ERROR) << "Intentionally exhausting renderer memory because user navigated to " << url.spec(); ExhaustMemory(); } else if (url == kChromeUICheckCrashURL) { LOG(ERROR) << "Intentionally causing CHECK because user navigated to " << url.spec(); CHECK(false); } #if defined(ADDRESS_SANITIZER) || defined(SYZYASAN) MaybeTriggerAsanError(url); #endif // ADDRESS_SANITIZER || SYZYASAN }
void HandleChromeDebugURL(const GURL& url) { DCHECK(IsRendererDebugURL(url) && !url.SchemeIs(url::kJavaScriptScheme)); if (url == kChromeUIBadCastCrashURL) { LOG(ERROR) << "Intentionally crashing (with bad cast)" << " because user navigated to " << url.spec(); internal::BadCastCrashIntentionally(); } else if (url == kChromeUICrashURL) { LOG(ERROR) << "Intentionally crashing (with null pointer dereference)" << " because user navigated to " << url.spec(); internal::CrashIntentionally(); } else if (url == kChromeUIDumpURL) { base::debug::DumpWithoutCrashing(); } else if (url == kChromeUIKillURL) { LOG(ERROR) << "Intentionally issuing kill signal to current process" << " because user navigated to " << url.spec(); base::Process::Current().Terminate(1, false); } else if (url == kChromeUIHangURL) { LOG(ERROR) << "Intentionally hanging ourselves with sleep infinite loop" << " because user navigated to " << url.spec(); for (;;) { base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(1)); } } else if (url == kChromeUIShorthangURL) { LOG(ERROR) << "Intentionally sleeping renderer for 20 seconds" << " because user navigated to " << url.spec(); base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(20)); } else if (url == kChromeUIMemoryExhaustURL) { LOG(ERROR) << "Intentionally exhausting renderer memory because user navigated to " << url.spec(); ExhaustMemory(); } else if (url == kChromeUICheckCrashURL) { LOG(ERROR) << "Intentionally causing CHECK because user navigated to " << url.spec(); CHECK(false); } #if defined(ADDRESS_SANITIZER) || defined(SYZYASAN) MaybeTriggerAsanError(url); #endif // ADDRESS_SANITIZER || SYZYASAN }
C
Chrome
0
CVE-2013-2874
https://www.cvedetails.com/cve/CVE-2013-2874/
CWE-264
https://github.com/chromium/chromium/commit/c0da7c1c6e9ffe5006e146b6426f987238d4bf2e
c0da7c1c6e9ffe5006e146b6426f987238d4bf2e
DevTools: handle devtools renderer unresponsiveness during beforeunload event interception This patch fixes the crash which happenes under the following conditions: 1. DevTools window is in undocked state 2. DevTools renderer is unresponsive 3. User attempts to close inspected page BUG=322380 Review URL: https://codereview.chromium.org/84883002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237611 0039d316-1c4b-4281-b951-d872f2087c98
bool DevToolsWindow::InterceptPageBeforeUnload(content::WebContents* contents) { DevToolsWindow* window = DevToolsWindow::GetInstanceForInspectedRenderViewHost( contents->GetRenderViewHost()); if (!window || window->intercepted_page_beforeunload_) return false; window->intercepted_page_beforeunload_ = true; if (!DevToolsWindow::InterceptPageBeforeUnload(window->web_contents())) { window->web_contents()->GetRenderViewHost()->FirePageBeforeUnload(false); } return true; }
bool DevToolsWindow::InterceptPageBeforeUnload(content::WebContents* contents) { DevToolsWindow* window = DevToolsWindow::GetInstanceForInspectedRenderViewHost( contents->GetRenderViewHost()); if (!window || window->intercepted_page_beforeunload_) return false; window->intercepted_page_beforeunload_ = true; if (!DevToolsWindow::InterceptPageBeforeUnload(window->web_contents())) { window->web_contents()->GetRenderViewHost()->FirePageBeforeUnload(false); } return true; }
C
Chrome
0
CVE-2018-13006
https://www.cvedetails.com/cve/CVE-2018-13006/
CWE-125
https://github.com/gpac/gpac/commit/bceb03fd2be95097a7b409ea59914f332fb6bc86
bceb03fd2be95097a7b409ea59914f332fb6bc86
fixed 2 possible heap overflows (inc. #1088)
GF_Err trak_dump(GF_Box *a, FILE * trace) { GF_TrackBox *p; p = (GF_TrackBox *)a; gf_isom_box_dump_start(a, "TrackBox", trace); fprintf(trace, ">\n"); if (p->Header) { gf_isom_box_dump(p->Header, trace); } else if (p->size) { fprintf(trace, "<!--INVALID FILE: Missing Track Header-->\n"); } if (p->References) gf_isom_box_dump(p->References, trace); if (p->meta) gf_isom_box_dump(p->meta, trace); if (p->editBox) gf_isom_box_dump(p->editBox, trace); if (p->Media) gf_isom_box_dump(p->Media, trace); if (p->groups) gf_isom_box_dump(p->groups, trace); if (p->udta) gf_isom_box_dump(p->udta, trace); gf_isom_box_dump_done("TrackBox", a, trace); return GF_OK; }
GF_Err trak_dump(GF_Box *a, FILE * trace) { GF_TrackBox *p; p = (GF_TrackBox *)a; gf_isom_box_dump_start(a, "TrackBox", trace); fprintf(trace, ">\n"); if (p->Header) { gf_isom_box_dump(p->Header, trace); } else if (p->size) { fprintf(trace, "<!--INVALID FILE: Missing Track Header-->\n"); } if (p->References) gf_isom_box_dump(p->References, trace); if (p->meta) gf_isom_box_dump(p->meta, trace); if (p->editBox) gf_isom_box_dump(p->editBox, trace); if (p->Media) gf_isom_box_dump(p->Media, trace); if (p->groups) gf_isom_box_dump(p->groups, trace); if (p->udta) gf_isom_box_dump(p->udta, trace); gf_isom_box_dump_done("TrackBox", a, trace); return GF_OK; }
C
gpac
0
CVE-2013-4130
https://www.cvedetails.com/cve/CVE-2013-4130/
CWE-399
https://cgit.freedesktop.org/spice/spice/commit/?id=53488f0275d6c8a121af49f7ac817d09ce68090d
53488f0275d6c8a121af49f7ac817d09ce68090d
null
uint32_t red_channel_sum_pipes_size(RedChannel *channel) { RingItem *link; RedChannelClient *rcc; uint32_t sum = 0; RING_FOREACH(link, &channel->clients) { rcc = SPICE_CONTAINEROF(link, RedChannelClient, channel_link); sum += rcc->pipe_size; } return sum; }
uint32_t red_channel_sum_pipes_size(RedChannel *channel) { RingItem *link; RedChannelClient *rcc; uint32_t sum = 0; RING_FOREACH(link, &channel->clients) { rcc = SPICE_CONTAINEROF(link, RedChannelClient, channel_link); sum += rcc->pipe_size; } return sum; }
C
spice
0
CVE-2016-1618
https://www.cvedetails.com/cve/CVE-2016-1618/
CWE-310
https://github.com/chromium/chromium/commit/0d151e09e13a704e9738ea913d117df7282e6c7d
0d151e09e13a704e9738ea913d117df7282e6c7d
Add assertions that the empty Platform::cryptographicallyRandomValues() overrides are not being used. These implementations are not safe and look scary if not accompanied by an assertion. Also one of the comments was incorrect. BUG=552749 Review URL: https://codereview.chromium.org/1419293005 Cr-Commit-Position: refs/heads/master@{#359229}
void BlinkMediaTestSuite::Initialize() { base::TestSuite::Initialize(); #if defined(OS_ANDROID) JNIEnv* env = base::android::AttachCurrentThread(); ui::gl::android::RegisterJni(env); media::RegisterJni(env); #endif media::InitializeMediaLibrary(); #ifdef V8_USE_EXTERNAL_STARTUP_DATA gin::V8Initializer::LoadV8Snapshot(); gin::V8Initializer::LoadV8Natives(); #endif scoped_ptr<base::MessageLoop> message_loop; if (!base::MessageLoop::current()) message_loop.reset(new base::MessageLoop()); blink::initialize(blink_platform_support_.get()); }
void BlinkMediaTestSuite::Initialize() { base::TestSuite::Initialize(); #if defined(OS_ANDROID) JNIEnv* env = base::android::AttachCurrentThread(); ui::gl::android::RegisterJni(env); media::RegisterJni(env); #endif media::InitializeMediaLibrary(); #ifdef V8_USE_EXTERNAL_STARTUP_DATA gin::V8Initializer::LoadV8Snapshot(); gin::V8Initializer::LoadV8Natives(); #endif scoped_ptr<base::MessageLoop> message_loop; if (!base::MessageLoop::current()) message_loop.reset(new base::MessageLoop()); blink::initialize(blink_platform_support_.get()); }
C
Chrome
0
CVE-2017-5060
https://www.cvedetails.com/cve/CVE-2017-5060/
CWE-20
https://github.com/chromium/chromium/commit/08cb718ba7c3961c1006176c9faba0a5841ec792
08cb718ba7c3961c1006176c9faba0a5841ec792
Block domain labels made of Cyrillic letters that look alike Latin Block a label made entirely of Latin-look-alike Cyrillic letters when the TLD is not an IDN (i.e. this check is ON only for TLDs like 'com', 'net', 'uk', but not applied for IDN TLDs like рф. BUG=683314 TEST=components_unittests --gtest_filter=U*IDN* Review-Url: https://codereview.chromium.org/2683793010 Cr-Commit-Position: refs/heads/master@{#459226}
bool IDNToUnicodeOneComponent(const base::char16* comp, size_t comp_len, bool is_tld_ascii, base::string16* out) { DCHECK(out); if (comp_len == 0) return false; static const base::char16 kIdnPrefix[] = {'x', 'n', '-', '-'}; if ((comp_len > arraysize(kIdnPrefix)) && !memcmp(comp, kIdnPrefix, sizeof(kIdnPrefix))) { UIDNA* uidna = g_uidna.Get().value; DCHECK(uidna != NULL); size_t original_length = out->length(); int32_t output_length = 64; UIDNAInfo info = UIDNA_INFO_INITIALIZER; UErrorCode status; do { out->resize(original_length + output_length); status = U_ZERO_ERROR; output_length = uidna_labelToUnicode( uidna, comp, static_cast<int32_t>(comp_len), &(*out)[original_length], output_length, &info, &status); } while ((status == U_BUFFER_OVERFLOW_ERROR && info.errors == 0)); if (U_SUCCESS(status) && info.errors == 0) { out->resize(original_length + output_length); if (IsIDNComponentSafe( base::StringPiece16(out->data() + original_length, base::checked_cast<size_t>(output_length)), is_tld_ascii)) return true; } out->resize(original_length); } out->append(comp, comp_len); return false; }
bool IDNToUnicodeOneComponent(const base::char16* comp, size_t comp_len, base::string16* out) { DCHECK(out); if (comp_len == 0) return false; static const base::char16 kIdnPrefix[] = {'x', 'n', '-', '-'}; if ((comp_len > arraysize(kIdnPrefix)) && !memcmp(comp, kIdnPrefix, sizeof(kIdnPrefix))) { UIDNA* uidna = g_uidna.Get().value; DCHECK(uidna != NULL); size_t original_length = out->length(); int32_t output_length = 64; UIDNAInfo info = UIDNA_INFO_INITIALIZER; UErrorCode status; do { out->resize(original_length + output_length); status = U_ZERO_ERROR; output_length = uidna_labelToUnicode( uidna, comp, static_cast<int32_t>(comp_len), &(*out)[original_length], output_length, &info, &status); } while ((status == U_BUFFER_OVERFLOW_ERROR && info.errors == 0)); if (U_SUCCESS(status) && info.errors == 0) { out->resize(original_length + output_length); if (IsIDNComponentSafe( base::StringPiece16(out->data() + original_length, base::checked_cast<size_t>(output_length)))) return true; } out->resize(original_length); } out->append(comp, comp_len); return false; }
C
Chrome
1
CVE-2018-19044
https://www.cvedetails.com/cve/CVE-2018-19044/
CWE-59
https://github.com/acassen/keepalived/commit/04f2d32871bb3b11d7dc024039952f2fe2750306
04f2d32871bb3b11d7dc024039952f2fe2750306
When opening files for write, ensure they aren't symbolic links Issue #1048 identified that if, for example, a non privileged user created a symbolic link from /etc/keepalvied.data to /etc/passwd, writing to /etc/keepalived.data (which could be invoked via DBus) would cause /etc/passwd to be overwritten. This commit stops keepalived writing to pathnames where the ultimate component is a symbolic link, by setting O_NOFOLLOW whenever opening a file for writing. This might break some setups, where, for example, /etc/keepalived.data was a symbolic link to /home/fred/keepalived.data. If this was the case, instead create a symbolic link from /home/fred/keepalived.data to /tmp/keepalived.data, so that the file is still accessible via /home/fred/keepalived.data. There doesn't appear to be a way around this backward incompatibility, since even checking if the pathname is a symbolic link prior to opening for writing would create a race condition. Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
vrrp_dont_track_handler(__attribute__((unused)) vector_t *strvec) { vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp); vrrp->dont_track_primary = true; }
vrrp_dont_track_handler(__attribute__((unused)) vector_t *strvec) { vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp); vrrp->dont_track_primary = true; }
C
keepalived
0
CVE-2012-5155
https://www.cvedetails.com/cve/CVE-2012-5155/
CWE-264
https://github.com/chromium/chromium/commit/0d7717faeaef5b72434632c95c78bee4883e2573
0d7717faeaef5b72434632c95c78bee4883e2573
Fix OS_MACOS typos. Should be OS_MACOSX. BUG=163208 TEST=none Review URL: https://codereview.chromium.org/12829005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189130 0039d316-1c4b-4281-b951-d872f2087c98
virtual ~FullscreenTestBrowserWindow() {}
virtual ~FullscreenTestBrowserWindow() {}
C
Chrome
0
CVE-2016-5696
https://www.cvedetails.com/cve/CVE-2016-5696/
CWE-200
https://github.com/torvalds/linux/commit/75ff39ccc1bd5d3c455b6822ab09e533c551f758
75ff39ccc1bd5d3c455b6822ab09e533c551f758
tcp: make challenge acks less predictable Yue Cao claims that current host rate limiting of challenge ACKS (RFC 5961) could leak enough information to allow a patient attacker to hijack TCP sessions. He will soon provide details in an academic paper. This patch increases the default limit from 100 to 1000, and adds some randomization so that the attacker can no longer hijack sessions without spending a considerable amount of probes. Based on initial analysis and patch from Linus. Note that we also have per socket rate limiting, so it is tempting to remove the host limit in the future. v2: randomize the count of challenge acks per second, not the period. Fixes: 282f23c6ee34 ("tcp: implement RFC 5961 3.2") Reported-by: Yue Cao <ycao009@ucr.edu> Signed-off-by: Eric Dumazet <edumazet@google.com> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: Yuchung Cheng <ycheng@google.com> Cc: Neal Cardwell <ncardwell@google.com> Acked-by: Neal Cardwell <ncardwell@google.com> Acked-by: Yuchung Cheng <ycheng@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
static bool tcp_parse_aligned_timestamp(struct tcp_sock *tp, const struct tcphdr *th) { const __be32 *ptr = (const __be32 *)(th + 1); if (*ptr == htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) { tp->rx_opt.saw_tstamp = 1; ++ptr; tp->rx_opt.rcv_tsval = ntohl(*ptr); ++ptr; if (*ptr) tp->rx_opt.rcv_tsecr = ntohl(*ptr) - tp->tsoffset; else tp->rx_opt.rcv_tsecr = 0; return true; } return false; }
static bool tcp_parse_aligned_timestamp(struct tcp_sock *tp, const struct tcphdr *th) { const __be32 *ptr = (const __be32 *)(th + 1); if (*ptr == htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) { tp->rx_opt.saw_tstamp = 1; ++ptr; tp->rx_opt.rcv_tsval = ntohl(*ptr); ++ptr; if (*ptr) tp->rx_opt.rcv_tsecr = ntohl(*ptr) - tp->tsoffset; else tp->rx_opt.rcv_tsecr = 0; return true; } return false; }
C
linux
0
CVE-2018-20067
https://www.cvedetails.com/cve/CVE-2018-20067/
CWE-254
https://github.com/chromium/chromium/commit/a7d715ae5b654d1f98669fd979a00282a7229044
a7d715ae5b654d1f98669fd979a00282a7229044
Prevent renderer initiated back navigation to cancel a browser one. Renderer initiated back/forward navigations must not be able to cancel ongoing browser initiated navigation if they are not user initiated. Note: 'normal' renderer initiated navigation uses the FrameHost::BeginNavigation() path. A code similar to this patch is done in NavigatorImpl::OnBeginNavigation(). Test: ----- Added: NavigationBrowserTest. * HistoryBackInBeforeUnload * HistoryBackInBeforeUnloadAfterSetTimeout * HistoryBackCancelPendingNavigationNoUserGesture * HistoryBackCancelPendingNavigationUserGesture Fixed: * (WPT) .../the-history-interface/traverse_the_history_2.html * (WPT) .../the-history-interface/traverse_the_history_3.html * (WPT) .../the-history-interface/traverse_the_history_4.html * (WPT) .../the-history-interface/traverse_the_history_5.html Bug: 879965 Change-Id: I1a9bfaaea1ffc219e6c32f6e676b660e746c578c Reviewed-on: https://chromium-review.googlesource.com/1209744 Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Mustaq Ahmed <mustaq@chromium.org> Reviewed-by: Camille Lamy <clamy@chromium.org> Reviewed-by: Charlie Reis <creis@chromium.org> Cr-Commit-Position: refs/heads/master@{#592823}
void WebContentsImpl::CollapseSelection() { RenderFrameHostImpl* focused_frame = GetFocusedFrame(); if (!focused_frame) return; focused_frame->GetFrameInputHandler()->CollapseSelection(); }
void WebContentsImpl::CollapseSelection() { RenderFrameHostImpl* focused_frame = GetFocusedFrame(); if (!focused_frame) return; focused_frame->GetFrameInputHandler()->CollapseSelection(); }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/610f904d8215075c4681be4eb413f4348860bf9f
610f904d8215075c4681be4eb413f4348860bf9f
Retrieve per host storage usage from QuotaManager. R=kinuko@chromium.org BUG=none TEST=QuotaManagerTest.GetUsage Review URL: http://codereview.chromium.org/8079004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103921 0039d316-1c4b-4281-b951-d872f2087c98
bool db_disabled() const { return db_disabled_; }
bool db_disabled() const { return db_disabled_; }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/7cb8e1ae121cf6b14aa0a59cc708de630c0ef965
7cb8e1ae121cf6b14aa0a59cc708de630c0ef965
Move variations prefs into the variations component These prefs are used by variations code that is targeted for componentization. BUG=382865 TBR=thakis Review URL: https://codereview.chromium.org/1265423003 Cr-Commit-Position: refs/heads/master@{#343661}
void MasterPreferences::InitializeFromCommandLine( const base::CommandLine& cmd_line) { #if defined(OS_WIN) if (cmd_line.HasSwitch(installer::switches::kInstallerData)) { base::FilePath prefs_path(cmd_line.GetSwitchValuePath( installer::switches::kInstallerData)); InitializeFromFilePath(prefs_path); } else { master_dictionary_.reset(new base::DictionaryValue()); } DCHECK(master_dictionary_.get()); static const struct CmdLineSwitchToDistributionSwitch { const char* cmd_line_switch; const char* distribution_switch; } translate_switches[] = { { installer::switches::kAutoLaunchChrome, installer::master_preferences::kAutoLaunchChrome }, { installer::switches::kChrome, installer::master_preferences::kChrome }, { installer::switches::kDisableLogging, installer::master_preferences::kDisableLogging }, { installer::switches::kMsi, installer::master_preferences::kMsi }, { installer::switches::kMultiInstall, installer::master_preferences::kMultiInstall }, { installer::switches::kDoNotRegisterForUpdateLaunch, installer::master_preferences::kDoNotRegisterForUpdateLaunch }, { installer::switches::kDoNotLaunchChrome, installer::master_preferences::kDoNotLaunchChrome }, { installer::switches::kMakeChromeDefault, installer::master_preferences::kMakeChromeDefault }, { installer::switches::kSystemLevel, installer::master_preferences::kSystemLevel }, { installer::switches::kVerboseLogging, installer::master_preferences::kVerboseLogging }, }; std::string name(installer::master_preferences::kDistroDict); for (int i = 0; i < arraysize(translate_switches); ++i) { if (cmd_line.HasSwitch(translate_switches[i].cmd_line_switch)) { name.assign(installer::master_preferences::kDistroDict); name.append(".").append(translate_switches[i].distribution_switch); master_dictionary_->SetBoolean(name, true); } } std::wstring str_value(cmd_line.GetSwitchValueNative( installer::switches::kLogFile)); if (!str_value.empty()) { name.assign(installer::master_preferences::kDistroDict); name.append(".").append(installer::master_preferences::kLogFile); master_dictionary_->SetString(name, str_value); } scoped_ptr<base::Environment> env(base::Environment::Create()); if (env != NULL) { std::string is_machine_var; env->GetVar(env_vars::kGoogleUpdateIsMachineEnvVar, &is_machine_var); if (!is_machine_var.empty() && is_machine_var[0] == '1') { VLOG(1) << "Taking system-level from environment."; name.assign(installer::master_preferences::kDistroDict); name.append(".").append(installer::master_preferences::kSystemLevel); master_dictionary_->SetBoolean(name, true); } } master_dictionary_->GetDictionary(installer::master_preferences::kDistroDict, &distribution_); InitializeProductFlags(); #endif }
void MasterPreferences::InitializeFromCommandLine( const base::CommandLine& cmd_line) { #if defined(OS_WIN) if (cmd_line.HasSwitch(installer::switches::kInstallerData)) { base::FilePath prefs_path(cmd_line.GetSwitchValuePath( installer::switches::kInstallerData)); InitializeFromFilePath(prefs_path); } else { master_dictionary_.reset(new base::DictionaryValue()); } DCHECK(master_dictionary_.get()); static const struct CmdLineSwitchToDistributionSwitch { const char* cmd_line_switch; const char* distribution_switch; } translate_switches[] = { { installer::switches::kAutoLaunchChrome, installer::master_preferences::kAutoLaunchChrome }, { installer::switches::kChrome, installer::master_preferences::kChrome }, { installer::switches::kDisableLogging, installer::master_preferences::kDisableLogging }, { installer::switches::kMsi, installer::master_preferences::kMsi }, { installer::switches::kMultiInstall, installer::master_preferences::kMultiInstall }, { installer::switches::kDoNotRegisterForUpdateLaunch, installer::master_preferences::kDoNotRegisterForUpdateLaunch }, { installer::switches::kDoNotLaunchChrome, installer::master_preferences::kDoNotLaunchChrome }, { installer::switches::kMakeChromeDefault, installer::master_preferences::kMakeChromeDefault }, { installer::switches::kSystemLevel, installer::master_preferences::kSystemLevel }, { installer::switches::kVerboseLogging, installer::master_preferences::kVerboseLogging }, }; std::string name(installer::master_preferences::kDistroDict); for (int i = 0; i < arraysize(translate_switches); ++i) { if (cmd_line.HasSwitch(translate_switches[i].cmd_line_switch)) { name.assign(installer::master_preferences::kDistroDict); name.append(".").append(translate_switches[i].distribution_switch); master_dictionary_->SetBoolean(name, true); } } std::wstring str_value(cmd_line.GetSwitchValueNative( installer::switches::kLogFile)); if (!str_value.empty()) { name.assign(installer::master_preferences::kDistroDict); name.append(".").append(installer::master_preferences::kLogFile); master_dictionary_->SetString(name, str_value); } scoped_ptr<base::Environment> env(base::Environment::Create()); if (env != NULL) { std::string is_machine_var; env->GetVar(env_vars::kGoogleUpdateIsMachineEnvVar, &is_machine_var); if (!is_machine_var.empty() && is_machine_var[0] == '1') { VLOG(1) << "Taking system-level from environment."; name.assign(installer::master_preferences::kDistroDict); name.append(".").append(installer::master_preferences::kSystemLevel); master_dictionary_->SetBoolean(name, true); } } master_dictionary_->GetDictionary(installer::master_preferences::kDistroDict, &distribution_); InitializeProductFlags(); #endif }
C
Chrome
0
CVE-2012-6712
https://www.cvedetails.com/cve/CVE-2012-6712/
CWE-119
https://github.com/torvalds/linux/commit/2da424b0773cea3db47e1e81db71eeebde8269d4
2da424b0773cea3db47e1e81db71eeebde8269d4
iwlwifi: Sanity check for sta_id On my testing, I saw some strange behavior [ 421.739708] iwlwifi 0000:01:00.0: ACTIVATE a non DRIVER active station id 148 addr 00:00:00:00:00:00 [ 421.739719] iwlwifi 0000:01:00.0: iwl_sta_ucode_activate Added STA id 148 addr 00:00:00:00:00:00 to uCode not sure how it happen, but adding the sanity check to prevent memory corruption Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
static u8 iwlagn_key_sta_id(struct iwl_priv *priv, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; u8 sta_id = IWL_INVALID_STATION; if (sta) sta_id = iwl_sta_id(sta); /* * The device expects GTKs for station interfaces to be * installed as GTKs for the AP station. If we have no * station ID, then use the ap_sta_id in that case. */ if (!sta && vif && vif_priv->ctx) { switch (vif->type) { case NL80211_IFTYPE_STATION: sta_id = vif_priv->ctx->ap_sta_id; break; default: /* * In all other cases, the key will be * used either for TX only or is bound * to a station already. */ break; } } return sta_id; }
static u8 iwlagn_key_sta_id(struct iwl_priv *priv, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; u8 sta_id = IWL_INVALID_STATION; if (sta) sta_id = iwl_sta_id(sta); /* * The device expects GTKs for station interfaces to be * installed as GTKs for the AP station. If we have no * station ID, then use the ap_sta_id in that case. */ if (!sta && vif && vif_priv->ctx) { switch (vif->type) { case NL80211_IFTYPE_STATION: sta_id = vif_priv->ctx->ap_sta_id; break; default: /* * In all other cases, the key will be * used either for TX only or is bound * to a station already. */ break; } } return sta_id; }
C
linux
0
CVE-2013-2902
https://www.cvedetails.com/cve/CVE-2013-2902/
CWE-399
https://github.com/chromium/chromium/commit/87a082c5137a63dedb3fe5b1f48f75dcd1fd780c
87a082c5137a63dedb3fe5b1f48f75dcd1fd780c
Removed pinch viewport scroll offset distribution The associated change in Blink makes the pinch viewport a proper ScrollableArea meaning the normal path for synchronizing layer scroll offsets is used. This is a 2 sided patch, the other CL: https://codereview.chromium.org/199253002/ BUG=349941 Review URL: https://codereview.chromium.org/210543002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260105 0039d316-1c4b-4281-b951-d872f2087c98
bool LayerTreeHost::ScheduleMicroBenchmark( const std::string& benchmark_name, scoped_ptr<base::Value> value, const MicroBenchmark::DoneCallback& callback) { return micro_benchmark_controller_.ScheduleRun( benchmark_name, value.Pass(), callback); }
bool LayerTreeHost::ScheduleMicroBenchmark( const std::string& benchmark_name, scoped_ptr<base::Value> value, const MicroBenchmark::DoneCallback& callback) { return micro_benchmark_controller_.ScheduleRun( benchmark_name, value.Pass(), callback); }
C
Chrome
0
CVE-2013-1848
https://www.cvedetails.com/cve/CVE-2013-1848/
CWE-20
https://github.com/torvalds/linux/commit/8d0c2d10dd72c5292eda7a06231056a4c972e4cc
8d0c2d10dd72c5292eda7a06231056a4c972e4cc
ext3: Fix format string issues ext3_msg() takes the printk prefix as the second parameter and the format string as the third parameter. Two callers of ext3_msg omit the prefix and pass the format string as the second parameter and the first parameter to the format string as the third parameter. In both cases this string comes from an arbitrary source. Which means the string may contain format string characters, which will lead to undefined and potentially harmful behavior. The issue was introduced in commit 4cf46b67eb("ext3: Unify log messages in ext3") and is fixed by this patch. CC: stable@vger.kernel.org Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jan Kara <jack@suse.cz>
void ext3_error(struct super_block *sb, const char *function, const char *fmt, ...) { struct va_format vaf; va_list args; va_start(args, fmt); vaf.fmt = fmt; vaf.va = &args; printk(KERN_CRIT "EXT3-fs error (device %s): %s: %pV\n", sb->s_id, function, &vaf); va_end(args); ext3_handle_error(sb); }
void ext3_error(struct super_block *sb, const char *function, const char *fmt, ...) { struct va_format vaf; va_list args; va_start(args, fmt); vaf.fmt = fmt; vaf.va = &args; printk(KERN_CRIT "EXT3-fs error (device %s): %s: %pV\n", sb->s_id, function, &vaf); va_end(args); ext3_handle_error(sb); }
C
linux
0
CVE-2011-2918
https://www.cvedetails.com/cve/CVE-2011-2918/
CWE-399
https://github.com/torvalds/linux/commit/a8b0ca17b80e92faab46ee7179ba9e99ccb61233
a8b0ca17b80e92faab46ee7179ba9e99ccb61233
perf: Remove the nmi parameter from the swevent and overflow interface The nmi parameter indicated if we could do wakeups from the current context, if not, we would set some state and self-IPI and let the resulting interrupt do the wakeup. For the various event classes: - hardware: nmi=0; PMI is in fact an NMI or we run irq_work_run from the PMI-tail (ARM etc.) - tracepoint: nmi=0; since tracepoint could be from NMI context. - software: nmi=[0,1]; some, like the schedule thing cannot perform wakeups, and hence need 0. As one can see, there is very little nmi=1 usage, and the down-side of not using it is that on some platforms some software events can have a jiffy delay in wakeup (when arch_irq_work_raise isn't implemented). The up-side however is that we can remove the nmi parameter and save a bunch of conditionals in fast paths. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Michael Cree <mcree@orcon.net.nz> Cc: Will Deacon <will.deacon@arm.com> Cc: Deng-Cheng Zhu <dengcheng.zhu@gmail.com> Cc: Anton Blanchard <anton@samba.org> Cc: Eric B Munson <emunson@mgebm.net> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Paul Mundt <lethal@linux-sh.org> Cc: David S. Miller <davem@davemloft.net> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jason Wessel <jason.wessel@windriver.com> Cc: Don Zickus <dzickus@redhat.com> Link: http://lkml.kernel.org/n/tip-agjev8eu666tvknpb3iaj0fg@git.kernel.org Signed-off-by: Ingo Molnar <mingo@elte.hu>
static inline bool kernel_ip(unsigned long ip) { #ifdef CONFIG_X86_32 return ip > PAGE_OFFSET; #else return (long)ip < 0; #endif }
static inline bool kernel_ip(unsigned long ip) { #ifdef CONFIG_X86_32 return ip > PAGE_OFFSET; #else return (long)ip < 0; #endif }
C
linux
0
CVE-2016-2449
https://www.cvedetails.com/cve/CVE-2016-2449/
CWE-264
https://android.googlesource.com/platform/frameworks/av/+/b04aee833c5cfb6b31b8558350feb14bb1a0f353
b04aee833c5cfb6b31b8558350feb14bb1a0f353
Camera3Device: Validate template ID Validate template ID before creating a default request. Bug: 26866110 Bug: 27568958 Change-Id: Ifda457024f1d5c2b1382f189c1a8d5fda852d30d
void Camera3Device::sProcessCaptureResult(const camera3_callback_ops *cb, const camera3_capture_result *result) { Camera3Device *d = const_cast<Camera3Device*>(static_cast<const Camera3Device*>(cb)); d->processCaptureResult(result); }
void Camera3Device::sProcessCaptureResult(const camera3_callback_ops *cb, const camera3_capture_result *result) { Camera3Device *d = const_cast<Camera3Device*>(static_cast<const Camera3Device*>(cb)); d->processCaptureResult(result); }
C
Android
0
CVE-2018-1066
https://www.cvedetails.com/cve/CVE-2018-1066/
CWE-476
https://github.com/torvalds/linux/commit/cabfb3680f78981d26c078a26e5c748531257ebb
cabfb3680f78981d26c078a26e5c748531257ebb
CIFS: Enable encryption during session setup phase In order to allow encryption on SMB connection we need to exchange a session key and generate encryption and decryption keys. Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
SMB2_sess_auth_rawntlmssp_authenticate(struct SMB2_sess_data *sess_data) { int rc; struct cifs_ses *ses = sess_data->ses; struct smb2_sess_setup_req *req; struct smb2_sess_setup_rsp *rsp = NULL; unsigned char *ntlmssp_blob = NULL; bool use_spnego = false; /* else use raw ntlmssp */ u16 blob_length = 0; rc = SMB2_sess_alloc_buffer(sess_data); if (rc) goto out; req = (struct smb2_sess_setup_req *) sess_data->iov[0].iov_base; req->hdr.sync_hdr.SessionId = ses->Suid; rc = build_ntlmssp_auth_blob(&ntlmssp_blob, &blob_length, ses, sess_data->nls_cp); if (rc) { cifs_dbg(FYI, "build_ntlmssp_auth_blob failed %d\n", rc); goto out; } if (use_spnego) { /* BB eventually need to add this */ cifs_dbg(VFS, "spnego not supported for SMB2 yet\n"); rc = -EOPNOTSUPP; goto out; } sess_data->iov[1].iov_base = ntlmssp_blob; sess_data->iov[1].iov_len = blob_length; rc = SMB2_sess_sendreceive(sess_data); if (rc) goto out; rsp = (struct smb2_sess_setup_rsp *)sess_data->iov[0].iov_base; ses->Suid = rsp->hdr.sync_hdr.SessionId; ses->session_flags = le16_to_cpu(rsp->SessionFlags); if (ses->session_flags & SMB2_SESSION_FLAG_ENCRYPT_DATA) cifs_dbg(VFS, "SMB3 encryption not supported yet\n"); rc = SMB2_sess_establish_session(sess_data); out: kfree(ntlmssp_blob); SMB2_sess_free_buffer(sess_data); kfree(ses->ntlmssp); ses->ntlmssp = NULL; sess_data->result = rc; sess_data->func = NULL; }
SMB2_sess_auth_rawntlmssp_authenticate(struct SMB2_sess_data *sess_data) { int rc; struct cifs_ses *ses = sess_data->ses; struct smb2_sess_setup_req *req; struct smb2_sess_setup_rsp *rsp = NULL; unsigned char *ntlmssp_blob = NULL; bool use_spnego = false; /* else use raw ntlmssp */ u16 blob_length = 0; rc = SMB2_sess_alloc_buffer(sess_data); if (rc) goto out; req = (struct smb2_sess_setup_req *) sess_data->iov[0].iov_base; req->hdr.sync_hdr.SessionId = ses->Suid; rc = build_ntlmssp_auth_blob(&ntlmssp_blob, &blob_length, ses, sess_data->nls_cp); if (rc) { cifs_dbg(FYI, "build_ntlmssp_auth_blob failed %d\n", rc); goto out; } if (use_spnego) { /* BB eventually need to add this */ cifs_dbg(VFS, "spnego not supported for SMB2 yet\n"); rc = -EOPNOTSUPP; goto out; } sess_data->iov[1].iov_base = ntlmssp_blob; sess_data->iov[1].iov_len = blob_length; rc = SMB2_sess_sendreceive(sess_data); if (rc) goto out; rsp = (struct smb2_sess_setup_rsp *)sess_data->iov[0].iov_base; ses->Suid = rsp->hdr.sync_hdr.SessionId; ses->session_flags = le16_to_cpu(rsp->SessionFlags); if (ses->session_flags & SMB2_SESSION_FLAG_ENCRYPT_DATA) cifs_dbg(VFS, "SMB3 encryption not supported yet\n"); rc = SMB2_sess_establish_session(sess_data); out: kfree(ntlmssp_blob); SMB2_sess_free_buffer(sess_data); kfree(ses->ntlmssp); ses->ntlmssp = NULL; sess_data->result = rc; sess_data->func = NULL; }
C
linux
0
CVE-2019-14284
https://www.cvedetails.com/cve/CVE-2019-14284/
CWE-369
https://github.com/torvalds/linux/commit/f3554aeb991214cbfafd17d55e2bfddb50282e32
f3554aeb991214cbfafd17d55e2bfddb50282e32
floppy: fix div-by-zero in setup_format_params This fixes a divide by zero error in the setup_format_params function of the floppy driver. Two consecutive ioctls can trigger the bug: The first one should set the drive geometry with such .sect and .rate values for the F_SECT_PER_TRACK to become zero. Next, the floppy format operation should be called. A floppy disk is not required to be inserted. An unprivileged user could trigger the bug if the device is accessible. The patch checks F_SECT_PER_TRACK for a non-zero value in the set_geometry function. The proper check should involve a reasonable upper limit for the .sect and .rate fields, but it could change the UAPI. The patch also checks F_SECT_PER_TRACK in the setup_format_params, and cancels the formatting operation in case of zero. The bug was found by syzkaller. Signed-off-by: Denis Efremov <efremov@ispras.ru> Tested-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
static int raw_cmd_copyin(int cmd, void __user *param, struct floppy_raw_cmd **rcmd) { struct floppy_raw_cmd *ptr; int ret; int i; *rcmd = NULL; loop: ptr = kmalloc(sizeof(struct floppy_raw_cmd), GFP_KERNEL); if (!ptr) return -ENOMEM; *rcmd = ptr; ret = copy_from_user(ptr, param, sizeof(*ptr)); ptr->next = NULL; ptr->buffer_length = 0; ptr->kernel_data = NULL; if (ret) return -EFAULT; param += sizeof(struct floppy_raw_cmd); if (ptr->cmd_count > 33) /* the command may now also take up the space * initially intended for the reply & the * reply count. Needed for long 82078 commands * such as RESTORE, which takes ... 17 command * bytes. Murphy's law #137: When you reserve * 16 bytes for a structure, you'll one day * discover that you really need 17... */ return -EINVAL; for (i = 0; i < 16; i++) ptr->reply[i] = 0; ptr->resultcode = 0; if (ptr->flags & (FD_RAW_READ | FD_RAW_WRITE)) { if (ptr->length <= 0) return -EINVAL; ptr->kernel_data = (char *)fd_dma_mem_alloc(ptr->length); fallback_on_nodma_alloc(&ptr->kernel_data, ptr->length); if (!ptr->kernel_data) return -ENOMEM; ptr->buffer_length = ptr->length; } if (ptr->flags & FD_RAW_WRITE) { ret = fd_copyin(ptr->data, ptr->kernel_data, ptr->length); if (ret) return ret; } if (ptr->flags & FD_RAW_MORE) { rcmd = &(ptr->next); ptr->rate &= 0x43; goto loop; } return 0; }
static int raw_cmd_copyin(int cmd, void __user *param, struct floppy_raw_cmd **rcmd) { struct floppy_raw_cmd *ptr; int ret; int i; *rcmd = NULL; loop: ptr = kmalloc(sizeof(struct floppy_raw_cmd), GFP_KERNEL); if (!ptr) return -ENOMEM; *rcmd = ptr; ret = copy_from_user(ptr, param, sizeof(*ptr)); ptr->next = NULL; ptr->buffer_length = 0; ptr->kernel_data = NULL; if (ret) return -EFAULT; param += sizeof(struct floppy_raw_cmd); if (ptr->cmd_count > 33) /* the command may now also take up the space * initially intended for the reply & the * reply count. Needed for long 82078 commands * such as RESTORE, which takes ... 17 command * bytes. Murphy's law #137: When you reserve * 16 bytes for a structure, you'll one day * discover that you really need 17... */ return -EINVAL; for (i = 0; i < 16; i++) ptr->reply[i] = 0; ptr->resultcode = 0; if (ptr->flags & (FD_RAW_READ | FD_RAW_WRITE)) { if (ptr->length <= 0) return -EINVAL; ptr->kernel_data = (char *)fd_dma_mem_alloc(ptr->length); fallback_on_nodma_alloc(&ptr->kernel_data, ptr->length); if (!ptr->kernel_data) return -ENOMEM; ptr->buffer_length = ptr->length; } if (ptr->flags & FD_RAW_WRITE) { ret = fd_copyin(ptr->data, ptr->kernel_data, ptr->length); if (ret) return ret; } if (ptr->flags & FD_RAW_MORE) { rcmd = &(ptr->next); ptr->rate &= 0x43; goto loop; } return 0; }
C
linux
0
CVE-2013-0839
https://www.cvedetails.com/cve/CVE-2013-0839/
CWE-399
https://github.com/chromium/chromium/commit/dd3b6fe574edad231c01c78e4647a74c38dc4178
dd3b6fe574edad231c01c78e4647a74c38dc4178
Remove parent* arg from GDataEntry ctor. * Remove static FromDocumentEntry from GDataEntry, GDataFile, GDataDirectory. Replace with InitFromDocumentEntry. * Move common code from GDataFile::InitFromDocumentEntry and GDataDirectory::InitFromDocumentEntry to GDataEntry::InitFromDocumentEntry. * Add GDataDirectoryService::FromDocumentEntry and use this everywhere. * Make ctors of GDataFile, GDataDirectory private, so these must be created by GDataDirectoryService's CreateGDataFile and CreateGDataDirectory. Make GDataEntry ctor protected. BUG=141494 TEST=unit tests. Review URL: https://chromiumcodereview.appspot.com/10854083 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151008 0039d316-1c4b-4281-b951-d872f2087c98
void GDataFileSystem::OnGetCacheFilePathCompleteForCloseFile( const FilePath& file_path, const FileOperationCallback& callback, GDataFileError error, const std::string& resource_id, const std::string& md5, const FilePath& local_cache_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (error != GDATA_FILE_OK) { if (!callback.is_null()) callback.Run(error); return; } base::PlatformFileInfo* file_info = new base::PlatformFileInfo; bool* get_file_info_result = new bool(false); util::PostBlockingPoolSequencedTaskAndReply( FROM_HERE, blocking_task_runner_, base::Bind(&GetFileInfoOnBlockingPool, local_cache_path, base::Unretained(file_info), base::Unretained(get_file_info_result)), base::Bind(&GDataFileSystem::OnGetModifiedFileInfoCompleteForCloseFile, ui_weak_ptr_, file_path, base::Owned(file_info), base::Owned(get_file_info_result), callback)); }
void GDataFileSystem::OnGetCacheFilePathCompleteForCloseFile( const FilePath& file_path, const FileOperationCallback& callback, GDataFileError error, const std::string& resource_id, const std::string& md5, const FilePath& local_cache_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (error != GDATA_FILE_OK) { if (!callback.is_null()) callback.Run(error); return; } base::PlatformFileInfo* file_info = new base::PlatformFileInfo; bool* get_file_info_result = new bool(false); util::PostBlockingPoolSequencedTaskAndReply( FROM_HERE, blocking_task_runner_, base::Bind(&GetFileInfoOnBlockingPool, local_cache_path, base::Unretained(file_info), base::Unretained(get_file_info_result)), base::Bind(&GDataFileSystem::OnGetModifiedFileInfoCompleteForCloseFile, ui_weak_ptr_, file_path, base::Owned(file_info), base::Owned(get_file_info_result), callback)); }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/3b7ff00418c0e7593d42e5648ba39397e23fe2f9
3b7ff00418c0e7593d42e5648ba39397e23fe2f9
sync: ensure sync init path doesn't block on CheckTime The call to RequestEarlyExit (which calls Abort) only happens if the SyncBackendHost has received the initialization callback from the SyncManager. But during init, the SyncManager could make a call to CheckTime, meaning that call would never be aborted. This patch makes sure to cover that case. BUG=93829 TEST=None at the moment :( Review URL: http://codereview.chromium.org/7862011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100543 0039d316-1c4b-4281-b951-d872f2087c98
void SyncBackendHost::Core::SaveChanges() { sync_manager_->SaveChanges(); }
void SyncBackendHost::Core::SaveChanges() { sync_manager_->SaveChanges(); }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/1da0daecc540238cb473f0d6322da51d3a544244
1da0daecc540238cb473f0d6322da51d3a544244
Change VideoDecoder::ReadCB to take const scoped_refptr<VideoFrame>&. BUG=none TEST=media_unittests, media layout tests. Review URL: https://chromiumcodereview.appspot.com/10559074 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143192 0039d316-1c4b-4281-b951-d872f2087c98
void VideoRendererBase::Initialize(const scoped_refptr<VideoDecoder>& decoder, const PipelineStatusCB& status_cb, const StatisticsCB& statistics_cb, const TimeCB& time_cb) { base::AutoLock auto_lock(lock_); DCHECK(decoder); DCHECK(!status_cb.is_null()); DCHECK(!statistics_cb.is_null()); DCHECK(!time_cb.is_null()); DCHECK_EQ(kUninitialized, state_); decoder_ = decoder; statistics_cb_ = statistics_cb; time_cb_ = time_cb; host()->SetNaturalVideoSize(decoder_->natural_size()); state_ = kFlushed; set_opaque_cb_.Run(!decoder->HasAlpha()); set_opaque_cb_.Reset(); if (!base::PlatformThread::Create(0, this, &thread_)) { NOTREACHED() << "Video thread creation failed"; state_ = kError; status_cb.Run(PIPELINE_ERROR_INITIALIZATION_FAILED); return; } #if defined(OS_WIN) ::SetThreadPriority(thread_, THREAD_PRIORITY_ABOVE_NORMAL); #endif // defined(OS_WIN) status_cb.Run(PIPELINE_OK); }
void VideoRendererBase::Initialize(const scoped_refptr<VideoDecoder>& decoder, const PipelineStatusCB& status_cb, const StatisticsCB& statistics_cb, const TimeCB& time_cb) { base::AutoLock auto_lock(lock_); DCHECK(decoder); DCHECK(!status_cb.is_null()); DCHECK(!statistics_cb.is_null()); DCHECK(!time_cb.is_null()); DCHECK_EQ(kUninitialized, state_); decoder_ = decoder; statistics_cb_ = statistics_cb; time_cb_ = time_cb; host()->SetNaturalVideoSize(decoder_->natural_size()); state_ = kFlushed; set_opaque_cb_.Run(!decoder->HasAlpha()); set_opaque_cb_.Reset(); if (!base::PlatformThread::Create(0, this, &thread_)) { NOTREACHED() << "Video thread creation failed"; state_ = kError; status_cb.Run(PIPELINE_ERROR_INITIALIZATION_FAILED); return; } #if defined(OS_WIN) ::SetThreadPriority(thread_, THREAD_PRIORITY_ABOVE_NORMAL); #endif // defined(OS_WIN) status_cb.Run(PIPELINE_OK); }
C
Chrome
0
CVE-2016-10749
https://www.cvedetails.com/cve/CVE-2016-10749/
CWE-125
https://github.com/DaveGamble/cJSON/commit/94df772485c92866ca417d92137747b2e3b0a917
94df772485c92866ca417d92137747b2e3b0a917
fix buffer overflow (#30)
static cJSON *cJSON_New_Item(void) { cJSON* node = (cJSON*)cJSON_malloc(sizeof(cJSON)); if (node) memset(node,0,sizeof(cJSON)); return node; }
static cJSON *cJSON_New_Item(void) { cJSON* node = (cJSON*)cJSON_malloc(sizeof(cJSON)); if (node) memset(node,0,sizeof(cJSON)); return node; }
C
cJSON
0
CVE-2019-12904
https://www.cvedetails.com/cve/CVE-2019-12904/
CWE-310
https://github.com/gpg/libgcrypt/commit/a4c561aab1014c3630bc88faf6f5246fee16b020
a4c561aab1014c3630bc88faf6f5246fee16b020
GCM: move look-up table to .data section and unshare between processes * cipher/cipher-gcm.c (ATTR_ALIGNED_64): New. (gcmR): Move to 'gcm_table' structure. (gcm_table): New structure for look-up table with counters before and after. (gcmR): New macro. (prefetch_table): Handle input with length not multiple of 256. (do_prefetch_tables): Modify pre- and post-table counters to unshare look-up table pages between processes. -- GnuPG-bug-id: 4541 Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
is_tag_length_valid(size_t taglen) { switch (taglen) { /* Allowed tag lengths from NIST SP 800-38D. */ case 128 / 8: /* GCRY_GCM_BLOCK_LEN */ case 120 / 8: case 112 / 8: case 104 / 8: case 96 / 8: case 64 / 8: case 32 / 8: return 1; default: return 0; } }
is_tag_length_valid(size_t taglen) { switch (taglen) { /* Allowed tag lengths from NIST SP 800-38D. */ case 128 / 8: /* GCRY_GCM_BLOCK_LEN */ case 120 / 8: case 112 / 8: case 104 / 8: case 96 / 8: case 64 / 8: case 32 / 8: return 1; default: return 0; } }
C
libgcrypt
0
CVE-2010-1149
https://www.cvedetails.com/cve/CVE-2010-1149/
CWE-200
https://cgit.freedesktop.org/udisks/commit/?id=0fcc7cb3b66f23fac53ae08647aa0007a2bd56c4
0fcc7cb3b66f23fac53ae08647aa0007a2bd56c4
null
daemon_linux_md_start (Daemon *daemon, GPtrArray *components, char **options, DBusGMethodInvocation *context) { gchar **components_as_strv; guint n; components_as_strv = g_new0 (gchar *, components->len + 1); for (n = 0; n < components->len; n++) components_as_strv[n] = g_strdup (components->pdata[n]); daemon_local_check_auth (daemon, NULL, "org.freedesktop.udisks.linux-md", "LinuxMdStart", TRUE, daemon_linux_md_start_authorized_cb, context, 2, components_as_strv, g_strfreev, g_strdupv (options), g_strfreev); return TRUE; }
daemon_linux_md_start (Daemon *daemon, GPtrArray *components, char **options, DBusGMethodInvocation *context) { gchar **components_as_strv; guint n; components_as_strv = g_new0 (gchar *, components->len + 1); for (n = 0; n < components->len; n++) components_as_strv[n] = g_strdup (components->pdata[n]); daemon_local_check_auth (daemon, NULL, "org.freedesktop.udisks.linux-md", "LinuxMdStart", TRUE, daemon_linux_md_start_authorized_cb, context, 2, components_as_strv, g_strfreev, g_strdupv (options), g_strfreev); return TRUE; }
C
udisks
0
CVE-2013-6420
https://www.cvedetails.com/cve/CVE-2013-6420/
CWE-119
https://git.php.net/?p=php-src.git;a=commit;h=c1224573c773b6845e83505f717fbf820fc18415
c1224573c773b6845e83505f717fbf820fc18415
null
PHP_FUNCTION(openssl_pkey_get_public) { zval **cert; EVP_PKEY *pkey; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &cert) == FAILURE) { return; } Z_TYPE_P(return_value) = IS_RESOURCE; pkey = php_openssl_evp_from_zval(cert, 1, NULL, 1, &Z_LVAL_P(return_value) TSRMLS_CC); if (pkey == NULL) { RETURN_FALSE; } }
PHP_FUNCTION(openssl_pkey_get_public) { zval **cert; EVP_PKEY *pkey; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &cert) == FAILURE) { return; } Z_TYPE_P(return_value) = IS_RESOURCE; pkey = php_openssl_evp_from_zval(cert, 1, NULL, 1, &Z_LVAL_P(return_value) TSRMLS_CC); if (pkey == NULL) { RETURN_FALSE; } }
C
php
0
CVE-2012-5149
https://www.cvedetails.com/cve/CVE-2012-5149/
CWE-189
https://github.com/chromium/chromium/commit/503bea2643350c6378de5f7a268b85cf2480e1ac
503bea2643350c6378de5f7a268b85cf2480e1ac
Improve validation when creating audio streams. BUG=166795 Review URL: https://codereview.chromium.org/11647012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173981 0039d316-1c4b-4281-b951-d872f2087c98
void AudioRendererHost::OnAssociateStreamWithProducer(int stream_id, int render_view_id) { DVLOG(1) << "AudioRendererHost@" << this << "::OnAssociateStreamWithProducer(stream_id=" << stream_id << ", render_view_id=" << render_view_id << ")"; }
void AudioRendererHost::OnAssociateStreamWithProducer(int stream_id, int render_view_id) { DVLOG(1) << "AudioRendererHost@" << this << "::OnAssociateStreamWithProducer(stream_id=" << stream_id << ", render_view_id=" << render_view_id << ")"; }
C
Chrome
0
CVE-2018-18352
https://www.cvedetails.com/cve/CVE-2018-18352/
CWE-732
https://github.com/chromium/chromium/commit/a9cbaa7a40e2b2723cfc2f266c42f4980038a949
a9cbaa7a40e2b2723cfc2f266c42f4980038a949
Simplify "WouldTaintOrigin" concept in media/blink Currently WebMediaPlayer has three predicates: - DidGetOpaqueResponseFromServiceWorker - HasSingleSecurityOrigin - DidPassCORSAccessCheck . These are used to determine whether the response body is available for scripts. They are known to be confusing, and actually MediaElementAudioSourceHandler::WouldTaintOrigin misuses them. This CL merges the three predicates to one, WouldTaintOrigin, to remove the confusion. Now the "response type" concept is available and we don't need a custom CORS check, so this CL removes BaseAudioContext::WouldTaintOrigin. This CL also renames URLData::has_opaque_data_ and its (direct and indirect) data accessors to match the spec. Bug: 849942, 875153 Change-Id: I6acf50169d7445c4ff614e80ac606f79ee577d2a Reviewed-on: https://chromium-review.googlesource.com/c/1238098 Reviewed-by: Fredrik Hubinette <hubbe@chromium.org> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> Reviewed-by: Raymond Toy <rtoy@chromium.org> Commit-Queue: Yutaka Hirano <yhirano@chromium.org> Cr-Commit-Position: refs/heads/master@{#598258}
EncryptionMode DetermineEncryptionMode( const EncryptionScheme& encryption_scheme) { switch (encryption_scheme.mode()) { case EncryptionScheme::CIPHER_MODE_UNENCRYPTED: return EncryptionMode::kUnencrypted; case EncryptionScheme::CIPHER_MODE_AES_CTR: return EncryptionMode::kCenc; case EncryptionScheme::CIPHER_MODE_AES_CBC: return EncryptionMode::kCbcs; } }
EncryptionMode DetermineEncryptionMode( const EncryptionScheme& encryption_scheme) { switch (encryption_scheme.mode()) { case EncryptionScheme::CIPHER_MODE_UNENCRYPTED: return EncryptionMode::kUnencrypted; case EncryptionScheme::CIPHER_MODE_AES_CTR: return EncryptionMode::kCenc; case EncryptionScheme::CIPHER_MODE_AES_CBC: return EncryptionMode::kCbcs; } }
C
Chrome
0
CVE-2017-2616
https://www.cvedetails.com/cve/CVE-2017-2616/
CWE-362
https://github.com/karelzak/util-linux/commit/dffab154d29a288aa171ff50263ecc8f2e14a891
dffab154d29a288aa171ff50263ecc8f2e14a891
su: properly clear child PID Reported-by: Tobias Stöckmann <tobias@stoeckmann.org> Signed-off-by: Karel Zak <kzak@redhat.com>
export_pamenv (void) { char **env; /* This is a copy but don't care to free as we exec later anyways. */ env = pam_getenvlist (pamh); while (env && *env) { if (putenv (*env) != 0) err (EXIT_FAILURE, NULL); env++; } }
export_pamenv (void) { char **env; /* This is a copy but don't care to free as we exec later anyways. */ env = pam_getenvlist (pamh); while (env && *env) { if (putenv (*env) != 0) err (EXIT_FAILURE, NULL); env++; } }
C
util-linux
0
null
null
null
https://github.com/chromium/chromium/commit/5c9d37f8055700c36b4c9006b0d4d81f4f961a06
5c9d37f8055700c36b4c9006b0d4d81f4f961a06
2010-07-26 Tony Gentilcore <tonyg@chromium.org> Reviewed by Darin Fisher. Move DocumentLoadTiming struct to a new file https://bugs.webkit.org/show_bug.cgi?id=42917 Also makes DocumentLoadTiming Noncopyable. No new tests because no new functionality. * GNUmakefile.am: * WebCore.gypi: * WebCore.vcproj/WebCore.vcproj: * WebCore.xcodeproj/project.pbxproj: * loader/DocumentLoadTiming.h: Added. (WebCore::DocumentLoadTiming::DocumentLoadTiming): * loader/DocumentLoader.h: * loader/FrameLoader.cpp: * loader/FrameLoaderTypes.h: * loader/MainResourceLoader.cpp: * page/Timing.cpp: git-svn-id: svn://svn.chromium.org/blink/trunk@64051 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void MainResourceLoader::addData(const char* data, int length, bool allAtOnce) { ResourceLoader::addData(data, length, allAtOnce); frameLoader()->receivedData(data, length); }
void MainResourceLoader::addData(const char* data, int length, bool allAtOnce) { ResourceLoader::addData(data, length, allAtOnce); frameLoader()->receivedData(data, length); }
C
Chrome
0