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-2015-2150
https://www.cvedetails.com/cve/CVE-2015-2150/
CWE-264
https://github.com/torvalds/linux/commit/af6fc858a35b90e89ea7a7ee58e66628c55c776b
af6fc858a35b90e89ea7a7ee58e66628c55c776b
xen-pciback: limit guest control of command register Otherwise the guest can abuse that control to cause e.g. PCIe Unsupported Request responses by disabling memory and/or I/O decoding and subsequently causing (CPU side) accesses to the respective address ranges, which (depending on system configuration) may be fatal to the host. Note that to alter any of the bits collected together as PCI_COMMAND_GUEST permissive mode is now required to be enabled globally or on the specific device. This is CVE-2015-2150 / XSA-120. Signed-off-by: Jan Beulich <[email protected]> Reviewed-by: Konrad Rzeszutek Wilk <[email protected]> Cc: <[email protected]> Signed-off-by: David Vrabel <[email protected]>
static int command_write(struct pci_dev *dev, int offset, u16 value, void *data) { struct xen_pcibk_dev_data *dev_data; int err; u16 val; struct pci_cmd_info *cmd = data; dev_data = pci_get_drvdata(dev); if (!pci_is_enabled(dev) && is_enable_cmd(value)) { if (unlikely(verbose_request)) printk(KERN_DEBUG DRV_NAME ": %s: enable\n", pci_name(dev)); err = pci_enable_device(dev); if (err) return err; if (dev_data) dev_data->enable_intx = 1; } else if (pci_is_enabled(dev) && !is_enable_cmd(value)) { if (unlikely(verbose_request)) printk(KERN_DEBUG DRV_NAME ": %s: disable\n", pci_name(dev)); pci_disable_device(dev); if (dev_data) dev_data->enable_intx = 0; } if (!dev->is_busmaster && is_master_cmd(value)) { if (unlikely(verbose_request)) printk(KERN_DEBUG DRV_NAME ": %s: set bus master\n", pci_name(dev)); pci_set_master(dev); } if (value & PCI_COMMAND_INVALIDATE) { if (unlikely(verbose_request)) printk(KERN_DEBUG DRV_NAME ": %s: enable memory-write-invalidate\n", pci_name(dev)); err = pci_set_mwi(dev); if (err) { pr_warn("%s: cannot enable memory-write-invalidate (%d)\n", pci_name(dev), err); value &= ~PCI_COMMAND_INVALIDATE; } } cmd->val = value; if (!permissive && (!dev_data || !dev_data->permissive)) return 0; /* Only allow the guest to control certain bits. */ err = pci_read_config_word(dev, offset, &val); if (err || val == value) return err; value &= PCI_COMMAND_GUEST; value |= val & ~PCI_COMMAND_GUEST; return pci_write_config_word(dev, offset, value); }
static int command_write(struct pci_dev *dev, int offset, u16 value, void *data) { struct xen_pcibk_dev_data *dev_data; int err; dev_data = pci_get_drvdata(dev); if (!pci_is_enabled(dev) && is_enable_cmd(value)) { if (unlikely(verbose_request)) printk(KERN_DEBUG DRV_NAME ": %s: enable\n", pci_name(dev)); err = pci_enable_device(dev); if (err) return err; if (dev_data) dev_data->enable_intx = 1; } else if (pci_is_enabled(dev) && !is_enable_cmd(value)) { if (unlikely(verbose_request)) printk(KERN_DEBUG DRV_NAME ": %s: disable\n", pci_name(dev)); pci_disable_device(dev); if (dev_data) dev_data->enable_intx = 0; } if (!dev->is_busmaster && is_master_cmd(value)) { if (unlikely(verbose_request)) printk(KERN_DEBUG DRV_NAME ": %s: set bus master\n", pci_name(dev)); pci_set_master(dev); } if (value & PCI_COMMAND_INVALIDATE) { if (unlikely(verbose_request)) printk(KERN_DEBUG DRV_NAME ": %s: enable memory-write-invalidate\n", pci_name(dev)); err = pci_set_mwi(dev); if (err) { pr_warn("%s: cannot enable memory-write-invalidate (%d)\n", pci_name(dev), err); value &= ~PCI_COMMAND_INVALIDATE; } } return pci_write_config_word(dev, offset, value); }
C
linux
1
CVE-2012-0058
https://www.cvedetails.com/cve/CVE-2012-0058/
CWE-399
https://github.com/torvalds/linux/commit/802f43594d6e4d2ac61086d239153c17873a0428
802f43594d6e4d2ac61086d239153c17873a0428
Unused iocbs in a batch should not be accounted as active. commit 69e4747ee9727d660b88d7e1efe0f4afcb35db1b upstream. Since commit 080d676de095 ("aio: allocate kiocbs in batches") iocbs are allocated in a batch during processing of first iocbs. All iocbs in a batch are automatically added to ctx->active_reqs list and accounted in ctx->reqs_active. If one (not the last one) of iocbs submitted by an user fails, further iocbs are not processed, but they are still present in ctx->active_reqs and accounted in ctx->reqs_active. This causes process to stuck in a D state in wait_for_all_aios() on exit since ctx->reqs_active will never go down to zero. Furthermore since kiocb_batch_free() frees iocb without removing it from active_reqs list the list become corrupted which may cause oops. Fix this by removing iocb from ctx->active_reqs and updating ctx->reqs_active in kiocb_batch_free(). Signed-off-by: Gleb Natapov <[email protected]> Reviewed-by: Jeff Moyer <[email protected]> Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
static struct kioctx *ioctx_alloc(unsigned nr_events) { struct mm_struct *mm; struct kioctx *ctx; int did_sync = 0; /* Prevent overflows */ if ((nr_events > (0x10000000U / sizeof(struct io_event))) || (nr_events > (0x10000000U / sizeof(struct kiocb)))) { pr_debug("ENOMEM: nr_events too high\n"); return ERR_PTR(-EINVAL); } if ((unsigned long)nr_events > aio_max_nr) return ERR_PTR(-EAGAIN); ctx = kmem_cache_zalloc(kioctx_cachep, GFP_KERNEL); if (!ctx) return ERR_PTR(-ENOMEM); ctx->max_reqs = nr_events; mm = ctx->mm = current->mm; atomic_inc(&mm->mm_count); atomic_set(&ctx->users, 1); spin_lock_init(&ctx->ctx_lock); spin_lock_init(&ctx->ring_info.ring_lock); init_waitqueue_head(&ctx->wait); INIT_LIST_HEAD(&ctx->active_reqs); INIT_LIST_HEAD(&ctx->run_list); INIT_DELAYED_WORK(&ctx->wq, aio_kick_handler); if (aio_setup_ring(ctx) < 0) goto out_freectx; /* limit the number of system wide aios */ do { spin_lock_bh(&aio_nr_lock); if (aio_nr + nr_events > aio_max_nr || aio_nr + nr_events < aio_nr) ctx->max_reqs = 0; else aio_nr += ctx->max_reqs; spin_unlock_bh(&aio_nr_lock); if (ctx->max_reqs || did_sync) break; /* wait for rcu callbacks to have completed before giving up */ synchronize_rcu(); did_sync = 1; ctx->max_reqs = nr_events; } while (1); if (ctx->max_reqs == 0) goto out_cleanup; /* now link into global list. */ spin_lock(&mm->ioctx_lock); hlist_add_head_rcu(&ctx->list, &mm->ioctx_list); spin_unlock(&mm->ioctx_lock); dprintk("aio: allocated ioctx %p[%ld]: mm=%p mask=0x%x\n", ctx, ctx->user_id, current->mm, ctx->ring_info.nr); return ctx; out_cleanup: __put_ioctx(ctx); return ERR_PTR(-EAGAIN); out_freectx: mmdrop(mm); kmem_cache_free(kioctx_cachep, ctx); ctx = ERR_PTR(-ENOMEM); dprintk("aio: error allocating ioctx %p\n", ctx); return ctx; }
static struct kioctx *ioctx_alloc(unsigned nr_events) { struct mm_struct *mm; struct kioctx *ctx; int did_sync = 0; /* Prevent overflows */ if ((nr_events > (0x10000000U / sizeof(struct io_event))) || (nr_events > (0x10000000U / sizeof(struct kiocb)))) { pr_debug("ENOMEM: nr_events too high\n"); return ERR_PTR(-EINVAL); } if ((unsigned long)nr_events > aio_max_nr) return ERR_PTR(-EAGAIN); ctx = kmem_cache_zalloc(kioctx_cachep, GFP_KERNEL); if (!ctx) return ERR_PTR(-ENOMEM); ctx->max_reqs = nr_events; mm = ctx->mm = current->mm; atomic_inc(&mm->mm_count); atomic_set(&ctx->users, 1); spin_lock_init(&ctx->ctx_lock); spin_lock_init(&ctx->ring_info.ring_lock); init_waitqueue_head(&ctx->wait); INIT_LIST_HEAD(&ctx->active_reqs); INIT_LIST_HEAD(&ctx->run_list); INIT_DELAYED_WORK(&ctx->wq, aio_kick_handler); if (aio_setup_ring(ctx) < 0) goto out_freectx; /* limit the number of system wide aios */ do { spin_lock_bh(&aio_nr_lock); if (aio_nr + nr_events > aio_max_nr || aio_nr + nr_events < aio_nr) ctx->max_reqs = 0; else aio_nr += ctx->max_reqs; spin_unlock_bh(&aio_nr_lock); if (ctx->max_reqs || did_sync) break; /* wait for rcu callbacks to have completed before giving up */ synchronize_rcu(); did_sync = 1; ctx->max_reqs = nr_events; } while (1); if (ctx->max_reqs == 0) goto out_cleanup; /* now link into global list. */ spin_lock(&mm->ioctx_lock); hlist_add_head_rcu(&ctx->list, &mm->ioctx_list); spin_unlock(&mm->ioctx_lock); dprintk("aio: allocated ioctx %p[%ld]: mm=%p mask=0x%x\n", ctx, ctx->user_id, current->mm, ctx->ring_info.nr); return ctx; out_cleanup: __put_ioctx(ctx); return ERR_PTR(-EAGAIN); out_freectx: mmdrop(mm); kmem_cache_free(kioctx_cachep, ctx); ctx = ERR_PTR(-ENOMEM); dprintk("aio: error allocating ioctx %p\n", ctx); return ctx; }
C
linux
0
CVE-2017-5039
https://www.cvedetails.com/cve/CVE-2017-5039/
CWE-416
https://github.com/chromium/chromium/commit/69b4b9ef7455753b12c3efe4eec71647e6fb1da1
69b4b9ef7455753b12c3efe4eec71647e6fb1da1
Disable all DRP URL fetches when holdback is enabled Disable secure proxy checker, warmup url fetcher and client config fetch when the client is in DRP (Data Reduction Proxy) holdback. This CL does not disable pingbacks when client is in the holdback, but the pingback code is going away soon. Change-Id: Icbb59d814d1452123869c609e0770d1439c1db51 Bug: 984964 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1709965 Commit-Queue: Tarun Bansal <[email protected]> Reviewed-by: Robert Ogden <[email protected]> Cr-Commit-Position: refs/heads/master@{#679649}
uint64_t received_page_id() const { return received_page_id_; }
uint64_t received_page_id() const { return received_page_id_; }
C
Chrome
0
CVE-2015-1278
https://www.cvedetails.com/cve/CVE-2015-1278/
CWE-254
https://github.com/chromium/chromium/commit/784f56a9c97a838448dd23f9bdc7c05fe8e639b3
784f56a9c97a838448dd23f9bdc7c05fe8e639b3
Correctly reset FP in RFHI whenever origin changes Bug: 713364 Change-Id: Id8bb923750e20f3db6fc9358b1d44120513ac95f CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation Change-Id: Id8bb923750e20f3db6fc9358b1d44120513ac95f Reviewed-on: https://chromium-review.googlesource.com/482380 Commit-Queue: Ian Clelland <[email protected]> Reviewed-by: Charles Reis <[email protected]> Cr-Commit-Position: refs/heads/master@{#466778}
MockRenderProcessHost* TestRenderViewHost::GetProcess() const { return static_cast<MockRenderProcessHost*>(RenderViewHostImpl::GetProcess()); }
MockRenderProcessHost* TestRenderViewHost::GetProcess() const { return static_cast<MockRenderProcessHost*>(RenderViewHostImpl::GetProcess()); }
C
Chrome
0
CVE-2019-10664
https://www.cvedetails.com/cve/CVE-2019-10664/
CWE-89
https://github.com/domoticz/domoticz/commit/ee70db46f81afa582c96b887b73bcd2a86feda00
ee70db46f81afa582c96b887b73bcd2a86feda00
Fixed possible SQL Injection Vulnerability (Thanks to Fabio Carretto!)
void CWebServer::DisplaySwitchTypesCombo(std::string & content_part) { char szTmp[200]; std::map<std::string, int> _switchtypes; for (int ii = 0; ii < STYPE_END; ii++) { _switchtypes[Switch_Type_Desc((_eSwitchType)ii)] = ii; } for (const auto & itt : _switchtypes) { sprintf(szTmp, "<option value=\"%d\">%s</option>\n", itt.second, itt.first.c_str()); content_part += szTmp; } }
void CWebServer::DisplaySwitchTypesCombo(std::string & content_part) { char szTmp[200]; std::map<std::string, int> _switchtypes; for (int ii = 0; ii < STYPE_END; ii++) { _switchtypes[Switch_Type_Desc((_eSwitchType)ii)] = ii; } for (const auto & itt : _switchtypes) { sprintf(szTmp, "<option value=\"%d\">%s</option>\n", itt.second, itt.first.c_str()); content_part += szTmp; } }
C
domoticz
0
CVE-2018-6154
https://www.cvedetails.com/cve/CVE-2018-6154/
CWE-119
https://github.com/chromium/chromium/commit/98095c718d7580b5d6715e5bfd8698234ecb4470
98095c718d7580b5d6715e5bfd8698234ecb4470
Validate all incoming WebGLObjects. A few entry points were missing the correct validation. Tested with improved conformance tests in https://github.com/KhronosGroup/WebGL/pull/2654 . Bug: 848914 Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel Change-Id: Ib98a61cc5bf378d1b3338b04acd7e1bc4c2fe008 Reviewed-on: https://chromium-review.googlesource.com/1086718 Reviewed-by: Kai Ninomiya <[email protected]> Reviewed-by: Antoine Labour <[email protected]> Commit-Queue: Kenneth Russell <[email protected]> Cr-Commit-Position: refs/heads/master@{#565016}
void WebGL2RenderingContextBase::beginTransformFeedback(GLenum primitive_mode) { if (isContextLost()) return; if (!ValidateTransformFeedbackPrimitiveMode("beginTransformFeedback", primitive_mode)) return; if (!current_program_) { SynthesizeGLError(GL_INVALID_OPERATION, "beginTransformFeedback", "no program object is active"); return; } if (transform_feedback_binding_->active()) { SynthesizeGLError(GL_INVALID_OPERATION, "beginTransformFeedback", "transform feedback is already active"); return; } int required_buffer_count = current_program_->GetRequiredTransformFeedbackBufferCount(this); if (required_buffer_count == 0) { SynthesizeGLError(GL_INVALID_OPERATION, "beginTransformFeedback", "current active program does not specify any transform " "feedback varyings to record"); return; } if (!transform_feedback_binding_->HasEnoughBuffers(required_buffer_count)) { SynthesizeGLError(GL_INVALID_OPERATION, "beginTransformFeedback", "not enough transform feedback buffers bound"); return; } ContextGL()->BeginTransformFeedback(primitive_mode); current_program_->IncreaseActiveTransformFeedbackCount(); transform_feedback_binding_->SetProgram(current_program_); transform_feedback_binding_->SetActive(true); transform_feedback_binding_->SetPaused(false); }
void WebGL2RenderingContextBase::beginTransformFeedback(GLenum primitive_mode) { if (isContextLost()) return; if (!ValidateTransformFeedbackPrimitiveMode("beginTransformFeedback", primitive_mode)) return; if (!current_program_) { SynthesizeGLError(GL_INVALID_OPERATION, "beginTransformFeedback", "no program object is active"); return; } if (transform_feedback_binding_->active()) { SynthesizeGLError(GL_INVALID_OPERATION, "beginTransformFeedback", "transform feedback is already active"); return; } int required_buffer_count = current_program_->GetRequiredTransformFeedbackBufferCount(this); if (required_buffer_count == 0) { SynthesizeGLError(GL_INVALID_OPERATION, "beginTransformFeedback", "current active program does not specify any transform " "feedback varyings to record"); return; } if (!transform_feedback_binding_->HasEnoughBuffers(required_buffer_count)) { SynthesizeGLError(GL_INVALID_OPERATION, "beginTransformFeedback", "not enough transform feedback buffers bound"); return; } ContextGL()->BeginTransformFeedback(primitive_mode); current_program_->IncreaseActiveTransformFeedbackCount(); transform_feedback_binding_->SetProgram(current_program_); transform_feedback_binding_->SetActive(true); transform_feedback_binding_->SetPaused(false); }
C
Chrome
0
CVE-2012-5148
https://www.cvedetails.com/cve/CVE-2012-5148/
CWE-20
https://github.com/chromium/chromium/commit/e89cfcb9090e8c98129ae9160c513f504db74599
e89cfcb9090e8c98129ae9160c513f504db74599
Remove TabContents from TabStripModelObserver::TabDetachedAt. BUG=107201 TEST=no visible change Review URL: https://chromiumcodereview.appspot.com/11293205 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167122 0039d316-1c4b-4281-b951-d872f2087c98
bool Browser::GetConstrainedWindowTopCenter(gfx::Point* point) { int y = 0; if (window_->GetConstrainedWindowTopY(&y)) { *point = gfx::Point(window_->GetBounds().width() / 2, y); return true; } return false; }
bool Browser::GetConstrainedWindowTopCenter(gfx::Point* point) { int y = 0; if (window_->GetConstrainedWindowTopY(&y)) { *point = gfx::Point(window_->GetBounds().width() / 2, y); return true; } return false; }
C
Chrome
0
CVE-2018-7480
https://www.cvedetails.com/cve/CVE-2018-7480/
CWE-415
https://github.com/torvalds/linux/commit/9b54d816e00425c3a517514e0d677bb3cec49258
9b54d816e00425c3a517514e0d677bb3cec49258
blkcg: fix double free of new_blkg in blkcg_init_queue If blkg_create fails, new_blkg passed as an argument will be freed by blkg_create, so there is no need to free it again. Signed-off-by: Hou Tao <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
struct blkcg_gq *blkg_lookup_slowpath(struct blkcg *blkcg, struct request_queue *q, bool update_hint) { struct blkcg_gq *blkg; /* * Hint didn't match. Look up from the radix tree. Note that the * hint can only be updated under queue_lock as otherwise @blkg * could have already been removed from blkg_tree. The caller is * responsible for grabbing queue_lock if @update_hint. */ blkg = radix_tree_lookup(&blkcg->blkg_tree, q->id); if (blkg && blkg->q == q) { if (update_hint) { lockdep_assert_held(q->queue_lock); rcu_assign_pointer(blkcg->blkg_hint, blkg); } return blkg; } return NULL; }
struct blkcg_gq *blkg_lookup_slowpath(struct blkcg *blkcg, struct request_queue *q, bool update_hint) { struct blkcg_gq *blkg; /* * Hint didn't match. Look up from the radix tree. Note that the * hint can only be updated under queue_lock as otherwise @blkg * could have already been removed from blkg_tree. The caller is * responsible for grabbing queue_lock if @update_hint. */ blkg = radix_tree_lookup(&blkcg->blkg_tree, q->id); if (blkg && blkg->q == q) { if (update_hint) { lockdep_assert_held(q->queue_lock); rcu_assign_pointer(blkcg->blkg_hint, blkg); } return blkg; } return NULL; }
C
linux
0
CVE-2011-3097
https://www.cvedetails.com/cve/CVE-2011-3097/
CWE-20
https://github.com/chromium/chromium/commit/027429ee5abe6e2fb5e3b2b4542f0a6fe0dbc12d
027429ee5abe6e2fb5e3b2b4542f0a6fe0dbc12d
Metrics for measuring how much overhead reading compressed content states adds. BUG=104293 TEST=NONE Review URL: https://chromiumcodereview.appspot.com/9426039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123733 0039d316-1c4b-4281-b951-d872f2087c98
SessionService::Handle SessionService::GetLastSession( CancelableRequestConsumerBase* consumer, const SessionCallback& callback) { return ScheduleGetLastSessionCommands( new InternalSessionRequest( base::Bind(&SessionService::OnGotSessionCommands, base::Unretained(this)), callback), consumer); }
SessionService::Handle SessionService::GetLastSession( CancelableRequestConsumerBase* consumer, const SessionCallback& callback) { return ScheduleGetLastSessionCommands( new InternalSessionRequest( base::Bind(&SessionService::OnGotSessionCommands, base::Unretained(this)), callback), consumer); }
C
Chrome
0
CVE-2012-2895
https://www.cvedetails.com/cve/CVE-2012-2895/
CWE-119
https://github.com/chromium/chromium/commit/baef1ffd73db183ca50c854e1779ed7f6e5100a8
baef1ffd73db183ca50c854e1779ed7f6e5100a8
Revert 144993 - gdata: Remove invalid files in the cache directories Broke linux_chromeos_valgrind: http://build.chromium.org/p/chromium.memory.fyi/builders/Chromium%20OS%20%28valgrind%29%285%29/builds/8628/steps/memory%20test%3A%20unit/logs/stdio In theory, we shouldn't have any invalid files left in the cache directories, but things can go wrong and invalid files may be left if the device shuts down unexpectedly, for instance. Besides, it's good to be defensive. BUG=134862 TEST=added unit tests Review URL: https://chromiumcodereview.appspot.com/10693020 [email protected] git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145029 0039d316-1c4b-4281-b951-d872f2087c98
void OnGetFileInfoForInsertGDataCachePathsPermissions( Profile* profile, std::vector<std::pair<FilePath, int> >* cache_paths, const base::Closure& callback, base::PlatformFileError error, scoped_ptr<GDataFileProto> file_info) { DCHECK(profile); DCHECK(cache_paths); DCHECK(!callback.is_null()); GDataCache* cache = GetGDataCache(profile); if (!cache || error != base::PLATFORM_FILE_OK) { callback.Run(); return; } DCHECK(file_info.get()); std::string resource_id = file_info->gdata_entry().resource_id(); std::string file_md5 = file_info->file_md5(); cache_paths->push_back(std::make_pair( cache->GetCacheFilePath(resource_id, file_md5, GDataCache::CACHE_TYPE_PERSISTENT, GDataCache::CACHED_FILE_FROM_SERVER), kReadOnlyFilePermissions)); cache_paths->push_back(std::make_pair( cache->GetCacheFilePath(resource_id, file_md5, GDataCache::CACHE_TYPE_PERSISTENT, GDataCache::CACHED_FILE_LOCALLY_MODIFIED), kReadOnlyFilePermissions)); cache_paths->push_back(std::make_pair( cache->GetCacheFilePath(resource_id, file_md5, GDataCache::CACHE_TYPE_PERSISTENT, GDataCache::CACHED_FILE_MOUNTED), kReadOnlyFilePermissions)); cache_paths->push_back(std::make_pair( cache->GetCacheFilePath(resource_id, file_md5, GDataCache::CACHE_TYPE_TMP, GDataCache::CACHED_FILE_FROM_SERVER), kReadOnlyFilePermissions)); callback.Run(); }
void OnGetFileInfoForInsertGDataCachePathsPermissions( Profile* profile, std::vector<std::pair<FilePath, int> >* cache_paths, const base::Closure& callback, base::PlatformFileError error, scoped_ptr<GDataFileProto> file_info) { DCHECK(profile); DCHECK(cache_paths); DCHECK(!callback.is_null()); GDataCache* cache = GetGDataCache(profile); if (!cache || error != base::PLATFORM_FILE_OK) { callback.Run(); return; } DCHECK(file_info.get()); std::string resource_id = file_info->gdata_entry().resource_id(); std::string file_md5 = file_info->file_md5(); cache_paths->push_back(std::make_pair( cache->GetCacheFilePath(resource_id, file_md5, GDataCache::CACHE_TYPE_PERSISTENT, GDataCache::CACHED_FILE_FROM_SERVER), kReadOnlyFilePermissions)); cache_paths->push_back(std::make_pair( cache->GetCacheFilePath(resource_id, file_md5, GDataCache::CACHE_TYPE_PERSISTENT, GDataCache::CACHED_FILE_LOCALLY_MODIFIED), kReadOnlyFilePermissions)); cache_paths->push_back(std::make_pair( cache->GetCacheFilePath(resource_id, file_md5, GDataCache::CACHE_TYPE_PERSISTENT, GDataCache::CACHED_FILE_MOUNTED), kReadOnlyFilePermissions)); cache_paths->push_back(std::make_pair( cache->GetCacheFilePath(resource_id, file_md5, GDataCache::CACHE_TYPE_TMP, GDataCache::CACHED_FILE_FROM_SERVER), kReadOnlyFilePermissions)); callback.Run(); }
C
Chrome
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 <[email protected]> Reviewed-by: Philip Jägenstedt <[email protected]> Commit-Queue: Avi Drissman <[email protected]> Cr-Commit-Position: refs/heads/master@{#533790}
void RenderFrameImpl::FrameDetached(DetachType type) { for (auto& observer : observers_) observer.FrameDetached(); SendUpdateState(); if (!in_browser_initiated_detach_ && type == DetachType::kRemove) Send(new FrameHostMsg_Detach(routing_id_)); GetRenderWidget()->UnregisterRenderFrame(this); if (render_widget_) render_widget_->CloseForFrame(); FrameMap::iterator it = g_frame_map.Get().find(frame_); CHECK(it != g_frame_map.Get().end()); CHECK_EQ(it->second, this); g_frame_map.Get().erase(it); frame_->Close(); frame_ = nullptr; if (proxy_routing_id_ != MSG_ROUTING_NONE) { RenderFrameProxy* proxy = RenderFrameProxy::FromRoutingID(proxy_routing_id_); CHECK(proxy); CHECK_EQ(routing_id_, proxy->provisional_frame_routing_id()); proxy->set_provisional_frame_routing_id(MSG_ROUTING_NONE); } delete this; }
void RenderFrameImpl::FrameDetached(DetachType type) { for (auto& observer : observers_) observer.FrameDetached(); SendUpdateState(); if (!in_browser_initiated_detach_ && type == DetachType::kRemove) Send(new FrameHostMsg_Detach(routing_id_)); GetRenderWidget()->UnregisterRenderFrame(this); if (render_widget_) render_widget_->CloseForFrame(); FrameMap::iterator it = g_frame_map.Get().find(frame_); CHECK(it != g_frame_map.Get().end()); CHECK_EQ(it->second, this); g_frame_map.Get().erase(it); frame_->Close(); frame_ = nullptr; if (proxy_routing_id_ != MSG_ROUTING_NONE) { RenderFrameProxy* proxy = RenderFrameProxy::FromRoutingID(proxy_routing_id_); CHECK(proxy); CHECK_EQ(routing_id_, proxy->provisional_frame_routing_id()); proxy->set_provisional_frame_routing_id(MSG_ROUTING_NONE); } delete this; }
C
Chrome
0
CVE-2012-5156
https://www.cvedetails.com/cve/CVE-2012-5156/
CWE-399
https://github.com/chromium/chromium/commit/b15c87071f906301bccc824ce013966ca93998c7
b15c87071f906301bccc824ce013966ca93998c7
Validate and report peer's PID to WorkerProcessIpcDelegate so it will be able to duplicate handles to and from the worker process. As a side effect WorkerProcessLauncher::Delegate is now responsible for retrieving the client's PID and deciding whether a launch failed due to a permanent error condition. BUG=134694 Review URL: https://chromiumcodereview.appspot.com/11143025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162778 0039d316-1c4b-4281-b951-d872f2087c98
void DaemonProcess::CreateDesktopSession(int terminal_id) { DCHECK(caller_task_runner()->BelongsToCurrentThread()); if (IsTerminalIdKnown(terminal_id)) { LOG(ERROR) << "An invalid terminal ID. terminal_id=" << terminal_id; RestartNetworkProcess(); DeleteAllDesktopSessions(); return; } VLOG(1) << "Daemon: opened desktop session " << terminal_id; desktop_sessions_.push_back( DoCreateDesktopSession(terminal_id).release()); next_terminal_id_ = std::max(next_terminal_id_, terminal_id + 1); }
void DaemonProcess::CreateDesktopSession(int terminal_id) { DCHECK(caller_task_runner()->BelongsToCurrentThread()); if (IsTerminalIdKnown(terminal_id)) { LOG(ERROR) << "An invalid terminal ID. terminal_id=" << terminal_id; RestartNetworkProcess(); DeleteAllDesktopSessions(); return; } VLOG(1) << "Daemon: opened desktop session " << terminal_id; desktop_sessions_.push_back( DoCreateDesktopSession(terminal_id).release()); next_terminal_id_ = std::max(next_terminal_id_, terminal_id + 1); }
C
Chrome
0
CVE-2013-4150
https://www.cvedetails.com/cve/CVE-2013-4150/
CWE-119
https://git.qemu.org/?p=qemu.git;a=commit;h=eea750a5623ddac7a61982eec8f1c93481857578
eea750a5623ddac7a61982eec8f1c93481857578
null
static void virtio_net_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq) { VirtIONet *n = VIRTIO_NET(vdev); struct virtio_net_ctrl_hdr ctrl; virtio_net_ctrl_ack status = VIRTIO_NET_ERR; VirtQueueElement elem; size_t s; struct iovec *iov; unsigned int iov_cnt; while (virtqueue_pop(vq, &elem)) { if (iov_size(elem.in_sg, elem.in_num) < sizeof(status) || iov_size(elem.out_sg, elem.out_num) < sizeof(ctrl)) { error_report("virtio-net ctrl missing headers"); exit(1); } iov = elem.out_sg; iov_cnt = elem.out_num; s = iov_to_buf(iov, iov_cnt, 0, &ctrl, sizeof(ctrl)); iov_discard_front(&iov, &iov_cnt, sizeof(ctrl)); if (s != sizeof(ctrl)) { status = VIRTIO_NET_ERR; } else if (ctrl.class == VIRTIO_NET_CTRL_RX) { status = virtio_net_handle_rx_mode(n, ctrl.cmd, iov, iov_cnt); } else if (ctrl.class == VIRTIO_NET_CTRL_MAC) { status = virtio_net_handle_mac(n, ctrl.cmd, iov, iov_cnt); } else if (ctrl.class == VIRTIO_NET_CTRL_VLAN) { status = virtio_net_handle_vlan_table(n, ctrl.cmd, iov, iov_cnt); } else if (ctrl.class == VIRTIO_NET_CTRL_MQ) { status = virtio_net_handle_mq(n, ctrl.cmd, iov, iov_cnt); } else if (ctrl.class == VIRTIO_NET_CTRL_GUEST_OFFLOADS) { status = virtio_net_handle_offloads(n, ctrl.cmd, iov, iov_cnt); } s = iov_from_buf(elem.in_sg, elem.in_num, 0, &status, sizeof(status)); assert(s == sizeof(status)); virtqueue_push(vq, &elem, sizeof(status)); virtio_notify(vdev, vq); } }
static void virtio_net_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq) { VirtIONet *n = VIRTIO_NET(vdev); struct virtio_net_ctrl_hdr ctrl; virtio_net_ctrl_ack status = VIRTIO_NET_ERR; VirtQueueElement elem; size_t s; struct iovec *iov; unsigned int iov_cnt; while (virtqueue_pop(vq, &elem)) { if (iov_size(elem.in_sg, elem.in_num) < sizeof(status) || iov_size(elem.out_sg, elem.out_num) < sizeof(ctrl)) { error_report("virtio-net ctrl missing headers"); exit(1); } iov = elem.out_sg; iov_cnt = elem.out_num; s = iov_to_buf(iov, iov_cnt, 0, &ctrl, sizeof(ctrl)); iov_discard_front(&iov, &iov_cnt, sizeof(ctrl)); if (s != sizeof(ctrl)) { status = VIRTIO_NET_ERR; } else if (ctrl.class == VIRTIO_NET_CTRL_RX) { status = virtio_net_handle_rx_mode(n, ctrl.cmd, iov, iov_cnt); } else if (ctrl.class == VIRTIO_NET_CTRL_MAC) { status = virtio_net_handle_mac(n, ctrl.cmd, iov, iov_cnt); } else if (ctrl.class == VIRTIO_NET_CTRL_VLAN) { status = virtio_net_handle_vlan_table(n, ctrl.cmd, iov, iov_cnt); } else if (ctrl.class == VIRTIO_NET_CTRL_MQ) { status = virtio_net_handle_mq(n, ctrl.cmd, iov, iov_cnt); } else if (ctrl.class == VIRTIO_NET_CTRL_GUEST_OFFLOADS) { status = virtio_net_handle_offloads(n, ctrl.cmd, iov, iov_cnt); } s = iov_from_buf(elem.in_sg, elem.in_num, 0, &status, sizeof(status)); assert(s == sizeof(status)); virtqueue_push(vq, &elem, sizeof(status)); virtio_notify(vdev, vq); } }
C
qemu
0
CVE-2013-2884
https://www.cvedetails.com/cve/CVE-2013-2884/
CWE-399
https://github.com/chromium/chromium/commit/4ac8bc08e3306f38a5ab3e551aef6ad43753579c
4ac8bc08e3306f38a5ab3e551aef6ad43753579c
Set Attr.ownerDocument in Element#setAttributeNode() Attr objects can move across documents by setAttributeNode(). So It needs to reset ownerDocument through TreeScopeAdoptr::adoptIfNeeded(). BUG=248950 TEST=set-attribute-node-from-iframe.html Review URL: https://chromiumcodereview.appspot.com/17583003 git-svn-id: svn://svn.chromium.org/blink/trunk@152938 bbb929c8-8fbe-4397-9dbb-9b2b20218538
ElementShadow* Element::shadow() const { return hasRareData() ? elementRareData()->shadow() : 0; }
ElementShadow* Element::shadow() const { return hasRareData() ? elementRareData()->shadow() : 0; }
C
Chrome
0
CVE-2012-5148
https://www.cvedetails.com/cve/CVE-2012-5148/
CWE-20
https://github.com/chromium/chromium/commit/e89cfcb9090e8c98129ae9160c513f504db74599
e89cfcb9090e8c98129ae9160c513f504db74599
Remove TabContents from TabStripModelObserver::TabDetachedAt. BUG=107201 TEST=no visible change Review URL: https://chromiumcodereview.appspot.com/11293205 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167122 0039d316-1c4b-4281-b951-d872f2087c98
void BrowserLauncherItemController::TabDetachedAt(TabContents* contents, void BrowserLauncherItemController::TabDetachedAt( content::WebContents* contents, int index) { launcher_controller()->UpdateAppState( contents, ChromeLauncherController::APP_STATE_REMOVED); }
void BrowserLauncherItemController::TabDetachedAt(TabContents* contents, int index) { launcher_controller()->UpdateAppState( contents->web_contents(), ChromeLauncherController::APP_STATE_REMOVED); }
C
Chrome
1
CVE-2019-15920
https://www.cvedetails.com/cve/CVE-2019-15920/
CWE-416
https://github.com/torvalds/linux/commit/088aaf17aa79300cab14dbee2569c58cfafd7d6e
088aaf17aa79300cab14dbee2569c58cfafd7d6e
cifs: Fix use-after-free in SMB2_read There is a KASAN use-after-free: BUG: KASAN: use-after-free in SMB2_read+0x1136/0x1190 Read of size 8 at addr ffff8880b4e45e50 by task ln/1009 Should not release the 'req' because it will use in the trace. Fixes: eccb4422cf97 ("smb3: Add ftrace tracepoints for improved SMB3 debugging") Signed-off-by: ZhangXiaoxu <[email protected]> Signed-off-by: Steve French <[email protected]> CC: Stable <[email protected]> 4.18+ Reviewed-by: Pavel Shilovsky <[email protected]>
SMB2_tdis(const unsigned int xid, struct cifs_tcon *tcon) { struct smb_rqst rqst; struct smb2_tree_disconnect_req *req; /* response is trivial */ int rc = 0; struct cifs_ses *ses = tcon->ses; int flags = 0; unsigned int total_len; struct kvec iov[1]; struct kvec rsp_iov; int resp_buf_type; cifs_dbg(FYI, "Tree Disconnect\n"); if (!ses || !(ses->server)) return -EIO; if ((tcon->need_reconnect) || (tcon->ses->need_reconnect)) return 0; rc = smb2_plain_req_init(SMB2_TREE_DISCONNECT, tcon, (void **) &req, &total_len); if (rc) return rc; if (smb3_encryption_required(tcon)) flags |= CIFS_TRANSFORM_REQ; flags |= CIFS_NO_RESP; iov[0].iov_base = (char *)req; iov[0].iov_len = total_len; memset(&rqst, 0, sizeof(struct smb_rqst)); rqst.rq_iov = iov; rqst.rq_nvec = 1; rc = cifs_send_recv(xid, ses, &rqst, &resp_buf_type, flags, &rsp_iov); cifs_small_buf_release(req); if (rc) cifs_stats_fail_inc(tcon, SMB2_TREE_DISCONNECT_HE); return rc; }
SMB2_tdis(const unsigned int xid, struct cifs_tcon *tcon) { struct smb_rqst rqst; struct smb2_tree_disconnect_req *req; /* response is trivial */ int rc = 0; struct cifs_ses *ses = tcon->ses; int flags = 0; unsigned int total_len; struct kvec iov[1]; struct kvec rsp_iov; int resp_buf_type; cifs_dbg(FYI, "Tree Disconnect\n"); if (!ses || !(ses->server)) return -EIO; if ((tcon->need_reconnect) || (tcon->ses->need_reconnect)) return 0; rc = smb2_plain_req_init(SMB2_TREE_DISCONNECT, tcon, (void **) &req, &total_len); if (rc) return rc; if (smb3_encryption_required(tcon)) flags |= CIFS_TRANSFORM_REQ; flags |= CIFS_NO_RESP; iov[0].iov_base = (char *)req; iov[0].iov_len = total_len; memset(&rqst, 0, sizeof(struct smb_rqst)); rqst.rq_iov = iov; rqst.rq_nvec = 1; rc = cifs_send_recv(xid, ses, &rqst, &resp_buf_type, flags, &rsp_iov); cifs_small_buf_release(req); if (rc) cifs_stats_fail_inc(tcon, SMB2_TREE_DISCONNECT_HE); return rc; }
C
linux
0
CVE-2011-2351
https://www.cvedetails.com/cve/CVE-2011-2351/
CWE-399
https://github.com/chromium/chromium/commit/bf381d8a02c3d272d4dd879ac719d8993dfb5ad6
bf381d8a02c3d272d4dd879ac719d8993dfb5ad6
Enable HistoryModelWorker by default, now that bug 69561 is fixed. BUG=69561 TEST=Run sync manually and run integration tests, sync should not crash. Review URL: http://codereview.chromium.org/7016007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85211 0039d316-1c4b-4281-b951-d872f2087c98
SyncBackendHost::Status SyncBackendHost::GetDetailedStatus() { DCHECK(syncapi_initialized_); return core_->syncapi()->GetDetailedStatus(); }
SyncBackendHost::Status SyncBackendHost::GetDetailedStatus() { DCHECK(syncapi_initialized_); return core_->syncapi()->GetDetailedStatus(); }
C
Chrome
0
CVE-2015-0228
https://www.cvedetails.com/cve/CVE-2015-0228/
CWE-20
https://github.com/apache/httpd/commit/643f0fcf3b8ab09a68f0ecd2aa37aafeda3e63ef
643f0fcf3b8ab09a68f0ecd2aa37aafeda3e63ef
*) SECURITY: CVE-2015-0228 (cve.mitre.org) mod_lua: A maliciously crafted websockets PING after a script calls r:wsupgrade() can cause a child process crash. [Edward Lu <Chaosed0 gmail.com>] Discovered by Guido Vranken <guidovranken gmail.com> Submitted by: Edward Lu Committed by: covener git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1657261 13f79535-47bb-0310-9956-ffa450edef68
static req_table_t* req_err_headers_out(request_rec *r) { req_table_t* t = apr_palloc(r->pool, sizeof(req_table_t)); t->r = r; t->t = r->err_headers_out; t->n = "err_headers_out"; return t; }
static req_table_t* req_err_headers_out(request_rec *r) { req_table_t* t = apr_palloc(r->pool, sizeof(req_table_t)); t->r = r; t->t = r->err_headers_out; t->n = "err_headers_out"; return t; }
C
httpd
0
CVE-2015-6768
https://www.cvedetails.com/cve/CVE-2015-6768/
CWE-264
https://github.com/chromium/chromium/commit/4c8b008f055f79e622344627fed7f820375a4f01
4c8b008f055f79e622344627fed7f820375a4f01
Change Document::detach() to RELEASE_ASSERT all subframes are gone. BUG=556724,577105 Review URL: https://codereview.chromium.org/1667573002 Cr-Commit-Position: refs/heads/master@{#373642}
void Document::setThreadedParsingEnabledForTesting(bool enabled) { s_threadedParsingEnabledForTesting = enabled; }
void Document::setThreadedParsingEnabledForTesting(bool enabled) { s_threadedParsingEnabledForTesting = enabled; }
C
Chrome
0
CVE-2016-9388
https://www.cvedetails.com/cve/CVE-2016-9388/
null
https://github.com/mdadams/jasper/commit/411a4068f8c464e883358bf403a3e25158863823
411a4068f8c464e883358bf403a3e25158863823
Fixed a few bugs in the RAS encoder and decoder where errors were tested with assertions instead of being gracefully handled.
static int ras_getint(jas_stream_t *in, int_fast32_t *val) { int x; int c; int i; x = 0; for (i = 0; i < 4; i++) { if ((c = jas_stream_getc(in)) == EOF) { return -1; } x = (x << 8) | (c & 0xff); } *val = x; return 0; }
static int ras_getint(jas_stream_t *in, int_fast32_t *val) { int x; int c; int i; x = 0; for (i = 0; i < 4; i++) { if ((c = jas_stream_getc(in)) == EOF) { return -1; } x = (x << 8) | (c & 0xff); } *val = x; return 0; }
C
jasper
0
CVE-2016-1632
https://www.cvedetails.com/cve/CVE-2016-1632/
CWE-264
https://github.com/chromium/chromium/commit/3f38b2253b19f9f9595f79fb92bfb5077e7b1959
3f38b2253b19f9f9595f79fb92bfb5077e7b1959
Remove UMA.CreatePersistentHistogram.Result This histogram isn't showing anything meaningful and the problems it could show are better observed by looking at the allocators directly. Bug: 831013 Change-Id: Ibe968597758230192e53a7675e7390e968c9e5b9 Reviewed-on: https://chromium-review.googlesource.com/1008047 Commit-Queue: Brian White <[email protected]> Reviewed-by: Alexei Svitkine <[email protected]> Cr-Commit-Position: refs/heads/master@{#549986}
Histogram* CreateHistogram(const char* name, HistogramBase::Sample min, HistogramBase::Sample max, size_t bucket_count) { BucketRanges* ranges = new BucketRanges(bucket_count + 1); Histogram::InitializeBucketRanges(min, max, ranges); const BucketRanges* registered_ranges = StatisticsRecorder::RegisterOrDeleteDuplicateRanges(ranges); return new Histogram(name, min, max, registered_ranges); }
Histogram* CreateHistogram(const char* name, HistogramBase::Sample min, HistogramBase::Sample max, size_t bucket_count) { BucketRanges* ranges = new BucketRanges(bucket_count + 1); Histogram::InitializeBucketRanges(min, max, ranges); const BucketRanges* registered_ranges = StatisticsRecorder::RegisterOrDeleteDuplicateRanges(ranges); return new Histogram(name, min, max, registered_ranges); }
C
Chrome
0
CVE-2012-5134
https://www.cvedetails.com/cve/CVE-2012-5134/
CWE-119
https://github.com/chromium/chromium/commit/6e487b9db2ff0324523a040180f8da42796aeef5
6e487b9db2ff0324523a040180f8da42796aeef5
Add a check to prevent len from going negative in xmlParseAttValueComplex. BUG=158249 Review URL: https://chromiumcodereview.appspot.com/11343029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164867 0039d316-1c4b-4281-b951-d872f2087c98
xmlParsePI(xmlParserCtxtPtr ctxt) { xmlChar *buf = NULL; int len = 0; int size = XML_PARSER_BUFFER_SIZE; int cur, l; const xmlChar *target; xmlParserInputState state; int count = 0; if ((RAW == '<') && (NXT(1) == '?')) { xmlParserInputPtr input = ctxt->input; state = ctxt->instate; ctxt->instate = XML_PARSER_PI; /* * this is a Processing Instruction. */ SKIP(2); SHRINK; /* * Parse the target name and check for special support like * namespace. */ target = xmlParsePITarget(ctxt); if (target != NULL) { if ((RAW == '?') && (NXT(1) == '>')) { if (input != ctxt->input) { xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY, "PI declaration doesn't start and stop in the same entity\n"); } SKIP(2); /* * SAX: PI detected. */ if ((ctxt->sax) && (!ctxt->disableSAX) && (ctxt->sax->processingInstruction != NULL)) ctxt->sax->processingInstruction(ctxt->userData, target, NULL); if (ctxt->instate != XML_PARSER_EOF) ctxt->instate = state; return; } buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); if (buf == NULL) { xmlErrMemory(ctxt, NULL); ctxt->instate = state; return; } cur = CUR; if (!IS_BLANK(cur)) { xmlFatalErrMsgStr(ctxt, XML_ERR_SPACE_REQUIRED, "ParsePI: PI %s space expected\n", target); } SKIP_BLANKS; cur = CUR_CHAR(l); while (IS_CHAR(cur) && /* checked */ ((cur != '?') || (NXT(1) != '>'))) { if (len + 5 >= size) { xmlChar *tmp; size *= 2; tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); if (tmp == NULL) { xmlErrMemory(ctxt, NULL); xmlFree(buf); ctxt->instate = state; return; } buf = tmp; } count++; if (count > 50) { GROW; count = 0; } COPY_BUF(l,buf,len,cur); NEXTL(l); cur = CUR_CHAR(l); if (cur == 0) { SHRINK; GROW; cur = CUR_CHAR(l); } } buf[len] = 0; if (cur != '?') { xmlFatalErrMsgStr(ctxt, XML_ERR_PI_NOT_FINISHED, "ParsePI: PI %s never end ...\n", target); } else { if (input != ctxt->input) { xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, "PI declaration doesn't start and stop in the same entity\n"); } SKIP(2); #ifdef LIBXML_CATALOG_ENABLED if (((state == XML_PARSER_MISC) || (state == XML_PARSER_START)) && (xmlStrEqual(target, XML_CATALOG_PI))) { xmlCatalogAllow allow = xmlCatalogGetDefaults(); if ((allow == XML_CATA_ALLOW_DOCUMENT) || (allow == XML_CATA_ALLOW_ALL)) xmlParseCatalogPI(ctxt, buf); } #endif /* * SAX: PI detected. */ if ((ctxt->sax) && (!ctxt->disableSAX) && (ctxt->sax->processingInstruction != NULL)) ctxt->sax->processingInstruction(ctxt->userData, target, buf); } xmlFree(buf); } else { xmlFatalErr(ctxt, XML_ERR_PI_NOT_STARTED, NULL); } if (ctxt->instate != XML_PARSER_EOF) ctxt->instate = state; } }
xmlParsePI(xmlParserCtxtPtr ctxt) { xmlChar *buf = NULL; int len = 0; int size = XML_PARSER_BUFFER_SIZE; int cur, l; const xmlChar *target; xmlParserInputState state; int count = 0; if ((RAW == '<') && (NXT(1) == '?')) { xmlParserInputPtr input = ctxt->input; state = ctxt->instate; ctxt->instate = XML_PARSER_PI; /* * this is a Processing Instruction. */ SKIP(2); SHRINK; /* * Parse the target name and check for special support like * namespace. */ target = xmlParsePITarget(ctxt); if (target != NULL) { if ((RAW == '?') && (NXT(1) == '>')) { if (input != ctxt->input) { xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY, "PI declaration doesn't start and stop in the same entity\n"); } SKIP(2); /* * SAX: PI detected. */ if ((ctxt->sax) && (!ctxt->disableSAX) && (ctxt->sax->processingInstruction != NULL)) ctxt->sax->processingInstruction(ctxt->userData, target, NULL); if (ctxt->instate != XML_PARSER_EOF) ctxt->instate = state; return; } buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); if (buf == NULL) { xmlErrMemory(ctxt, NULL); ctxt->instate = state; return; } cur = CUR; if (!IS_BLANK(cur)) { xmlFatalErrMsgStr(ctxt, XML_ERR_SPACE_REQUIRED, "ParsePI: PI %s space expected\n", target); } SKIP_BLANKS; cur = CUR_CHAR(l); while (IS_CHAR(cur) && /* checked */ ((cur != '?') || (NXT(1) != '>'))) { if (len + 5 >= size) { xmlChar *tmp; size *= 2; tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); if (tmp == NULL) { xmlErrMemory(ctxt, NULL); xmlFree(buf); ctxt->instate = state; return; } buf = tmp; } count++; if (count > 50) { GROW; count = 0; } COPY_BUF(l,buf,len,cur); NEXTL(l); cur = CUR_CHAR(l); if (cur == 0) { SHRINK; GROW; cur = CUR_CHAR(l); } } buf[len] = 0; if (cur != '?') { xmlFatalErrMsgStr(ctxt, XML_ERR_PI_NOT_FINISHED, "ParsePI: PI %s never end ...\n", target); } else { if (input != ctxt->input) { xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, "PI declaration doesn't start and stop in the same entity\n"); } SKIP(2); #ifdef LIBXML_CATALOG_ENABLED if (((state == XML_PARSER_MISC) || (state == XML_PARSER_START)) && (xmlStrEqual(target, XML_CATALOG_PI))) { xmlCatalogAllow allow = xmlCatalogGetDefaults(); if ((allow == XML_CATA_ALLOW_DOCUMENT) || (allow == XML_CATA_ALLOW_ALL)) xmlParseCatalogPI(ctxt, buf); } #endif /* * SAX: PI detected. */ if ((ctxt->sax) && (!ctxt->disableSAX) && (ctxt->sax->processingInstruction != NULL)) ctxt->sax->processingInstruction(ctxt->userData, target, buf); } xmlFree(buf); } else { xmlFatalErr(ctxt, XML_ERR_PI_NOT_STARTED, NULL); } if (ctxt->instate != XML_PARSER_EOF) ctxt->instate = state; } }
C
Chrome
0
CVE-2017-5120
https://www.cvedetails.com/cve/CVE-2017-5120/
null
https://github.com/chromium/chromium/commit/b7277af490d28ac7f802c015bb0ff31395768556
b7277af490d28ac7f802c015bb0ff31395768556
bindings: Support "attribute FrozenArray<T>?" Adds a quick hack to support a case of "attribute FrozenArray<T>?". Bug: 1028047 Change-Id: Ib3cecc4beb6bcc0fb0dbc667aca595454cc90c86 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1933866 Reviewed-by: Hitoshi Yoshida <[email protected]> Commit-Queue: Yuki Shiino <[email protected]> Cr-Commit-Position: refs/heads/master@{#718676}
void V8TestObject::BooleanAttributeAttributeSetterCallback( const v8::FunctionCallbackInfo<v8::Value>& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_booleanAttribute_Setter"); v8::Local<v8::Value> v8_value = info[0]; test_object_v8_internal::BooleanAttributeAttributeSetter(v8_value, info); }
void V8TestObject::BooleanAttributeAttributeSetterCallback( const v8::FunctionCallbackInfo<v8::Value>& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_booleanAttribute_Setter"); v8::Local<v8::Value> v8_value = info[0]; test_object_v8_internal::BooleanAttributeAttributeSetter(v8_value, info); }
C
Chrome
0
CVE-2017-5118
https://www.cvedetails.com/cve/CVE-2017-5118/
CWE-732
https://github.com/chromium/chromium/commit/0ab2412a104d2f235d7b9fe19d30ef605a410832
0ab2412a104d2f235d7b9fe19d30ef605a410832
Inherit CSP when we inherit the security origin This prevents attacks that use main window navigation to get out of the existing csp constraints such as the related bug Bug: 747847 Change-Id: I1e57b50da17f65d38088205b0a3c7c49ef2ae4d8 Reviewed-on: https://chromium-review.googlesource.com/592027 Reviewed-by: Mike West <[email protected]> Commit-Queue: Andy Paicu <[email protected]> Cr-Commit-Position: refs/heads/master@{#492333}
bool DocumentLoader::ShouldPersistUserGestureValue( const SecurityOrigin* previous_security_origin, const SecurityOrigin* new_security_origin) { if (!CheckOriginIsHttpOrHttps(previous_security_origin) || !CheckOriginIsHttpOrHttps(new_security_origin)) return false; if (previous_security_origin->Host() == new_security_origin->Host()) return true; String previous_domain = NetworkUtils::GetDomainAndRegistry( previous_security_origin->Host(), NetworkUtils::kIncludePrivateRegistries); String new_domain = NetworkUtils::GetDomainAndRegistry( new_security_origin->Host(), NetworkUtils::kIncludePrivateRegistries); return !previous_domain.IsEmpty() && previous_domain == new_domain; }
bool DocumentLoader::ShouldPersistUserGestureValue( const SecurityOrigin* previous_security_origin, const SecurityOrigin* new_security_origin) { if (!CheckOriginIsHttpOrHttps(previous_security_origin) || !CheckOriginIsHttpOrHttps(new_security_origin)) return false; if (previous_security_origin->Host() == new_security_origin->Host()) return true; String previous_domain = NetworkUtils::GetDomainAndRegistry( previous_security_origin->Host(), NetworkUtils::kIncludePrivateRegistries); String new_domain = NetworkUtils::GetDomainAndRegistry( new_security_origin->Host(), NetworkUtils::kIncludePrivateRegistries); return !previous_domain.IsEmpty() && previous_domain == new_domain; }
C
Chrome
0
CVE-2016-5170
https://www.cvedetails.com/cve/CVE-2016-5170/
CWE-416
https://github.com/chromium/chromium/commit/c3957448cfc6e299165196a33cd954b790875fdb
c3957448cfc6e299165196a33cd954b790875fdb
Cleanup and remove dead code in SetFocusedElement This early-out was added in: https://crrev.com/ce8ea3446283965c7eabab592cbffe223b1cf2bc Back then, we applied fragment focus in LayoutUpdated() which could cause this issue. This got cleaned up in: https://crrev.com/45236fd563e9df53dc45579be1f3d0b4784885a2 so that focus is no longer applied after layout. +Cleanup: Goto considered harmful Bug: 795381 Change-Id: Ifeb4d2e03e872fd48cca6720b1d4de36ad1ecbb7 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1524417 Commit-Queue: David Bokan <[email protected]> Reviewed-by: Stefan Zager <[email protected]> Cr-Commit-Position: refs/heads/master@{#641101}
MouseEventWithHitTestResults Document::PerformMouseEventHitTest( const HitTestRequest& request, const LayoutPoint& document_point, const WebMouseEvent& event) { DCHECK(!GetLayoutView() || GetLayoutView()->IsLayoutView()); if (!GetLayoutView() || !View() || !View()->DidFirstLayout()) { HitTestLocation location((LayoutPoint())); return MouseEventWithHitTestResults(event, location, HitTestResult(request, location)); } HitTestLocation location(document_point); HitTestResult result(request, location); GetLayoutView()->HitTest(location, result); if (!request.ReadOnly()) UpdateHoverActiveState(request, result.InnerElement()); if (auto* canvas = ToHTMLCanvasElementOrNull(result.InnerNode())) { HitTestCanvasResult* hit_test_canvas_result = canvas->GetControlAndIdIfHitRegionExists( result.PointInInnerNodeFrame()); if (hit_test_canvas_result->GetControl()) { result.SetInnerNode(hit_test_canvas_result->GetControl()); } result.SetCanvasRegionId(hit_test_canvas_result->GetId()); } return MouseEventWithHitTestResults(event, location, result); }
MouseEventWithHitTestResults Document::PerformMouseEventHitTest( const HitTestRequest& request, const LayoutPoint& document_point, const WebMouseEvent& event) { DCHECK(!GetLayoutView() || GetLayoutView()->IsLayoutView()); if (!GetLayoutView() || !View() || !View()->DidFirstLayout()) { HitTestLocation location((LayoutPoint())); return MouseEventWithHitTestResults(event, location, HitTestResult(request, location)); } HitTestLocation location(document_point); HitTestResult result(request, location); GetLayoutView()->HitTest(location, result); if (!request.ReadOnly()) UpdateHoverActiveState(request, result.InnerElement()); if (auto* canvas = ToHTMLCanvasElementOrNull(result.InnerNode())) { HitTestCanvasResult* hit_test_canvas_result = canvas->GetControlAndIdIfHitRegionExists( result.PointInInnerNodeFrame()); if (hit_test_canvas_result->GetControl()) { result.SetInnerNode(hit_test_canvas_result->GetControl()); } result.SetCanvasRegionId(hit_test_canvas_result->GetId()); } return MouseEventWithHitTestResults(event, location, result); }
C
Chrome
0
CVE-2016-3751
https://www.cvedetails.com/cve/CVE-2016-3751/
null
https://android.googlesource.com/platform/external/libpng/+/9d4853418ab2f754c2b63e091c29c5529b8b86ca
9d4853418ab2f754c2b63e091c29c5529b8b86ca
DO NOT MERGE Update libpng to 1.6.20 BUG:23265085 Change-Id: I85199805636d771f3597b691b63bc0bf46084833 (cherry picked from commit bbe98b40cda082024b669fa508931042eed18f82)
image_transform_png_set_strip_alpha_set(PNG_CONST image_transform *this, image_transform_png_set_strip_alpha_set(const image_transform *this, transform_display *that, png_structp pp, png_infop pi) { png_set_strip_alpha(pp); this->next->set(this->next, that, pp, pi); }
image_transform_png_set_strip_alpha_set(PNG_CONST image_transform *this, transform_display *that, png_structp pp, png_infop pi) { png_set_strip_alpha(pp); this->next->set(this->next, that, pp, pi); }
C
Android
1
CVE-2017-6439
https://www.cvedetails.com/cve/CVE-2017-6439/
CWE-787
https://github.com/libimobiledevice/libplist/commit/32ee5213fe64f1e10ec76c1ee861ee6f233120dd
32ee5213fe64f1e10ec76c1ee861ee6f233120dd
bplist: Fix data range check for string/data/dict/array nodes Passing a size of 0xFFFFFFFFFFFFFFFF to parse_string_node() might result in a memcpy with a size of -1, leading to undefined behavior. This commit makes sure that the actual node data (which depends on the size) is in the range start_of_object..start_of_object+size. Credit to OSS-Fuzz
static void write_date(bytearray_t * bplist, double val) { uint8_t buff[9]; buff[0] = BPLIST_DATE | 3; *(uint64_t*)(buff+1) = float_bswap64(*(uint64_t*)&val); byte_array_append(bplist, buff, sizeof(buff)); }
static void write_date(bytearray_t * bplist, double val) { uint8_t buff[9]; buff[0] = BPLIST_DATE | 3; *(uint64_t*)(buff+1) = float_bswap64(*(uint64_t*)&val); byte_array_append(bplist, buff, sizeof(buff)); }
C
libplist
0
CVE-2019-13295
https://www.cvedetails.com/cve/CVE-2019-13295/
CWE-125
https://github.com/ImageMagick/ImageMagick/commit/a7759f410b773a1dd57b0e1fb28112e1cd8b97bc
a7759f410b773a1dd57b0e1fb28112e1cd8b97bc
https://github.com/ImageMagick/ImageMagick/issues/1608
MagickExport Image *AdaptiveThresholdImage(const Image *image, const size_t width,const size_t height,const double bias, ExceptionInfo *exception) { #define AdaptiveThresholdImageTag "AdaptiveThreshold/Image" CacheView *image_view, *threshold_view; Image *threshold_image; MagickBooleanType status; MagickOffsetType progress; MagickSizeType number_pixels; ssize_t y; /* Initialize threshold image attributes. */ assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); threshold_image=CloneImage(image,0,0,MagickTrue,exception); if (threshold_image == (Image *) NULL) return((Image *) NULL); if (width == 0) return(threshold_image); status=SetImageStorageClass(threshold_image,DirectClass,exception); if (status == MagickFalse) { threshold_image=DestroyImage(threshold_image); return((Image *) NULL); } /* Threshold image. */ status=MagickTrue; progress=0; number_pixels=(MagickSizeType) width*height; image_view=AcquireVirtualCacheView(image,exception); threshold_view=AcquireAuthenticCacheView(threshold_image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(progress,status) \ magick_number_threads(image,threshold_image,image->rows,1) #endif for (y=0; y < (ssize_t) image->rows; y++) { double channel_bias[MaxPixelChannels], channel_sum[MaxPixelChannels]; register const Quantum *magick_restrict p, *magick_restrict pixels; register Quantum *magick_restrict q; register ssize_t i, x; ssize_t center, u, v; if (status == MagickFalse) continue; p=GetCacheViewVirtualPixels(image_view,-((ssize_t) width/2L),y-(ssize_t) (height/2L),image->columns+width,height,exception); q=QueueCacheViewAuthenticPixels(threshold_view,0,y,threshold_image->columns, 1,exception); if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL)) { status=MagickFalse; continue; } center=(ssize_t) GetPixelChannels(image)*(image->columns+width)*(height/2L)+ GetPixelChannels(image)*(width/2); for (i=0; i < (ssize_t) GetPixelChannels(image); i++) { PixelChannel channel = GetPixelChannelChannel(image,i); PixelTrait traits = GetPixelChannelTraits(image,channel); PixelTrait threshold_traits=GetPixelChannelTraits(threshold_image, channel); if ((traits == UndefinedPixelTrait) || (threshold_traits == UndefinedPixelTrait)) continue; if ((threshold_traits & CopyPixelTrait) != 0) { SetPixelChannel(threshold_image,channel,p[center+i],q); continue; } pixels=p; channel_bias[channel]=0.0; channel_sum[channel]=0.0; for (v=0; v < (ssize_t) height; v++) { for (u=0; u < (ssize_t) width; u++) { if (u == (ssize_t) (width-1)) channel_bias[channel]+=pixels[i]; channel_sum[channel]+=pixels[i]; pixels+=GetPixelChannels(image); } pixels+=GetPixelChannels(image)*image->columns; } } for (x=0; x < (ssize_t) image->columns; x++) { for (i=0; i < (ssize_t) GetPixelChannels(image); i++) { double mean; PixelChannel channel = GetPixelChannelChannel(image,i); PixelTrait traits = GetPixelChannelTraits(image,channel); PixelTrait threshold_traits=GetPixelChannelTraits(threshold_image, channel); if ((traits == UndefinedPixelTrait) || (threshold_traits == UndefinedPixelTrait)) continue; if ((threshold_traits & CopyPixelTrait) != 0) { SetPixelChannel(threshold_image,channel,p[center+i],q); continue; } channel_sum[channel]-=channel_bias[channel]; channel_bias[channel]=0.0; pixels=p; for (v=0; v < (ssize_t) height; v++) { channel_bias[channel]+=pixels[i]; pixels+=(width-1)*GetPixelChannels(image); channel_sum[channel]+=pixels[i]; pixels+=GetPixelChannels(image)*(image->columns+1); } mean=(double) (channel_sum[channel]/number_pixels+bias); SetPixelChannel(threshold_image,channel,(Quantum) ((double) p[center+i] <= mean ? 0 : QuantumRange),q); } p+=GetPixelChannels(image); q+=GetPixelChannels(threshold_image); } if (SyncCacheViewAuthenticPixels(threshold_view,exception) == MagickFalse) status=MagickFalse; if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp atomic #endif progress++; proceed=SetImageProgress(image,AdaptiveThresholdImageTag,progress, image->rows); if (proceed == MagickFalse) status=MagickFalse; } } threshold_image->type=image->type; threshold_view=DestroyCacheView(threshold_view); image_view=DestroyCacheView(image_view); if (status == MagickFalse) threshold_image=DestroyImage(threshold_image); return(threshold_image); }
MagickExport Image *AdaptiveThresholdImage(const Image *image, const size_t width,const size_t height,const double bias, ExceptionInfo *exception) { #define AdaptiveThresholdImageTag "AdaptiveThreshold/Image" CacheView *image_view, *threshold_view; Image *threshold_image; MagickBooleanType status; MagickOffsetType progress; MagickSizeType number_pixels; ssize_t y; /* Initialize threshold image attributes. */ assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); threshold_image=CloneImage(image,0,0,MagickTrue,exception); if (threshold_image == (Image *) NULL) return((Image *) NULL); status=SetImageStorageClass(threshold_image,DirectClass,exception); if (status == MagickFalse) { threshold_image=DestroyImage(threshold_image); return((Image *) NULL); } /* Threshold image. */ status=MagickTrue; progress=0; number_pixels=(MagickSizeType) width*height; image_view=AcquireVirtualCacheView(image,exception); threshold_view=AcquireAuthenticCacheView(threshold_image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(progress,status) \ magick_number_threads(image,threshold_image,image->rows,1) #endif for (y=0; y < (ssize_t) image->rows; y++) { double channel_bias[MaxPixelChannels], channel_sum[MaxPixelChannels]; register const Quantum *magick_restrict p, *magick_restrict pixels; register Quantum *magick_restrict q; register ssize_t i, x; ssize_t center, u, v; if (status == MagickFalse) continue; p=GetCacheViewVirtualPixels(image_view,-((ssize_t) width/2L),y-(ssize_t) (height/2L),image->columns+width,height,exception); q=QueueCacheViewAuthenticPixels(threshold_view,0,y,threshold_image->columns, 1,exception); if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL)) { status=MagickFalse; continue; } center=(ssize_t) GetPixelChannels(image)*(image->columns+width)*(height/2L)+ GetPixelChannels(image)*(width/2); for (i=0; i < (ssize_t) GetPixelChannels(image); i++) { PixelChannel channel = GetPixelChannelChannel(image,i); PixelTrait traits = GetPixelChannelTraits(image,channel); PixelTrait threshold_traits=GetPixelChannelTraits(threshold_image, channel); if ((traits == UndefinedPixelTrait) || (threshold_traits == UndefinedPixelTrait)) continue; if ((threshold_traits & CopyPixelTrait) != 0) { SetPixelChannel(threshold_image,channel,p[center+i],q); continue; } pixels=p; channel_bias[channel]=0.0; channel_sum[channel]=0.0; for (v=0; v < (ssize_t) height; v++) { for (u=0; u < (ssize_t) width; u++) { if (u == (ssize_t) (width-1)) channel_bias[channel]+=pixels[i]; channel_sum[channel]+=pixels[i]; pixels+=GetPixelChannels(image); } pixels+=GetPixelChannels(image)*image->columns; } } for (x=0; x < (ssize_t) image->columns; x++) { for (i=0; i < (ssize_t) GetPixelChannels(image); i++) { double mean; PixelChannel channel = GetPixelChannelChannel(image,i); PixelTrait traits = GetPixelChannelTraits(image,channel); PixelTrait threshold_traits=GetPixelChannelTraits(threshold_image, channel); if ((traits == UndefinedPixelTrait) || (threshold_traits == UndefinedPixelTrait)) continue; if ((threshold_traits & CopyPixelTrait) != 0) { SetPixelChannel(threshold_image,channel,p[center+i],q); continue; } channel_sum[channel]-=channel_bias[channel]; channel_bias[channel]=0.0; pixels=p; for (v=0; v < (ssize_t) height; v++) { channel_bias[channel]+=pixels[i]; pixels+=(width-1)*GetPixelChannels(image); channel_sum[channel]+=pixels[i]; pixels+=GetPixelChannels(image)*(image->columns+1); } mean=(double) (channel_sum[channel]/number_pixels+bias); SetPixelChannel(threshold_image,channel,(Quantum) ((double) p[center+i] <= mean ? 0 : QuantumRange),q); } p+=GetPixelChannels(image); q+=GetPixelChannels(threshold_image); } if (SyncCacheViewAuthenticPixels(threshold_view,exception) == MagickFalse) status=MagickFalse; if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp atomic #endif progress++; proceed=SetImageProgress(image,AdaptiveThresholdImageTag,progress, image->rows); if (proceed == MagickFalse) status=MagickFalse; } } threshold_image->type=image->type; threshold_view=DestroyCacheView(threshold_view); image_view=DestroyCacheView(image_view); if (status == MagickFalse) threshold_image=DestroyImage(threshold_image); return(threshold_image); }
C
ImageMagick
1
CVE-2016-5170
https://www.cvedetails.com/cve/CVE-2016-5170/
CWE-416
https://github.com/chromium/chromium/commit/c3957448cfc6e299165196a33cd954b790875fdb
c3957448cfc6e299165196a33cd954b790875fdb
Cleanup and remove dead code in SetFocusedElement This early-out was added in: https://crrev.com/ce8ea3446283965c7eabab592cbffe223b1cf2bc Back then, we applied fragment focus in LayoutUpdated() which could cause this issue. This got cleaned up in: https://crrev.com/45236fd563e9df53dc45579be1f3d0b4784885a2 so that focus is no longer applied after layout. +Cleanup: Goto considered harmful Bug: 795381 Change-Id: Ifeb4d2e03e872fd48cca6720b1d4de36ad1ecbb7 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1524417 Commit-Queue: David Bokan <[email protected]> Reviewed-by: Stefan Zager <[email protected]> Cr-Commit-Position: refs/heads/master@{#641101}
void Document::SetResizedForViewportUnits() { if (media_query_matcher_) media_query_matcher_->ViewportChanged(); if (!HasViewportUnits()) return; EnsureStyleResolver().SetResizedForViewportUnits(); SetNeedsStyleRecalcForViewportUnits(); }
void Document::SetResizedForViewportUnits() { if (media_query_matcher_) media_query_matcher_->ViewportChanged(); if (!HasViewportUnits()) return; EnsureStyleResolver().SetResizedForViewportUnits(); SetNeedsStyleRecalcForViewportUnits(); }
C
Chrome
0
CVE-2017-5112
https://www.cvedetails.com/cve/CVE-2017-5112/
CWE-119
https://github.com/chromium/chromium/commit/f6ac1dba5e36f338a490752a2cbef3339096d9fe
f6ac1dba5e36f338a490752a2cbef3339096d9fe
Reset ES3 pixel pack parameters and PIXEL_PACK_BUFFER binding in DrawingBuffer before ReadPixels() and recover them later. BUG=740603 TEST=new conformance test [email protected],[email protected] Change-Id: I3ea54c6cc34f34e249f7c8b9f792d93c5e1958f4 Reviewed-on: https://chromium-review.googlesource.com/570840 Reviewed-by: Antoine Labour <[email protected]> Reviewed-by: Kenneth Russell <[email protected]> Commit-Queue: Zhenyao Mo <[email protected]> Cr-Commit-Position: refs/heads/master@{#486518}
void WebGLRenderingContextBase::uniform1i(const WebGLUniformLocation* location, GLint x) { if (isContextLost() || !location) return; if (location->Program() != current_program_) { SynthesizeGLError(GL_INVALID_OPERATION, "uniform1i", "location not for current program"); return; } ContextGL()->Uniform1i(location->Location(), x); }
void WebGLRenderingContextBase::uniform1i(const WebGLUniformLocation* location, GLint x) { if (isContextLost() || !location) return; if (location->Program() != current_program_) { SynthesizeGLError(GL_INVALID_OPERATION, "uniform1i", "location not for current program"); return; } ContextGL()->Uniform1i(location->Location(), x); }
C
Chrome
0
CVE-2016-10030
https://www.cvedetails.com/cve/CVE-2016-10030/
CWE-284
https://github.com/SchedMD/slurm/commit/92362a92fffe60187df61f99ab11c249d44120ee
92362a92fffe60187df61f99ab11c249d44120ee
Fix security issue in _prolog_error(). Fix security issue caused by insecure file path handling triggered by the failure of a Prolog script. To exploit this a user needs to anticipate or cause the Prolog to fail for their job. (This commit is slightly different from the fix to the 15.08 branch.) CVE-2016-10030.
_rpc_batch_job(slurm_msg_t *msg, bool new_msg) { batch_job_launch_msg_t *req = (batch_job_launch_msg_t *)msg->data; bool first_job_run; int rc = SLURM_SUCCESS; bool replied = false, revoked; slurm_addr_t *cli = &msg->orig_addr; if (new_msg) { uid_t req_uid = g_slurm_auth_get_uid(msg->auth_cred, conf->auth_info); if (!_slurm_authorized_user(req_uid)) { error("Security violation, batch launch RPC from uid %d", req_uid); rc = ESLURM_USER_ID_MISSING; /* or bad in this case */ goto done; } } if (_launch_job_test(req->job_id)) { error("Job %u already running, do not launch second copy", req->job_id); rc = ESLURM_DUPLICATE_JOB_ID; /* job already running */ _launch_job_fail(req->job_id, rc); goto done; } slurm_cred_handle_reissue(conf->vctx, req->cred); if (slurm_cred_revoked(conf->vctx, req->cred)) { error("Job %u already killed, do not launch batch job", req->job_id); rc = ESLURMD_CREDENTIAL_REVOKED; /* job already ran */ goto done; } task_g_slurmd_batch_request(req->job_id, req); /* determine task affinity */ slurm_mutex_lock(&prolog_mutex); first_job_run = !slurm_cred_jobid_cached(conf->vctx, req->job_id); /* BlueGene prolog waits for partition boot and is very slow. * On any system we might need to load environment variables * for Moab (see --get-user-env), which could also be slow. * Just reply now and send a separate kill job request if the * prolog or launch fail. */ replied = true; if (new_msg && (slurm_send_rc_msg(msg, rc) < 1)) { /* The slurmctld is no longer waiting for a reply. * This typically indicates that the slurmd was * blocked from memory and/or CPUs and the slurmctld * has requeued the batch job request. */ error("Could not confirm batch launch for job %u, " "aborting request", req->job_id); rc = SLURM_COMMUNICATIONS_SEND_ERROR; slurm_mutex_unlock(&prolog_mutex); goto done; } /* * Insert jobid into credential context to denote that * we've now "seen" an instance of the job */ if (first_job_run) { job_env_t job_env; slurm_cred_insert_jobid(conf->vctx, req->job_id); _add_job_running_prolog(req->job_id); slurm_mutex_unlock(&prolog_mutex); memset(&job_env, 0, sizeof(job_env_t)); job_env.jobid = req->job_id; job_env.step_id = req->step_id; job_env.node_list = req->nodes; job_env.partition = req->partition; job_env.spank_job_env = req->spank_job_env; job_env.spank_job_env_size = req->spank_job_env_size; job_env.uid = req->uid; job_env.user_name = req->user_name; /* * Run job prolog on this node */ #if defined(HAVE_BG) select_g_select_jobinfo_get(req->select_jobinfo, SELECT_JOBDATA_BLOCK_ID, &job_env.resv_id); #elif defined(HAVE_ALPS_CRAY) job_env.resv_id = select_g_select_jobinfo_xstrdup( req->select_jobinfo, SELECT_PRINT_RESV_ID); #endif if (container_g_create(req->job_id)) error("container_g_create(%u): %m", req->job_id); rc = _run_prolog(&job_env, req->cred); xfree(job_env.resv_id); if (rc) { int term_sig, exit_status; if (WIFSIGNALED(rc)) { exit_status = 0; term_sig = WTERMSIG(rc); } else { exit_status = WEXITSTATUS(rc); term_sig = 0; } error("[job %u] prolog failed status=%d:%d", req->job_id, exit_status, term_sig); _prolog_error(req, rc); rc = ESLURMD_PROLOG_FAILED; goto done; } } else { slurm_mutex_unlock(&prolog_mutex); _wait_for_job_running_prolog(req->job_id); } if (_get_user_env(req) < 0) { bool requeue = _requeue_setup_env_fail(); if (requeue) { rc = ESLURMD_SETUP_ENVIRONMENT_ERROR; goto done; } } _set_batch_job_limits(msg); /* Since job could have been killed while the prolog was * running (especially on BlueGene, which can take minutes * for partition booting). Test if the credential has since * been revoked and exit as needed. */ if (slurm_cred_revoked(conf->vctx, req->cred)) { info("Job %u already killed, do not launch batch job", req->job_id); rc = ESLURMD_CREDENTIAL_REVOKED; /* job already ran */ goto done; } slurm_mutex_lock(&launch_mutex); if (req->step_id == SLURM_BATCH_SCRIPT) info("Launching batch job %u for UID %d", req->job_id, req->uid); else info("Launching batch job %u.%u for UID %d", req->job_id, req->step_id, req->uid); debug3("_rpc_batch_job: call to _forkexec_slurmstepd"); rc = _forkexec_slurmstepd(LAUNCH_BATCH_JOB, (void *)req, cli, NULL, (hostset_t)NULL, SLURM_PROTOCOL_VERSION); debug3("_rpc_batch_job: return from _forkexec_slurmstepd: %d", rc); slurm_mutex_unlock(&launch_mutex); _launch_complete_add(req->job_id); /* On a busy system, slurmstepd may take a while to respond, * if the job was cancelled in the interim, run through the * abort logic below. */ revoked = slurm_cred_revoked(conf->vctx, req->cred); if (revoked) _launch_complete_rm(req->job_id); if (revoked && _is_batch_job_finished(req->job_id)) { /* If configured with select/serial and the batch job already * completed, consider the job sucessfully launched and do * not repeat termination logic below, which in the worst case * just slows things down with another message. */ revoked = false; } if (revoked) { info("Job %u killed while launch was in progress", req->job_id); sleep(1); /* give slurmstepd time to create * the communication socket */ _terminate_all_steps(req->job_id, true); rc = ESLURMD_CREDENTIAL_REVOKED; goto done; } done: if (!replied) { if (new_msg && (slurm_send_rc_msg(msg, rc) < 1)) { /* The slurmctld is no longer waiting for a reply. * This typically indicates that the slurmd was * blocked from memory and/or CPUs and the slurmctld * has requeued the batch job request. */ error("Could not confirm batch launch for job %u, " "aborting request", req->job_id); rc = SLURM_COMMUNICATIONS_SEND_ERROR; } else { /* No need to initiate separate reply below */ rc = SLURM_SUCCESS; } } if (rc != SLURM_SUCCESS) { /* prolog or job launch failure, * tell slurmctld that the job failed */ if (req->step_id == SLURM_BATCH_SCRIPT) _launch_job_fail(req->job_id, rc); else _abort_step(req->job_id, req->step_id); } /* * If job prolog failed or we could not reply, * initiate message to slurmctld with current state */ if ((rc == ESLURMD_PROLOG_FAILED) || (rc == SLURM_COMMUNICATIONS_SEND_ERROR) || (rc == ESLURMD_SETUP_ENVIRONMENT_ERROR)) { send_registration_msg(rc, false); } }
_rpc_batch_job(slurm_msg_t *msg, bool new_msg) { batch_job_launch_msg_t *req = (batch_job_launch_msg_t *)msg->data; bool first_job_run; int rc = SLURM_SUCCESS; bool replied = false, revoked; slurm_addr_t *cli = &msg->orig_addr; if (new_msg) { uid_t req_uid = g_slurm_auth_get_uid(msg->auth_cred, conf->auth_info); if (!_slurm_authorized_user(req_uid)) { error("Security violation, batch launch RPC from uid %d", req_uid); rc = ESLURM_USER_ID_MISSING; /* or bad in this case */ goto done; } } if (_launch_job_test(req->job_id)) { error("Job %u already running, do not launch second copy", req->job_id); rc = ESLURM_DUPLICATE_JOB_ID; /* job already running */ _launch_job_fail(req->job_id, rc); goto done; } slurm_cred_handle_reissue(conf->vctx, req->cred); if (slurm_cred_revoked(conf->vctx, req->cred)) { error("Job %u already killed, do not launch batch job", req->job_id); rc = ESLURMD_CREDENTIAL_REVOKED; /* job already ran */ goto done; } task_g_slurmd_batch_request(req->job_id, req); /* determine task affinity */ slurm_mutex_lock(&prolog_mutex); first_job_run = !slurm_cred_jobid_cached(conf->vctx, req->job_id); /* BlueGene prolog waits for partition boot and is very slow. * On any system we might need to load environment variables * for Moab (see --get-user-env), which could also be slow. * Just reply now and send a separate kill job request if the * prolog or launch fail. */ replied = true; if (new_msg && (slurm_send_rc_msg(msg, rc) < 1)) { /* The slurmctld is no longer waiting for a reply. * This typically indicates that the slurmd was * blocked from memory and/or CPUs and the slurmctld * has requeued the batch job request. */ error("Could not confirm batch launch for job %u, " "aborting request", req->job_id); rc = SLURM_COMMUNICATIONS_SEND_ERROR; slurm_mutex_unlock(&prolog_mutex); goto done; } /* * Insert jobid into credential context to denote that * we've now "seen" an instance of the job */ if (first_job_run) { job_env_t job_env; slurm_cred_insert_jobid(conf->vctx, req->job_id); _add_job_running_prolog(req->job_id); slurm_mutex_unlock(&prolog_mutex); memset(&job_env, 0, sizeof(job_env_t)); job_env.jobid = req->job_id; job_env.step_id = req->step_id; job_env.node_list = req->nodes; job_env.partition = req->partition; job_env.spank_job_env = req->spank_job_env; job_env.spank_job_env_size = req->spank_job_env_size; job_env.uid = req->uid; job_env.user_name = req->user_name; /* * Run job prolog on this node */ #if defined(HAVE_BG) select_g_select_jobinfo_get(req->select_jobinfo, SELECT_JOBDATA_BLOCK_ID, &job_env.resv_id); #elif defined(HAVE_ALPS_CRAY) job_env.resv_id = select_g_select_jobinfo_xstrdup( req->select_jobinfo, SELECT_PRINT_RESV_ID); #endif if (container_g_create(req->job_id)) error("container_g_create(%u): %m", req->job_id); rc = _run_prolog(&job_env, req->cred); xfree(job_env.resv_id); if (rc) { int term_sig, exit_status; if (WIFSIGNALED(rc)) { exit_status = 0; term_sig = WTERMSIG(rc); } else { exit_status = WEXITSTATUS(rc); term_sig = 0; } error("[job %u] prolog failed status=%d:%d", req->job_id, exit_status, term_sig); _prolog_error(req, rc); rc = ESLURMD_PROLOG_FAILED; goto done; } } else { slurm_mutex_unlock(&prolog_mutex); _wait_for_job_running_prolog(req->job_id); } if (_get_user_env(req) < 0) { bool requeue = _requeue_setup_env_fail(); if (requeue) { rc = ESLURMD_SETUP_ENVIRONMENT_ERROR; goto done; } } _set_batch_job_limits(msg); /* Since job could have been killed while the prolog was * running (especially on BlueGene, which can take minutes * for partition booting). Test if the credential has since * been revoked and exit as needed. */ if (slurm_cred_revoked(conf->vctx, req->cred)) { info("Job %u already killed, do not launch batch job", req->job_id); rc = ESLURMD_CREDENTIAL_REVOKED; /* job already ran */ goto done; } slurm_mutex_lock(&launch_mutex); if (req->step_id == SLURM_BATCH_SCRIPT) info("Launching batch job %u for UID %d", req->job_id, req->uid); else info("Launching batch job %u.%u for UID %d", req->job_id, req->step_id, req->uid); debug3("_rpc_batch_job: call to _forkexec_slurmstepd"); rc = _forkexec_slurmstepd(LAUNCH_BATCH_JOB, (void *)req, cli, NULL, (hostset_t)NULL, SLURM_PROTOCOL_VERSION); debug3("_rpc_batch_job: return from _forkexec_slurmstepd: %d", rc); slurm_mutex_unlock(&launch_mutex); _launch_complete_add(req->job_id); /* On a busy system, slurmstepd may take a while to respond, * if the job was cancelled in the interim, run through the * abort logic below. */ revoked = slurm_cred_revoked(conf->vctx, req->cred); if (revoked) _launch_complete_rm(req->job_id); if (revoked && _is_batch_job_finished(req->job_id)) { /* If configured with select/serial and the batch job already * completed, consider the job sucessfully launched and do * not repeat termination logic below, which in the worst case * just slows things down with another message. */ revoked = false; } if (revoked) { info("Job %u killed while launch was in progress", req->job_id); sleep(1); /* give slurmstepd time to create * the communication socket */ _terminate_all_steps(req->job_id, true); rc = ESLURMD_CREDENTIAL_REVOKED; goto done; } done: if (!replied) { if (new_msg && (slurm_send_rc_msg(msg, rc) < 1)) { /* The slurmctld is no longer waiting for a reply. * This typically indicates that the slurmd was * blocked from memory and/or CPUs and the slurmctld * has requeued the batch job request. */ error("Could not confirm batch launch for job %u, " "aborting request", req->job_id); rc = SLURM_COMMUNICATIONS_SEND_ERROR; } else { /* No need to initiate separate reply below */ rc = SLURM_SUCCESS; } } if (rc != SLURM_SUCCESS) { /* prolog or job launch failure, * tell slurmctld that the job failed */ if (req->step_id == SLURM_BATCH_SCRIPT) _launch_job_fail(req->job_id, rc); else _abort_step(req->job_id, req->step_id); } /* * If job prolog failed or we could not reply, * initiate message to slurmctld with current state */ if ((rc == ESLURMD_PROLOG_FAILED) || (rc == SLURM_COMMUNICATIONS_SEND_ERROR) || (rc == ESLURMD_SETUP_ENVIRONMENT_ERROR)) { send_registration_msg(rc, false); } }
C
slurm
0
CVE-2019-5822
https://www.cvedetails.com/cve/CVE-2019-5822/
CWE-284
https://github.com/chromium/chromium/commit/2f81d000fdb5331121cba7ff81dfaaec25b520a5
2f81d000fdb5331121cba7ff81dfaaec25b520a5
When turning a download into a navigation, navigate the right frame Code changes from Nate Chapin <[email protected]> Bug: 926105 Change-Id: I098599394e6ebe7d2fce5af838014297a337d294 Reviewed-on: https://chromium-review.googlesource.com/c/1454962 Reviewed-by: Camille Lamy <[email protected]> Commit-Queue: Jochen Eisinger <[email protected]> Cr-Commit-Position: refs/heads/master@{#629547}
void ResourceDispatcherHostImpl::OnRenderViewHostDeleted(int child_id, int route_id) { auto* host = ResourceDispatcherHostImpl::Get(); if (host && host->scheduler_) { host->scheduler_->OnClientDeleted(child_id, route_id); } }
void ResourceDispatcherHostImpl::OnRenderViewHostDeleted(int child_id, int route_id) { auto* host = ResourceDispatcherHostImpl::Get(); if (host && host->scheduler_) { host->scheduler_->OnClientDeleted(child_id, route_id); } }
C
Chrome
0
CVE-2017-15411
https://www.cvedetails.com/cve/CVE-2017-15411/
CWE-416
https://github.com/chromium/chromium/commit/9d81094d7b0bfc8be6bba2f5084e790677e527c8
9d81094d7b0bfc8be6bba2f5084e790677e527c8
[Reland #1] Add Android OOP HP end-to-end tests. The original CL added a javatest and its dependencies to the apk_under_test. This causes the dependencies to be stripped from the instrumentation_apk, which causes issue. This CL updates the build configuration so that the javatest and its dependencies are only added to the instrumentation_apk. This is a reland of e0b4355f0651adb1ebc2c513dc4410471af712f5 Original change's description: > Add Android OOP HP end-to-end tests. > > This CL has three components: > 1) The bulk of the logic in OOP HP was refactored into ProfilingTestDriver. > 2) Adds a java instrumentation test, along with a JNI shim that forwards into > ProfilingTestDriver. > 3) Creates a new apk: chrome_public_apk_for_test that contains the same > content as chrome_public_apk, as well as native files needed for (2). > chrome_public_apk_test now targets chrome_public_apk_for_test instead of > chrome_public_apk. > > Other ideas, discarded: > * Originally, I attempted to make the browser_tests target runnable on > Android. The primary problem is that native test harness cannot fork > or spawn processes. This is difficult to solve. > > More details on each of the components: > (1) ProfilingTestDriver > * The TracingController test was migrated to use ProfilingTestDriver, but the > write-to-file test was left as-is. The latter behavior will likely be phased > out, but I'll clean that up in a future CL. > * gtest isn't supported for Android instrumentation tests. ProfilingTestDriver > has a single function RunTest that returns a 'bool' indicating success. On > failure, the class uses LOG(ERROR) to print the nature of the error. This will > cause the error to be printed out on browser_test error. On instrumentation > test failure, the error will be forwarded to logcat, which is available on all > infra bot test runs. > (2) Instrumentation test > * For now, I only added a single test for the "browser" mode. Furthermore, I'm > only testing the start with command-line path. > (3) New apk > * libchromefortest is a new shared library that contains all content from > libchrome, but also contains native sources for the JNI shim. > * chrome_public_apk_for_test is a new apk that contains all content from > chrome_public_apk, but uses a single shared library libchromefortest rather > than libchrome. This also contains java sources for the JNI shim. > * There is no way to just add a second shared library to chrome_public_apk > that just contains the native sources from the JNI shim without causing ODR > issues. > * chrome_public_test_apk now has apk_under_test = chrome_public_apk_for_test. > * There is no way to add native JNI sources as a shared library to > chrome_public_test_apk without causing ODR issues. > > Finally, this CL drastically increases the timeout to wait for native > initialization. The previous timeout was 2 * > CriteriaHelper.DEFAULT_MAX_TIME_TO_POLL, which flakily failed for this test. > This suggests that this step/timeout is generally flaky. I increased the timeout > to 20 * CriteriaHelper.DEFAULT_MAX_TIME_TO_POLL. > > Bug: 753218 > Change-Id: Ic224b7314fff57f1770a4048aa5753f54e040b55 > Reviewed-on: https://chromium-review.googlesource.com/770148 > Commit-Queue: Erik Chen <[email protected]> > Reviewed-by: John Budorick <[email protected]> > Reviewed-by: Brett Wilson <[email protected]> > Cr-Commit-Position: refs/heads/master@{#517541} Bug: 753218 TBR: [email protected] Change-Id: Ic6aafb34c2467253f75cc85da48200d19f3bc9af Reviewed-on: https://chromium-review.googlesource.com/777697 Commit-Queue: Erik Chen <[email protected]> Reviewed-by: John Budorick <[email protected]> Cr-Commit-Position: refs/heads/master@{#517850}
void ProfilingProcessHost::RequestProcessReport(std::string trigger_name) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); if (!connector_) { DLOG(ERROR) << "Requesting process dump when profiling process hasn't started."; return; } bool result = content::TracingController::GetInstance()->StartTracing( GetBackgroundTracingConfig(), base::Closure()); if (!result) return; auto finish_sink_callback = base::Bind( [](std::string trigger_name, std::unique_ptr<const base::DictionaryValue> metadata, base::RefCountedString* in) { std::string result; result.swap(in->data()); content::BrowserThread::GetTaskRunnerForThread( content::BrowserThread::UI) ->PostTask(FROM_HERE, base::BindOnce(&UploadTraceToCrashServer, std::move(result), std::move(trigger_name))); }, std::move(trigger_name)); scoped_refptr<content::TracingController::TraceDataEndpoint> sink = content::TracingController::CreateStringEndpoint( std::move(finish_sink_callback)); base::OnceClosure stop_tracing_closure = base::BindOnce( base::IgnoreResult<bool (content::TracingController::*)( // NOLINT const scoped_refptr<content::TracingController::TraceDataEndpoint>&)>( &content::TracingController::StopTracing), base::Unretained(content::TracingController::GetInstance()), sink); base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, std::move(stop_tracing_closure), base::TimeDelta::FromSeconds(10)); }
void ProfilingProcessHost::RequestProcessReport(std::string trigger_name) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); if (!connector_) { DLOG(ERROR) << "Requesting process dump when profiling process hasn't started."; return; } bool result = content::TracingController::GetInstance()->StartTracing( GetBackgroundTracingConfig(), base::Closure()); if (!result) return; auto finish_sink_callback = base::Bind( [](std::string trigger_name, std::unique_ptr<const base::DictionaryValue> metadata, base::RefCountedString* in) { std::string result; result.swap(in->data()); content::BrowserThread::GetTaskRunnerForThread( content::BrowserThread::UI) ->PostTask(FROM_HERE, base::BindOnce(&UploadTraceToCrashServer, std::move(result), std::move(trigger_name))); }, std::move(trigger_name)); scoped_refptr<content::TracingController::TraceDataEndpoint> sink = content::TracingController::CreateStringEndpoint( std::move(finish_sink_callback)); base::OnceClosure stop_tracing_closure = base::BindOnce( base::IgnoreResult<bool (content::TracingController::*)( // NOLINT const scoped_refptr<content::TracingController::TraceDataEndpoint>&)>( &content::TracingController::StopTracing), base::Unretained(content::TracingController::GetInstance()), sink); base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, std::move(stop_tracing_closure), base::TimeDelta::FromSeconds(10)); }
C
Chrome
0
CVE-2019-5755
https://www.cvedetails.com/cve/CVE-2019-5755/
CWE-189
https://github.com/chromium/chromium/commit/971548cdca2d4c0a6fedd3db0c94372c2a27eac3
971548cdca2d4c0a6fedd3db0c94372c2a27eac3
Make MediaStreamDispatcherHost per-request instead of per-frame. Instead of having RenderFrameHost own a single MSDH to handle all requests from a frame, MSDH objects will be owned by a strong binding. A consequence of this is that an additional requester ID is added to requests to MediaStreamManager, so that an MSDH is able to cancel only requests generated by it. In practice, MSDH will continue to be per frame in most cases since each frame normally makes a single request for an MSDH object. This fixes a lifetime issue caused by the IO thread executing tasks after the RenderFrameHost dies. Drive-by: Fix some minor lint issues. Bug: 912520 Change-Id: I52742ffc98b9fc57ce8e6f5093a61aed86d3e516 Reviewed-on: https://chromium-review.googlesource.com/c/1369799 Reviewed-by: Emircan Uysaler <[email protected]> Reviewed-by: Ken Buchanan <[email protected]> Reviewed-by: Olga Sharonova <[email protected]> Commit-Queue: Guido Urdaneta <[email protected]> Cr-Commit-Position: refs/heads/master@{#616347}
void LogVideoCaptureError(media::VideoCaptureError error) { UMA_HISTOGRAM_ENUMERATION( "Media.VideoCapture.Error", error, static_cast<int>(media::VideoCaptureError::kMaxValue) + 1); }
void LogVideoCaptureError(media::VideoCaptureError error) { UMA_HISTOGRAM_ENUMERATION( "Media.VideoCapture.Error", error, static_cast<int>(media::VideoCaptureError::kMaxValue) + 1); }
C
Chrome
0
CVE-2012-4508
https://www.cvedetails.com/cve/CVE-2012-4508/
CWE-362
https://github.com/torvalds/linux/commit/dee1f973ca341c266229faa5a1a5bb268bed3531
dee1f973ca341c266229faa5a1a5bb268bed3531
ext4: race-condition protection for ext4_convert_unwritten_extents_endio We assumed that at the time we call ext4_convert_unwritten_extents_endio() extent in question is fully inside [map.m_lblk, map->m_len] because it was already split during submission. But this may not be true due to a race between writeback vs fallocate. If extent in question is larger than requested we will split it again. Special precautions should being done if zeroout required because [map.m_lblk, map->m_len] already contains valid data. Signed-off-by: Dmitry Monakhov <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]> Cc: [email protected]
ext4_ext_new_meta_block(handle_t *handle, struct inode *inode, struct ext4_ext_path *path, struct ext4_extent *ex, int *err, unsigned int flags) { ext4_fsblk_t goal, newblock; goal = ext4_ext_find_goal(inode, path, le32_to_cpu(ex->ee_block)); newblock = ext4_new_meta_blocks(handle, inode, goal, flags, NULL, err); return newblock; }
ext4_ext_new_meta_block(handle_t *handle, struct inode *inode, struct ext4_ext_path *path, struct ext4_extent *ex, int *err, unsigned int flags) { ext4_fsblk_t goal, newblock; goal = ext4_ext_find_goal(inode, path, le32_to_cpu(ex->ee_block)); newblock = ext4_new_meta_blocks(handle, inode, goal, flags, NULL, err); return newblock; }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/59f5e0204cbc0e524b2687fb1beddda82047d16d
59f5e0204cbc0e524b2687fb1beddda82047d16d
AutoFill: Record whether the user initiated the form submission and don't save form data if the form was not user-submitted. BUG=48225 TEST=none Review URL: http://codereview.chromium.org/2842062 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53350 0039d316-1c4b-4281-b951-d872f2087c98
AutoFillManager::~AutoFillManager() { download_manager_.SetObserver(NULL); }
AutoFillManager::~AutoFillManager() { download_manager_.SetObserver(NULL); }
C
Chrome
0
CVE-2012-3552
https://www.cvedetails.com/cve/CVE-2012-3552/
CWE-362
https://github.com/torvalds/linux/commit/f6d8bd051c391c1c0458a30b2a7abcd939329259
f6d8bd051c391c1c0458a30b2a7abcd939329259
inet: add RCU protection to inet->opt We lack proper synchronization to manipulate inet->opt ip_options Problem is ip_make_skb() calls ip_setup_cork() and ip_setup_cork() possibly makes a copy of ipc->opt (struct ip_options), without any protection against another thread manipulating inet->opt. Another thread can change inet->opt pointer and free old one under us. Use RCU to protect inet->opt (changed to inet->inet_opt). Instead of handling atomic refcounts, just copy ip_options when necessary, to avoid cache line dirtying. We cant insert an rcu_head in struct ip_options since its included in skb->cb[], so this patch is large because I had to introduce a new ip_options_rcu structure. Signed-off-by: Eric Dumazet <[email protected]> Cc: Herbert Xu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, __be32 daddr, __be16 dport, int dif, struct udp_table *udptable) { struct sock *sk, *result; struct hlist_nulls_node *node; unsigned short hnum = ntohs(dport); unsigned int hash2, slot2, slot = udp_hashfn(net, hnum, udptable->mask); struct udp_hslot *hslot2, *hslot = &udptable->hash[slot]; int score, badness; rcu_read_lock(); if (hslot->count > 10) { hash2 = udp4_portaddr_hash(net, daddr, hnum); slot2 = hash2 & udptable->mask; hslot2 = &udptable->hash2[slot2]; if (hslot->count < hslot2->count) goto begin; result = udp4_lib_lookup2(net, saddr, sport, daddr, hnum, dif, hslot2, slot2); if (!result) { hash2 = udp4_portaddr_hash(net, htonl(INADDR_ANY), hnum); slot2 = hash2 & udptable->mask; hslot2 = &udptable->hash2[slot2]; if (hslot->count < hslot2->count) goto begin; result = udp4_lib_lookup2(net, saddr, sport, htonl(INADDR_ANY), hnum, dif, hslot2, slot2); } rcu_read_unlock(); return result; } begin: result = NULL; badness = -1; sk_nulls_for_each_rcu(sk, node, &hslot->head) { score = compute_score(sk, net, saddr, hnum, sport, daddr, dport, dif); if (score > badness) { result = sk; badness = score; } } /* * if the nulls value we got at the end of this lookup is * not the expected one, we must restart lookup. * We probably met an item that was moved to another chain. */ if (get_nulls_value(node) != slot) goto begin; if (result) { if (unlikely(!atomic_inc_not_zero_hint(&result->sk_refcnt, 2))) result = NULL; else if (unlikely(compute_score(result, net, saddr, hnum, sport, daddr, dport, dif) < badness)) { sock_put(result); goto begin; } } rcu_read_unlock(); return result; }
static struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, __be32 daddr, __be16 dport, int dif, struct udp_table *udptable) { struct sock *sk, *result; struct hlist_nulls_node *node; unsigned short hnum = ntohs(dport); unsigned int hash2, slot2, slot = udp_hashfn(net, hnum, udptable->mask); struct udp_hslot *hslot2, *hslot = &udptable->hash[slot]; int score, badness; rcu_read_lock(); if (hslot->count > 10) { hash2 = udp4_portaddr_hash(net, daddr, hnum); slot2 = hash2 & udptable->mask; hslot2 = &udptable->hash2[slot2]; if (hslot->count < hslot2->count) goto begin; result = udp4_lib_lookup2(net, saddr, sport, daddr, hnum, dif, hslot2, slot2); if (!result) { hash2 = udp4_portaddr_hash(net, htonl(INADDR_ANY), hnum); slot2 = hash2 & udptable->mask; hslot2 = &udptable->hash2[slot2]; if (hslot->count < hslot2->count) goto begin; result = udp4_lib_lookup2(net, saddr, sport, htonl(INADDR_ANY), hnum, dif, hslot2, slot2); } rcu_read_unlock(); return result; } begin: result = NULL; badness = -1; sk_nulls_for_each_rcu(sk, node, &hslot->head) { score = compute_score(sk, net, saddr, hnum, sport, daddr, dport, dif); if (score > badness) { result = sk; badness = score; } } /* * if the nulls value we got at the end of this lookup is * not the expected one, we must restart lookup. * We probably met an item that was moved to another chain. */ if (get_nulls_value(node) != slot) goto begin; if (result) { if (unlikely(!atomic_inc_not_zero_hint(&result->sk_refcnt, 2))) result = NULL; else if (unlikely(compute_score(result, net, saddr, hnum, sport, daddr, dport, dif) < badness)) { sock_put(result); goto begin; } } rcu_read_unlock(); return result; }
C
linux
0
CVE-2014-3181
https://www.cvedetails.com/cve/CVE-2014-3181/
CWE-119
https://github.com/torvalds/linux/commit/c54def7bd64d7c0b6993336abcffb8444795bf38
c54def7bd64d7c0b6993336abcffb8444795bf38
HID: magicmouse: sanity check report size in raw_event() callback The report passed to us from transport driver could potentially be arbitrarily large, therefore we better sanity-check it so that magicmouse_emit_touch() gets only valid values of raw_id. Cc: [email protected] Reported-by: Steven Vittitoe <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
static int magicmouse_raw_event(struct hid_device *hdev, struct hid_report *report, u8 *data, int size) { struct magicmouse_sc *msc = hid_get_drvdata(hdev); struct input_dev *input = msc->input; int x = 0, y = 0, ii, clicks = 0, npoints; switch (data[0]) { case TRACKPAD_REPORT_ID: /* Expect four bytes of prefix, and N*9 bytes of touch data. */ if (size < 4 || ((size - 4) % 9) != 0) return 0; npoints = (size - 4) / 9; if (npoints > 15) { hid_warn(hdev, "invalid size value (%d) for TRACKPAD_REPORT_ID\n", size); return 0; } msc->ntouches = 0; for (ii = 0; ii < npoints; ii++) magicmouse_emit_touch(msc, ii, data + ii * 9 + 4); clicks = data[1]; /* The following bits provide a device specific timestamp. They * are unused here. * * ts = data[1] >> 6 | data[2] << 2 | data[3] << 10; */ break; case MOUSE_REPORT_ID: /* Expect six bytes of prefix, and N*8 bytes of touch data. */ if (size < 6 || ((size - 6) % 8) != 0) return 0; npoints = (size - 6) / 8; if (npoints > 15) { hid_warn(hdev, "invalid size value (%d) for MOUSE_REPORT_ID\n", size); return 0; } msc->ntouches = 0; for (ii = 0; ii < npoints; ii++) magicmouse_emit_touch(msc, ii, data + ii * 8 + 6); /* When emulating three-button mode, it is important * to have the current touch information before * generating a click event. */ x = (int)(((data[3] & 0x0c) << 28) | (data[1] << 22)) >> 22; y = (int)(((data[3] & 0x30) << 26) | (data[2] << 22)) >> 22; clicks = data[3]; /* The following bits provide a device specific timestamp. They * are unused here. * * ts = data[3] >> 6 | data[4] << 2 | data[5] << 10; */ break; case DOUBLE_REPORT_ID: /* Sometimes the trackpad sends two touch reports in one * packet. */ magicmouse_raw_event(hdev, report, data + 2, data[1]); magicmouse_raw_event(hdev, report, data + 2 + data[1], size - 2 - data[1]); break; default: return 0; } if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) { magicmouse_emit_buttons(msc, clicks & 3); input_report_rel(input, REL_X, x); input_report_rel(input, REL_Y, y); } else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */ input_report_key(input, BTN_MOUSE, clicks & 1); input_mt_report_pointer_emulation(input, true); } input_sync(input); return 1; }
static int magicmouse_raw_event(struct hid_device *hdev, struct hid_report *report, u8 *data, int size) { struct magicmouse_sc *msc = hid_get_drvdata(hdev); struct input_dev *input = msc->input; int x = 0, y = 0, ii, clicks = 0, npoints; switch (data[0]) { case TRACKPAD_REPORT_ID: /* Expect four bytes of prefix, and N*9 bytes of touch data. */ if (size < 4 || ((size - 4) % 9) != 0) return 0; npoints = (size - 4) / 9; msc->ntouches = 0; for (ii = 0; ii < npoints; ii++) magicmouse_emit_touch(msc, ii, data + ii * 9 + 4); clicks = data[1]; /* The following bits provide a device specific timestamp. They * are unused here. * * ts = data[1] >> 6 | data[2] << 2 | data[3] << 10; */ break; case MOUSE_REPORT_ID: /* Expect six bytes of prefix, and N*8 bytes of touch data. */ if (size < 6 || ((size - 6) % 8) != 0) return 0; npoints = (size - 6) / 8; msc->ntouches = 0; for (ii = 0; ii < npoints; ii++) magicmouse_emit_touch(msc, ii, data + ii * 8 + 6); /* When emulating three-button mode, it is important * to have the current touch information before * generating a click event. */ x = (int)(((data[3] & 0x0c) << 28) | (data[1] << 22)) >> 22; y = (int)(((data[3] & 0x30) << 26) | (data[2] << 22)) >> 22; clicks = data[3]; /* The following bits provide a device specific timestamp. They * are unused here. * * ts = data[3] >> 6 | data[4] << 2 | data[5] << 10; */ break; case DOUBLE_REPORT_ID: /* Sometimes the trackpad sends two touch reports in one * packet. */ magicmouse_raw_event(hdev, report, data + 2, data[1]); magicmouse_raw_event(hdev, report, data + 2 + data[1], size - 2 - data[1]); break; default: return 0; } if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) { magicmouse_emit_buttons(msc, clicks & 3); input_report_rel(input, REL_X, x); input_report_rel(input, REL_Y, y); } else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */ input_report_key(input, BTN_MOUSE, clicks & 1); input_mt_report_pointer_emulation(input, true); } input_sync(input); return 1; }
C
linux
1
CVE-2015-1278
https://www.cvedetails.com/cve/CVE-2015-1278/
CWE-254
https://github.com/chromium/chromium/commit/784f56a9c97a838448dd23f9bdc7c05fe8e639b3
784f56a9c97a838448dd23f9bdc7c05fe8e639b3
Correctly reset FP in RFHI whenever origin changes Bug: 713364 Change-Id: Id8bb923750e20f3db6fc9358b1d44120513ac95f CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation Change-Id: Id8bb923750e20f3db6fc9358b1d44120513ac95f Reviewed-on: https://chromium-review.googlesource.com/482380 Commit-Queue: Ian Clelland <[email protected]> Reviewed-by: Charles Reis <[email protected]> Cr-Commit-Position: refs/heads/master@{#466778}
WebBluetoothServiceImpl* RenderFrameHostImpl::CreateWebBluetoothService( blink::mojom::WebBluetoothServiceRequest request) { auto web_bluetooth_service = base::MakeUnique<WebBluetoothServiceImpl>(this, std::move(request)); web_bluetooth_service->SetClientConnectionErrorHandler( base::Bind(&RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this), web_bluetooth_service.get())); web_bluetooth_services_.push_back(std::move(web_bluetooth_service)); return web_bluetooth_services_.back().get(); }
WebBluetoothServiceImpl* RenderFrameHostImpl::CreateWebBluetoothService( blink::mojom::WebBluetoothServiceRequest request) { auto web_bluetooth_service = base::MakeUnique<WebBluetoothServiceImpl>(this, std::move(request)); web_bluetooth_service->SetClientConnectionErrorHandler( base::Bind(&RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this), web_bluetooth_service.get())); web_bluetooth_services_.push_back(std::move(web_bluetooth_service)); return web_bluetooth_services_.back().get(); }
C
Chrome
0
CVE-2011-5327
https://www.cvedetails.com/cve/CVE-2011-5327/
CWE-119
https://github.com/torvalds/linux/commit/12f09ccb4612734a53e47ed5302e0479c10a50f8
12f09ccb4612734a53e47ed5302e0479c10a50f8
loopback: off by one in tcm_loop_make_naa_tpg() This is an off by one 'tgpt' check in tcm_loop_make_naa_tpg() that could result in memory corruption. Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Nicholas A. Bellinger <[email protected]>
static int __init tcm_loop_fabric_init(void) { int ret; tcm_loop_cmd_cache = kmem_cache_create("tcm_loop_cmd_cache", sizeof(struct tcm_loop_cmd), __alignof__(struct tcm_loop_cmd), 0, NULL); if (!tcm_loop_cmd_cache) { printk(KERN_ERR "kmem_cache_create() for" " tcm_loop_cmd_cache failed\n"); return -ENOMEM; } ret = tcm_loop_alloc_core_bus(); if (ret) return ret; ret = tcm_loop_register_configfs(); if (ret) { tcm_loop_release_core_bus(); return ret; } return 0; }
static int __init tcm_loop_fabric_init(void) { int ret; tcm_loop_cmd_cache = kmem_cache_create("tcm_loop_cmd_cache", sizeof(struct tcm_loop_cmd), __alignof__(struct tcm_loop_cmd), 0, NULL); if (!tcm_loop_cmd_cache) { printk(KERN_ERR "kmem_cache_create() for" " tcm_loop_cmd_cache failed\n"); return -ENOMEM; } ret = tcm_loop_alloc_core_bus(); if (ret) return ret; ret = tcm_loop_register_configfs(); if (ret) { tcm_loop_release_core_bus(); return ret; } return 0; }
C
linux
0
CVE-2013-7271
https://www.cvedetails.com/cve/CVE-2013-7271/
CWE-20
https://github.com/torvalds/linux/commit/f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
net: rework recvmsg handler msg_name and msg_namelen logic This patch now always passes msg->msg_namelen as 0. recvmsg handlers must set msg_namelen to the proper size <= sizeof(struct sockaddr_storage) to return msg_name to the user. This prevents numerous uninitialized memory leaks we had in the recvmsg handlers and makes it harder for new code to accidentally leak uninitialized memory. Optimize for the case recvfrom is called with NULL as address. We don't need to copy the address at all, so set it to NULL before invoking the recvmsg handler. We can do so, because all the recvmsg handlers must cope with the case a plain read() is called on them. read() also sets msg_name to NULL. Also document these changes in include/linux/net.h as suggested by David Miller. Changes since RFC: Set msg->msg_name = NULL if user specified a NULL in msg_name but had a non-null msg_namelen in verify_iovec/verify_compat_iovec. This doesn't affect sendto as it would bail out earlier while trying to copy-in the address. It also more naturally reflects the logic by the callers of verify_iovec. With this change in place I could remove " if (!uaddr || msg_sys->msg_namelen == 0) msg->msg_name = NULL ". This change does not alter the user visible error logic as we ignore msg_namelen as long as msg_name is NULL. Also remove two unnecessary curly brackets in ___sys_recvmsg and change comments to netdev style. Cc: David Miller <[email protected]> Suggested-by: Eric Dumazet <[email protected]> Signed-off-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static void *packet_previous_frame(struct packet_sock *po, struct packet_ring_buffer *rb, int status) { unsigned int previous = rb->head ? rb->head - 1 : rb->frame_max; return packet_lookup_frame(po, rb, previous, status); }
static void *packet_previous_frame(struct packet_sock *po, struct packet_ring_buffer *rb, int status) { unsigned int previous = rb->head ? rb->head - 1 : rb->frame_max; return packet_lookup_frame(po, rb, previous, status); }
C
linux
0
CVE-2013-7421
https://www.cvedetails.com/cve/CVE-2013-7421/
CWE-264
https://github.com/torvalds/linux/commit/5d26a105b5a73e5635eae0629b42fa0a90e07b7b
5d26a105b5a73e5635eae0629b42fa0a90e07b7b
crypto: prefix module autoloading with "crypto-" This prefixes all crypto module loading with "crypto-" so we never run the risk of exposing module auto-loading to userspace via a crypto API, as demonstrated by Mathias Krause: https://lkml.org/lkml/2013/3/4/70 Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
static int crc32c_cra_init(struct crypto_tfm *tfm) { struct chksum_ctx *mctx = crypto_tfm_ctx(tfm); mctx->key = ~0; return 0; }
static int crc32c_cra_init(struct crypto_tfm *tfm) { struct chksum_ctx *mctx = crypto_tfm_ctx(tfm); mctx->key = ~0; return 0; }
C
linux
0
CVE-2017-10662
https://www.cvedetails.com/cve/CVE-2017-10662/
null
https://github.com/torvalds/linux/commit/b9dd46188edc2f0d1f37328637860bb65a771124
b9dd46188edc2f0d1f37328637860bb65a771124
f2fs: sanity check segment count F2FS uses 4 bytes to represent block address. As a result, supported size of disk is 16 TB and it equals to 16 * 1024 * 1024 / 2 segments. Signed-off-by: Jin Qian <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
static int sanity_check_raw_super(struct f2fs_sb_info *sbi, struct buffer_head *bh) { struct f2fs_super_block *raw_super = (struct f2fs_super_block *) (bh->b_data + F2FS_SUPER_OFFSET); struct super_block *sb = sbi->sb; unsigned int blocksize; if (F2FS_SUPER_MAGIC != le32_to_cpu(raw_super->magic)) { f2fs_msg(sb, KERN_INFO, "Magic Mismatch, valid(0x%x) - read(0x%x)", F2FS_SUPER_MAGIC, le32_to_cpu(raw_super->magic)); return 1; } /* Currently, support only 4KB page cache size */ if (F2FS_BLKSIZE != PAGE_SIZE) { f2fs_msg(sb, KERN_INFO, "Invalid page_cache_size (%lu), supports only 4KB\n", PAGE_SIZE); return 1; } /* Currently, support only 4KB block size */ blocksize = 1 << le32_to_cpu(raw_super->log_blocksize); if (blocksize != F2FS_BLKSIZE) { f2fs_msg(sb, KERN_INFO, "Invalid blocksize (%u), supports only 4KB\n", blocksize); return 1; } /* check log blocks per segment */ if (le32_to_cpu(raw_super->log_blocks_per_seg) != 9) { f2fs_msg(sb, KERN_INFO, "Invalid log blocks per segment (%u)\n", le32_to_cpu(raw_super->log_blocks_per_seg)); return 1; } /* Currently, support 512/1024/2048/4096 bytes sector size */ if (le32_to_cpu(raw_super->log_sectorsize) > F2FS_MAX_LOG_SECTOR_SIZE || le32_to_cpu(raw_super->log_sectorsize) < F2FS_MIN_LOG_SECTOR_SIZE) { f2fs_msg(sb, KERN_INFO, "Invalid log sectorsize (%u)", le32_to_cpu(raw_super->log_sectorsize)); return 1; } if (le32_to_cpu(raw_super->log_sectors_per_block) + le32_to_cpu(raw_super->log_sectorsize) != F2FS_MAX_LOG_SECTOR_SIZE) { f2fs_msg(sb, KERN_INFO, "Invalid log sectors per block(%u) log sectorsize(%u)", le32_to_cpu(raw_super->log_sectors_per_block), le32_to_cpu(raw_super->log_sectorsize)); return 1; } /* check reserved ino info */ if (le32_to_cpu(raw_super->node_ino) != 1 || le32_to_cpu(raw_super->meta_ino) != 2 || le32_to_cpu(raw_super->root_ino) != 3) { f2fs_msg(sb, KERN_INFO, "Invalid Fs Meta Ino: node(%u) meta(%u) root(%u)", le32_to_cpu(raw_super->node_ino), le32_to_cpu(raw_super->meta_ino), le32_to_cpu(raw_super->root_ino)); return 1; } if (le32_to_cpu(raw_super->segment_count) > F2FS_MAX_SEGMENT) { f2fs_msg(sb, KERN_INFO, "Invalid segment count (%u)", le32_to_cpu(raw_super->segment_count)); return 1; } /* check CP/SIT/NAT/SSA/MAIN_AREA area boundary */ if (sanity_check_area_boundary(sbi, bh)) return 1; return 0; }
static int sanity_check_raw_super(struct f2fs_sb_info *sbi, struct buffer_head *bh) { struct f2fs_super_block *raw_super = (struct f2fs_super_block *) (bh->b_data + F2FS_SUPER_OFFSET); struct super_block *sb = sbi->sb; unsigned int blocksize; if (F2FS_SUPER_MAGIC != le32_to_cpu(raw_super->magic)) { f2fs_msg(sb, KERN_INFO, "Magic Mismatch, valid(0x%x) - read(0x%x)", F2FS_SUPER_MAGIC, le32_to_cpu(raw_super->magic)); return 1; } /* Currently, support only 4KB page cache size */ if (F2FS_BLKSIZE != PAGE_SIZE) { f2fs_msg(sb, KERN_INFO, "Invalid page_cache_size (%lu), supports only 4KB\n", PAGE_SIZE); return 1; } /* Currently, support only 4KB block size */ blocksize = 1 << le32_to_cpu(raw_super->log_blocksize); if (blocksize != F2FS_BLKSIZE) { f2fs_msg(sb, KERN_INFO, "Invalid blocksize (%u), supports only 4KB\n", blocksize); return 1; } /* check log blocks per segment */ if (le32_to_cpu(raw_super->log_blocks_per_seg) != 9) { f2fs_msg(sb, KERN_INFO, "Invalid log blocks per segment (%u)\n", le32_to_cpu(raw_super->log_blocks_per_seg)); return 1; } /* Currently, support 512/1024/2048/4096 bytes sector size */ if (le32_to_cpu(raw_super->log_sectorsize) > F2FS_MAX_LOG_SECTOR_SIZE || le32_to_cpu(raw_super->log_sectorsize) < F2FS_MIN_LOG_SECTOR_SIZE) { f2fs_msg(sb, KERN_INFO, "Invalid log sectorsize (%u)", le32_to_cpu(raw_super->log_sectorsize)); return 1; } if (le32_to_cpu(raw_super->log_sectors_per_block) + le32_to_cpu(raw_super->log_sectorsize) != F2FS_MAX_LOG_SECTOR_SIZE) { f2fs_msg(sb, KERN_INFO, "Invalid log sectors per block(%u) log sectorsize(%u)", le32_to_cpu(raw_super->log_sectors_per_block), le32_to_cpu(raw_super->log_sectorsize)); return 1; } /* check reserved ino info */ if (le32_to_cpu(raw_super->node_ino) != 1 || le32_to_cpu(raw_super->meta_ino) != 2 || le32_to_cpu(raw_super->root_ino) != 3) { f2fs_msg(sb, KERN_INFO, "Invalid Fs Meta Ino: node(%u) meta(%u) root(%u)", le32_to_cpu(raw_super->node_ino), le32_to_cpu(raw_super->meta_ino), le32_to_cpu(raw_super->root_ino)); return 1; } /* check CP/SIT/NAT/SSA/MAIN_AREA area boundary */ if (sanity_check_area_boundary(sbi, bh)) return 1; return 0; }
C
linux
1
CVE-2018-16427
https://www.cvedetails.com/cve/CVE-2018-16427/
CWE-125
https://github.com/OpenSC/OpenSC/pull/1447/commits/8fe377e93b4b56060e5bbfb6f3142ceaeca744fa
8fe377e93b4b56060e5bbfb6f3142ceaeca744fa
fixed out of bounds reads Thanks to Eric Sesterhenn from X41 D-SEC GmbH for reporting and suggesting security fixes.
gpk_verify_crycks(sc_card_t *card, sc_apdu_t *apdu, u8 *crycks) { if (apdu->resplen < 3 || memcmp(apdu->resp + apdu->resplen - 3, crycks, 3)) { sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "Invalid secure messaging reply\n"); return SC_ERROR_UNKNOWN_DATA_RECEIVED; } apdu->resplen -= 3; return 0; }
gpk_verify_crycks(sc_card_t *card, sc_apdu_t *apdu, u8 *crycks) { if (apdu->resplen < 3 || memcmp(apdu->resp + apdu->resplen - 3, crycks, 3)) { sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "Invalid secure messaging reply\n"); return SC_ERROR_UNKNOWN_DATA_RECEIVED; } apdu->resplen -= 3; return 0; }
C
OpenSC
0
null
null
null
https://github.com/chromium/chromium/commit/ea994548ed483e234a6fadd0cbdfa10d58b75cef
ea994548ed483e234a6fadd0cbdfa10d58b75cef
Fix integer overflow in software compositor Ensure that the size mapped from the renderer process for the software frame is not less than expected due to integer overflow. BUG=348332 Review URL: https://codereview.chromium.org/196283018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257417 0039d316-1c4b-4281-b951-d872f2087c98
uint32 SoftwareFrameManager::GetCurrentFrameOutputSurfaceId() const { DCHECK(HasCurrentFrame()); return current_frame_->output_surface_id_; }
uint32 SoftwareFrameManager::GetCurrentFrameOutputSurfaceId() const { DCHECK(HasCurrentFrame()); return current_frame_->output_surface_id_; }
C
Chrome
0
CVE-2015-1300
https://www.cvedetails.com/cve/CVE-2015-1300/
CWE-254
https://github.com/chromium/chromium/commit/9c391ac04f9ac478c8b0e43b359c2b43a6c892ab
9c391ac04f9ac478c8b0e43b359c2b43a6c892ab
Use pdf compositor service for printing when OOPIF is enabled When OOPIF is enabled (by site-per-process flag or top-document-isolation feature), use the pdf compositor service for converting PaintRecord to PDF on renderers. In the future, this will make compositing PDF from multiple renderers possible. [email protected] BUG=455764 Change-Id: I3c28f03f4358e4228239fe1a33384f85e7716e8f Reviewed-on: https://chromium-review.googlesource.com/699765 Commit-Queue: Wei Li <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Reviewed-by: Lei Zhang <[email protected]> Cr-Commit-Position: refs/heads/master@{#511616}
void PrintPreviewDialogController::RemovePreviewDialog( WebContents* preview_dialog) { WebContents* initiator = GetInitiator(preview_dialog); if (initiator) { RemoveObservers(initiator); PrintViewManager::FromWebContents(initiator)->PrintPreviewDone(); } preview_dialog_map_.erase(preview_dialog); RemoveObservers(preview_dialog); }
void PrintPreviewDialogController::RemovePreviewDialog( WebContents* preview_dialog) { WebContents* initiator = GetInitiator(preview_dialog); if (initiator) { RemoveObservers(initiator); PrintViewManager::FromWebContents(initiator)->PrintPreviewDone(); } preview_dialog_map_.erase(preview_dialog); RemoveObservers(preview_dialog); }
C
Chrome
0
CVE-2012-5534
https://www.cvedetails.com/cve/CVE-2012-5534/
CWE-20
https://git.savannah.gnu.org/gitweb/?p=weechat.git;a=commitdiff_plain;h=efb795c74fe954b9544074aafcebb1be4452b03a
efb795c74fe954b9544074aafcebb1be4452b03a
null
hook_process (struct t_weechat_plugin *plugin, const char *command, int timeout, t_hook_callback_process *callback, void *callback_data) { return hook_process_hashtable (plugin, command, NULL, timeout, callback, callback_data); }
hook_process (struct t_weechat_plugin *plugin, const char *command, int timeout, t_hook_callback_process *callback, void *callback_data) { return hook_process_hashtable (plugin, command, NULL, timeout, callback, callback_data); }
C
savannah
0
CVE-2018-11363
https://www.cvedetails.com/cve/CVE-2018-11363/
CWE-125
https://github.com/AndreRenaud/PDFGen/commit/ee58aff6918b8bbc3be29b9e3089485ea46ff956
ee58aff6918b8bbc3be29b9e3089485ea46ff956
jpeg: Fix another possible buffer overrun Found via the clang libfuzzer
static struct pdf_object *pdf_find_first_object(struct pdf_doc *pdf, int type) { return pdf->first_objects[type]; }
static struct pdf_object *pdf_find_first_object(struct pdf_doc *pdf, int type) { return pdf->first_objects[type]; }
C
PDFGen
0
CVE-2016-3951
https://www.cvedetails.com/cve/CVE-2016-3951/
null
https://github.com/torvalds/linux/commit/1666984c8625b3db19a9abc298931d35ab7bc64b
1666984c8625b3db19a9abc298931d35ab7bc64b
usbnet: cleanup after bind() in probe() In case bind() works, but a later error forces bailing in probe() in error cases work and a timer may be scheduled. They must be killed. This fixes an error case related to the double free reported in http://www.spinics.net/lists/netdev/msg367669.html and needs to go on top of Linus' fix to cdc-ncm. Signed-off-by: Oliver Neukum <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static void __usbnet_queue_skb(struct sk_buff_head *list, struct sk_buff *newsk, enum skb_state state) { struct skb_data *entry = (struct skb_data *) newsk->cb; __skb_queue_tail(list, newsk); entry->state = state; }
static void __usbnet_queue_skb(struct sk_buff_head *list, struct sk_buff *newsk, enum skb_state state) { struct skb_data *entry = (struct skb_data *) newsk->cb; __skb_queue_tail(list, newsk); entry->state = state; }
C
linux
0
CVE-2013-7010
https://www.cvedetails.com/cve/CVE-2013-7010/
CWE-189
https://github.com/FFmpeg/FFmpeg/commit/454a11a1c9c686c78aa97954306fb63453299760
454a11a1c9c686c78aa97954306fb63453299760
avcodec/dsputil: fix signedness in sizeof() comparissions Signed-off-by: Michael Niedermayer <[email protected]>
static int dct_max8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){ MpegEncContext * const s= (MpegEncContext *)c; LOCAL_ALIGNED_16(int16_t, temp, [64]); int sum=0, i; av_assert2(h==8); s->dsp.diff_pixels(temp, src1, src2, stride); s->dsp.fdct(temp); for(i=0; i<64; i++) sum= FFMAX(sum, FFABS(temp[i])); return sum; }
static int dct_max8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){ MpegEncContext * const s= (MpegEncContext *)c; LOCAL_ALIGNED_16(int16_t, temp, [64]); int sum=0, i; av_assert2(h==8); s->dsp.diff_pixels(temp, src1, src2, stride); s->dsp.fdct(temp); for(i=0; i<64; i++) sum= FFMAX(sum, FFABS(temp[i])); return sum; }
C
FFmpeg
0
CVE-2011-3897
https://www.cvedetails.com/cve/CVE-2011-3897/
CWE-399
https://github.com/chromium/chromium/commit/c7a90019bf7054145b11d2577b851cf2779d3d79
c7a90019bf7054145b11d2577b851cf2779d3d79
Fix print preview workflow to reflect settings of selected printer. BUG=95110 TEST=none Review URL: http://codereview.chromium.org/7831041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102242 0039d316-1c4b-4281-b951-d872f2087c98
void PrintDialogGtk::PrintDocument(const printing::Metafile* metafile, const string16& document_name) { DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); AddRef(); bool error = false; if (!file_util::CreateTemporaryFile(&path_to_pdf_)) { LOG(ERROR) << "Creating temporary file failed"; error = true; } if (!error && !metafile->SaveTo(path_to_pdf_)) { LOG(ERROR) << "Saving metafile failed"; file_util::Delete(path_to_pdf_, false); error = true; } if (error) { Release(); } else { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, NewRunnableMethod(this, &PrintDialogGtk::SendDocumentToPrinter, document_name)); } }
void PrintDialogGtk::PrintDocument(const printing::Metafile* metafile, const string16& document_name) { DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); AddRef(); bool error = false; if (!file_util::CreateTemporaryFile(&path_to_pdf_)) { LOG(ERROR) << "Creating temporary file failed"; error = true; } if (!error && !metafile->SaveTo(path_to_pdf_)) { LOG(ERROR) << "Saving metafile failed"; file_util::Delete(path_to_pdf_, false); error = true; } if (error) { Release(); } else { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, NewRunnableMethod(this, &PrintDialogGtk::SendDocumentToPrinter, document_name)); } }
C
Chrome
0
CVE-2013-0884
https://www.cvedetails.com/cve/CVE-2013-0884/
null
https://github.com/chromium/chromium/commit/4c39b8e5670c4a0f2bb06008502ebb0c4fe322e0
4c39b8e5670c4a0f2bb06008502ebb0c4fe322e0
[4/4] Process clearBrowserCahce/cookies commands in browser. BUG=366585 Review URL: https://codereview.chromium.org/251183005 git-svn-id: svn://svn.chromium.org/blink/trunk@172984 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void WebDevToolsAgentImpl::inspectElementAt(const WebPoint& point) { m_webViewImpl->inspectElementAt(point); }
void WebDevToolsAgentImpl::inspectElementAt(const WebPoint& point) { m_webViewImpl->inspectElementAt(point); }
C
Chrome
0
CVE-2018-16075
https://www.cvedetails.com/cve/CVE-2018-16075/
CWE-254
https://github.com/chromium/chromium/commit/d913f72b4875cf0814fc3f03ad7c00642097c4a4
d913f72b4875cf0814fc3f03ad7c00642097c4a4
Remove RequireCSSExtensionForFile runtime enabled flag. The feature has long since been stable (since M64) and doesn't seem to be a need for this flag. BUG=788936 Change-Id: I666390b869289c328acb4a2daa5bf4154e1702c0 Reviewed-on: https://chromium-review.googlesource.com/c/1324143 Reviewed-by: Mike West <[email protected]> Reviewed-by: Camille Lamy <[email protected]> Commit-Queue: Dave Tapuska <[email protected]> Cr-Commit-Position: refs/heads/master@{#607329}
void WebRuntimeFeatures::EnableOrientationEvent(bool enable) { RuntimeEnabledFeatures::SetOrientationEventEnabled(enable); }
void WebRuntimeFeatures::EnableOrientationEvent(bool enable) { RuntimeEnabledFeatures::SetOrientationEventEnabled(enable); }
C
Chrome
0
CVE-2017-7418
https://www.cvedetails.com/cve/CVE-2017-7418/
CWE-59
https://github.com/proftpd/proftpd/pull/444/commits/349addc3be4fcdad9bd4ec01ad1ccd916c898ed8
349addc3be4fcdad9bd4ec01ad1ccd916c898ed8
Walk the entire DefaultRoot path, checking for symlinks of any component, when AllowChrootSymlinks is disabled.
MODRET auth_pre_pass(cmd_rec *cmd) { const char *user; char *displaylogin; pr_auth_endpwent(cmd->tmp_pool); pr_auth_endgrent(cmd->tmp_pool); /* Handle cases where PASS might be sent before USER. */ user = pr_table_get(session.notes, "mod_auth.orig-user", NULL); if (user != NULL) { config_rec *c; c = find_config(main_server->conf, CONF_PARAM, "AllowEmptyPasswords", FALSE); if (c == NULL) { const char *anon_user; config_rec *anon_config; /* Since we have not authenticated yet, we cannot use the TOPLEVEL_CONF * macro to handle <Anonymous> sections. So we do it manually. */ anon_user = pstrdup(cmd->tmp_pool, user); anon_config = pr_auth_get_anon_config(cmd->tmp_pool, &anon_user, NULL, NULL); if (anon_config != NULL) { c = find_config(anon_config->subset, CONF_PARAM, "AllowEmptyPasswords", FALSE); } } if (c != NULL) { int allow_empty_passwords; allow_empty_passwords = *((int *) c->argv[0]); if (allow_empty_passwords == FALSE) { size_t passwd_len = 0; if (cmd->argc > 1) { if (cmd->arg != NULL) { passwd_len = strlen(cmd->arg); } } /* Make sure to NOT enforce 'AllowEmptyPasswords off' if e.g. * the AllowDotLogin TLSOption is in effect. */ if (cmd->argc == 1 || passwd_len == 0) { if (session.auth_mech == NULL || strcmp(session.auth_mech, "mod_tls.c") != 0) { pr_log_debug(DEBUG5, "Refusing empty password from user '%s' (AllowEmptyPasswords " "false)", user); pr_log_auth(PR_LOG_NOTICE, "Refusing empty password from user '%s'", user); pr_event_generate("mod_auth.empty-password", user); pr_response_add_err(R_501, _("Login incorrect.")); return PR_ERROR(cmd); } pr_log_debug(DEBUG9, "%s", "'AllowEmptyPasswords off' in effect, " "BUT client authenticated via the AllowDotLogin TLSOption"); } } } } /* Look for a DisplayLogin file which has an absolute path. If we find one, * open a filehandle, such that that file can be displayed even if the * session is chrooted. DisplayLogin files with relative paths will be * handled after chroot, preserving the old behavior. */ displaylogin = get_param_ptr(TOPLEVEL_CONF, "DisplayLogin", FALSE); if (displaylogin && *displaylogin == '/') { struct stat st; displaylogin_fh = pr_fsio_open(displaylogin, O_RDONLY); if (displaylogin_fh == NULL) { pr_log_debug(DEBUG6, "unable to open DisplayLogin file '%s': %s", displaylogin, strerror(errno)); } else { if (pr_fsio_fstat(displaylogin_fh, &st) < 0) { pr_log_debug(DEBUG6, "unable to stat DisplayLogin file '%s': %s", displaylogin, strerror(errno)); pr_fsio_close(displaylogin_fh); displaylogin_fh = NULL; } else { if (S_ISDIR(st.st_mode)) { errno = EISDIR; pr_log_debug(DEBUG6, "unable to use DisplayLogin file '%s': %s", displaylogin, strerror(errno)); pr_fsio_close(displaylogin_fh); displaylogin_fh = NULL; } } } } return PR_DECLINED(cmd); }
MODRET auth_pre_pass(cmd_rec *cmd) { const char *user; char *displaylogin; pr_auth_endpwent(cmd->tmp_pool); pr_auth_endgrent(cmd->tmp_pool); /* Handle cases where PASS might be sent before USER. */ user = pr_table_get(session.notes, "mod_auth.orig-user", NULL); if (user != NULL) { config_rec *c; c = find_config(main_server->conf, CONF_PARAM, "AllowEmptyPasswords", FALSE); if (c == NULL) { const char *anon_user; config_rec *anon_config; /* Since we have not authenticated yet, we cannot use the TOPLEVEL_CONF * macro to handle <Anonymous> sections. So we do it manually. */ anon_user = pstrdup(cmd->tmp_pool, user); anon_config = pr_auth_get_anon_config(cmd->tmp_pool, &anon_user, NULL, NULL); if (anon_config != NULL) { c = find_config(anon_config->subset, CONF_PARAM, "AllowEmptyPasswords", FALSE); } } if (c != NULL) { int allow_empty_passwords; allow_empty_passwords = *((int *) c->argv[0]); if (allow_empty_passwords == FALSE) { size_t passwd_len = 0; if (cmd->argc > 1) { if (cmd->arg != NULL) { passwd_len = strlen(cmd->arg); } } /* Make sure to NOT enforce 'AllowEmptyPasswords off' if e.g. * the AllowDotLogin TLSOption is in effect. */ if (cmd->argc == 1 || passwd_len == 0) { if (session.auth_mech == NULL || strcmp(session.auth_mech, "mod_tls.c") != 0) { pr_log_debug(DEBUG5, "Refusing empty password from user '%s' (AllowEmptyPasswords " "false)", user); pr_log_auth(PR_LOG_NOTICE, "Refusing empty password from user '%s'", user); pr_event_generate("mod_auth.empty-password", user); pr_response_add_err(R_501, _("Login incorrect.")); return PR_ERROR(cmd); } pr_log_debug(DEBUG9, "%s", "'AllowEmptyPasswords off' in effect, " "BUT client authenticated via the AllowDotLogin TLSOption"); } } } } /* Look for a DisplayLogin file which has an absolute path. If we find one, * open a filehandle, such that that file can be displayed even if the * session is chrooted. DisplayLogin files with relative paths will be * handled after chroot, preserving the old behavior. */ displaylogin = get_param_ptr(TOPLEVEL_CONF, "DisplayLogin", FALSE); if (displaylogin && *displaylogin == '/') { struct stat st; displaylogin_fh = pr_fsio_open(displaylogin, O_RDONLY); if (displaylogin_fh == NULL) { pr_log_debug(DEBUG6, "unable to open DisplayLogin file '%s': %s", displaylogin, strerror(errno)); } else { if (pr_fsio_fstat(displaylogin_fh, &st) < 0) { pr_log_debug(DEBUG6, "unable to stat DisplayLogin file '%s': %s", displaylogin, strerror(errno)); pr_fsio_close(displaylogin_fh); displaylogin_fh = NULL; } else { if (S_ISDIR(st.st_mode)) { errno = EISDIR; pr_log_debug(DEBUG6, "unable to use DisplayLogin file '%s': %s", displaylogin, strerror(errno)); pr_fsio_close(displaylogin_fh); displaylogin_fh = NULL; } } } } return PR_DECLINED(cmd); }
C
proftpd
0
CVE-2017-15128
https://www.cvedetails.com/cve/CVE-2017-15128/
CWE-119
https://github.com/torvalds/linux/commit/1e3921471354244f70fe268586ff94a97a6dd4df
1e3921471354244f70fe268586ff94a97a6dd4df
userfaultfd: hugetlbfs: prevent UFFDIO_COPY to fill beyond the end of i_size This oops: kernel BUG at fs/hugetlbfs/inode.c:484! RIP: remove_inode_hugepages+0x3d0/0x410 Call Trace: hugetlbfs_setattr+0xd9/0x130 notify_change+0x292/0x410 do_truncate+0x65/0xa0 do_sys_ftruncate.constprop.3+0x11a/0x180 SyS_ftruncate+0xe/0x10 tracesys+0xd9/0xde was caused by the lack of i_size check in hugetlb_mcopy_atomic_pte. mmap() can still succeed beyond the end of the i_size after vmtruncate zapped vmas in those ranges, but the faults must not succeed, and that includes UFFDIO_COPY. We could differentiate the retval to userland to represent a SIGBUS like a page fault would do (vs SIGSEGV), but it doesn't seem very useful and we'd need to pick a random retval as there's no meaningful syscall retval that would differentiate from SIGSEGV and SIGBUS, there's just -EFAULT. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Andrea Arcangeli <[email protected]> Reviewed-by: Mike Kravetz <[email protected]> Cc: Mike Rapoport <[email protected]> Cc: "Dr. David Alan Gilbert" <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
static struct page *alloc_fresh_gigantic_page_node(struct hstate *h, int nid) { struct page *page; page = alloc_gigantic_page(nid, h); if (page) { prep_compound_gigantic_page(page, huge_page_order(h)); prep_new_huge_page(h, page, nid); } return page; }
static struct page *alloc_fresh_gigantic_page_node(struct hstate *h, int nid) { struct page *page; page = alloc_gigantic_page(nid, h); if (page) { prep_compound_gigantic_page(page, huge_page_order(h)); prep_new_huge_page(h, page, nid); } return page; }
C
linux
0
CVE-2014-9644
https://www.cvedetails.com/cve/CVE-2014-9644/
CWE-264
https://github.com/torvalds/linux/commit/4943ba16bbc2db05115707b3ff7b4874e9e3c560
4943ba16bbc2db05115707b3ff7b4874e9e3c560
crypto: include crypto- module prefix in template This adds the module loading prefix "crypto-" to the template lookup as well. For example, attempting to load 'vfat(blowfish)' via AF_ALG now correctly includes the "crypto-" prefix at every level, correctly rejecting "vfat": net-pf-38 algif-hash crypto-vfat(blowfish) crypto-vfat(blowfish)-all crypto-vfat Reported-by: Mathias Krause <[email protected]> Signed-off-by: Kees Cook <[email protected]> Acked-by: Mathias Krause <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
static int cryptd_create_blkcipher(struct crypto_template *tmpl, struct rtattr **tb, struct cryptd_queue *queue) { struct cryptd_instance_ctx *ctx; struct crypto_instance *inst; struct crypto_alg *alg; int err; alg = crypto_get_attr_alg(tb, CRYPTO_ALG_TYPE_BLKCIPHER, CRYPTO_ALG_TYPE_MASK); if (IS_ERR(alg)) return PTR_ERR(alg); inst = cryptd_alloc_instance(alg, 0, sizeof(*ctx)); err = PTR_ERR(inst); if (IS_ERR(inst)) goto out_put_alg; ctx = crypto_instance_ctx(inst); ctx->queue = queue; err = crypto_init_spawn(&ctx->spawn, alg, inst, CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC); if (err) goto out_free_inst; inst->alg.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC; inst->alg.cra_type = &crypto_ablkcipher_type; inst->alg.cra_ablkcipher.ivsize = alg->cra_blkcipher.ivsize; inst->alg.cra_ablkcipher.min_keysize = alg->cra_blkcipher.min_keysize; inst->alg.cra_ablkcipher.max_keysize = alg->cra_blkcipher.max_keysize; inst->alg.cra_ablkcipher.geniv = alg->cra_blkcipher.geniv; inst->alg.cra_ctxsize = sizeof(struct cryptd_blkcipher_ctx); inst->alg.cra_init = cryptd_blkcipher_init_tfm; inst->alg.cra_exit = cryptd_blkcipher_exit_tfm; inst->alg.cra_ablkcipher.setkey = cryptd_blkcipher_setkey; inst->alg.cra_ablkcipher.encrypt = cryptd_blkcipher_encrypt_enqueue; inst->alg.cra_ablkcipher.decrypt = cryptd_blkcipher_decrypt_enqueue; err = crypto_register_instance(tmpl, inst); if (err) { crypto_drop_spawn(&ctx->spawn); out_free_inst: kfree(inst); } out_put_alg: crypto_mod_put(alg); return err; }
static int cryptd_create_blkcipher(struct crypto_template *tmpl, struct rtattr **tb, struct cryptd_queue *queue) { struct cryptd_instance_ctx *ctx; struct crypto_instance *inst; struct crypto_alg *alg; int err; alg = crypto_get_attr_alg(tb, CRYPTO_ALG_TYPE_BLKCIPHER, CRYPTO_ALG_TYPE_MASK); if (IS_ERR(alg)) return PTR_ERR(alg); inst = cryptd_alloc_instance(alg, 0, sizeof(*ctx)); err = PTR_ERR(inst); if (IS_ERR(inst)) goto out_put_alg; ctx = crypto_instance_ctx(inst); ctx->queue = queue; err = crypto_init_spawn(&ctx->spawn, alg, inst, CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC); if (err) goto out_free_inst; inst->alg.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC; inst->alg.cra_type = &crypto_ablkcipher_type; inst->alg.cra_ablkcipher.ivsize = alg->cra_blkcipher.ivsize; inst->alg.cra_ablkcipher.min_keysize = alg->cra_blkcipher.min_keysize; inst->alg.cra_ablkcipher.max_keysize = alg->cra_blkcipher.max_keysize; inst->alg.cra_ablkcipher.geniv = alg->cra_blkcipher.geniv; inst->alg.cra_ctxsize = sizeof(struct cryptd_blkcipher_ctx); inst->alg.cra_init = cryptd_blkcipher_init_tfm; inst->alg.cra_exit = cryptd_blkcipher_exit_tfm; inst->alg.cra_ablkcipher.setkey = cryptd_blkcipher_setkey; inst->alg.cra_ablkcipher.encrypt = cryptd_blkcipher_encrypt_enqueue; inst->alg.cra_ablkcipher.decrypt = cryptd_blkcipher_decrypt_enqueue; err = crypto_register_instance(tmpl, inst); if (err) { crypto_drop_spawn(&ctx->spawn); out_free_inst: kfree(inst); } out_put_alg: crypto_mod_put(alg); return err; }
C
linux
0
CVE-2011-1428
https://www.cvedetails.com/cve/CVE-2011-1428/
CWE-20
https://git.savannah.gnu.org/gitweb/?p=weechat.git;a=commit;h=c265cad1c95b84abfd4e8d861f25926ef13b5d91
c265cad1c95b84abfd4e8d861f25926ef13b5d91
null
irc_server_send (struct t_irc_server *server, const char *buffer, int size_buf) { int rc; if (!server) { weechat_printf (NULL, _("%s%s: sending data to server: null pointer (please " "report problem to developers)"), weechat_prefix ("error"), IRC_PLUGIN_NAME); return 0; } if (size_buf <= 0) { weechat_printf (server->buffer, _("%s%s: sending data to server: empty buffer (please " "report problem to developers)"), weechat_prefix ("error"), IRC_PLUGIN_NAME); return 0; } #ifdef HAVE_GNUTLS if (server->ssl_connected) rc = gnutls_record_send (server->gnutls_sess, buffer, size_buf); else #endif rc = send (server->sock, buffer, size_buf, 0); if (rc < 0) { #ifdef HAVE_GNUTLS if (server->ssl_connected) { weechat_printf (server->buffer, _("%s%s: sending data to server: %d %s"), weechat_prefix ("error"), IRC_PLUGIN_NAME, rc, gnutls_strerror (rc)); } else #endif { weechat_printf (server->buffer, _("%s%s: sending data to server: %d %s"), weechat_prefix ("error"), IRC_PLUGIN_NAME, errno, strerror (errno)); } } return rc; }
irc_server_send (struct t_irc_server *server, const char *buffer, int size_buf) { int rc; if (!server) { weechat_printf (NULL, _("%s%s: sending data to server: null pointer (please " "report problem to developers)"), weechat_prefix ("error"), IRC_PLUGIN_NAME); return 0; } if (size_buf <= 0) { weechat_printf (server->buffer, _("%s%s: sending data to server: empty buffer (please " "report problem to developers)"), weechat_prefix ("error"), IRC_PLUGIN_NAME); return 0; } #ifdef HAVE_GNUTLS if (server->ssl_connected) rc = gnutls_record_send (server->gnutls_sess, buffer, size_buf); else #endif rc = send (server->sock, buffer, size_buf, 0); if (rc < 0) { #ifdef HAVE_GNUTLS if (server->ssl_connected) { weechat_printf (server->buffer, _("%s%s: sending data to server: %d %s"), weechat_prefix ("error"), IRC_PLUGIN_NAME, rc, gnutls_strerror (rc)); } else #endif { weechat_printf (server->buffer, _("%s%s: sending data to server: %d %s"), weechat_prefix ("error"), IRC_PLUGIN_NAME, errno, strerror (errno)); } } return rc; }
C
savannah
0
CVE-2018-17470
https://www.cvedetails.com/cve/CVE-2018-17470/
CWE-119
https://github.com/chromium/chromium/commit/385508dc888ef15d272cdd2705b17996abc519d6
385508dc888ef15d272cdd2705b17996abc519d6
Implement immutable texture base/max level clamping It seems some drivers fail to handle that gracefully, so let's always clamp to be on the safe side. BUG=877874 TEST=test case in the bug, gpu_unittests [email protected] Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel Change-Id: I6d93cb9389ea70525df4604112223604577582a2 Reviewed-on: https://chromium-review.googlesource.com/1194994 Reviewed-by: Kenneth Russell <[email protected]> Commit-Queue: Zhenyao Mo <[email protected]> Cr-Commit-Position: refs/heads/master@{#587264}
void GLES2DecoderImpl::DoCopyTextureCHROMIUM( GLuint source_id, GLint source_level, GLenum dest_target, GLuint dest_id, GLint dest_level, GLenum internal_format, GLenum dest_type, GLboolean unpack_flip_y, GLboolean unpack_premultiply_alpha, GLboolean unpack_unmultiply_alpha) { TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopyTextureCHROMIUM"); static const char kFunctionName[] = "glCopyTextureCHROMIUM"; TextureRef* source_texture_ref = GetTexture(source_id); TextureRef* dest_texture_ref = GetTexture(dest_id); if (!ValidateCopyTextureCHROMIUMTextures( kFunctionName, dest_target, source_texture_ref, dest_texture_ref)) { return; } if (source_level < 0 || dest_level < 0 || (feature_info_->IsWebGL1OrES2Context() && source_level > 0)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "source_level or dest_level out of range"); return; } Texture* source_texture = source_texture_ref->texture(); Texture* dest_texture = dest_texture_ref->texture(); GLenum source_target = source_texture->target(); GLenum dest_binding_target = dest_texture->target(); GLenum source_type = 0; GLenum source_internal_format = 0; source_texture->GetLevelType(source_target, source_level, &source_type, &source_internal_format); GLenum format = TextureManager::ExtractFormatFromStorageFormat(internal_format); if (!texture_manager()->ValidateTextureParameters( GetErrorState(), kFunctionName, true, format, dest_type, internal_format, dest_level)) { return; } std::string output_error_msg; if (!ValidateCopyTextureCHROMIUMInternalFormats( GetFeatureInfo(), source_internal_format, internal_format, &output_error_msg)) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, output_error_msg.c_str()); return; } if (feature_info_->feature_flags().desktop_srgb_support) { bool enable_framebuffer_srgb = GLES2Util::GetColorEncodingFromInternalFormat(source_internal_format) == GL_SRGB || GLES2Util::GetColorEncodingFromInternalFormat(internal_format) == GL_SRGB; state_.EnableDisableFramebufferSRGB(enable_framebuffer_srgb); } int source_width = 0; int source_height = 0; gl::GLImage* image = source_texture->GetLevelImage(source_target, source_level); if (image) { gfx::Size size = image->GetSize(); source_width = size.width(); source_height = size.height(); if (source_width <= 0 || source_height <= 0) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "invalid image size"); return; } } else { if (!source_texture->GetLevelSize(source_target, source_level, &source_width, &source_height, nullptr)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "source texture has no data for level"); return; } if (!texture_manager()->ValidForTarget(source_target, source_level, source_width, source_height, 1)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "Bad dimensions"); return; } } if (dest_texture->IsImmutable()) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, "texture is immutable"); return; } if (!texture_manager()->ClearTextureLevel(this, source_texture_ref, source_target, source_level)) { LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, kFunctionName, "dimensions too big"); return; } if (!InitializeCopyTextureCHROMIUM(kFunctionName)) return; GLenum dest_type_previous = dest_type; GLenum dest_internal_format = internal_format; int dest_width = 0; int dest_height = 0; bool dest_level_defined = dest_texture->GetLevelSize( dest_target, dest_level, &dest_width, &dest_height, nullptr); if (dest_level_defined) { dest_texture->GetLevelType(dest_target, dest_level, &dest_type_previous, &dest_internal_format); } if (!dest_level_defined || dest_width != source_width || dest_height != source_height || dest_internal_format != internal_format || dest_type_previous != dest_type) { LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(kFunctionName); api()->glBindTextureFn(dest_binding_target, dest_texture->service_id()); ScopedPixelUnpackState reset_restore(&state_); api()->glTexImage2DFn( dest_target, dest_level, TextureManager::AdjustTexInternalFormat(feature_info_.get(), internal_format), source_width, source_height, 0, TextureManager::AdjustTexFormat(feature_info_.get(), format), dest_type, nullptr); GLenum error = LOCAL_PEEK_GL_ERROR(kFunctionName); if (error != GL_NO_ERROR) { RestoreCurrentTextureBindings(&state_, dest_binding_target, state_.active_texture_unit); return; } texture_manager()->SetLevelInfo(dest_texture_ref, dest_target, dest_level, internal_format, source_width, source_height, 1, 0, format, dest_type, gfx::Rect(source_width, source_height)); dest_texture->ApplyFormatWorkarounds(feature_info_.get()); } else { texture_manager()->SetLevelCleared(dest_texture_ref, dest_target, dest_level, true); } bool unpack_premultiply_alpha_change = (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; if (image && internal_format == source_internal_format && dest_level == 0 && !unpack_flip_y && !unpack_premultiply_alpha_change) { api()->glBindTextureFn(dest_binding_target, dest_texture->service_id()); if (image->CopyTexImage(dest_target)) return; } DoBindOrCopyTexImageIfNeeded(source_texture, source_target, 0); if (source_target == GL_TEXTURE_EXTERNAL_OES) { if (GLStreamTextureImage* image = source_texture->GetLevelStreamTextureImage(GL_TEXTURE_EXTERNAL_OES, source_level)) { GLfloat transform_matrix[16]; image->GetTextureMatrix(transform_matrix); copy_texture_chromium_->DoCopyTextureWithTransform( this, source_target, source_texture->service_id(), source_level, source_internal_format, dest_target, dest_texture->service_id(), dest_level, internal_format, source_width, source_height, unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, unpack_unmultiply_alpha == GL_TRUE, false /* dither */, transform_matrix, copy_tex_image_blit_.get()); return; } } CopyTextureMethod method = GetCopyTextureCHROMIUMMethod( GetFeatureInfo(), source_target, source_level, source_internal_format, source_type, dest_binding_target, dest_level, internal_format, unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, unpack_unmultiply_alpha == GL_TRUE, false /* dither */); copy_texture_chromium_->DoCopyTexture( this, source_target, source_texture->service_id(), source_level, source_internal_format, dest_target, dest_texture->service_id(), dest_level, internal_format, source_width, source_height, unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, unpack_unmultiply_alpha == GL_TRUE, false /* dither */, method, copy_tex_image_blit_.get()); }
void GLES2DecoderImpl::DoCopyTextureCHROMIUM( GLuint source_id, GLint source_level, GLenum dest_target, GLuint dest_id, GLint dest_level, GLenum internal_format, GLenum dest_type, GLboolean unpack_flip_y, GLboolean unpack_premultiply_alpha, GLboolean unpack_unmultiply_alpha) { TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopyTextureCHROMIUM"); static const char kFunctionName[] = "glCopyTextureCHROMIUM"; TextureRef* source_texture_ref = GetTexture(source_id); TextureRef* dest_texture_ref = GetTexture(dest_id); if (!ValidateCopyTextureCHROMIUMTextures( kFunctionName, dest_target, source_texture_ref, dest_texture_ref)) { return; } if (source_level < 0 || dest_level < 0 || (feature_info_->IsWebGL1OrES2Context() && source_level > 0)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "source_level or dest_level out of range"); return; } Texture* source_texture = source_texture_ref->texture(); Texture* dest_texture = dest_texture_ref->texture(); GLenum source_target = source_texture->target(); GLenum dest_binding_target = dest_texture->target(); GLenum source_type = 0; GLenum source_internal_format = 0; source_texture->GetLevelType(source_target, source_level, &source_type, &source_internal_format); GLenum format = TextureManager::ExtractFormatFromStorageFormat(internal_format); if (!texture_manager()->ValidateTextureParameters( GetErrorState(), kFunctionName, true, format, dest_type, internal_format, dest_level)) { return; } std::string output_error_msg; if (!ValidateCopyTextureCHROMIUMInternalFormats( GetFeatureInfo(), source_internal_format, internal_format, &output_error_msg)) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, output_error_msg.c_str()); return; } if (feature_info_->feature_flags().desktop_srgb_support) { bool enable_framebuffer_srgb = GLES2Util::GetColorEncodingFromInternalFormat(source_internal_format) == GL_SRGB || GLES2Util::GetColorEncodingFromInternalFormat(internal_format) == GL_SRGB; state_.EnableDisableFramebufferSRGB(enable_framebuffer_srgb); } int source_width = 0; int source_height = 0; gl::GLImage* image = source_texture->GetLevelImage(source_target, source_level); if (image) { gfx::Size size = image->GetSize(); source_width = size.width(); source_height = size.height(); if (source_width <= 0 || source_height <= 0) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "invalid image size"); return; } } else { if (!source_texture->GetLevelSize(source_target, source_level, &source_width, &source_height, nullptr)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "source texture has no data for level"); return; } if (!texture_manager()->ValidForTarget(source_target, source_level, source_width, source_height, 1)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "Bad dimensions"); return; } } if (dest_texture->IsImmutable()) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, "texture is immutable"); return; } if (!texture_manager()->ClearTextureLevel(this, source_texture_ref, source_target, source_level)) { LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, kFunctionName, "dimensions too big"); return; } if (!InitializeCopyTextureCHROMIUM(kFunctionName)) return; GLenum dest_type_previous = dest_type; GLenum dest_internal_format = internal_format; int dest_width = 0; int dest_height = 0; bool dest_level_defined = dest_texture->GetLevelSize( dest_target, dest_level, &dest_width, &dest_height, nullptr); if (dest_level_defined) { dest_texture->GetLevelType(dest_target, dest_level, &dest_type_previous, &dest_internal_format); } if (!dest_level_defined || dest_width != source_width || dest_height != source_height || dest_internal_format != internal_format || dest_type_previous != dest_type) { LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(kFunctionName); api()->glBindTextureFn(dest_binding_target, dest_texture->service_id()); ScopedPixelUnpackState reset_restore(&state_); api()->glTexImage2DFn( dest_target, dest_level, TextureManager::AdjustTexInternalFormat(feature_info_.get(), internal_format), source_width, source_height, 0, TextureManager::AdjustTexFormat(feature_info_.get(), format), dest_type, nullptr); GLenum error = LOCAL_PEEK_GL_ERROR(kFunctionName); if (error != GL_NO_ERROR) { RestoreCurrentTextureBindings(&state_, dest_binding_target, state_.active_texture_unit); return; } texture_manager()->SetLevelInfo(dest_texture_ref, dest_target, dest_level, internal_format, source_width, source_height, 1, 0, format, dest_type, gfx::Rect(source_width, source_height)); dest_texture->ApplyFormatWorkarounds(feature_info_.get()); } else { texture_manager()->SetLevelCleared(dest_texture_ref, dest_target, dest_level, true); } bool unpack_premultiply_alpha_change = (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; if (image && internal_format == source_internal_format && dest_level == 0 && !unpack_flip_y && !unpack_premultiply_alpha_change) { api()->glBindTextureFn(dest_binding_target, dest_texture->service_id()); if (image->CopyTexImage(dest_target)) return; } DoBindOrCopyTexImageIfNeeded(source_texture, source_target, 0); if (source_target == GL_TEXTURE_EXTERNAL_OES) { if (GLStreamTextureImage* image = source_texture->GetLevelStreamTextureImage(GL_TEXTURE_EXTERNAL_OES, source_level)) { GLfloat transform_matrix[16]; image->GetTextureMatrix(transform_matrix); copy_texture_chromium_->DoCopyTextureWithTransform( this, source_target, source_texture->service_id(), source_level, source_internal_format, dest_target, dest_texture->service_id(), dest_level, internal_format, source_width, source_height, unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, unpack_unmultiply_alpha == GL_TRUE, false /* dither */, transform_matrix, copy_tex_image_blit_.get()); return; } } CopyTextureMethod method = GetCopyTextureCHROMIUMMethod( GetFeatureInfo(), source_target, source_level, source_internal_format, source_type, dest_binding_target, dest_level, internal_format, unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, unpack_unmultiply_alpha == GL_TRUE, false /* dither */); copy_texture_chromium_->DoCopyTexture( this, source_target, source_texture->service_id(), source_level, source_internal_format, dest_target, dest_texture->service_id(), dest_level, internal_format, source_width, source_height, unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, unpack_unmultiply_alpha == GL_TRUE, false /* dither */, method, copy_tex_image_blit_.get()); }
C
Chrome
0
CVE-2018-20784
https://www.cvedetails.com/cve/CVE-2018-20784/
CWE-400
https://github.com/torvalds/linux/commit/c40f7d74c741a907cfaeb73a7697081881c497d0
c40f7d74c741a907cfaeb73a7697081881c497d0
sched/fair: Fix infinite loop in update_blocked_averages() by reverting a9e7f6544b9c Zhipeng Xie, Xie XiuQi and Sargun Dhillon reported lockups in the scheduler under high loads, starting at around the v4.18 time frame, and Zhipeng Xie tracked it down to bugs in the rq->leaf_cfs_rq_list manipulation. Do a (manual) revert of: a9e7f6544b9c ("sched/fair: Fix O(nr_cgroups) in load balance path") It turns out that the list_del_leaf_cfs_rq() introduced by this commit is a surprising property that was not considered in followup commits such as: 9c2791f936ef ("sched/fair: Fix hierarchical order in rq->leaf_cfs_rq_list") As Vincent Guittot explains: "I think that there is a bigger problem with commit a9e7f6544b9c and cfs_rq throttling: Let take the example of the following topology TG2 --> TG1 --> root: 1) The 1st time a task is enqueued, we will add TG2 cfs_rq then TG1 cfs_rq to leaf_cfs_rq_list and we are sure to do the whole branch in one path because it has never been used and can't be throttled so tmp_alone_branch will point to leaf_cfs_rq_list at the end. 2) Then TG1 is throttled 3) and we add TG3 as a new child of TG1. 4) The 1st enqueue of a task on TG3 will add TG3 cfs_rq just before TG1 cfs_rq and tmp_alone_branch will stay on rq->leaf_cfs_rq_list. With commit a9e7f6544b9c, we can del a cfs_rq from rq->leaf_cfs_rq_list. So if the load of TG1 cfs_rq becomes NULL before step 2) above, TG1 cfs_rq is removed from the list. Then at step 4), TG3 cfs_rq is added at the beginning of rq->leaf_cfs_rq_list but tmp_alone_branch still points to TG3 cfs_rq because its throttled parent can't be enqueued when the lock is released. tmp_alone_branch doesn't point to rq->leaf_cfs_rq_list whereas it should. So if TG3 cfs_rq is removed or destroyed before tmp_alone_branch points on another TG cfs_rq, the next TG cfs_rq that will be added, will be linked outside rq->leaf_cfs_rq_list - which is bad. In addition, we can break the ordering of the cfs_rq in rq->leaf_cfs_rq_list but this ordering is used to update and propagate the update from leaf down to root." Instead of trying to work through all these cases and trying to reproduce the very high loads that produced the lockup to begin with, simplify the code temporarily by reverting a9e7f6544b9c - which change was clearly not thought through completely. This (hopefully) gives us a kernel that doesn't lock up so people can continue to enjoy their holidays without worrying about regressions. ;-) [ mingo: Wrote changelog, fixed weird spelling in code comment while at it. ] Analyzed-by: Xie XiuQi <[email protected]> Analyzed-by: Vincent Guittot <[email protected]> Reported-by: Zhipeng Xie <[email protected]> Reported-by: Sargun Dhillon <[email protected]> Reported-by: Xie XiuQi <[email protected]> Tested-by: Zhipeng Xie <[email protected]> Tested-by: Sargun Dhillon <[email protected]> Signed-off-by: Linus Torvalds <[email protected]> Acked-by: Vincent Guittot <[email protected]> Cc: <[email protected]> # v4.13+ Cc: Bin Li <[email protected]> Cc: Mike Galbraith <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Tejun Heo <[email protected]> Cc: Thomas Gleixner <[email protected]> Fixes: a9e7f6544b9c ("sched/fair: Fix O(nr_cgroups) in load balance path") Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
static inline int sg_imbalanced(struct sched_group *group) { return group->sgc->imbalance; }
static inline int sg_imbalanced(struct sched_group *group) { return group->sgc->imbalance; }
C
linux
0
CVE-2013-7026
https://www.cvedetails.com/cve/CVE-2013-7026/
CWE-362
https://github.com/torvalds/linux/commit/a399b29dfbaaaf91162b2dc5a5875dd51bbfa2a1
a399b29dfbaaaf91162b2dc5a5875dd51bbfa2a1
ipc,shm: fix shm_file deletion races When IPC_RMID races with other shm operations there's potential for use-after-free of the shm object's associated file (shm_file). Here's the race before this patch: TASK 1 TASK 2 ------ ------ shm_rmid() ipc_lock_object() shmctl() shp = shm_obtain_object_check() shm_destroy() shum_unlock() fput(shp->shm_file) ipc_lock_object() shmem_lock(shp->shm_file) <OOPS> The oops is caused because shm_destroy() calls fput() after dropping the ipc_lock. fput() clears the file's f_inode, f_path.dentry, and f_path.mnt, which causes various NULL pointer references in task 2. I reliably see the oops in task 2 if with shmlock, shmu This patch fixes the races by: 1) set shm_file=NULL in shm_destroy() while holding ipc_object_lock(). 2) modify at risk operations to check shm_file while holding ipc_object_lock(). Example workloads, which each trigger oops... Workload 1: while true; do id=$(shmget 1 4096) shm_rmid $id & shmlock $id & wait done The oops stack shows accessing NULL f_inode due to racing fput: _raw_spin_lock shmem_lock SyS_shmctl Workload 2: while true; do id=$(shmget 1 4096) shmat $id 4096 & shm_rmid $id & wait done The oops stack is similar to workload 1 due to NULL f_inode: touch_atime shmem_mmap shm_mmap mmap_region do_mmap_pgoff do_shmat SyS_shmat Workload 3: while true; do id=$(shmget 1 4096) shmlock $id shm_rmid $id & shmunlock $id & wait done The oops stack shows second fput tripping on an NULL f_inode. The first fput() completed via from shm_destroy(), but a racing thread did a get_file() and queued this fput(): locks_remove_flock __fput ____fput task_work_run do_notify_resume int_signal Fixes: c2c737a0461e ("ipc,shm: shorten critical region for shmat") Fixes: 2caacaa82a51 ("ipc,shm: shorten critical region for shmctl") Signed-off-by: Greg Thelen <[email protected]> Cc: Davidlohr Bueso <[email protected]> Cc: Rik van Riel <[email protected]> Cc: Manfred Spraul <[email protected]> Cc: <[email protected]> # 3.10.17+ 3.11.6+ Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
static inline struct shmid_kernel *shm_obtain_object_check(struct ipc_namespace *ns, int id) { struct kern_ipc_perm *ipcp = ipc_obtain_object_check(&shm_ids(ns), id); if (IS_ERR(ipcp)) return ERR_CAST(ipcp); return container_of(ipcp, struct shmid_kernel, shm_perm); }
static inline struct shmid_kernel *shm_obtain_object_check(struct ipc_namespace *ns, int id) { struct kern_ipc_perm *ipcp = ipc_obtain_object_check(&shm_ids(ns), id); if (IS_ERR(ipcp)) return ERR_CAST(ipcp); return container_of(ipcp, struct shmid_kernel, shm_perm); }
C
linux
0
CVE-2017-8064
https://www.cvedetails.com/cve/CVE-2017-8064/
CWE-119
https://github.com/torvalds/linux/commit/005145378c9ad7575a01b6ce1ba118fb427f583a
005145378c9ad7575a01b6ce1ba118fb427f583a
[media] dvb-usb-v2: avoid use-after-free I ran into a stack frame size warning because of the on-stack copy of the USB device structure: drivers/media/usb/dvb-usb-v2/dvb_usb_core.c: In function 'dvb_usbv2_disconnect': drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:1029:1: error: the frame size of 1104 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] Copying a device structure like this is wrong for a number of other reasons too aside from the possible stack overflow. One of them is that the dev_info() call will print the name of the device later, but AFAICT we have only copied a pointer to the name earlier and the actual name has been freed by the time it gets printed. This removes the on-stack copy of the device and instead copies the device name using kstrdup(). I'm ignoring the possible failure here as both printk() and kfree() are able to deal with NULL pointers. Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
static int dvb_usbv2_adapter_dvb_exit(struct dvb_usb_adapter *adap) { dev_dbg(&adap_to_d(adap)->udev->dev, "%s: adap=%d\n", __func__, adap->id); if (adap->dvb_adap.priv) { dvb_net_release(&adap->dvb_net); adap->demux.dmx.close(&adap->demux.dmx); dvb_dmxdev_release(&adap->dmxdev); dvb_dmx_release(&adap->demux); dvb_unregister_adapter(&adap->dvb_adap); } return 0; }
static int dvb_usbv2_adapter_dvb_exit(struct dvb_usb_adapter *adap) { dev_dbg(&adap_to_d(adap)->udev->dev, "%s: adap=%d\n", __func__, adap->id); if (adap->dvb_adap.priv) { dvb_net_release(&adap->dvb_net); adap->demux.dmx.close(&adap->demux.dmx); dvb_dmxdev_release(&adap->dmxdev); dvb_dmx_release(&adap->demux); dvb_unregister_adapter(&adap->dvb_adap); } return 0; }
C
linux
0
CVE-2019-17351
https://www.cvedetails.com/cve/CVE-2019-17351/
CWE-400
https://github.com/torvalds/linux/commit/6ef36ab967c71690ebe7e5ef997a8be4da3bc844
6ef36ab967c71690ebe7e5ef997a8be4da3bc844
xen: let alloc_xenballooned_pages() fail if not enough memory free commit a1078e821b605813b63bf6bca414a85f804d5c66 upstream. Instead of trying to allocate pages with GFP_USER in add_ballooned_pages() check the available free memory via si_mem_available(). GFP_USER is far less limiting memory exhaustion than the test via si_mem_available(). This will avoid dom0 running out of memory due to excessive foreign page mappings especially on ARM and on x86 in PVH mode, as those don't have a pre-ballooned area which can be used for foreign mappings. As the normal ballooning suffers from the same problem don't balloon down more than si_mem_available() pages in one iteration. At the same time limit the default maximum number of retries. This is part of XSA-300. Signed-off-by: Juergen Gross <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
static void release_memory_resource(struct resource *resource) { if (!resource) return; /* * No need to reset region to identity mapped since we now * know that no I/O can be in this region */ release_resource(resource); kfree(resource); }
static void release_memory_resource(struct resource *resource) { if (!resource) return; /* * No need to reset region to identity mapped since we now * know that no I/O can be in this region */ release_resource(resource); kfree(resource); }
C
linux
0
CVE-2012-5139
https://www.cvedetails.com/cve/CVE-2012-5139/
CWE-416
https://github.com/chromium/chromium/commit/9e417dae2833230a651989bb4e56b835355dda39
9e417dae2833230a651989bb4e56b835355dda39
Tests were marked as Flaky. BUG=151811,151810 [email protected],[email protected] NOTRY=true Review URL: https://chromiumcodereview.appspot.com/10968052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@158204 0039d316-1c4b-4281-b951-d872f2087c98
static std::string redirect_headers() { return URLRequestTestJob::test_redirect_headers(); }
static std::string redirect_headers() { return URLRequestTestJob::test_redirect_headers(); }
C
Chrome
0
CVE-2013-7421
https://www.cvedetails.com/cve/CVE-2013-7421/
CWE-264
https://github.com/torvalds/linux/commit/5d26a105b5a73e5635eae0629b42fa0a90e07b7b
5d26a105b5a73e5635eae0629b42fa0a90e07b7b
crypto: prefix module autoloading with "crypto-" This prefixes all crypto module loading with "crypto-" so we never run the risk of exposing module auto-loading to userspace via a crypto API, as demonstrated by Mathias Krause: https://lkml.org/lkml/2013/3/4/70 Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
static int lzo_init(struct crypto_tfm *tfm) { struct lzo_ctx *ctx = crypto_tfm_ctx(tfm); ctx->lzo_comp_mem = kmalloc(LZO1X_MEM_COMPRESS, GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT); if (!ctx->lzo_comp_mem) ctx->lzo_comp_mem = vmalloc(LZO1X_MEM_COMPRESS); if (!ctx->lzo_comp_mem) return -ENOMEM; return 0; }
static int lzo_init(struct crypto_tfm *tfm) { struct lzo_ctx *ctx = crypto_tfm_ctx(tfm); ctx->lzo_comp_mem = kmalloc(LZO1X_MEM_COMPRESS, GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT); if (!ctx->lzo_comp_mem) ctx->lzo_comp_mem = vmalloc(LZO1X_MEM_COMPRESS); if (!ctx->lzo_comp_mem) return -ENOMEM; return 0; }
C
linux
0
CVE-2012-6538
https://www.cvedetails.com/cve/CVE-2012-6538/
CWE-200
https://github.com/torvalds/linux/commit/4c87308bdea31a7b4828a51f6156e6f721a1fcc9
4c87308bdea31a7b4828a51f6156e6f721a1fcc9
xfrm_user: fix info leak in copy_to_user_auth() copy_to_user_auth() fails to initialize the remainder of alg_name and therefore discloses up to 54 bytes of heap memory via netlink to userland. Use strncpy() instead of strcpy() to fill the trailing bytes of alg_name with null bytes. Signed-off-by: Mathias Krause <[email protected]> Acked-by: Steffen Klassert <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static int copy_to_user_auth(struct xfrm_algo_auth *auth, struct sk_buff *skb) { struct xfrm_algo *algo; struct nlattr *nla; nla = nla_reserve(skb, XFRMA_ALG_AUTH, sizeof(*algo) + (auth->alg_key_len + 7) / 8); if (!nla) return -EMSGSIZE; algo = nla_data(nla); strncpy(algo->alg_name, auth->alg_name, sizeof(algo->alg_name)); memcpy(algo->alg_key, auth->alg_key, (auth->alg_key_len + 7) / 8); algo->alg_key_len = auth->alg_key_len; return 0; }
static int copy_to_user_auth(struct xfrm_algo_auth *auth, struct sk_buff *skb) { struct xfrm_algo *algo; struct nlattr *nla; nla = nla_reserve(skb, XFRMA_ALG_AUTH, sizeof(*algo) + (auth->alg_key_len + 7) / 8); if (!nla) return -EMSGSIZE; algo = nla_data(nla); strcpy(algo->alg_name, auth->alg_name); memcpy(algo->alg_key, auth->alg_key, (auth->alg_key_len + 7) / 8); algo->alg_key_len = auth->alg_key_len; return 0; }
C
linux
1
CVE-2018-1000040
https://www.cvedetails.com/cve/CVE-2018-1000040/
CWE-20
http://git.ghostscript.com/?p=mupdf.git;a=commitdiff;h=83d4dae44c71816c084a635550acc1a51529b881;hp=f597300439e62f5e921f0d7b1e880b5c1a1f1607
83d4dae44c71816c084a635550acc1a51529b881
null
fz_keep_colorspace(fz_context *ctx, fz_colorspace *cs) { return fz_keep_key_storable(ctx, &cs->key_storable); }
fz_keep_colorspace(fz_context *ctx, fz_colorspace *cs) { return fz_keep_key_storable(ctx, &cs->key_storable); }
C
ghostscript
0
CVE-2018-1000050
https://www.cvedetails.com/cve/CVE-2018-1000050/
CWE-119
https://github.com/nothings/stb/commit/244d83bc3d859293f55812d48b3db168e581f6ab
244d83bc3d859293f55812d48b3db168e581f6ab
fix unchecked length in stb_vorbis that could crash on corrupt/invalid files
int stb_vorbis_seek_start(stb_vorbis *f) { if (IS_PUSH_MODE(f)) { return error(f, VORBIS_invalid_api_mixing); } set_file_offset(f, f->first_audio_page_offset); f->previous_length = 0; f->first_decode = TRUE; f->next_seg = -1; return vorbis_pump_first_frame(f); }
int stb_vorbis_seek_start(stb_vorbis *f) { if (IS_PUSH_MODE(f)) { return error(f, VORBIS_invalid_api_mixing); } set_file_offset(f, f->first_audio_page_offset); f->previous_length = 0; f->first_decode = TRUE; f->next_seg = -1; return vorbis_pump_first_frame(f); }
C
stb
0
CVE-2013-6644
https://www.cvedetails.com/cve/CVE-2013-6644/
null
https://github.com/chromium/chromium/commit/db93178bcaaf7e99ebb18bd51fa99b2feaf47e1f
db93178bcaaf7e99ebb18bd51fa99b2feaf47e1f
[Extensions] Add GetInstalledExtension() method to ExtensionRegistry This CL adds GetInstalledExtension() method to ExtensionRegistry and uses it instead of deprecated ExtensionService::GetInstalledExtension() in chrome/browser/ui/app_list/. Part of removing the deprecated GetInstalledExtension() call from the ExtensionService. BUG=489687 Review URL: https://codereview.chromium.org/1130353010 Cr-Commit-Position: refs/heads/master@{#333036}
AppListSyncableService::~AppListSyncableService() { model_observer_.reset(); model_pref_updater_.reset(); STLDeleteContainerPairSecondPointers(sync_items_.begin(), sync_items_.end()); }
AppListSyncableService::~AppListSyncableService() { model_observer_.reset(); model_pref_updater_.reset(); STLDeleteContainerPairSecondPointers(sync_items_.begin(), sync_items_.end()); }
C
Chrome
0
CVE-2015-1300
https://www.cvedetails.com/cve/CVE-2015-1300/
CWE-254
https://github.com/chromium/chromium/commit/9c391ac04f9ac478c8b0e43b359c2b43a6c892ab
9c391ac04f9ac478c8b0e43b359c2b43a6c892ab
Use pdf compositor service for printing when OOPIF is enabled When OOPIF is enabled (by site-per-process flag or top-document-isolation feature), use the pdf compositor service for converting PaintRecord to PDF on renderers. In the future, this will make compositing PDF from multiple renderers possible. [email protected] BUG=455764 Change-Id: I3c28f03f4358e4228239fe1a33384f85e7716e8f Reviewed-on: https://chromium-review.googlesource.com/699765 Commit-Queue: Wei Li <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Reviewed-by: Lei Zhang <[email protected]> Cr-Commit-Position: refs/heads/master@{#511616}
~PendingFrame() {}
~PendingFrame() {}
C
Chrome
0
CVE-2016-5194
null
null
https://github.com/chromium/chromium/commit/d4e0a7273cd8d7a9ee667ad5b5c8aad0f5f59251
d4e0a7273cd8d7a9ee667ad5b5c8aad0f5f59251
Clear Shill stub config in offline file manager tests The Shill stub client fakes ethernet and wifi connections during testing. Clear its config during offline tests to simulate a lack of network connectivity. As a side effect, fileManagerPrivate.getDriveConnectionState will no longer need to be stubbed out, as it will now think the device is offline and return the appropriate result. Bug: 925272 Change-Id: Idd6cb44325cfde4991d3b1e64185a28e8655c733 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1578149 Commit-Queue: Austin Tankiang <[email protected]> Reviewed-by: Sam McNally <[email protected]> Cr-Commit-Position: refs/heads/master@{#654782}
static bool ConvertJSONValue(const base::DictionaryValue& value, AddEntriesMessage* message) { base::JSONValueConverter<AddEntriesMessage> converter; return converter.Convert(value, message); }
static bool ConvertJSONValue(const base::DictionaryValue& value, AddEntriesMessage* message) { base::JSONValueConverter<AddEntriesMessage> converter; return converter.Convert(value, message); }
C
Chrome
0
CVE-2015-0291
https://www.cvedetails.com/cve/CVE-2015-0291/
null
https://git.openssl.org/?p=openssl.git;a=commit;h=76343947ada960b6269090638f5391068daee88d
76343947ada960b6269090638f5391068daee88d
null
int tls12_check_peer_sigalg(const EVP_MD **pmd, SSL *s, const unsigned char *sig, EVP_PKEY *pkey) { const unsigned char *sent_sigs; size_t sent_sigslen, i; int sigalg = tls12_get_sigid(pkey); /* Should never happen */ if (sigalg == -1) return -1; /* Check key type is consistent with signature */ if (sigalg != (int)sig[1]) { SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_WRONG_SIGNATURE_TYPE); return 0; } # ifndef OPENSSL_NO_EC if (pkey->type == EVP_PKEY_EC) { unsigned char curve_id[2], comp_id; /* Check compression and curve matches extensions */ if (!tls1_set_ec_id(curve_id, &comp_id, pkey->pkey.ec)) return 0; if (!s->server && !tls1_check_ec_key(s, curve_id, &comp_id)) { SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_WRONG_CURVE); return 0; } /* If Suite B only P-384+SHA384 or P-256+SHA-256 allowed */ if (tls1_suiteb(s)) { if (curve_id[0]) return 0; if (curve_id[1] == TLSEXT_curve_P_256) { if (sig[0] != TLSEXT_hash_sha256) { SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_ILLEGAL_SUITEB_DIGEST); return 0; } } else if (curve_id[1] == TLSEXT_curve_P_384) { if (sig[0] != TLSEXT_hash_sha384) { SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_ILLEGAL_SUITEB_DIGEST); return 0; } } else return 0; } } else if (tls1_suiteb(s)) return 0; # endif /* Check signature matches a type we sent */ sent_sigslen = tls12_get_psigalgs(s, &sent_sigs); for (i = 0; i < sent_sigslen; i += 2, sent_sigs += 2) { if (sig[0] == sent_sigs[0] && sig[1] == sent_sigs[1]) break; } /* Allow fallback to SHA1 if not strict mode */ if (i == sent_sigslen && (sig[0] != TLSEXT_hash_sha1 || s->cert->cert_flags & SSL_CERT_FLAGS_CHECK_TLS_STRICT)) { SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_WRONG_SIGNATURE_TYPE); return 0; } *pmd = tls12_get_hash(sig[0]); if (*pmd == NULL) { SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_UNKNOWN_DIGEST); return 0; } /* * Store the digest used so applications can retrieve it if they wish. */ if (s->session && s->session->sess_cert) s->session->sess_cert->peer_key->digest = *pmd; return 1; }
int tls12_check_peer_sigalg(const EVP_MD **pmd, SSL *s, const unsigned char *sig, EVP_PKEY *pkey) { const unsigned char *sent_sigs; size_t sent_sigslen, i; int sigalg = tls12_get_sigid(pkey); /* Should never happen */ if (sigalg == -1) return -1; /* Check key type is consistent with signature */ if (sigalg != (int)sig[1]) { SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_WRONG_SIGNATURE_TYPE); return 0; } # ifndef OPENSSL_NO_EC if (pkey->type == EVP_PKEY_EC) { unsigned char curve_id[2], comp_id; /* Check compression and curve matches extensions */ if (!tls1_set_ec_id(curve_id, &comp_id, pkey->pkey.ec)) return 0; if (!s->server && !tls1_check_ec_key(s, curve_id, &comp_id)) { SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_WRONG_CURVE); return 0; } /* If Suite B only P-384+SHA384 or P-256+SHA-256 allowed */ if (tls1_suiteb(s)) { if (curve_id[0]) return 0; if (curve_id[1] == TLSEXT_curve_P_256) { if (sig[0] != TLSEXT_hash_sha256) { SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_ILLEGAL_SUITEB_DIGEST); return 0; } } else if (curve_id[1] == TLSEXT_curve_P_384) { if (sig[0] != TLSEXT_hash_sha384) { SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_ILLEGAL_SUITEB_DIGEST); return 0; } } else return 0; } } else if (tls1_suiteb(s)) return 0; # endif /* Check signature matches a type we sent */ sent_sigslen = tls12_get_psigalgs(s, &sent_sigs); for (i = 0; i < sent_sigslen; i += 2, sent_sigs += 2) { if (sig[0] == sent_sigs[0] && sig[1] == sent_sigs[1]) break; } /* Allow fallback to SHA1 if not strict mode */ if (i == sent_sigslen && (sig[0] != TLSEXT_hash_sha1 || s->cert->cert_flags & SSL_CERT_FLAGS_CHECK_TLS_STRICT)) { SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_WRONG_SIGNATURE_TYPE); return 0; } *pmd = tls12_get_hash(sig[0]); if (*pmd == NULL) { SSLerr(SSL_F_TLS12_CHECK_PEER_SIGALG, SSL_R_UNKNOWN_DIGEST); return 0; } /* * Store the digest used so applications can retrieve it if they wish. */ if (s->session && s->session->sess_cert) s->session->sess_cert->peer_key->digest = *pmd; return 1; }
C
openssl
0
CVE-2014-4503
https://www.cvedetails.com/cve/CVE-2014-4503/
CWE-20
https://github.com/sgminer-dev/sgminer/commit/910c36089940e81fb85c65b8e63dcd2fac71470c
910c36089940e81fb85c65b8e63dcd2fac71470c
stratum: parse_notify(): Don't die on malformed bbversion/prev_hash/nbit/ntime. Might have introduced a memory leak, don't have time to check. :( Should the other hex2bin()'s be checked? Thanks to Mick Ayzenberg <mick.dejavusecurity.com> for finding this.
bool hex2bin(unsigned char *p, const char *hexstr, size_t len) { int nibble1, nibble2; unsigned char idx; bool ret = false; while (*hexstr && len) { if (unlikely(!hexstr[1])) { applog(LOG_ERR, "hex2bin str truncated"); return ret; } idx = *hexstr++; nibble1 = hex2bin_tbl[idx]; idx = *hexstr++; nibble2 = hex2bin_tbl[idx]; if (unlikely((nibble1 < 0) || (nibble2 < 0))) { applog(LOG_ERR, "hex2bin scan failed"); return ret; } *p++ = (((unsigned char)nibble1) << 4) | ((unsigned char)nibble2); --len; } if (likely(len == 0 && *hexstr == 0)) ret = true; return ret; }
bool hex2bin(unsigned char *p, const char *hexstr, size_t len) { int nibble1, nibble2; unsigned char idx; bool ret = false; while (*hexstr && len) { if (unlikely(!hexstr[1])) { applog(LOG_ERR, "hex2bin str truncated"); return ret; } idx = *hexstr++; nibble1 = hex2bin_tbl[idx]; idx = *hexstr++; nibble2 = hex2bin_tbl[idx]; if (unlikely((nibble1 < 0) || (nibble2 < 0))) { applog(LOG_ERR, "hex2bin scan failed"); return ret; } *p++ = (((unsigned char)nibble1) << 4) | ((unsigned char)nibble2); --len; } if (likely(len == 0 && *hexstr == 0)) ret = true; return ret; }
C
sgminer
0
CVE-2016-7418
https://www.cvedetails.com/cve/CVE-2016-7418/
CWE-119
https://github.com/php/php-src/commit/c4cca4c20e75359c9a13a1f9a36cb7b4e9601d29?w=1
c4cca4c20e75359c9a13a1f9a36cb7b4e9601d29?w=1
Fix bug #73065: Out-Of-Bounds Read in php_wddx_push_element of wddx.c
void php_wddx_destructor(wddx_packet *packet) { smart_str_free(packet); efree(packet); }
void php_wddx_destructor(wddx_packet *packet) { smart_str_free(packet); efree(packet); }
C
php-src
0
CVE-2016-10746
https://www.cvedetails.com/cve/CVE-2016-10746/
CWE-254
https://github.com/libvirt/libvirt/commit/506e9d6c2d4baaf580d489fff0690c0ff2ff588f
506e9d6c2d4baaf580d489fff0690c0ff2ff588f
virDomainGetTime: Deny on RO connections We have a policy that if API may end up talking to a guest agent it should require RW connection. We don't obey the rule in virDomainGetTime(). Signed-off-by: Michal Privoznik <[email protected]>
virDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid) { VIR_UUID_DEBUG(conn, uuid); virResetLastError(); virCheckConnectReturn(conn, NULL); virCheckNonNullArgGoto(uuid, error); if (conn->driver->domainLookupByUUID) { virDomainPtr ret; ret = conn->driver->domainLookupByUUID(conn, uuid); if (!ret) goto error; return ret; } virReportUnsupportedError(); error: virDispatchError(conn); return NULL; }
virDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid) { VIR_UUID_DEBUG(conn, uuid); virResetLastError(); virCheckConnectReturn(conn, NULL); virCheckNonNullArgGoto(uuid, error); if (conn->driver->domainLookupByUUID) { virDomainPtr ret; ret = conn->driver->domainLookupByUUID(conn, uuid); if (!ret) goto error; return ret; } virReportUnsupportedError(); error: virDispatchError(conn); return NULL; }
C
libvirt
0
CVE-2013-6623
https://www.cvedetails.com/cve/CVE-2013-6623/
CWE-119
https://github.com/chromium/chromium/commit/9fd9d629fcf836bb0d6210015d33a299cf6bca34
9fd9d629fcf836bb0d6210015d33a299cf6bca34
Make the policy fetch for first time login blocking The CL makes policy fetching for first time login blocking for all users, except the ones that are known to be non-enterprise users. BUG=334584 Review URL: https://codereview.chromium.org/330843002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282925 0039d316-1c4b-4281-b951-d872f2087c98
void UserCloudPolicyManagerChromeOS::CancelWaitForPolicyFetch() { if (!wait_for_policy_fetch_) return; wait_for_policy_fetch_ = false; policy_fetch_timeout_.Stop(); CheckAndPublishPolicy(); StartRefreshSchedulerIfReady(); }
void UserCloudPolicyManagerChromeOS::CancelWaitForPolicyFetch() { if (!wait_for_policy_fetch_) return; wait_for_policy_fetch_ = false; policy_fetch_timeout_.Stop(); CheckAndPublishPolicy(); StartRefreshSchedulerIfReady(); }
C
Chrome
0
CVE-2016-1586
https://www.cvedetails.com/cve/CVE-2016-1586/
CWE-20
https://git.launchpad.net/oxide/commit/?id=29014da83e5fc358d6bff0f574e9ed45e61a35ac
29014da83e5fc358d6bff0f574e9ed45e61a35ac
null
scoped_refptr<BrowserContextDelegate> BrowserContextIOData::GetDelegate() { BrowserContextSharedIOData& data = GetSharedData(); base::AutoLock lock(data.lock); return data.delegate; }
scoped_refptr<BrowserContextDelegate> BrowserContextIOData::GetDelegate() { BrowserContextSharedIOData& data = GetSharedData(); base::AutoLock lock(data.lock); return data.delegate; }
CPP
launchpad
0
CVE-2013-0885
https://www.cvedetails.com/cve/CVE-2013-0885/
CWE-264
https://github.com/chromium/chromium/commit/f335421145bb7f82c60fb9d61babcd6ce2e4b21e
f335421145bb7f82c60fb9d61babcd6ce2e4b21e
Tighten restrictions on hosted apps calling extension APIs Only allow component apps to make any API calls, and for them only allow the namespaces they explicitly have permission for (plus chrome.test - I need to see if I can rework some WebStore tests to remove even this). BUG=172369 Review URL: https://chromiumcodereview.appspot.com/12095095 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180426 0039d316-1c4b-4281-b951-d872f2087c98
scoped_refptr<Extension> Extension::Create(const FilePath& path, Manifest::Location location, const DictionaryValue& value, int flags, std::string* utf8_error) { return Extension::Create(path, location, value, flags, std::string(), // ID is ignored if empty. utf8_error); }
scoped_refptr<Extension> Extension::Create(const FilePath& path, Manifest::Location location, const DictionaryValue& value, int flags, std::string* utf8_error) { return Extension::Create(path, location, value, flags, std::string(), // ID is ignored if empty. utf8_error); }
C
Chrome
0
CVE-2016-1678
https://www.cvedetails.com/cve/CVE-2016-1678/
CWE-119
https://github.com/chromium/chromium/commit/1f5ad409dbf5334523931df37598ea49e9849c87
1f5ad409dbf5334523931df37598ea49e9849c87
Allow origin lock for WebUI pages. Returning true for WebUI pages in DoesSiteRequireDedicatedProcess helps to keep enforcing a SiteInstance swap during chrome://foo -> chrome://bar navigation, even after relaxing BrowsingInstance::GetSiteInstanceForURL to consider RPH::IsSuitableHost (see https://crrev.com/c/783470 for that fixes process sharing in isolated(b(c),d(c)) scenario). I've manually tested this CL by visiting the following URLs: - chrome://welcome/ - chrome://settings - chrome://extensions - chrome://history - chrome://help and chrome://chrome (both redirect to chrome://settings/help) Bug: 510588, 847127 Change-Id: I55073bce00f32cb8bc5c1c91034438ff9a3f8971 Reviewed-on: https://chromium-review.googlesource.com/1237392 Commit-Queue: Łukasz Anforowicz <[email protected]> Reviewed-by: François Doray <[email protected]> Reviewed-by: Nasko Oskov <[email protected]> Reviewed-by: Avi Drissman <[email protected]> Cr-Commit-Position: refs/heads/master@{#595259}
bool SiteInstanceImpl::DoesSiteRequireDedicatedProcess( BrowserContext* browser_context, const GURL& url) { if (SiteIsolationPolicy::UseDedicatedProcessesForAllSites()) return true; // Always require a dedicated process for isolated origins. GURL site_url = SiteInstance::GetSiteForURL(browser_context, url); auto* policy = ChildProcessSecurityPolicyImpl::GetInstance(); if (policy->IsIsolatedOrigin(url::Origin::Create(site_url))) return true; if (site_url.SchemeIs(kChromeErrorScheme)) return true; // Isolate kChromeUIScheme pages from one another and from other kinds of // schemes. if (site_url.SchemeIs(content::kChromeUIScheme)) return true; if (GetContentClient()->browser()->DoesSiteRequireDedicatedProcess( browser_context, site_url)) { return true; } return false; }
bool SiteInstanceImpl::DoesSiteRequireDedicatedProcess( BrowserContext* browser_context, const GURL& url) { if (SiteIsolationPolicy::UseDedicatedProcessesForAllSites()) return true; if (url.SchemeIs(kChromeErrorScheme)) return true; GURL site_url = SiteInstance::GetSiteForURL(browser_context, url); auto* policy = ChildProcessSecurityPolicyImpl::GetInstance(); if (policy->IsIsolatedOrigin(url::Origin::Create(site_url))) return true; if (GetContentClient()->browser()->DoesSiteRequireDedicatedProcess( browser_context, site_url)) { return true; } return false; }
C
Chrome
1
CVE-2014-3647
https://www.cvedetails.com/cve/CVE-2014-3647/
CWE-264
https://github.com/torvalds/linux/commit/234f3ce485d54017f15cf5e0699cff4100121601
234f3ce485d54017f15cf5e0699cff4100121601
KVM: x86: Emulator fixes for eip canonical checks on near branches Before changing rip (during jmp, call, ret, etc.) the target should be asserted to be canonical one, as real CPUs do. During sysret, both target rsp and rip should be canonical. If any of these values is noncanonical, a #GP exception should occur. The exception to this rule are syscall and sysenter instructions in which the assigned rip is checked during the assignment to the relevant MSRs. This patch fixes the emulator to behave as real CPUs do for near branches. Far branches are handled by the next patch. This fixes CVE-2014-3647. Cc: [email protected] Signed-off-by: Nadav Amit <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
static int em_call(struct x86_emulate_ctxt *ctxt) { int rc; long rel = ctxt->src.val; ctxt->src.val = (unsigned long)ctxt->_eip; rc = jmp_rel(ctxt, rel); if (rc != X86EMUL_CONTINUE) return rc; return em_push(ctxt); }
static int em_call(struct x86_emulate_ctxt *ctxt) { long rel = ctxt->src.val; ctxt->src.val = (unsigned long)ctxt->_eip; jmp_rel(ctxt, rel); return em_push(ctxt); }
C
linux
1
null
null
null
https://github.com/chromium/chromium/commit/dc3857aac17be72c96f28d860d875235b3be349a
dc3857aac17be72c96f28d860d875235b3be349a
Unreviewed, rolling out r142736. http://trac.webkit.org/changeset/142736 https://bugs.webkit.org/show_bug.cgi?id=109716 Broke ABI, nightly builds crash on launch (Requested by ap on #webkit). Patch by Sheriff Bot <[email protected]> on 2013-02-13 Source/WebKit2: * Shared/APIClientTraits.cpp: (WebKit): * Shared/APIClientTraits.h: * UIProcess/API/C/WKPage.h: * UIProcess/API/gtk/WebKitLoaderClient.cpp: (attachLoaderClientToView): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: * WebProcess/qt/QtBuiltinBundlePage.cpp: (WebKit::QtBuiltinBundlePage::QtBuiltinBundlePage): Tools: * MiniBrowser/mac/WK2BrowserWindowController.m: (-[WK2BrowserWindowController awakeFromNib]): * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: (WTR::InjectedBundlePage::InjectedBundlePage): * WebKitTestRunner/TestController.cpp: (WTR::TestController::createWebViewWithOptions): git-svn-id: svn://svn.chromium.org/blink/trunk@142762 bbb929c8-8fbe-4397-9dbb-9b2b20218538
static inline bool isLocalFileScheme(WKStringRef scheme) { return WKStringIsEqualToUTF8CStringIgnoringCase(scheme, "file"); }
static inline bool isLocalFileScheme(WKStringRef scheme) { return WKStringIsEqualToUTF8CStringIgnoringCase(scheme, "file"); }
C
Chrome
0
CVE-2013-1767
https://www.cvedetails.com/cve/CVE-2013-1767/
CWE-399
https://github.com/torvalds/linux/commit/5f00110f7273f9ff04ac69a5f85bb535a4fd0987
5f00110f7273f9ff04ac69a5f85bb535a4fd0987
tmpfs: fix use-after-free of mempolicy object The tmpfs remount logic preserves filesystem mempolicy if the mpol=M option is not specified in the remount request. A new policy can be specified if mpol=M is given. Before this patch remounting an mpol bound tmpfs without specifying mpol= mount option in the remount request would set the filesystem's mempolicy object to a freed mempolicy object. To reproduce the problem boot a DEBUG_PAGEALLOC kernel and run: # mkdir /tmp/x # mount -t tmpfs -o size=100M,mpol=interleave nodev /tmp/x # grep /tmp/x /proc/mounts nodev /tmp/x tmpfs rw,relatime,size=102400k,mpol=interleave:0-3 0 0 # mount -o remount,size=200M nodev /tmp/x # grep /tmp/x /proc/mounts nodev /tmp/x tmpfs rw,relatime,size=204800k,mpol=??? 0 0 # note ? garbage in mpol=... output above # dd if=/dev/zero of=/tmp/x/f count=1 # panic here Panic: BUG: unable to handle kernel NULL pointer dereference at (null) IP: [< (null)>] (null) [...] Oops: 0010 [#1] SMP DEBUG_PAGEALLOC Call Trace: mpol_shared_policy_init+0xa5/0x160 shmem_get_inode+0x209/0x270 shmem_mknod+0x3e/0xf0 shmem_create+0x18/0x20 vfs_create+0xb5/0x130 do_last+0x9a1/0xea0 path_openat+0xb3/0x4d0 do_filp_open+0x42/0xa0 do_sys_open+0xfe/0x1e0 compat_sys_open+0x1b/0x20 cstar_dispatch+0x7/0x1f Non-debug kernels will not crash immediately because referencing the dangling mpol will not cause a fault. Instead the filesystem will reference a freed mempolicy object, which will cause unpredictable behavior. The problem boils down to a dropped mpol reference below if shmem_parse_options() does not allocate a new mpol: config = *sbinfo shmem_parse_options(data, &config, true) mpol_put(sbinfo->mpol) sbinfo->mpol = config.mpol /* BUG: saves unreferenced mpol */ This patch avoids the crash by not releasing the mempolicy if shmem_parse_options() doesn't create a new mpol. How far back does this issue go? I see it in both 2.6.36 and 3.3. I did not look back further. Signed-off-by: Greg Thelen <[email protected]> Acked-by: Hugh Dickins <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
static int shmem_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry) { struct inode *inode = old_dentry->d_inode; int they_are_dirs = S_ISDIR(inode->i_mode); if (!simple_empty(new_dentry)) return -ENOTEMPTY; if (new_dentry->d_inode) { (void) shmem_unlink(new_dir, new_dentry); if (they_are_dirs) drop_nlink(old_dir); } else if (they_are_dirs) { drop_nlink(old_dir); inc_nlink(new_dir); } old_dir->i_size -= BOGO_DIRENT_SIZE; new_dir->i_size += BOGO_DIRENT_SIZE; old_dir->i_ctime = old_dir->i_mtime = new_dir->i_ctime = new_dir->i_mtime = inode->i_ctime = CURRENT_TIME; return 0; }
static int shmem_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry) { struct inode *inode = old_dentry->d_inode; int they_are_dirs = S_ISDIR(inode->i_mode); if (!simple_empty(new_dentry)) return -ENOTEMPTY; if (new_dentry->d_inode) { (void) shmem_unlink(new_dir, new_dentry); if (they_are_dirs) drop_nlink(old_dir); } else if (they_are_dirs) { drop_nlink(old_dir); inc_nlink(new_dir); } old_dir->i_size -= BOGO_DIRENT_SIZE; new_dir->i_size += BOGO_DIRENT_SIZE; old_dir->i_ctime = old_dir->i_mtime = new_dir->i_ctime = new_dir->i_mtime = inode->i_ctime = CURRENT_TIME; return 0; }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/dfd28b1909358445e838fb0fdf3995c77a420aa8
dfd28b1909358445e838fb0fdf3995c77a420aa8
Refactor ScrollableShelf on |space_for_icons_| |space_for_icons_| indicates the available space in scrollable shelf to accommodate shelf icons. Now it is an integer type. Replace it with gfx::Rect. Bug: 997807 Change-Id: I4f9ba3206bd69dfdaf50894de46239e676db6454 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1801326 Commit-Queue: Andrew Xu <[email protected]> Reviewed-by: Manu Cornet <[email protected]> Reviewed-by: Xiyuan Xia <[email protected]> Cr-Commit-Position: refs/heads/master@{#696446}
void ScrollableShelfView::Layout() { const bool is_horizontal = GetShelf()->IsHorizontalAlignment(); const int adjusted_length = (is_horizontal ? width() : height()) - 2 * ShelfConfig::Get()->app_icon_group_margin(); UpdateLayoutStrategy(adjusted_length); // |padding_insets| includes the app icon group margin. const gfx::Insets padding_insets = CalculateEdgePadding(); available_space_ = GetLocalBounds(); available_space_.Inset(padding_insets); gfx::Size arrow_button_size(kArrowButtonSize, kArrowButtonSize); gfx::Rect shelf_container_bounds = gfx::Rect(size()); if (!is_horizontal) shelf_container_bounds.Transpose(); gfx::Size arrow_button_group_size(kArrowButtonGroupWidth, shelf_container_bounds.height()); gfx::Rect left_arrow_bounds; gfx::Rect right_arrow_bounds; const int before_padding = is_horizontal ? padding_insets.left() : padding_insets.top(); const int after_padding = is_horizontal ? padding_insets.right() : padding_insets.bottom(); if (layout_strategy_ == kShowLeftArrowButton || layout_strategy_ == kShowButtons) { left_arrow_bounds = gfx::Rect(arrow_button_group_size); left_arrow_bounds.Offset(before_padding, 0); left_arrow_bounds.Inset(kArrowButtonEndPadding, 0, kDistanceToArrowButton, 0); left_arrow_bounds.ClampToCenteredSize(arrow_button_size); shelf_container_bounds.Inset(kArrowButtonGroupWidth, 0, 0, 0); } if (layout_strategy_ == kShowRightArrowButton || layout_strategy_ == kShowButtons) { gfx::Point right_arrow_start_point( shelf_container_bounds.right() - after_padding - kArrowButtonGroupWidth, 0); right_arrow_bounds = gfx::Rect(right_arrow_start_point, arrow_button_group_size); right_arrow_bounds.Inset(kDistanceToArrowButton, 0, kArrowButtonEndPadding, 0); right_arrow_bounds.ClampToCenteredSize(arrow_button_size); shelf_container_bounds.Inset(0, 0, kArrowButtonGroupWidth, 0); } shelf_container_bounds.Inset( before_padding + (left_arrow_bounds.IsEmpty() ? GetAppIconEndPadding() : 0), 0, after_padding + (right_arrow_bounds.IsEmpty() ? GetAppIconEndPadding() : 0), 0); if (!is_horizontal) { left_arrow_bounds.Transpose(); right_arrow_bounds.Transpose(); shelf_container_bounds.Transpose(); } const bool is_right_arrow_changed = (right_arrow_->bounds() != right_arrow_bounds) || (!right_arrow_bounds.IsEmpty() && !right_arrow_->GetVisible()); left_arrow_->SetVisible(!left_arrow_bounds.IsEmpty()); if (left_arrow_->GetVisible()) left_arrow_->SetBoundsRect(left_arrow_bounds); right_arrow_->SetVisible(!right_arrow_bounds.IsEmpty()); if (right_arrow_->GetVisible()) right_arrow_->SetBoundsRect(right_arrow_bounds); if (gradient_layer_delegate_->layer()->bounds() != layer()->bounds()) gradient_layer_delegate_->layer()->SetBounds(layer()->bounds()); if (is_right_arrow_changed && !focus_ring_activated_) UpdateGradientZone(); shelf_container_view_->SetBoundsRect(shelf_container_bounds); gfx::Vector2d translate_vector; if (!left_arrow_bounds.IsEmpty()) { translate_vector = GetShelf()->IsHorizontalAlignment() ? gfx::Vector2d(shelf_container_bounds.x() - GetAppIconEndPadding() - before_padding, 0) : gfx::Vector2d(0, shelf_container_bounds.y() - GetAppIconEndPadding() - before_padding); } gfx::Vector2dF total_offset = scroll_offset_ + translate_vector; if (ShouldAdaptToRTL()) total_offset = -total_offset; shelf_container_view_->TranslateShelfView(total_offset); UpdateTappableIconIndices(); } void ScrollableShelfView::ChildPreferredSizeChanged(views::View* child) { if (GetShelf()->IsHorizontalAlignment()) ScrollByXOffset(0, /*animate=*/false); else ScrollByYOffset(0, /*animate=*/false); } void ScrollableShelfView::OnMouseEvent(ui::MouseEvent* event) { gfx::Point location_in_shelf_view = event->location(); View::ConvertPointToTarget(this, shelf_view_, &location_in_shelf_view); event->set_location(location_in_shelf_view); shelf_view_->OnMouseEvent(event); } void ScrollableShelfView::OnGestureEvent(ui::GestureEvent* event) { if (ShouldHandleGestures(*event)) HandleGestureEvent(event); else shelf_view_->HandleGestureEvent(event); } const char* ScrollableShelfView::GetClassName() const { return "ScrollableShelfView"; } void ScrollableShelfView::OnShelfButtonAboutToRequestFocusFromTabTraversal( ShelfButton* button, bool reverse) {} void ScrollableShelfView::ButtonPressed(views::Button* sender, const ui::Event& event, views::InkDrop* ink_drop) { views::View* sender_view = sender; DCHECK((sender_view == left_arrow_) || (sender_view == right_arrow_)); ScrollToNewPage(sender_view == right_arrow_); } void ScrollableShelfView::OnShelfAlignmentChanged(aura::Window* root_window) { const bool is_horizontal_alignment = GetShelf()->IsHorizontalAlignment(); left_arrow_->set_is_horizontal_alignment(is_horizontal_alignment); right_arrow_->set_is_horizontal_alignment(is_horizontal_alignment); scroll_offset_ = gfx::Vector2dF(); Layout(); } gfx::Insets ScrollableShelfView::CalculateEdgePadding() const { if (ShouldApplyDisplayCentering()) return CalculatePaddingForDisplayCentering(); const int icons_size = shelf_view_->GetSizeOfAppIcons( shelf_view_->number_of_visible_apps(), false); const int base_padding = ShelfConfig::Get()->app_icon_group_margin(); const int available_size_for_app_icons = (GetShelf()->IsHorizontalAlignment() ? width() : height()) - 2 * ShelfConfig::Get()->app_icon_group_margin(); int gap = layout_strategy_ == kNotShowArrowButtons ? available_size_for_app_icons - icons_size // shelf centering : CalculateOverflowPadding(available_size_for_app_icons); // overflow // Calculates the paddings before/after the visible area of scrollable shelf. const int before_padding = base_padding + gap / 2; const int after_padding = base_padding + (gap % 2 ? gap / 2 + 1 : gap / 2); gfx::Insets padding_insets; if (GetShelf()->IsHorizontalAlignment()) { padding_insets = gfx::Insets(/*top=*/0, before_padding, /*bottom=*/0, after_padding); } else { padding_insets = gfx::Insets(before_padding, /*left=*/0, after_padding, /*right=*/0); } return padding_insets; } gfx::Insets ScrollableShelfView::CalculatePaddingForDisplayCentering() const { const int icons_size = shelf_view_->GetSizeOfAppIcons( shelf_view_->number_of_visible_apps(), false); const gfx::Rect display_bounds = screen_util::GetDisplayBoundsWithShelf(GetWidget()->GetNativeWindow()); const int display_size_primary = GetShelf()->PrimaryAxisValue( display_bounds.width(), display_bounds.height()); const int gap = (display_size_primary - icons_size) / 2; const gfx::Rect screen_bounds = GetBoundsInScreen(); const int before_padding = gap - GetShelf()->PrimaryAxisValue( screen_bounds.x() - display_bounds.x(), screen_bounds.y() - display_bounds.y()); const int after_padding = gap - GetShelf()->PrimaryAxisValue( display_bounds.right() - screen_bounds.right(), display_bounds.bottom() - screen_bounds.bottom()); gfx::Insets padding_insets; if (GetShelf()->IsHorizontalAlignment()) { padding_insets = gfx::Insets(/*top=*/0, before_padding, /*bottom=*/0, after_padding); } else { padding_insets = gfx::Insets(before_padding, /*left=*/0, after_padding, /*right=*/0); } return padding_insets; } bool ScrollableShelfView::ShouldHandleGestures(const ui::GestureEvent& event) { if (scroll_status_ == kNotInScroll && !event.IsScrollGestureEvent()) return false; if (event.type() == ui::ET_GESTURE_SCROLL_BEGIN) { CHECK_EQ(scroll_status_, kNotInScroll); float main_offset = event.details().scroll_x_hint(); float cross_offset = event.details().scroll_y_hint(); if (!GetShelf()->IsHorizontalAlignment()) std::swap(main_offset, cross_offset); scroll_status_ = std::abs(main_offset) < std::abs(cross_offset) ? kAcrossMainAxisScroll : kAlongMainAxisScroll; } bool should_handle_gestures = scroll_status_ == kAlongMainAxisScroll; if (scroll_status_ == kAlongMainAxisScroll && event.type() == ui::ET_GESTURE_SCROLL_BEGIN) { scroll_offset_before_main_axis_scrolling_ = scroll_offset_; layout_strategy_before_main_axis_scrolling_ = layout_strategy_; } if (event.type() == ui::ET_GESTURE_END) { scroll_status_ = kNotInScroll; if (should_handle_gestures) { scroll_offset_before_main_axis_scrolling_ = gfx::Vector2dF(); layout_strategy_before_main_axis_scrolling_ = kNotShowArrowButtons; } } return should_handle_gestures; } void ScrollableShelfView::HandleGestureEvent(ui::GestureEvent* event) { if (ProcessGestureEvent(*event)) event->SetHandled(); } bool ScrollableShelfView::ProcessGestureEvent(const ui::GestureEvent& event) { if (layout_strategy_ == kNotShowArrowButtons) return true; if (event.type() == ui::ET_GESTURE_SCROLL_BEGIN || event.type() == ui::ET_GESTURE_SCROLL_END) { return true; } if (event.type() == ui::ET_GESTURE_END) { scroll_offset_ = gfx::ToFlooredVector2d(scroll_offset_); int actual_scroll_distance = GetActualScrollOffset(); if (actual_scroll_distance == CalculateScrollUpperBound()) return true; const int residue = actual_scroll_distance % GetUnit(); int offset = residue > GetGestureDragThreshold() ? GetUnit() - residue : -residue; if (!offset) return true; if (GetShelf()->IsHorizontalAlignment()) ScrollByXOffset(offset, /*animate=*/true); else ScrollByYOffset(offset, /*animate=*/true); return true; } if (event.type() == ui::ET_SCROLL_FLING_START) { const bool is_horizontal_alignment = GetShelf()->IsHorizontalAlignment(); int scroll_velocity = is_horizontal_alignment ? event.details().velocity_x() : event.details().velocity_y(); if (abs(scroll_velocity) < kFlingVelocityThreshold) return false; layout_strategy_ = layout_strategy_before_main_axis_scrolling_; float page_scrolling_offset = CalculatePageScrollingOffset(scroll_velocity < 0); if (is_horizontal_alignment) { ScrollToXOffset( scroll_offset_before_main_axis_scrolling_.x() + page_scrolling_offset, true); } else { ScrollToYOffset( scroll_offset_before_main_axis_scrolling_.y() + page_scrolling_offset, true); } return true; } if (event.type() != ui::ET_GESTURE_SCROLL_UPDATE) return false; if (GetShelf()->IsHorizontalAlignment()) ScrollByXOffset(-event.details().scroll_x(), /*animate=*/false); else ScrollByYOffset(-event.details().scroll_y(), /*animate=*/false); return true; } void ScrollableShelfView::ScrollByXOffset(float x_offset, bool animating) { ScrollToXOffset(scroll_offset_.x() + x_offset, animating); } void ScrollableShelfView::ScrollByYOffset(float y_offset, bool animating) { ScrollToYOffset(scroll_offset_.y() + y_offset, animating); } void ScrollableShelfView::ScrollToXOffset(float x_target_offset, bool animating) { x_target_offset = CalculateClampedScrollOffset(x_target_offset); const float old_x = scroll_offset_.x(); scroll_offset_.set_x(x_target_offset); Layout(); const float diff = x_target_offset - old_x; if (animating) StartShelfScrollAnimation(diff); } void ScrollableShelfView::ScrollToYOffset(float y_target_offset, bool animating) { y_target_offset = CalculateClampedScrollOffset(y_target_offset); const int old_y = scroll_offset_.y(); scroll_offset_.set_y(y_target_offset); Layout(); const float diff = y_target_offset - old_y; if (animating) StartShelfScrollAnimation(diff); } float ScrollableShelfView::CalculatePageScrollingOffset(bool forward) const { float offset = GetSpaceForIcons() - kArrowButtonGroupWidth - ShelfConfig::Get()->button_size() - GetAppIconEndPadding(); if (layout_strategy_ == kShowRightArrowButton) offset -= (kArrowButtonGroupWidth - GetAppIconEndPadding()); DCHECK_GT(offset, 0); if (!forward) offset = -offset; return offset; } void ScrollableShelfView::UpdateGradientZone() { gfx::Rect zone_rect; bool fade_in; const int zone_length = GetFadeZoneLength(); const bool is_horizontal_alignment = GetShelf()->IsHorizontalAlignment(); if (right_arrow_->GetVisible()) { const gfx::Rect right_arrow_bounds = right_arrow_->bounds(); zone_rect = is_horizontal_alignment ? gfx::Rect(right_arrow_bounds.x() - zone_length, 0, zone_length, height()) : gfx::Rect(0, right_arrow_bounds.y() - zone_length, width(), zone_length); fade_in = false; } else if (left_arrow_->GetVisible()) { const gfx::Rect left_arrow_bounds = left_arrow_->bounds(); zone_rect = is_horizontal_alignment ? gfx::Rect(left_arrow_bounds.right(), 0, zone_length, height()) : gfx::Rect(0, left_arrow_bounds.bottom(), width(), zone_length); fade_in = true; } else { zone_rect = gfx::Rect(); fade_in = false; } GradientLayerDelegate::FadeZone fade_zone = {zone_rect, fade_in, is_horizontal_alignment}; gradient_layer_delegate_->set_fade_zone(fade_zone); SchedulePaint(); } int ScrollableShelfView::GetActualScrollOffset() const { int scroll_distance = GetShelf()->IsHorizontalAlignment() ? scroll_offset_.x() : scroll_offset_.y(); if (left_arrow_->GetVisible()) scroll_distance += (kArrowButtonGroupWidth - GetAppIconEndPadding()); return scroll_distance; } void ScrollableShelfView::UpdateTappableIconIndices() { if (layout_strategy_ == kNotShowArrowButtons) { first_tappable_app_index_ = shelf_view_->first_visible_index(); last_tappable_app_index_ = shelf_view_->last_visible_index(); return; } int actual_scroll_distance = GetActualScrollOffset(); int shelf_container_available_space = (GetShelf()->IsHorizontalAlignment() ? shelf_container_view_->width() : shelf_container_view_->height()) - GetFadeZoneLength(); if (layout_strategy_ == kShowRightArrowButton || layout_strategy_ == kShowButtons) { first_tappable_app_index_ = actual_scroll_distance / GetUnit(); last_tappable_app_index_ = first_tappable_app_index_ + shelf_container_available_space / GetUnit(); } else { DCHECK_EQ(layout_strategy_, kShowLeftArrowButton); last_tappable_app_index_ = shelf_view_->last_visible_index(); first_tappable_app_index_ = last_tappable_app_index_ - shelf_container_available_space / GetUnit(); } } views::View* ScrollableShelfView::FindFirstFocusableChild() { return shelf_view_->view_model()->view_at(shelf_view_->first_visible_index()); } views::View* ScrollableShelfView::FindLastFocusableChild() { return shelf_view_->view_model()->view_at(shelf_view_->last_visible_index()); } int ScrollableShelfView::GetSpaceForIcons() const { return GetShelf()->IsHorizontalAlignment() ? available_space_.width() : available_space_.height(); } } // namespace ash
void ScrollableShelfView::Layout() { const bool is_horizontal = GetShelf()->IsHorizontalAlignment(); const int adjusted_length = (is_horizontal ? width() : height()) - 2 * ShelfConfig::Get()->app_icon_group_margin(); UpdateLayoutStrategy(adjusted_length); gfx::Insets padding_insets = CalculateEdgePadding(); const int left_padding = padding_insets.left(); const int right_padding = padding_insets.right(); space_for_icons_ = (is_horizontal ? width() : height()) - left_padding - right_padding; gfx::Size arrow_button_size(kArrowButtonSize, kArrowButtonSize); gfx::Rect shelf_container_bounds = gfx::Rect(size()); if (!is_horizontal) shelf_container_bounds.Transpose(); gfx::Size arrow_button_group_size(kArrowButtonGroupWidth, shelf_container_bounds.height()); gfx::Rect left_arrow_bounds; gfx::Rect right_arrow_bounds; if (layout_strategy_ == kShowLeftArrowButton || layout_strategy_ == kShowButtons) { left_arrow_bounds = gfx::Rect(arrow_button_group_size); left_arrow_bounds.Offset(left_padding, 0); left_arrow_bounds.Inset(kArrowButtonEndPadding, 0, kDistanceToArrowButton, 0); left_arrow_bounds.ClampToCenteredSize(arrow_button_size); shelf_container_bounds.Inset(kArrowButtonGroupWidth, 0, 0, 0); } if (layout_strategy_ == kShowRightArrowButton || layout_strategy_ == kShowButtons) { gfx::Point right_arrow_start_point( shelf_container_bounds.right() - right_padding - kArrowButtonGroupWidth, 0); right_arrow_bounds = gfx::Rect(right_arrow_start_point, arrow_button_group_size); right_arrow_bounds.Inset(kDistanceToArrowButton, 0, kArrowButtonEndPadding, 0); right_arrow_bounds.ClampToCenteredSize(arrow_button_size); shelf_container_bounds.Inset(0, 0, kArrowButtonGroupWidth, 0); } shelf_container_bounds.Inset( left_padding + (left_arrow_bounds.IsEmpty() ? GetAppIconEndPadding() : 0), 0, right_padding + (right_arrow_bounds.IsEmpty() ? GetAppIconEndPadding() : 0), 0); if (!is_horizontal) { left_arrow_bounds.Transpose(); right_arrow_bounds.Transpose(); shelf_container_bounds.Transpose(); } const bool is_right_arrow_changed = (right_arrow_->bounds() != right_arrow_bounds) || (!right_arrow_bounds.IsEmpty() && !right_arrow_->GetVisible()); left_arrow_->SetVisible(!left_arrow_bounds.IsEmpty()); if (left_arrow_->GetVisible()) left_arrow_->SetBoundsRect(left_arrow_bounds); right_arrow_->SetVisible(!right_arrow_bounds.IsEmpty()); if (right_arrow_->GetVisible()) right_arrow_->SetBoundsRect(right_arrow_bounds); if (gradient_layer_delegate_->layer()->bounds() != layer()->bounds()) gradient_layer_delegate_->layer()->SetBounds(layer()->bounds()); if (is_right_arrow_changed && !focus_ring_activated_) UpdateGradientZone(); shelf_container_view_->SetBoundsRect(shelf_container_bounds); gfx::Vector2d translate_vector; if (!left_arrow_bounds.IsEmpty()) { translate_vector = GetShelf()->IsHorizontalAlignment() ? gfx::Vector2d(shelf_container_bounds.x() - GetAppIconEndPadding() - left_padding, 0) : gfx::Vector2d(0, shelf_container_bounds.y() - GetAppIconEndPadding() - left_padding); } gfx::Vector2dF total_offset = scroll_offset_ + translate_vector; if (ShouldAdaptToRTL()) total_offset = -total_offset; shelf_container_view_->TranslateShelfView(total_offset); UpdateTappableIconIndices(); } void ScrollableShelfView::ChildPreferredSizeChanged(views::View* child) { if (GetShelf()->IsHorizontalAlignment()) ScrollByXOffset(0, /*animate=*/false); else ScrollByYOffset(0, /*animate=*/false); } void ScrollableShelfView::OnMouseEvent(ui::MouseEvent* event) { gfx::Point location_in_shelf_view = event->location(); View::ConvertPointToTarget(this, shelf_view_, &location_in_shelf_view); event->set_location(location_in_shelf_view); shelf_view_->OnMouseEvent(event); } void ScrollableShelfView::OnGestureEvent(ui::GestureEvent* event) { if (ShouldHandleGestures(*event)) HandleGestureEvent(event); else shelf_view_->HandleGestureEvent(event); } const char* ScrollableShelfView::GetClassName() const { return "ScrollableShelfView"; } void ScrollableShelfView::OnShelfButtonAboutToRequestFocusFromTabTraversal( ShelfButton* button, bool reverse) {} void ScrollableShelfView::ButtonPressed(views::Button* sender, const ui::Event& event, views::InkDrop* ink_drop) { views::View* sender_view = sender; DCHECK((sender_view == left_arrow_) || (sender_view == right_arrow_)); ScrollToNewPage(sender_view == right_arrow_); } void ScrollableShelfView::OnShelfAlignmentChanged(aura::Window* root_window) { const bool is_horizontal_alignment = GetShelf()->IsHorizontalAlignment(); left_arrow_->set_is_horizontal_alignment(is_horizontal_alignment); right_arrow_->set_is_horizontal_alignment(is_horizontal_alignment); scroll_offset_ = gfx::Vector2dF(); Layout(); } gfx::Insets ScrollableShelfView::CalculateEdgePadding() const { if (ShouldApplyDisplayCentering()) return CalculatePaddingForDisplayCentering(); const int icons_size = shelf_view_->GetSizeOfAppIcons( shelf_view_->number_of_visible_apps(), false); gfx::Insets padding_insets( /*vertical= */ 0, /*horizontal= */ ShelfConfig::Get()->app_icon_group_margin()); const int available_size_for_app_icons = (GetShelf()->IsHorizontalAlignment() ? width() : height()) - 2 * ShelfConfig::Get()->app_icon_group_margin(); int gap = layout_strategy_ == kNotShowArrowButtons ? available_size_for_app_icons - icons_size // shelf centering : CalculateOverflowPadding(available_size_for_app_icons); // overflow padding_insets.set_left(padding_insets.left() + gap / 2); padding_insets.set_right(padding_insets.right() + (gap % 2 ? gap / 2 + 1 : gap / 2)); return padding_insets; } gfx::Insets ScrollableShelfView::CalculatePaddingForDisplayCentering() const { const int icons_size = shelf_view_->GetSizeOfAppIcons( shelf_view_->number_of_visible_apps(), false); const gfx::Rect display_bounds = screen_util::GetDisplayBoundsWithShelf(GetWidget()->GetNativeWindow()); const int display_size_primary = GetShelf()->PrimaryAxisValue( display_bounds.width(), display_bounds.height()); const int gap = (display_size_primary - icons_size) / 2; const gfx::Rect screen_bounds = GetBoundsInScreen(); const int left_padding = gap - GetShelf()->PrimaryAxisValue( screen_bounds.x() - display_bounds.x(), screen_bounds.y() - display_bounds.y()); const int right_padding = gap - GetShelf()->PrimaryAxisValue( display_bounds.right() - screen_bounds.right(), display_bounds.bottom() - screen_bounds.bottom()); return gfx::Insets(0, left_padding, 0, right_padding); } bool ScrollableShelfView::ShouldHandleGestures(const ui::GestureEvent& event) { if (scroll_status_ == kNotInScroll && !event.IsScrollGestureEvent()) return false; if (event.type() == ui::ET_GESTURE_SCROLL_BEGIN) { CHECK_EQ(scroll_status_, kNotInScroll); float main_offset = event.details().scroll_x_hint(); float cross_offset = event.details().scroll_y_hint(); if (!GetShelf()->IsHorizontalAlignment()) std::swap(main_offset, cross_offset); scroll_status_ = std::abs(main_offset) < std::abs(cross_offset) ? kAcrossMainAxisScroll : kAlongMainAxisScroll; } bool should_handle_gestures = scroll_status_ == kAlongMainAxisScroll; if (scroll_status_ == kAlongMainAxisScroll && event.type() == ui::ET_GESTURE_SCROLL_BEGIN) { scroll_offset_before_main_axis_scrolling_ = scroll_offset_; layout_strategy_before_main_axis_scrolling_ = layout_strategy_; } if (event.type() == ui::ET_GESTURE_END) { scroll_status_ = kNotInScroll; if (should_handle_gestures) { scroll_offset_before_main_axis_scrolling_ = gfx::Vector2dF(); layout_strategy_before_main_axis_scrolling_ = kNotShowArrowButtons; } } return should_handle_gestures; } void ScrollableShelfView::HandleGestureEvent(ui::GestureEvent* event) { if (ProcessGestureEvent(*event)) event->SetHandled(); } bool ScrollableShelfView::ProcessGestureEvent(const ui::GestureEvent& event) { if (layout_strategy_ == kNotShowArrowButtons) return true; if (event.type() == ui::ET_GESTURE_SCROLL_BEGIN || event.type() == ui::ET_GESTURE_SCROLL_END) { return true; } if (event.type() == ui::ET_GESTURE_END) { scroll_offset_ = gfx::ToFlooredVector2d(scroll_offset_); int actual_scroll_distance = GetActualScrollOffset(); if (actual_scroll_distance == CalculateScrollUpperBound()) return true; const int residue = actual_scroll_distance % GetUnit(); int offset = residue > GetGestureDragThreshold() ? GetUnit() - residue : -residue; if (!offset) return true; if (GetShelf()->IsHorizontalAlignment()) ScrollByXOffset(offset, /*animate=*/true); else ScrollByYOffset(offset, /*animate=*/true); return true; } if (event.type() == ui::ET_SCROLL_FLING_START) { const bool is_horizontal_alignment = GetShelf()->IsHorizontalAlignment(); int scroll_velocity = is_horizontal_alignment ? event.details().velocity_x() : event.details().velocity_y(); if (abs(scroll_velocity) < kFlingVelocityThreshold) return false; layout_strategy_ = layout_strategy_before_main_axis_scrolling_; float page_scrolling_offset = CalculatePageScrollingOffset(scroll_velocity < 0); if (is_horizontal_alignment) { ScrollToXOffset( scroll_offset_before_main_axis_scrolling_.x() + page_scrolling_offset, true); } else { ScrollToYOffset( scroll_offset_before_main_axis_scrolling_.y() + page_scrolling_offset, true); } return true; } if (event.type() != ui::ET_GESTURE_SCROLL_UPDATE) return false; if (GetShelf()->IsHorizontalAlignment()) ScrollByXOffset(-event.details().scroll_x(), /*animate=*/false); else ScrollByYOffset(-event.details().scroll_y(), /*animate=*/false); return true; } void ScrollableShelfView::ScrollByXOffset(float x_offset, bool animating) { ScrollToXOffset(scroll_offset_.x() + x_offset, animating); } void ScrollableShelfView::ScrollByYOffset(float y_offset, bool animating) { ScrollToYOffset(scroll_offset_.y() + y_offset, animating); } void ScrollableShelfView::ScrollToXOffset(float x_target_offset, bool animating) { x_target_offset = CalculateClampedScrollOffset(x_target_offset); const float old_x = scroll_offset_.x(); scroll_offset_.set_x(x_target_offset); Layout(); const float diff = x_target_offset - old_x; if (animating) StartShelfScrollAnimation(diff); } void ScrollableShelfView::ScrollToYOffset(float y_target_offset, bool animating) { y_target_offset = CalculateClampedScrollOffset(y_target_offset); const int old_y = scroll_offset_.y(); scroll_offset_.set_y(y_target_offset); Layout(); const float diff = y_target_offset - old_y; if (animating) StartShelfScrollAnimation(diff); } float ScrollableShelfView::CalculatePageScrollingOffset(bool forward) const { float offset = space_for_icons_ - kArrowButtonGroupWidth - ShelfConfig::Get()->button_size() - GetAppIconEndPadding(); if (layout_strategy_ == kShowRightArrowButton) offset -= (kArrowButtonGroupWidth - GetAppIconEndPadding()); DCHECK_GT(offset, 0); if (!forward) offset = -offset; return offset; } void ScrollableShelfView::UpdateGradientZone() { gfx::Rect zone_rect; bool fade_in; const int zone_length = GetFadeZoneLength(); const bool is_horizontal_alignment = GetShelf()->IsHorizontalAlignment(); if (right_arrow_->GetVisible()) { const gfx::Rect right_arrow_bounds = right_arrow_->bounds(); zone_rect = is_horizontal_alignment ? gfx::Rect(right_arrow_bounds.x() - zone_length, 0, zone_length, height()) : gfx::Rect(0, right_arrow_bounds.y() - zone_length, width(), zone_length); fade_in = false; } else if (left_arrow_->GetVisible()) { const gfx::Rect left_arrow_bounds = left_arrow_->bounds(); zone_rect = is_horizontal_alignment ? gfx::Rect(left_arrow_bounds.right(), 0, zone_length, height()) : gfx::Rect(0, left_arrow_bounds.bottom(), width(), zone_length); fade_in = true; } else { zone_rect = gfx::Rect(); fade_in = false; } GradientLayerDelegate::FadeZone fade_zone = {zone_rect, fade_in, is_horizontal_alignment}; gradient_layer_delegate_->set_fade_zone(fade_zone); SchedulePaint(); } int ScrollableShelfView::GetActualScrollOffset() const { int scroll_distance = GetShelf()->IsHorizontalAlignment() ? scroll_offset_.x() : scroll_offset_.y(); if (left_arrow_->GetVisible()) scroll_distance += (kArrowButtonGroupWidth - GetAppIconEndPadding()); return scroll_distance; } void ScrollableShelfView::UpdateTappableIconIndices() { if (layout_strategy_ == kNotShowArrowButtons) { first_tappable_app_index_ = shelf_view_->first_visible_index(); last_tappable_app_index_ = shelf_view_->last_visible_index(); return; } int actual_scroll_distance = GetActualScrollOffset(); int shelf_container_available_space = (GetShelf()->IsHorizontalAlignment() ? shelf_container_view_->width() : shelf_container_view_->height()) - GetFadeZoneLength(); if (layout_strategy_ == kShowRightArrowButton || layout_strategy_ == kShowButtons) { first_tappable_app_index_ = actual_scroll_distance / GetUnit(); last_tappable_app_index_ = first_tappable_app_index_ + shelf_container_available_space / GetUnit(); } else { DCHECK_EQ(layout_strategy_, kShowLeftArrowButton); last_tappable_app_index_ = shelf_view_->last_visible_index(); first_tappable_app_index_ = last_tappable_app_index_ - shelf_container_available_space / GetUnit(); } } views::View* ScrollableShelfView::FindFirstFocusableChild() { return shelf_view_->view_model()->view_at(shelf_view_->first_visible_index()); } views::View* ScrollableShelfView::FindLastFocusableChild() { return shelf_view_->view_model()->view_at(shelf_view_->last_visible_index()); } } // namespace ash
C
Chrome
1
CVE-2018-17570
https://www.cvedetails.com/cve/CVE-2018-17570/
CWE-190
https://github.com/viabtc/viabtc_exchange_server/commit/4a7c27bfe98f409623d4d857894d017ff0672cc9#diff-515c81af848352583bff286d6224875f
4a7c27bfe98f409623d4d857894d017ff0672cc9#diff-515c81af848352583bff286d6224875f
Merge pull request #131 from benjaminchodroff/master fix memory corruption and other 32bit overflows
int rpc_pack(rpc_pkg *pkg, void **data, uint32_t *size) { static void *send_buf; static size_t send_buf_size; uint32_t pkg_size; if (pkg->body_size > RPC_PKG_MAX_BODY_SIZE) { return -1; } pkg_size = RPC_PKG_HEAD_SIZE + pkg->ext_size + pkg->body_size; if (send_buf_size < pkg_size) { if (send_buf) free(send_buf); send_buf_size = pkg_size * 2; send_buf = malloc(send_buf_size); if (send_buf == NULL) { return -1; } } memcpy(send_buf, pkg, RPC_PKG_HEAD_SIZE); if (pkg->ext_size) memcpy(send_buf + RPC_PKG_HEAD_SIZE, pkg->ext, pkg->ext_size); if (pkg->body_size) memcpy(send_buf + RPC_PKG_HEAD_SIZE + pkg->ext_size, pkg->body, pkg->body_size); pkg = send_buf; pkg->magic = htole32(RPC_PKG_MAGIC); pkg->command = htole32(pkg->command); pkg->pkg_type = htole16(pkg->pkg_type); pkg->result = htole32(pkg->result); pkg->sequence = htole32(pkg->sequence); pkg->req_id = htole64(pkg->req_id); pkg->body_size = htole32(pkg->body_size); pkg->ext_size = htole16(pkg->ext_size); pkg->crc32 = 0; pkg->crc32 = htole32(generate_crc32c(send_buf, pkg_size)); *data = send_buf; *size = pkg_size; return 0; }
int rpc_pack(rpc_pkg *pkg, void **data, uint32_t *size) { static void *send_buf; static size_t send_buf_size; uint32_t pkg_size = RPC_PKG_HEAD_SIZE + pkg->ext_size + pkg->body_size; if (send_buf_size < pkg_size) { if (send_buf) free(send_buf); send_buf_size = pkg_size * 2; send_buf = malloc(send_buf_size); assert(send_buf != NULL); } memcpy(send_buf, pkg, RPC_PKG_HEAD_SIZE); if (pkg->ext_size) memcpy(send_buf + RPC_PKG_HEAD_SIZE, pkg->ext, pkg->ext_size); if (pkg->body_size) memcpy(send_buf + RPC_PKG_HEAD_SIZE + pkg->ext_size, pkg->body, pkg->body_size); pkg = send_buf; pkg->magic = htole32(RPC_PKG_MAGIC); pkg->command = htole32(pkg->command); pkg->pkg_type = htole16(pkg->pkg_type); pkg->result = htole32(pkg->result); pkg->sequence = htole32(pkg->sequence); pkg->req_id = htole64(pkg->req_id); pkg->body_size = htole32(pkg->body_size); pkg->ext_size = htole16(pkg->ext_size); pkg->crc32 = 0; pkg->crc32 = htole32(generate_crc32c(send_buf, pkg_size)); *data = send_buf; *size = pkg_size; return 0; }
C
viabtc_exchange_server
1
CVE-2013-6449
https://www.cvedetails.com/cve/CVE-2013-6449/
CWE-310
https://git.openssl.org/gitweb/?p=openssl.git;a=commit;h=ca989269a2876bae79393bd54c3e72d49975fc75
ca989269a2876bae79393bd54c3e72d49975fc75
null
int ssl3_write(SSL *s, const void *buf, int len) { int ret,n; #if 0 if (s->shutdown & SSL_SEND_SHUTDOWN) { s->rwstate=SSL_NOTHING; return(0); } #endif clear_sys_error(); if (s->s3->renegotiate) ssl3_renegotiate_check(s); /* This is an experimental flag that sends the * last handshake message in the same packet as the first * use data - used to see if it helps the TCP protocol during * session-id reuse */ /* The second test is because the buffer may have been removed */ if ((s->s3->flags & SSL3_FLAGS_POP_BUFFER) && (s->wbio == s->bbio)) { /* First time through, we write into the buffer */ if (s->s3->delay_buf_pop_ret == 0) { ret=ssl3_write_bytes(s,SSL3_RT_APPLICATION_DATA, buf,len); if (ret <= 0) return(ret); s->s3->delay_buf_pop_ret=ret; } s->rwstate=SSL_WRITING; n=BIO_flush(s->wbio); if (n <= 0) return(n); s->rwstate=SSL_NOTHING; /* We have flushed the buffer, so remove it */ ssl_free_wbio_buffer(s); s->s3->flags&= ~SSL3_FLAGS_POP_BUFFER; ret=s->s3->delay_buf_pop_ret; s->s3->delay_buf_pop_ret=0; } else { ret=s->method->ssl_write_bytes(s,SSL3_RT_APPLICATION_DATA, buf,len); if (ret <= 0) return(ret); } return(ret); }
int ssl3_write(SSL *s, const void *buf, int len) { int ret,n; #if 0 if (s->shutdown & SSL_SEND_SHUTDOWN) { s->rwstate=SSL_NOTHING; return(0); } #endif clear_sys_error(); if (s->s3->renegotiate) ssl3_renegotiate_check(s); /* This is an experimental flag that sends the * last handshake message in the same packet as the first * use data - used to see if it helps the TCP protocol during * session-id reuse */ /* The second test is because the buffer may have been removed */ if ((s->s3->flags & SSL3_FLAGS_POP_BUFFER) && (s->wbio == s->bbio)) { /* First time through, we write into the buffer */ if (s->s3->delay_buf_pop_ret == 0) { ret=ssl3_write_bytes(s,SSL3_RT_APPLICATION_DATA, buf,len); if (ret <= 0) return(ret); s->s3->delay_buf_pop_ret=ret; } s->rwstate=SSL_WRITING; n=BIO_flush(s->wbio); if (n <= 0) return(n); s->rwstate=SSL_NOTHING; /* We have flushed the buffer, so remove it */ ssl_free_wbio_buffer(s); s->s3->flags&= ~SSL3_FLAGS_POP_BUFFER; ret=s->s3->delay_buf_pop_ret; s->s3->delay_buf_pop_ret=0; } else { ret=s->method->ssl_write_bytes(s,SSL3_RT_APPLICATION_DATA, buf,len); if (ret <= 0) return(ret); } return(ret); }
C
openssl
0
CVE-2010-1152
https://www.cvedetails.com/cve/CVE-2010-1152/
CWE-20
https://github.com/memcached/memcached/commit/75cc83685e103bc8ba380a57468c8f04413033f9
75cc83685e103bc8ba380a57468c8f04413033f9
Issue 102: Piping null to the server will crash it
static enum test_return test_binary_noop(void) { union { protocol_binary_request_no_extras request; protocol_binary_response_no_extras response; char bytes[1024]; } buffer; size_t len = raw_command(buffer.bytes, sizeof(buffer.bytes), PROTOCOL_BINARY_CMD_NOOP, NULL, 0, NULL, 0); safe_send(buffer.bytes, len, false); safe_recv_packet(buffer.bytes, sizeof(buffer.bytes)); validate_response_header(&buffer.response, PROTOCOL_BINARY_CMD_NOOP, PROTOCOL_BINARY_RESPONSE_SUCCESS); return TEST_PASS; }
static enum test_return test_binary_noop(void) { union { protocol_binary_request_no_extras request; protocol_binary_response_no_extras response; char bytes[1024]; } buffer; size_t len = raw_command(buffer.bytes, sizeof(buffer.bytes), PROTOCOL_BINARY_CMD_NOOP, NULL, 0, NULL, 0); safe_send(buffer.bytes, len, false); safe_recv_packet(buffer.bytes, sizeof(buffer.bytes)); validate_response_header(&buffer.response, PROTOCOL_BINARY_CMD_NOOP, PROTOCOL_BINARY_RESPONSE_SUCCESS); return TEST_PASS; }
C
memcached
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
v8::Persistent<v8::FunctionTemplate> V8TestMediaQueryListListener::GetTemplate() { V8BindingPerIsolateData* data = V8BindingPerIsolateData::current(); V8BindingPerIsolateData::TemplateMap::iterator result = data->templateMap().find(&info); if (result != data->templateMap().end()) return result->second; v8::HandleScope handleScope; v8::Persistent<v8::FunctionTemplate> templ = ConfigureV8TestMediaQueryListListenerTemplate(GetRawTemplate()); data->templateMap().add(&info, templ); return templ; }
v8::Persistent<v8::FunctionTemplate> V8TestMediaQueryListListener::GetTemplate() { V8BindingPerIsolateData* data = V8BindingPerIsolateData::current(); V8BindingPerIsolateData::TemplateMap::iterator result = data->templateMap().find(&info); if (result != data->templateMap().end()) return result->second; v8::HandleScope handleScope; v8::Persistent<v8::FunctionTemplate> templ = ConfigureV8TestMediaQueryListListenerTemplate(GetRawTemplate()); data->templateMap().add(&info, templ); return templ; }
C
Chrome
0
CVE-2016-3750
https://www.cvedetails.com/cve/CVE-2016-3750/
CWE-20
https://android.googlesource.com/platform/frameworks/native/+/54cb02ad733fb71b1bdf78590428817fb780aff8
54cb02ad733fb71b1bdf78590428817fb780aff8
Correctly handle dup() failure in Parcel::readNativeHandle bail out if dup() fails, instead of creating an invalid native_handle_t Bug: 28395952 Change-Id: Ia1a6198c0f45165b9c6a55a803e5f64d8afa0572
status_t Parcel::readUint32(uint32_t *pArg) const { return readAligned(pArg); }
status_t Parcel::readUint32(uint32_t *pArg) const { return readAligned(pArg); }
C
Android
0
CVE-2011-2795
https://www.cvedetails.com/cve/CVE-2011-2795/
CWE-264
https://github.com/chromium/chromium/commit/73edae623529f04c668268de49d00324b96166a2
73edae623529f04c668268de49d00324b96166a2
There are too many poorly named functions to create a fragment from markup https://bugs.webkit.org/show_bug.cgi?id=87339 Reviewed by Eric Seidel. Source/WebCore: Moved all functions that create a fragment from markup to markup.h/cpp. There should be no behavioral change. * dom/Range.cpp: (WebCore::Range::createContextualFragment): * dom/Range.h: Removed createDocumentFragmentForElement. * dom/ShadowRoot.cpp: (WebCore::ShadowRoot::setInnerHTML): * editing/markup.cpp: (WebCore::createFragmentFromMarkup): (WebCore::createFragmentForInnerOuterHTML): Renamed from createFragmentFromSource. (WebCore::createFragmentForTransformToFragment): Moved from XSLTProcessor. (WebCore::removeElementPreservingChildren): Moved from Range. (WebCore::createContextualFragment): Ditto. * editing/markup.h: * html/HTMLElement.cpp: (WebCore::HTMLElement::setInnerHTML): (WebCore::HTMLElement::setOuterHTML): (WebCore::HTMLElement::insertAdjacentHTML): * inspector/DOMPatchSupport.cpp: (WebCore::DOMPatchSupport::patchNode): Added a FIXME since this code should be using one of the functions listed in markup.h * xml/XSLTProcessor.cpp: (WebCore::XSLTProcessor::transformToFragment): Source/WebKit/qt: Replace calls to Range::createDocumentFragmentForElement by calls to createContextualDocumentFragment. * Api/qwebelement.cpp: (QWebElement::appendInside): (QWebElement::prependInside): (QWebElement::prependOutside): (QWebElement::appendOutside): (QWebElement::encloseContentsWith): (QWebElement::encloseWith): git-svn-id: svn://svn.chromium.org/blink/trunk@118414 bbb929c8-8fbe-4397-9dbb-9b2b20218538
PassRefPtr<Node> Range::processContentsBetweenOffsets(ActionType action, PassRefPtr<DocumentFragment> fragment, Node* container, unsigned startOffset, unsigned endOffset, ExceptionCode& ec) { ASSERT(container); ASSERT(startOffset <= endOffset); RefPtr<Node> result; switch (container->nodeType()) { case Node::TEXT_NODE: case Node::CDATA_SECTION_NODE: case Node::COMMENT_NODE: ASSERT(endOffset <= static_cast<CharacterData*>(container)->length()); if (action == EXTRACT_CONTENTS || action == CLONE_CONTENTS) { RefPtr<CharacterData> c = static_pointer_cast<CharacterData>(container->cloneNode(true)); deleteCharacterData(c, startOffset, endOffset, ec); if (fragment) { result = fragment; result->appendChild(c.release(), ec); } else result = c.release(); } if (action == EXTRACT_CONTENTS || action == DELETE_CONTENTS) static_cast<CharacterData*>(container)->deleteData(startOffset, endOffset - startOffset, ec); break; case Node::PROCESSING_INSTRUCTION_NODE: ASSERT(endOffset <= static_cast<ProcessingInstruction*>(container)->data().length()); if (action == EXTRACT_CONTENTS || action == CLONE_CONTENTS) { RefPtr<ProcessingInstruction> c = static_pointer_cast<ProcessingInstruction>(container->cloneNode(true)); c->setData(c->data().substring(startOffset, endOffset - startOffset), ec); if (fragment) { result = fragment; result->appendChild(c.release(), ec); } else result = c.release(); } if (action == EXTRACT_CONTENTS || action == DELETE_CONTENTS) { ProcessingInstruction* pi = static_cast<ProcessingInstruction*>(container); String data(pi->data()); data.remove(startOffset, endOffset - startOffset); pi->setData(data, ec); } break; case Node::ELEMENT_NODE: case Node::ATTRIBUTE_NODE: case Node::ENTITY_REFERENCE_NODE: case Node::ENTITY_NODE: case Node::DOCUMENT_NODE: case Node::DOCUMENT_TYPE_NODE: case Node::DOCUMENT_FRAGMENT_NODE: case Node::NOTATION_NODE: case Node::XPATH_NAMESPACE_NODE: if (action == EXTRACT_CONTENTS || action == CLONE_CONTENTS) { if (fragment) result = fragment; else result = container->cloneNode(false); } Node* n = container->firstChild(); Vector<RefPtr<Node> > nodes; for (unsigned i = startOffset; n && i; i--) n = n->nextSibling(); for (unsigned i = startOffset; n && i < endOffset; i++, n = n->nextSibling()) nodes.append(n); processNodes(action, nodes, container, result, ec); break; } return result.release(); }
PassRefPtr<Node> Range::processContentsBetweenOffsets(ActionType action, PassRefPtr<DocumentFragment> fragment, Node* container, unsigned startOffset, unsigned endOffset, ExceptionCode& ec) { ASSERT(container); ASSERT(startOffset <= endOffset); RefPtr<Node> result; switch (container->nodeType()) { case Node::TEXT_NODE: case Node::CDATA_SECTION_NODE: case Node::COMMENT_NODE: ASSERT(endOffset <= static_cast<CharacterData*>(container)->length()); if (action == EXTRACT_CONTENTS || action == CLONE_CONTENTS) { RefPtr<CharacterData> c = static_pointer_cast<CharacterData>(container->cloneNode(true)); deleteCharacterData(c, startOffset, endOffset, ec); if (fragment) { result = fragment; result->appendChild(c.release(), ec); } else result = c.release(); } if (action == EXTRACT_CONTENTS || action == DELETE_CONTENTS) static_cast<CharacterData*>(container)->deleteData(startOffset, endOffset - startOffset, ec); break; case Node::PROCESSING_INSTRUCTION_NODE: ASSERT(endOffset <= static_cast<ProcessingInstruction*>(container)->data().length()); if (action == EXTRACT_CONTENTS || action == CLONE_CONTENTS) { RefPtr<ProcessingInstruction> c = static_pointer_cast<ProcessingInstruction>(container->cloneNode(true)); c->setData(c->data().substring(startOffset, endOffset - startOffset), ec); if (fragment) { result = fragment; result->appendChild(c.release(), ec); } else result = c.release(); } if (action == EXTRACT_CONTENTS || action == DELETE_CONTENTS) { ProcessingInstruction* pi = static_cast<ProcessingInstruction*>(container); String data(pi->data()); data.remove(startOffset, endOffset - startOffset); pi->setData(data, ec); } break; case Node::ELEMENT_NODE: case Node::ATTRIBUTE_NODE: case Node::ENTITY_REFERENCE_NODE: case Node::ENTITY_NODE: case Node::DOCUMENT_NODE: case Node::DOCUMENT_TYPE_NODE: case Node::DOCUMENT_FRAGMENT_NODE: case Node::NOTATION_NODE: case Node::XPATH_NAMESPACE_NODE: if (action == EXTRACT_CONTENTS || action == CLONE_CONTENTS) { if (fragment) result = fragment; else result = container->cloneNode(false); } Node* n = container->firstChild(); Vector<RefPtr<Node> > nodes; for (unsigned i = startOffset; n && i; i--) n = n->nextSibling(); for (unsigned i = startOffset; n && i < endOffset; i++, n = n->nextSibling()) nodes.append(n); processNodes(action, nodes, container, result, ec); break; } return result.release(); }
C
Chrome
0
CVE-2012-2888
https://www.cvedetails.com/cve/CVE-2012-2888/
CWE-399
https://github.com/chromium/chromium/commit/3b0d77670a0613f409110817455d2137576b485a
3b0d77670a0613f409110817455d2137576b485a
Revert 143656 - Add an IPC channel between the NaCl loader process and the renderer. BUG=116317 TEST=ppapi, nacl tests, manual testing for experimental IPC proxy. Review URL: https://chromiumcodereview.appspot.com/10641016 [email protected] Review URL: https://chromiumcodereview.appspot.com/10625007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143665 0039d316-1c4b-4281-b951-d872f2087c98
bool NaClProcessHost::StartWithLaunchedProcess() { #if defined(OS_LINUX) if (wait_for_nacl_gdb_) { if (LaunchNaClGdb(base::GetProcId(process_->GetData().handle))) { return true; } DLOG(ERROR) << "Failed to launch debugger"; } #endif NaClBrowser* nacl_browser = NaClBrowser::GetInstance(); if (nacl_browser->IsReady()) { return SendStart(); } else if (nacl_browser->IsOk()) { nacl_browser->WaitForResources( base::Bind(&NaClProcessHost::OnResourcesReady, weak_factory_.GetWeakPtr())); return true; } else { return false; } }
bool NaClProcessHost::StartWithLaunchedProcess() { #if defined(OS_LINUX) if (wait_for_nacl_gdb_) { if (LaunchNaClGdb(base::GetProcId(process_->GetData().handle))) { return true; } DLOG(ERROR) << "Failed to launch debugger"; } #endif NaClBrowser* nacl_browser = NaClBrowser::GetInstance(); if (nacl_browser->IsReady()) { return SendStart(); } else if (nacl_browser->IsOk()) { nacl_browser->WaitForResources( base::Bind(&NaClProcessHost::OnResourcesReady, weak_factory_.GetWeakPtr())); return true; } else { return false; } }
C
Chrome
0
CVE-2017-11664
https://www.cvedetails.com/cve/CVE-2017-11664/
CWE-125
https://github.com/Mindwerks/wildmidi/commit/660b513d99bced8783a4a5984ac2f742c74ebbdd
660b513d99bced8783a4a5984ac2f742c74ebbdd
Add a new size parameter to _WM_SetupMidiEvent() so that it knows where to stop reading, and adjust its users properly. Fixes bug #175 (CVE-2017-11661, CVE-2017-11662, CVE-2017-11663, CVE-2017-11664.)
void _WM_do_meta_keysignature(struct _mdi *mdi, struct _event_data *data) { /* placeholder function so we can record tempo in the event stream * for conversion function _WM_Event2Midi */ #ifdef DEBUG_MIDI uint8_t ch = data->channel; MIDI_EVENT_DEBUG(__FUNCTION__, ch, data->data.value); #else UNUSED(data); #endif UNUSED(mdi); return; }
void _WM_do_meta_keysignature(struct _mdi *mdi, struct _event_data *data) { /* placeholder function so we can record tempo in the event stream * for conversion function _WM_Event2Midi */ #ifdef DEBUG_MIDI uint8_t ch = data->channel; MIDI_EVENT_DEBUG(__FUNCTION__, ch, data->data.value); #else UNUSED(data); #endif UNUSED(mdi); return; }
C
wildmidi
0
CVE-2017-5091
https://www.cvedetails.com/cve/CVE-2017-5091/
CWE-416
https://github.com/chromium/chromium/commit/d007b8b750851fe1b375c463009ea3b24e5c021d
d007b8b750851fe1b375c463009ea3b24e5c021d
[IndexedDB] Fix Cursor UAF If the connection is closed before we return a cursor, it dies in IndexedDBCallbacks::IOThreadHelper::SendSuccessCursor. It's deleted on the correct thread, but we also need to makes sure to remove it from its transaction. To make things simpler, we have the cursor remove itself from its transaction on destruction. R: [email protected] Bug: 728887 Change-Id: I8c76e6195c2490137a05213e47c635d12f4d3dd2 Reviewed-on: https://chromium-review.googlesource.com/526284 Commit-Queue: Daniel Murphy <[email protected]> Reviewed-by: Victor Costan <[email protected]> Cr-Commit-Position: refs/heads/master@{#477504}
void CursorImpl::IDBThreadHelper::PrefetchReset(int32_t used_prefetches, int32_t unused_prefetches) { leveldb::Status s = cursor_->PrefetchReset(used_prefetches, unused_prefetches); if (!s.ok()) DLOG(ERROR) << "Unable to reset prefetch"; }
void CursorImpl::IDBThreadHelper::PrefetchReset(int32_t used_prefetches, int32_t unused_prefetches) { leveldb::Status s = cursor_->PrefetchReset(used_prefetches, unused_prefetches); if (!s.ok()) DLOG(ERROR) << "Unable to reset prefetch"; }
C
Chrome
0
CVE-2017-5009
https://www.cvedetails.com/cve/CVE-2017-5009/
CWE-119
https://github.com/chromium/chromium/commit/1c40f9042ae2d6ee7483d72998aabb5e73b2ff60
1c40f9042ae2d6ee7483d72998aabb5e73b2ff60
DevTools: send proper resource type in Network.RequestWillBeSent This patch plumbs resoure type into the DispatchWillSendRequest instrumenation. This allows us to report accurate type in Network.RequestWillBeSent event, instead of "Other", that we report today. BUG=765501 R=dgozman Change-Id: I0134c08b841e8dd247fdc8ff208bfd51e462709c Reviewed-on: https://chromium-review.googlesource.com/667504 Reviewed-by: Pavel Feldman <[email protected]> Reviewed-by: Dmitry Gozman <[email protected]> Commit-Queue: Andrey Lushnikov <[email protected]> Cr-Commit-Position: refs/heads/master@{#507936}
static LocalFrame* FrameForExecutionContext(ExecutionContext* context) { LocalFrame* frame = nullptr; if (context->IsDocument()) frame = ToDocument(context)->GetFrame(); return frame; }
static LocalFrame* FrameForExecutionContext(ExecutionContext* context) { LocalFrame* frame = nullptr; if (context->IsDocument()) frame = ToDocument(context)->GetFrame(); return frame; }
C
Chrome
0
CVE-2017-9059
https://www.cvedetails.com/cve/CVE-2017-9059/
CWE-404
https://github.com/torvalds/linux/commit/c70422f760c120480fee4de6c38804c72aa26bc1
c70422f760c120480fee4de6c38804c72aa26bc1
Merge tag 'nfsd-4.12' of git://linux-nfs.org/~bfields/linux Pull nfsd updates from Bruce Fields: "Another RDMA update from Chuck Lever, and a bunch of miscellaneous bugfixes" * tag 'nfsd-4.12' of git://linux-nfs.org/~bfields/linux: (26 commits) nfsd: Fix up the "supattr_exclcreat" attributes nfsd: encoders mustn't use unitialized values in error cases nfsd: fix undefined behavior in nfsd4_layout_verify lockd: fix lockd shutdown race NFSv4: Fix callback server shutdown SUNRPC: Refactor svc_set_num_threads() NFSv4.x/callback: Create the callback service through svc_create_pooled lockd: remove redundant check on block svcrdma: Clean out old XDR encoders svcrdma: Remove the req_map cache svcrdma: Remove unused RDMA Write completion handler svcrdma: Reduce size of sge array in struct svc_rdma_op_ctxt svcrdma: Clean up RPC-over-RDMA backchannel reply processing svcrdma: Report Write/Reply chunk overruns svcrdma: Clean up RDMA_ERROR path svcrdma: Use rdma_rw API in RPC reply path svcrdma: Introduce local rdma_rw API helpers svcrdma: Clean up svc_rdma_get_inv_rkey() svcrdma: Add helper to save pages under I/O svcrdma: Eliminate RPCRDMA_SQ_DEPTH_MULT ...
nfsd4_decode_remove(struct nfsd4_compoundargs *argp, struct nfsd4_remove *remove) { DECODE_HEAD; READ_BUF(4); remove->rm_namelen = be32_to_cpup(p++); READ_BUF(remove->rm_namelen); SAVEMEM(remove->rm_name, remove->rm_namelen); if ((status = check_filename(remove->rm_name, remove->rm_namelen))) return status; DECODE_TAIL; }
nfsd4_decode_remove(struct nfsd4_compoundargs *argp, struct nfsd4_remove *remove) { DECODE_HEAD; READ_BUF(4); remove->rm_namelen = be32_to_cpup(p++); READ_BUF(remove->rm_namelen); SAVEMEM(remove->rm_name, remove->rm_namelen); if ((status = check_filename(remove->rm_name, remove->rm_namelen))) return status; DECODE_TAIL; }
C
linux
0
CVE-2018-14361
https://www.cvedetails.com/cve/CVE-2018-14361/
CWE-20
https://github.com/neomutt/neomutt/commit/9e927affe3a021175f354af5fa01d22657c20585
9e927affe3a021175f354af5fa01d22657c20585
Add alloc fail check in nntp_fetch_headers
static int nntp_mbox_sync(struct Context *ctx, int *index_hint) { struct NntpData *nntp_data = ctx->data; int rc; #ifdef USE_HCACHE header_cache_t *hc = NULL; #endif /* check for new articles */ nntp_data->nserv->check_time = 0; rc = check_mailbox(ctx); if (rc) return rc; #ifdef USE_HCACHE nntp_data->last_cached = 0; hc = nntp_hcache_open(nntp_data); #endif for (int i = 0; i < ctx->msgcount; i++) { struct Header *hdr = ctx->hdrs[i]; char buf[16]; snprintf(buf, sizeof(buf), "%d", NHDR(hdr)->article_num); if (nntp_data->bcache && hdr->deleted) { mutt_debug(2, "mutt_bcache_del %s\n", buf); mutt_bcache_del(nntp_data->bcache, buf); } #ifdef USE_HCACHE if (hc && (hdr->changed || hdr->deleted)) { if (hdr->deleted && !hdr->read) nntp_data->unread--; mutt_debug(2, "mutt_hcache_store %s\n", buf); mutt_hcache_store(hc, buf, strlen(buf), hdr, 0); } #endif } #ifdef USE_HCACHE if (hc) { mutt_hcache_close(hc); nntp_data->last_cached = nntp_data->last_loaded; } #endif /* save .newsrc entries */ nntp_newsrc_gen_entries(ctx); nntp_newsrc_update(nntp_data->nserv); nntp_newsrc_close(nntp_data->nserv); return 0; }
static int nntp_mbox_sync(struct Context *ctx, int *index_hint) { struct NntpData *nntp_data = ctx->data; int rc; #ifdef USE_HCACHE header_cache_t *hc = NULL; #endif /* check for new articles */ nntp_data->nserv->check_time = 0; rc = check_mailbox(ctx); if (rc) return rc; #ifdef USE_HCACHE nntp_data->last_cached = 0; hc = nntp_hcache_open(nntp_data); #endif for (int i = 0; i < ctx->msgcount; i++) { struct Header *hdr = ctx->hdrs[i]; char buf[16]; snprintf(buf, sizeof(buf), "%d", NHDR(hdr)->article_num); if (nntp_data->bcache && hdr->deleted) { mutt_debug(2, "mutt_bcache_del %s\n", buf); mutt_bcache_del(nntp_data->bcache, buf); } #ifdef USE_HCACHE if (hc && (hdr->changed || hdr->deleted)) { if (hdr->deleted && !hdr->read) nntp_data->unread--; mutt_debug(2, "mutt_hcache_store %s\n", buf); mutt_hcache_store(hc, buf, strlen(buf), hdr, 0); } #endif } #ifdef USE_HCACHE if (hc) { mutt_hcache_close(hc); nntp_data->last_cached = nntp_data->last_loaded; } #endif /* save .newsrc entries */ nntp_newsrc_gen_entries(ctx); nntp_newsrc_update(nntp_data->nserv); nntp_newsrc_close(nntp_data->nserv); return 0; }
C
neomutt
0
null
null
null
https://github.com/chromium/chromium/commit/d30a8bd191f17b61938fc87890bffc80049b0774
d30a8bd191f17b61938fc87890bffc80049b0774
[Extensions] Rework inline installation observation Instead of observing through the WebstoreAPI, observe directly in the TabHelper. This is a great deal less code, more direct, and also fixes a lifetime issue with the TabHelper being deleted before the inline installation completes. BUG=613949 Review-Url: https://codereview.chromium.org/2103663002 Cr-Commit-Position: refs/heads/master@{#403188}
void TabHelper::SetTabId(content::RenderFrameHost* render_frame_host) { render_frame_host->Send( new ExtensionMsg_SetTabId(render_frame_host->GetRoutingID(), SessionTabHelper::IdForTab(web_contents()))); }
void TabHelper::SetTabId(content::RenderFrameHost* render_frame_host) { render_frame_host->Send( new ExtensionMsg_SetTabId(render_frame_host->GetRoutingID(), SessionTabHelper::IdForTab(web_contents()))); }
C
Chrome
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 <[email protected]>
static int size_of_ntlmssp_blob(struct cifs_ses *ses) { int sz = sizeof(AUTHENTICATE_MESSAGE) + ses->auth_key.len - CIFS_SESS_KEY_SIZE + CIFS_CPHTXT_SIZE + 2; if (ses->domainName) sz += 2 * strnlen(ses->domainName, CIFS_MAX_DOMAINNAME_LEN); else sz += 2; if (ses->user_name) sz += 2 * strnlen(ses->user_name, CIFS_MAX_USERNAME_LEN); else sz += 2; return sz; }
static int size_of_ntlmssp_blob(struct cifs_ses *ses) { int sz = sizeof(AUTHENTICATE_MESSAGE) + ses->auth_key.len - CIFS_SESS_KEY_SIZE + CIFS_CPHTXT_SIZE + 2; if (ses->domainName) sz += 2 * strnlen(ses->domainName, CIFS_MAX_DOMAINNAME_LEN); else sz += 2; if (ses->user_name) sz += 2 * strnlen(ses->user_name, CIFS_MAX_USERNAME_LEN); else sz += 2; return sz; }
C
linux
0
CVE-2015-1278
https://www.cvedetails.com/cve/CVE-2015-1278/
CWE-254
https://github.com/chromium/chromium/commit/784f56a9c97a838448dd23f9bdc7c05fe8e639b3
784f56a9c97a838448dd23f9bdc7c05fe8e639b3
Correctly reset FP in RFHI whenever origin changes Bug: 713364 Change-Id: Id8bb923750e20f3db6fc9358b1d44120513ac95f CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation Change-Id: Id8bb923750e20f3db6fc9358b1d44120513ac95f Reviewed-on: https://chromium-review.googlesource.com/482380 Commit-Queue: Ian Clelland <[email protected]> Reviewed-by: Charles Reis <[email protected]> Cr-Commit-Position: refs/heads/master@{#466778}
TestRenderWidgetHostView::TestRenderWidgetHostView(RenderWidgetHost* rwh) : rwh_(RenderWidgetHostImpl::From(rwh)), is_showing_(false), is_occluded_(false), did_swap_compositor_frame_(false), background_color_(SK_ColorWHITE) { #if defined(OS_ANDROID) frame_sink_id_ = AllocateFrameSinkId(); GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); #else if (ImageTransportFactory::GetInstance()) { frame_sink_id_ = AllocateFrameSinkId(); GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); } #endif rwh_->SetView(this); }
TestRenderWidgetHostView::TestRenderWidgetHostView(RenderWidgetHost* rwh) : rwh_(RenderWidgetHostImpl::From(rwh)), is_showing_(false), is_occluded_(false), did_swap_compositor_frame_(false), background_color_(SK_ColorWHITE) { #if defined(OS_ANDROID) frame_sink_id_ = AllocateFrameSinkId(); GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); #else if (ImageTransportFactory::GetInstance()) { frame_sink_id_ = AllocateFrameSinkId(); GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); } #endif rwh_->SetView(this); }
C
Chrome
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_x509_check_private_key) { zval ** zcert, **zkey; X509 * cert = NULL; EVP_PKEY * key = NULL; long certresource = -1, keyresource = -1; RETVAL_FALSE; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZ", &zcert, &zkey) == FAILURE) { return; } cert = php_openssl_x509_from_zval(zcert, 0, &certresource TSRMLS_CC); if (cert == NULL) { RETURN_FALSE; } key = php_openssl_evp_from_zval(zkey, 0, "", 1, &keyresource TSRMLS_CC); if (key) { RETVAL_BOOL(X509_check_private_key(cert, key)); } if (keyresource == -1 && key) { EVP_PKEY_free(key); } if (certresource == -1 && cert) { X509_free(cert); } }
PHP_FUNCTION(openssl_x509_check_private_key) { zval ** zcert, **zkey; X509 * cert = NULL; EVP_PKEY * key = NULL; long certresource = -1, keyresource = -1; RETVAL_FALSE; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZ", &zcert, &zkey) == FAILURE) { return; } cert = php_openssl_x509_from_zval(zcert, 0, &certresource TSRMLS_CC); if (cert == NULL) { RETURN_FALSE; } key = php_openssl_evp_from_zval(zkey, 0, "", 1, &keyresource TSRMLS_CC); if (key) { RETVAL_BOOL(X509_check_private_key(cert, key)); } if (keyresource == -1 && key) { EVP_PKEY_free(key); } if (certresource == -1 && cert) { X509_free(cert); } }
C
php
0
CVE-2017-11144
https://www.cvedetails.com/cve/CVE-2017-11144/
CWE-754
https://git.php.net/?p=php-src.git;a=commit;h=73cabfedf519298e1a11192699f44d53c529315e
73cabfedf519298e1a11192699f44d53c529315e
null
zend_bool php_openssl_pkey_init_and_assign_rsa(EVP_PKEY *pkey, RSA *rsa, zval *data) { BIGNUM *n, *e, *d, *p, *q, *dmp1, *dmq1, *iqmp; OPENSSL_PKEY_SET_BN(data, n); OPENSSL_PKEY_SET_BN(data, e); OPENSSL_PKEY_SET_BN(data, d); if (!n || !d || !RSA_set0_key(rsa, n, e, d)) { return 0; } OPENSSL_PKEY_SET_BN(data, p); OPENSSL_PKEY_SET_BN(data, q); if ((p || q) && !RSA_set0_factors(rsa, p, q)) { return 0; } OPENSSL_PKEY_SET_BN(data, dmp1); OPENSSL_PKEY_SET_BN(data, dmq1); OPENSSL_PKEY_SET_BN(data, iqmp); if ((dmp1 || dmq1 || iqmp) && !RSA_set0_crt_params(rsa, dmp1, dmq1, iqmp)) { return 0; } if (!EVP_PKEY_assign_RSA(pkey, rsa)) { return 0; } return 1; }
zend_bool php_openssl_pkey_init_and_assign_rsa(EVP_PKEY *pkey, RSA *rsa, zval *data) { BIGNUM *n, *e, *d, *p, *q, *dmp1, *dmq1, *iqmp; OPENSSL_PKEY_SET_BN(data, n); OPENSSL_PKEY_SET_BN(data, e); OPENSSL_PKEY_SET_BN(data, d); if (!n || !d || !RSA_set0_key(rsa, n, e, d)) { return 0; } OPENSSL_PKEY_SET_BN(data, p); OPENSSL_PKEY_SET_BN(data, q); if ((p || q) && !RSA_set0_factors(rsa, p, q)) { return 0; } OPENSSL_PKEY_SET_BN(data, dmp1); OPENSSL_PKEY_SET_BN(data, dmq1); OPENSSL_PKEY_SET_BN(data, iqmp); if ((dmp1 || dmq1 || iqmp) && !RSA_set0_crt_params(rsa, dmp1, dmq1, iqmp)) { return 0; } if (!EVP_PKEY_assign_RSA(pkey, rsa)) { return 0; } return 1; }
C
php
0
CVE-2011-1296
https://www.cvedetails.com/cve/CVE-2011-1296/
CWE-20
https://github.com/chromium/chromium/commit/c90c6ca59378d7e86d1a2f28fe96bada35df1508
c90c6ca59378d7e86d1a2f28fe96bada35df1508
Rename the TabContentWrapper pieces to be "TabHelper"s. (Except for the PasswordManager... for now.) Also, just pre-create them up-front. It saves us effort, as they're all going to be eventually created anyway, so being lazy saves us nothing and creates headaches since the rules about what can be lazy differ from feature to feature. BUG=71097 TEST=zero visible change Review URL: http://codereview.chromium.org/6480117 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75170 0039d316-1c4b-4281-b951-d872f2087c98
void Browser::SavePage() { UserMetrics::RecordAction(UserMetricsAction("SavePage"), profile_); TabContents* current_tab = GetSelectedTabContents(); if (current_tab && current_tab->contents_mime_type() == "application/pdf") UserMetrics::RecordAction(UserMetricsAction("PDF.SavePage"), profile_); GetSelectedTabContents()->OnSavePage(); }
void Browser::SavePage() { UserMetrics::RecordAction(UserMetricsAction("SavePage"), profile_); TabContents* current_tab = GetSelectedTabContents(); if (current_tab && current_tab->contents_mime_type() == "application/pdf") UserMetrics::RecordAction(UserMetricsAction("PDF.SavePage"), profile_); GetSelectedTabContents()->OnSavePage(); }
C
Chrome
0