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-3849
https://www.cvedetails.com/cve/CVE-2015-3849/
CWE-264
https://android.googlesource.com/platform/frameworks/base/+/4cff1f49ff95d990d6c2614da5d5a23d02145885
4cff1f49ff95d990d6c2614da5d5a23d02145885
Check that the parcel contained the expected amount of region data. DO NOT MERGE bug:20883006 Change-Id: Ib47a8ec8696dbc37e958b8dbceb43fcbabf6605b
static void Region_scale(JNIEnv* env, jobject region, jfloat scale, jobject dst) { SkRegion* rgn = GetSkRegion(env, region); if (dst) scale_rgn(GetSkRegion(env, dst), *rgn, scale); else scale_rgn(rgn, *rgn, scale); }
static void Region_scale(JNIEnv* env, jobject region, jfloat scale, jobject dst) { SkRegion* rgn = GetSkRegion(env, region); if (dst) scale_rgn(GetSkRegion(env, dst), *rgn, scale); else scale_rgn(rgn, *rgn, scale); }
C
Android
0
CVE-2017-6386
https://www.cvedetails.com/cve/CVE-2017-6386/
CWE-772
https://cgit.freedesktop.org/virglrenderer/commit/?id=737c3350850ca4dbc5633b3bdb4118176ce59920
737c3350850ca4dbc5633b3bdb4118176ce59920
null
void vrend_set_constants(struct vrend_context *ctx, uint32_t shader, uint32_t index, uint32_t num_constant, float *data) { struct vrend_constants *consts; int i; consts = &ctx->sub->consts[shader]; ctx->sub->const_dirty[shader] = true; consts->consts = realloc(consts->consts, num_constant * sizeof(float)); if (!consts->consts) return; consts->num_consts = num_constant; for (i = 0; i < num_constant; i++) consts->consts[i] = ((unsigned int *)data)[i]; }
void vrend_set_constants(struct vrend_context *ctx, uint32_t shader, uint32_t index, uint32_t num_constant, float *data) { struct vrend_constants *consts; int i; consts = &ctx->sub->consts[shader]; ctx->sub->const_dirty[shader] = true; consts->consts = realloc(consts->consts, num_constant * sizeof(float)); if (!consts->consts) return; consts->num_consts = num_constant; for (i = 0; i < num_constant; i++) consts->consts[i] = ((unsigned int *)data)[i]; }
C
virglrenderer
0
CVE-2014-9903
https://www.cvedetails.com/cve/CVE-2014-9903/
CWE-200
https://github.com/torvalds/linux/commit/4efbc454ba68def5ef285b26ebfcfdb605b52755
4efbc454ba68def5ef285b26ebfcfdb605b52755
sched: Fix information leak in sys_sched_getattr() We're copying the on-stack structure to userspace, but forgot to give the right number of bytes to copy. This allows the calling process to obtain up to PAGE_SIZE bytes from the stack (and possibly adjacent kernel memory). This fix copies only as much as we actually have on the stack (attr->size defaults to the size of the struct) and leaves the rest of the userspace-provided buffer untouched. Found using kmemcheck + trinity. Fixes: d50dde5a10f30 ("sched: Add new scheduler syscalls to support an extended scheduling parameters ABI") Cc: Dario Faggioli <[email protected]> Cc: Juri Lelli <[email protected]> Cc: Ingo Molnar <[email protected]> Signed-off-by: Vegard Nossum <[email protected]> Signed-off-by: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Thomas Gleixner <[email protected]>
static int cpuset_cpu_inactive(struct notifier_block *nfb, unsigned long action, void *hcpu) { switch (action) { case CPU_DOWN_PREPARE: cpuset_update_active_cpus(false); break; case CPU_DOWN_PREPARE_FROZEN: num_cpus_frozen++; partition_sched_domains(1, NULL, NULL); break; default: return NOTIFY_DONE; } return NOTIFY_OK; }
static int cpuset_cpu_inactive(struct notifier_block *nfb, unsigned long action, void *hcpu) { switch (action) { case CPU_DOWN_PREPARE: cpuset_update_active_cpus(false); break; case CPU_DOWN_PREPARE_FROZEN: num_cpus_frozen++; partition_sched_domains(1, NULL, NULL); break; default: return NOTIFY_DONE; } return NOTIFY_OK; }
C
linux
0
CVE-2018-16073
https://www.cvedetails.com/cve/CVE-2018-16073/
CWE-285
https://github.com/chromium/chromium/commit/0bb3f5c715eb66bb5c1fb05fd81d902ca57f33ca
0bb3f5c715eb66bb5c1fb05fd81d902ca57f33ca
Use unique processes for data URLs on restore. Data URLs are usually put into the process that created them, but this info is not tracked after a tab restore. Ensure that they do not end up in the parent frame's process (or each other's process), in case they are malicious. BUG=863069 Change-Id: Ib391f90c7bdf28a0a9c057c5cc7918c10aed968b Reviewed-on: https://chromium-review.googlesource.com/1150767 Reviewed-by: Alex Moshchuk <[email protected]> Reviewed-by: Lei Zhang <[email protected]> Commit-Queue: Charlie Reis <[email protected]> Cr-Commit-Position: refs/heads/master@{#581023}
RenderFrameHostManager::GetSiteInstanceForNavigationRequest( const NavigationRequest& request) { SiteInstance* current_site_instance = render_frame_host_->GetSiteInstance(); bool no_renderer_swap_allowed = false; bool was_server_redirect = request.navigation_handle() && request.navigation_handle()->WasServerRedirect(); if (frame_tree_node_->IsMainFrame()) { bool can_renderer_initiate_transfer = (request.state() == NavigationRequest::FAILED && SiteIsolationPolicy::IsErrorPageIsolationEnabled( true /* in_main_frame */)) || (render_frame_host_->IsRenderFrameLive() && IsURLHandledByNetworkStack(request.common_params().url) && IsRendererTransferNeededForNavigation(render_frame_host_.get(), request.common_params().url)); no_renderer_swap_allowed |= request.from_begin_navigation() && !can_renderer_initiate_transfer; } else { no_renderer_swap_allowed |= !CanSubframeSwapProcess( request.common_params().url, request.source_site_instance(), request.dest_site_instance()); } if (no_renderer_swap_allowed) return scoped_refptr<SiteInstance>(current_site_instance); SiteInstance* candidate_site_instance = speculative_render_frame_host_ ? speculative_render_frame_host_->GetSiteInstance() : nullptr; scoped_refptr<SiteInstance> dest_site_instance = GetSiteInstanceForNavigation( request.common_params().url, request.source_site_instance(), request.dest_site_instance(), candidate_site_instance, request.common_params().transition, request.state() == NavigationRequest::FAILED, request.restore_type() != RestoreType::NONE, request.is_view_source(), was_server_redirect); return dest_site_instance; }
RenderFrameHostManager::GetSiteInstanceForNavigationRequest( const NavigationRequest& request) { SiteInstance* current_site_instance = render_frame_host_->GetSiteInstance(); bool no_renderer_swap_allowed = false; bool was_server_redirect = request.navigation_handle() && request.navigation_handle()->WasServerRedirect(); if (frame_tree_node_->IsMainFrame()) { bool can_renderer_initiate_transfer = (request.state() == NavigationRequest::FAILED && SiteIsolationPolicy::IsErrorPageIsolationEnabled( true /* in_main_frame */)) || (render_frame_host_->IsRenderFrameLive() && IsURLHandledByNetworkStack(request.common_params().url) && IsRendererTransferNeededForNavigation(render_frame_host_.get(), request.common_params().url)); no_renderer_swap_allowed |= request.from_begin_navigation() && !can_renderer_initiate_transfer; } else { no_renderer_swap_allowed |= !CanSubframeSwapProcess( request.common_params().url, request.source_site_instance(), request.dest_site_instance(), was_server_redirect); } if (no_renderer_swap_allowed) return scoped_refptr<SiteInstance>(current_site_instance); SiteInstance* candidate_site_instance = speculative_render_frame_host_ ? speculative_render_frame_host_->GetSiteInstance() : nullptr; scoped_refptr<SiteInstance> dest_site_instance = GetSiteInstanceForNavigation( request.common_params().url, request.source_site_instance(), request.dest_site_instance(), candidate_site_instance, request.common_params().transition, request.state() == NavigationRequest::FAILED, request.restore_type() != RestoreType::NONE, request.is_view_source(), was_server_redirect); return dest_site_instance; }
C
Chrome
1
CVE-2013-6625
https://www.cvedetails.com/cve/CVE-2013-6625/
CWE-399
https://github.com/chromium/chromium/commit/f084d7007f67809ef116ee6b11f251bf3c9ed895
f084d7007f67809ef116ee6b11f251bf3c9ed895
Notify nodes removal to Range/Selection after dispatching blur and mutation event This patch changes notifying nodes removal to Range/Selection after dispatching blur and mutation event. In willRemoveChildren(), like willRemoveChild(); r115686 did same change, although it didn't change willRemoveChildren(). The issue 295010, use-after-free, is caused by setting removed node to Selection in mutation event handler. BUG=295010 TEST=LayoutTests/fast/dom/Range/range-created-during-remove-children.html, LayoutTests/editing/selection/selection-change-in-mutation-event-by-remove-children.html, LayoutTests/editing/selection/selection-change-in-blur-event-by-remove-children.html [email protected] Review URL: https://codereview.chromium.org/25389004 git-svn-id: svn://svn.chromium.org/blink/trunk@159007 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void ContainerNode::detach(const AttachContext& context) { detachChildren(context); clearChildNeedsStyleRecalc(); Node::detach(context); }
void ContainerNode::detach(const AttachContext& context) { detachChildren(context); clearChildNeedsStyleRecalc(); Node::detach(context); }
C
Chrome
0
CVE-2010-1166
https://www.cvedetails.com/cve/CVE-2010-1166/
CWE-189
https://cgit.freedesktop.org/xorg/xserver/commit/?id=d2f813f7db
d2f813f7db157fc83abc4b3726821c36ee7e40b1
null
fbStore_g1 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 *pixel = ((CARD32 *) bits) + ((i+x) >> 5); CARD32 mask = FbStipMask((i+x) & 0x1f, 1); CARD32 v = miIndexToEntY24(indexed,READ(values + i)) ? mask : 0; WRITE(pixel, (READ(pixel) & ~mask) | v); } }
fbStore_g1 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 *pixel = ((CARD32 *) bits) + ((i+x) >> 5); CARD32 mask = FbStipMask((i+x) & 0x1f, 1); CARD32 v = miIndexToEntY24(indexed,READ(values + i)) ? mask : 0; WRITE(pixel, (READ(pixel) & ~mask) | v); } }
C
xserver
0
CVE-2016-9137
https://www.cvedetails.com/cve/CVE-2016-9137/
CWE-416
https://git.php.net/?p=php-src.git;a=commit;h=0e6fe3a4c96be2d3e88389a5776f878021b4c59f
0e6fe3a4c96be2d3e88389a5776f878021b4c59f
null
ZEND_API int add_next_index_string(zval *arg, const char *str, int duplicate) /* {{{ */ { zval *tmp; MAKE_STD_ZVAL(tmp); ZVAL_STRING(tmp, str, duplicate); return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL); } /* }}} */
ZEND_API int add_next_index_string(zval *arg, const char *str, int duplicate) /* {{{ */ { zval *tmp; MAKE_STD_ZVAL(tmp); ZVAL_STRING(tmp, str, duplicate); return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp, sizeof(zval *), NULL); } /* }}} */
C
php
0
CVE-2016-5200
https://www.cvedetails.com/cve/CVE-2016-5200/
CWE-119
https://github.com/chromium/chromium/commit/2f19869af13bbfdcfd682a55c0d2c61c6e102475
2f19869af13bbfdcfd682a55c0d2c61c6e102475
chrome/browser/ui/webauthn: long domains may cause a line break. As requested by UX in [1], allow long host names to split a title into two lines. This allows us to show more of the name before eliding, although sufficiently long names will still trigger elision. Screenshot at https://drive.google.com/open?id=1_V6t2CeZDAVazy3Px-OET2LnB__aEW1r. [1] https://docs.google.com/presentation/d/1TtxkPUchyVZulqgdMcfui-68B0W-DWaFFVJEffGIbLA/edit#slide=id.g5913c4105f_1_12 Change-Id: I70f6541e0db3e9942239304de43b487a7561ca34 Bug: 870892 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1601812 Auto-Submit: Adam Langley <[email protected]> Commit-Queue: Nina Satragno <[email protected]> Reviewed-by: Nina Satragno <[email protected]> Cr-Commit-Position: refs/heads/master@{#658114}
base::string16 AuthenticatorAlreadyRegisteredErrorModel::GetStepTitle() const { return l10n_util::GetStringUTF16(IDS_WEBAUTHN_ERROR_WRONG_KEY_TITLE); }
base::string16 AuthenticatorAlreadyRegisteredErrorModel::GetStepTitle() const { return l10n_util::GetStringUTF16(IDS_WEBAUTHN_ERROR_WRONG_KEY_TITLE); }
C
Chrome
0
CVE-2019-5838
https://www.cvedetails.com/cve/CVE-2019-5838/
CWE-20
https://github.com/chromium/chromium/commit/0660e08731fd42076d7242068e9eaed1482b14d5
0660e08731fd42076d7242068e9eaed1482b14d5
Call CanCaptureVisiblePage in page capture API. Currently the pageCapture permission allows access to arbitrary local files and chrome:// pages which can be a security concern. In order to address this, the page capture API needs to be changed similar to the captureVisibleTab API. The API will now only allow extensions to capture otherwise-restricted URLs if the user has granted activeTab. In addition, file:// URLs are only capturable with the "Allow on file URLs" option enabled. Bug: 893087 Change-Id: I6d6225a3efb70fc033e2e1c031c633869afac624 Reviewed-on: https://chromium-review.googlesource.com/c/1330689 Commit-Queue: Bettina Dea <[email protected]> Reviewed-by: Devlin <[email protected]> Reviewed-by: Varun Khaneja <[email protected]> Cr-Commit-Position: refs/heads/master@{#615248}
AccessType GetExtensionAccess(const Extension* extension, const GURL& url, int tab_id) { bool allowed_script = IsAllowedScript(extension, url, tab_id); bool allowed_capture = extension->permissions_data()->CanCaptureVisiblePage( url, tab_id, nullptr, extensions::CaptureRequirement::kActiveTabOrAllUrls); if (allowed_script && allowed_capture) return ALLOWED_SCRIPT_AND_CAPTURE; if (allowed_script) return ALLOWED_SCRIPT_ONLY; if (allowed_capture) return ALLOWED_CAPTURE_ONLY; return DISALLOWED; }
AccessType GetExtensionAccess(const Extension* extension, const GURL& url, int tab_id) { bool allowed_script = IsAllowedScript(extension, url, tab_id); bool allowed_capture = extension->permissions_data()->CanCaptureVisiblePage( url, tab_id, nullptr); if (allowed_script && allowed_capture) return ALLOWED_SCRIPT_AND_CAPTURE; if (allowed_script) return ALLOWED_SCRIPT_ONLY; if (allowed_capture) return ALLOWED_CAPTURE_ONLY; return DISALLOWED; }
C
Chrome
1
CVE-2017-13083
https://www.cvedetails.com/cve/CVE-2017-13083/
CWE-494
https://github.com/pbatard/rufus/commit/c3c39f7f8a11f612c4ebf7affce25ec6928eb1cb
c3c39f7f8a11f612c4ebf7affce25ec6928eb1cb
[pki] fix https://www.kb.cert.org/vuls/id/403768 * This commit effectively fixes https://www.kb.cert.org/vuls/id/403768 (CVE-2017-13083) as it is described per its revision 11, which is the latest revision at the time of this commit, by disabling Windows prompts, enacted during signature validation, that allow the user to bypass the intended signature verification checks. * It needs to be pointed out that the vulnerability ("allow(ing) the use of a self-signed certificate"), which relies on the end-user actively ignoring a Windows prompt that tells them that the update failed the signature validation whilst also advising against running it, is being fully addressed, even as the update protocol remains HTTP. * It also need to be pointed out that the extended delay (48 hours) between the time the vulnerability was reported and the moment it is fixed in our codebase has to do with the fact that the reporter chose to deviate from standard security practices by not disclosing the details of the vulnerability with us, be it publicly or privately, before creating the cert.org report. The only advance notification we received was a generic note about the use of HTTP vs HTTPS, which, as have established, is not immediately relevant to addressing the reported vulnerability. * Closes #1009 * Note: The other vulnerability scenario described towards the end of #1009, which doesn't have to do with the "lack of CA checking", will be addressed separately.
LPCDLGTEMPLATE GetDialogTemplate(int Dialog_ID) { int i; const char thai_id[] = "th-TH"; size_t len; DWORD size; DWORD* dwBuf; WCHAR* wBuf; LPCDLGTEMPLATE rcTemplate = (LPCDLGTEMPLATE) GetResource(hMainInstance, MAKEINTRESOURCEA(Dialog_ID), _RT_DIALOG, get_name_from_id(Dialog_ID), &size, TRUE); if ((size == 0) || (rcTemplate == NULL)) { safe_free(rcTemplate); return NULL; } if (right_to_left_mode) { dwBuf = (DWORD*)rcTemplate; dwBuf[2] = WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL; } if (IsFontAvailable("Segoe UI Symbol") && (selected_locale != NULL) && (safe_strcmp(selected_locale->txt[0], thai_id) == 0)) return rcTemplate; wBuf = (WCHAR*)rcTemplate; wBuf = &wBuf[14]; // Move to class name for (i = 0; i<2; i++) { if (*wBuf == 0xFFFF) wBuf = &wBuf[2]; // Ordinal else wBuf = &wBuf[wcslen(wBuf) + 1]; // String } wBuf = &wBuf[3]; if (wcscmp(L"Segoe UI Symbol", wBuf) == 0) { uintptr_t src, dst, start = (uintptr_t)rcTemplate; if ((nWindowsVersion > WINDOWS_XP) && IsFontAvailable("Segoe UI")) { wBuf[8] = 0; } else { wcscpy(wBuf, L"MS Shell Dlg"); } len = wcslen(wBuf); wBuf[len + 1] = 0; dst = (uintptr_t)&wBuf[len + 2]; dst &= ~3; src = (uintptr_t)&wBuf[17]; src &= ~3; memmove((void*)dst, (void*)src, size - (src - start)); } else { uprintf("Could not locate font for %s!", get_name_from_id(Dialog_ID)); } return rcTemplate; }
LPCDLGTEMPLATE GetDialogTemplate(int Dialog_ID) { int i; const char thai_id[] = "th-TH"; size_t len; DWORD size; DWORD* dwBuf; WCHAR* wBuf; LPCDLGTEMPLATE rcTemplate = (LPCDLGTEMPLATE) GetResource(hMainInstance, MAKEINTRESOURCEA(Dialog_ID), _RT_DIALOG, get_name_from_id(Dialog_ID), &size, TRUE); if ((size == 0) || (rcTemplate == NULL)) { safe_free(rcTemplate); return NULL; } if (right_to_left_mode) { dwBuf = (DWORD*)rcTemplate; dwBuf[2] = WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL; } if (IsFontAvailable("Segoe UI Symbol") && (selected_locale != NULL) && (safe_strcmp(selected_locale->txt[0], thai_id) == 0)) return rcTemplate; wBuf = (WCHAR*)rcTemplate; wBuf = &wBuf[14]; // Move to class name for (i = 0; i<2; i++) { if (*wBuf == 0xFFFF) wBuf = &wBuf[2]; // Ordinal else wBuf = &wBuf[wcslen(wBuf) + 1]; // String } wBuf = &wBuf[3]; if (wcscmp(L"Segoe UI Symbol", wBuf) == 0) { uintptr_t src, dst, start = (uintptr_t)rcTemplate; if ((nWindowsVersion > WINDOWS_XP) && IsFontAvailable("Segoe UI")) { wBuf[8] = 0; } else { wcscpy(wBuf, L"MS Shell Dlg"); } len = wcslen(wBuf); wBuf[len + 1] = 0; dst = (uintptr_t)&wBuf[len + 2]; dst &= ~3; src = (uintptr_t)&wBuf[17]; src &= ~3; memmove((void*)dst, (void*)src, size - (src - start)); } else { uprintf("Could not locate font for %s!", get_name_from_id(Dialog_ID)); } return rcTemplate; }
C
rufus
0
null
null
null
https://github.com/chromium/chromium/commit/befb46ae3385fa13975521e9a2281e35805b339e
befb46ae3385fa13975521e9a2281e35805b339e
2009-10-23 Chris Evans <[email protected]> Reviewed by Adam Barth. Added test for bug 27239 (ignore Refresh for view source mode). https://bugs.webkit.org/show_bug.cgi?id=27239 * http/tests/security/view-source-no-refresh.html: Added * http/tests/security/view-source-no-refresh-expected.txt: Added * http/tests/security/resources/view-source-no-refresh.php: Added 2009-10-23 Chris Evans <[email protected]> Reviewed by Adam Barth. Ignore the Refresh header if we're in view source mode. https://bugs.webkit.org/show_bug.cgi?id=27239 Test: http/tests/security/view-source-no-refresh.html * loader/FrameLoader.cpp: ignore Refresh in view-source mode. git-svn-id: svn://svn.chromium.org/blink/trunk@50018 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void FrameLoader::load(const ResourceRequest& request, const String& frameName, bool lockHistory) { if (frameName.isEmpty()) { load(request, lockHistory); return; } Frame* frame = findFrameForNavigation(frameName); if (frame) { frame->loader()->load(request, lockHistory); return; } policyChecker()->checkNewWindowPolicy(NavigationAction(request.url(), NavigationTypeOther), FrameLoader::callContinueLoadAfterNewWindowPolicy, request, 0, frameName, this); }
void FrameLoader::load(const ResourceRequest& request, const String& frameName, bool lockHistory) { if (frameName.isEmpty()) { load(request, lockHistory); return; } Frame* frame = findFrameForNavigation(frameName); if (frame) { frame->loader()->load(request, lockHistory); return; } policyChecker()->checkNewWindowPolicy(NavigationAction(request.url(), NavigationTypeOther), FrameLoader::callContinueLoadAfterNewWindowPolicy, request, 0, frameName, this); }
C
Chrome
0
CVE-2015-6763
https://www.cvedetails.com/cve/CVE-2015-6763/
null
https://github.com/chromium/chromium/commit/f1574f25e1402e748bf2bd7e28ce3dd96ceb1ca4
f1574f25e1402e748bf2bd7e28ce3dd96ceb1ca4
MacViews: Enable secure text input for password Textfields. In Cocoa the NSTextInputContext automatically enables secure text input when activated and it's in the secure text entry mode. RenderWidgetHostViewMac did the similar thing for ages following the WebKit example. views::Textfield needs to do the same thing in a fashion that's sycnrhonized with RenderWidgetHostViewMac, otherwise the race conditions are possible when the Textfield gets focus, activates the secure text input mode and the RWHVM loses focus immediately afterwards and disables the secure text input instead of leaving it in the enabled state. BUG=818133,677220 Change-Id: I6db6c4b59e4a1a72cbb7f8c7056f71b04a3df08b Reviewed-on: https://chromium-review.googlesource.com/943064 Commit-Queue: Michail Pishchagin <[email protected]> Reviewed-by: Pavel Feldman <[email protected]> Reviewed-by: Avi Drissman <[email protected]> Reviewed-by: Peter Kasting <[email protected]> Cr-Commit-Position: refs/heads/master@{#542517}
String HTMLInputElement::value() const { switch (input_type_->GetValueMode()) { case ValueMode::kFilename: return input_type_->ValueInFilenameValueMode(); case ValueMode::kDefault: return FastGetAttribute(valueAttr); case ValueMode::kDefaultOn: { AtomicString value_string = FastGetAttribute(valueAttr); return value_string.IsNull() ? "on" : value_string; } case ValueMode::kValue: return non_attribute_value_; } NOTREACHED(); return g_empty_string; }
String HTMLInputElement::value() const { switch (input_type_->GetValueMode()) { case ValueMode::kFilename: return input_type_->ValueInFilenameValueMode(); case ValueMode::kDefault: return FastGetAttribute(valueAttr); case ValueMode::kDefaultOn: { AtomicString value_string = FastGetAttribute(valueAttr); return value_string.IsNull() ? "on" : value_string; } case ValueMode::kValue: return non_attribute_value_; } NOTREACHED(); return g_empty_string; }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/9d02cda7a634fbd6e53d98091f618057f0174387
9d02cda7a634fbd6e53d98091f618057f0174387
Coverity: Fixing pass by value. CID=101462, 101458, 101437, 101471, 101467 BUG=NONE TEST=NONE Review URL: http://codereview.chromium.org/9006023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115257 0039d316-1c4b-4281-b951-d872f2087c98
void ExtensionHelper::OnNotifyRendererViewType(content::ViewType type) { view_type_ = type; }
void ExtensionHelper::OnNotifyRendererViewType(content::ViewType type) { view_type_ = type; }
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
virtual double GetWidthForTab(int index) const { TabGtk* tab = tabstrip_->GetTabAt(index); if (index == to_index_) return animation_.CurrentValueBetween(0, target_bounds_.width()); if (tab->mini()) return TabGtk::GetMiniWidth(); if (tab->IsActive()) { return animation_.CurrentValueBetween(start_selected_width_, end_selected_width_); } return animation_.CurrentValueBetween(start_unselected_width_, end_unselected_width_); }
virtual double GetWidthForTab(int index) const { TabGtk* tab = tabstrip_->GetTabAt(index); if (index == to_index_) return animation_.CurrentValueBetween(0, target_bounds_.width()); if (tab->mini()) return TabGtk::GetMiniWidth(); if (tab->IsActive()) { return animation_.CurrentValueBetween(start_selected_width_, end_selected_width_); } return animation_.CurrentValueBetween(start_unselected_width_, end_unselected_width_); }
C
Chrome
0
CVE-2013-1774
https://www.cvedetails.com/cve/CVE-2013-1774/
CWE-264
https://github.com/torvalds/linux/commit/1ee0a224bc9aad1de496c795f96bc6ba2c394811
1ee0a224bc9aad1de496c795f96bc6ba2c394811
USB: io_ti: Fix NULL dereference in chase_port() The tty is NULL when the port is hanging up. chase_port() needs to check for this. This patch is intended for stable series. The behavior was observed and tested in Linux 3.2 and 3.7.1. Johan Hovold submitted a more elaborate patch for the mainline kernel. [ 56.277883] usb 1-1: edge_bulk_in_callback - nonzero read bulk status received: -84 [ 56.278811] usb 1-1: USB disconnect, device number 3 [ 56.278856] usb 1-1: edge_bulk_in_callback - stopping read! [ 56.279562] BUG: unable to handle kernel NULL pointer dereference at 00000000000001c8 [ 56.280536] IP: [<ffffffff8144e62a>] _raw_spin_lock_irqsave+0x19/0x35 [ 56.281212] PGD 1dc1b067 PUD 1e0f7067 PMD 0 [ 56.282085] Oops: 0002 [#1] SMP [ 56.282744] Modules linked in: [ 56.283512] CPU 1 [ 56.283512] Pid: 25, comm: khubd Not tainted 3.7.1 #1 innotek GmbH VirtualBox/VirtualBox [ 56.283512] RIP: 0010:[<ffffffff8144e62a>] [<ffffffff8144e62a>] _raw_spin_lock_irqsave+0x19/0x35 [ 56.283512] RSP: 0018:ffff88001fa99ab0 EFLAGS: 00010046 [ 56.283512] RAX: 0000000000000046 RBX: 00000000000001c8 RCX: 0000000000640064 [ 56.283512] RDX: 0000000000010000 RSI: ffff88001fa99b20 RDI: 00000000000001c8 [ 56.283512] RBP: ffff88001fa99b20 R08: 0000000000000000 R09: 0000000000000000 [ 56.283512] R10: 0000000000000000 R11: ffffffff812fcb4c R12: ffff88001ddf53c0 [ 56.283512] R13: 0000000000000000 R14: 00000000000001c8 R15: ffff88001e19b9f4 [ 56.283512] FS: 0000000000000000(0000) GS:ffff88001fd00000(0000) knlGS:0000000000000000 [ 56.283512] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 56.283512] CR2: 00000000000001c8 CR3: 000000001dc51000 CR4: 00000000000006e0 [ 56.283512] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 56.283512] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 56.283512] Process khubd (pid: 25, threadinfo ffff88001fa98000, task ffff88001fa94f80) [ 56.283512] Stack: [ 56.283512] 0000000000000046 00000000000001c8 ffffffff810578ec ffffffff812fcb4c [ 56.283512] ffff88001e19b980 0000000000002710 ffffffff812ffe81 0000000000000001 [ 56.283512] ffff88001fa94f80 0000000000000202 ffffffff00000001 0000000000000296 [ 56.283512] Call Trace: [ 56.283512] [<ffffffff810578ec>] ? add_wait_queue+0x12/0x3c [ 56.283512] [<ffffffff812fcb4c>] ? usb_serial_port_work+0x28/0x28 [ 56.283512] [<ffffffff812ffe81>] ? chase_port+0x84/0x2d6 [ 56.283512] [<ffffffff81063f27>] ? try_to_wake_up+0x199/0x199 [ 56.283512] [<ffffffff81263a5c>] ? tty_ldisc_hangup+0x222/0x298 [ 56.283512] [<ffffffff81300171>] ? edge_close+0x64/0x129 [ 56.283512] [<ffffffff810612f7>] ? __wake_up+0x35/0x46 [ 56.283512] [<ffffffff8106135b>] ? should_resched+0x5/0x23 [ 56.283512] [<ffffffff81264916>] ? tty_port_shutdown+0x39/0x44 [ 56.283512] [<ffffffff812fcb4c>] ? usb_serial_port_work+0x28/0x28 [ 56.283512] [<ffffffff8125d38c>] ? __tty_hangup+0x307/0x351 [ 56.283512] [<ffffffff812e6ddc>] ? usb_hcd_flush_endpoint+0xde/0xed [ 56.283512] [<ffffffff8144e625>] ? _raw_spin_lock_irqsave+0x14/0x35 [ 56.283512] [<ffffffff812fd361>] ? usb_serial_disconnect+0x57/0xc2 [ 56.283512] [<ffffffff812ea99b>] ? usb_unbind_interface+0x5c/0x131 [ 56.283512] [<ffffffff8128d738>] ? __device_release_driver+0x7f/0xd5 [ 56.283512] [<ffffffff8128d9cd>] ? device_release_driver+0x1a/0x25 [ 56.283512] [<ffffffff8128d393>] ? bus_remove_device+0xd2/0xe7 [ 56.283512] [<ffffffff8128b7a3>] ? device_del+0x119/0x167 [ 56.283512] [<ffffffff812e8d9d>] ? usb_disable_device+0x6a/0x180 [ 56.283512] [<ffffffff812e2ae0>] ? usb_disconnect+0x81/0xe6 [ 56.283512] [<ffffffff812e4435>] ? hub_thread+0x577/0xe82 [ 56.283512] [<ffffffff8144daa7>] ? __schedule+0x490/0x4be [ 56.283512] [<ffffffff8105798f>] ? abort_exclusive_wait+0x79/0x79 [ 56.283512] [<ffffffff812e3ebe>] ? usb_remote_wakeup+0x2f/0x2f [ 56.283512] [<ffffffff812e3ebe>] ? usb_remote_wakeup+0x2f/0x2f [ 56.283512] [<ffffffff810570b4>] ? kthread+0x81/0x89 [ 56.283512] [<ffffffff81057033>] ? __kthread_parkme+0x5c/0x5c [ 56.283512] [<ffffffff8145387c>] ? ret_from_fork+0x7c/0xb0 [ 56.283512] [<ffffffff81057033>] ? __kthread_parkme+0x5c/0x5c [ 56.283512] Code: 8b 7c 24 08 e8 17 0b c3 ff 48 8b 04 24 48 83 c4 10 c3 53 48 89 fb 41 50 e8 e0 0a c3 ff 48 89 04 24 e8 e7 0a c3 ff ba 00 00 01 00 <f0> 0f c1 13 48 8b 04 24 89 d1 c1 ea 10 66 39 d1 74 07 f3 90 66 [ 56.283512] RIP [<ffffffff8144e62a>] _raw_spin_lock_irqsave+0x19/0x35 [ 56.283512] RSP <ffff88001fa99ab0> [ 56.283512] CR2: 00000000000001c8 [ 56.283512] ---[ end trace 49714df27e1679ce ]--- Signed-off-by: Wolfgang Frisch <[email protected]> Cc: Johan Hovold <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
static int edge_write_room(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct edgeport_port *edge_port = usb_get_serial_port_data(port); int room = 0; unsigned long flags; if (edge_port == NULL) return 0; if (edge_port->close_pending == 1) return 0; spin_lock_irqsave(&edge_port->ep_lock, flags); room = kfifo_avail(&edge_port->write_fifo); spin_unlock_irqrestore(&edge_port->ep_lock, flags); dev_dbg(&port->dev, "%s - returns %d\n", __func__, room); return room; }
static int edge_write_room(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct edgeport_port *edge_port = usb_get_serial_port_data(port); int room = 0; unsigned long flags; if (edge_port == NULL) return 0; if (edge_port->close_pending == 1) return 0; spin_lock_irqsave(&edge_port->ep_lock, flags); room = kfifo_avail(&edge_port->write_fifo); spin_unlock_irqrestore(&edge_port->ep_lock, flags); dev_dbg(&port->dev, "%s - returns %d\n", __func__, room); return room; }
C
linux
0
CVE-2016-3924
https://www.cvedetails.com/cve/CVE-2016-3924/
CWE-200
https://android.googlesource.com/platform/frameworks/av/+/c894aa36be535886a8e5ff02cdbcd07dd24618f6
c894aa36be535886a8e5ff02cdbcd07dd24618f6
Add EFFECT_CMD_SET_PARAM parameter checking Bug: 30204301 Change-Id: Ib9c3ee1c2f23c96f8f7092dd9e146bc453d7a290 (cherry picked from commit e4a1d91501d47931dbae19c47815952378787ab6)
status_t AudioFlinger::EffectHandle::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { return BnEffect::onTransact(code, data, reply, flags); }
status_t AudioFlinger::EffectHandle::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { return BnEffect::onTransact(code, data, reply, flags); }
C
Android
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
hook_add_to_list (struct t_hook *new_hook) { struct t_hook *pos_hook; if (weechat_hooks[new_hook->type]) { pos_hook = hook_find_pos (new_hook); if (pos_hook) { /* add hook before "pos_hook" */ new_hook->prev_hook = pos_hook->prev_hook; new_hook->next_hook = pos_hook; if (pos_hook->prev_hook) (pos_hook->prev_hook)->next_hook = new_hook; else weechat_hooks[new_hook->type] = new_hook; pos_hook->prev_hook = new_hook; } else { /* add hook to end of list */ new_hook->prev_hook = last_weechat_hook[new_hook->type]; new_hook->next_hook = NULL; last_weechat_hook[new_hook->type]->next_hook = new_hook; last_weechat_hook[new_hook->type] = new_hook; } } else { new_hook->prev_hook = NULL; new_hook->next_hook = NULL; weechat_hooks[new_hook->type] = new_hook; last_weechat_hook[new_hook->type] = new_hook; } }
hook_add_to_list (struct t_hook *new_hook) { struct t_hook *pos_hook; if (weechat_hooks[new_hook->type]) { pos_hook = hook_find_pos (new_hook); if (pos_hook) { /* add hook before "pos_hook" */ new_hook->prev_hook = pos_hook->prev_hook; new_hook->next_hook = pos_hook; if (pos_hook->prev_hook) (pos_hook->prev_hook)->next_hook = new_hook; else weechat_hooks[new_hook->type] = new_hook; pos_hook->prev_hook = new_hook; } else { /* add hook to end of list */ new_hook->prev_hook = last_weechat_hook[new_hook->type]; new_hook->next_hook = NULL; last_weechat_hook[new_hook->type]->next_hook = new_hook; last_weechat_hook[new_hook->type] = new_hook; } } else { new_hook->prev_hook = NULL; new_hook->next_hook = NULL; weechat_hooks[new_hook->type] = new_hook; last_weechat_hook[new_hook->type] = new_hook; } }
C
savannah
0
CVE-2018-13006
https://www.cvedetails.com/cve/CVE-2018-13006/
CWE-125
https://github.com/gpac/gpac/commit/bceb03fd2be95097a7b409ea59914f332fb6bc86
bceb03fd2be95097a7b409ea59914f332fb6bc86
fixed 2 possible heap overflows (inc. #1088)
GF_Err mp4s_AddBox(GF_Box *s, GF_Box *a) { GF_MPEGSampleEntryBox *ptr = (GF_MPEGSampleEntryBox *)s; switch (a->type) { case GF_ISOM_BOX_TYPE_ESDS: if (ptr->esd) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->esd = (GF_ESDBox *)a; break; case GF_ISOM_BOX_TYPE_SINF: gf_list_add(ptr->protections, a); break; default: return gf_isom_box_add_default(s, a); } return GF_OK; }
GF_Err mp4s_AddBox(GF_Box *s, GF_Box *a) { GF_MPEGSampleEntryBox *ptr = (GF_MPEGSampleEntryBox *)s; switch (a->type) { case GF_ISOM_BOX_TYPE_ESDS: if (ptr->esd) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->esd = (GF_ESDBox *)a; break; case GF_ISOM_BOX_TYPE_SINF: gf_list_add(ptr->protections, a); break; default: return gf_isom_box_add_default(s, a); } return GF_OK; }
C
gpac
0
CVE-2016-10012
https://www.cvedetails.com/cve/CVE-2016-10012/
CWE-119
https://github.com/openbsd/src/commit/3095060f479b86288e31c79ecbc5131a66bcd2f9
3095060f479b86288e31c79ecbc5131a66bcd2f9
Remove support for pre-authentication compression. Doing compression early in the protocol probably seemed reasonable in the 1990s, but today it's clearly a bad idea in terms of both cryptography (cf. multiple compression oracle attacks in TLS) and attack surface. Moreover, to support it across privilege-separation zlib needed the assistance of a complex shared-memory manager that made the required attack surface considerably larger. Prompted by Guido Vranken pointing out a compiler-elided security check in the shared memory manager found by Stack (http://css.csail.mit.edu/stack/); ok deraadt@ markus@ NB. pre-auth authentication has been disabled by default in sshd for >10 years.
ssh_packet_write_wait(struct ssh *ssh) { fd_set *setp; int ret, r, ms_remain = 0; struct timeval start, timeout, *timeoutp = NULL; struct session_state *state = ssh->state; setp = calloc(howmany(state->connection_out + 1, NFDBITS), sizeof(fd_mask)); if (setp == NULL) return SSH_ERR_ALLOC_FAIL; if ((r = ssh_packet_write_poll(ssh)) != 0) { free(setp); return r; } while (ssh_packet_have_data_to_write(ssh)) { memset(setp, 0, howmany(state->connection_out + 1, NFDBITS) * sizeof(fd_mask)); FD_SET(state->connection_out, setp); if (state->packet_timeout_ms > 0) { ms_remain = state->packet_timeout_ms; timeoutp = &timeout; } for (;;) { if (state->packet_timeout_ms != -1) { ms_to_timeval(&timeout, ms_remain); gettimeofday(&start, NULL); } if ((ret = select(state->connection_out + 1, NULL, setp, NULL, timeoutp)) >= 0) break; if (errno != EAGAIN && errno != EINTR) break; if (state->packet_timeout_ms == -1) continue; ms_subtract_diff(&start, &ms_remain); if (ms_remain <= 0) { ret = 0; break; } } if (ret == 0) { free(setp); return SSH_ERR_CONN_TIMEOUT; } if ((r = ssh_packet_write_poll(ssh)) != 0) { free(setp); return r; } } free(setp); return 0; }
ssh_packet_write_wait(struct ssh *ssh) { fd_set *setp; int ret, r, ms_remain = 0; struct timeval start, timeout, *timeoutp = NULL; struct session_state *state = ssh->state; setp = calloc(howmany(state->connection_out + 1, NFDBITS), sizeof(fd_mask)); if (setp == NULL) return SSH_ERR_ALLOC_FAIL; if ((r = ssh_packet_write_poll(ssh)) != 0) { free(setp); return r; } while (ssh_packet_have_data_to_write(ssh)) { memset(setp, 0, howmany(state->connection_out + 1, NFDBITS) * sizeof(fd_mask)); FD_SET(state->connection_out, setp); if (state->packet_timeout_ms > 0) { ms_remain = state->packet_timeout_ms; timeoutp = &timeout; } for (;;) { if (state->packet_timeout_ms != -1) { ms_to_timeval(&timeout, ms_remain); gettimeofday(&start, NULL); } if ((ret = select(state->connection_out + 1, NULL, setp, NULL, timeoutp)) >= 0) break; if (errno != EAGAIN && errno != EINTR) break; if (state->packet_timeout_ms == -1) continue; ms_subtract_diff(&start, &ms_remain); if (ms_remain <= 0) { ret = 0; break; } } if (ret == 0) { free(setp); return SSH_ERR_CONN_TIMEOUT; } if ((r = ssh_packet_write_poll(ssh)) != 0) { free(setp); return r; } } free(setp); return 0; }
C
src
0
CVE-2019-13454
https://www.cvedetails.com/cve/CVE-2019-13454/
CWE-369
https://github.com/ImageMagick/ImageMagick6/commit/4f31d78716ac94c85c244efcea368fea202e2ed4
4f31d78716ac94c85c244efcea368fea202e2ed4
https://github.com/ImageMagick/ImageMagick/issues/1629
static RectangleInfo CompareImageBounds(const Image *image1,const Image *image2, const ImageLayerMethod method,ExceptionInfo *exception) { RectangleInfo bounds; MagickPixelPacket pixel1, pixel2; register const IndexPacket *indexes1, *indexes2; register const PixelPacket *p, *q; register ssize_t x; ssize_t y; #if 0 /* only same sized images can be compared */ assert(image1->columns == image2->columns); assert(image1->rows == image2->rows); #endif /* Set bounding box of the differences between images */ GetMagickPixelPacket(image1,&pixel1); GetMagickPixelPacket(image2,&pixel2); for (x=0; x < (ssize_t) image1->columns; x++) { p=GetVirtualPixels(image1,x,0,1,image1->rows,exception); q=GetVirtualPixels(image2,x,0,1,image2->rows,exception); if ((p == (const PixelPacket *) NULL) || (q == (const PixelPacket *) NULL)) break; indexes1=GetVirtualIndexQueue(image1); indexes2=GetVirtualIndexQueue(image2); for (y=0; y < (ssize_t) image1->rows; y++) { SetMagickPixelPacket(image1,p,indexes1+x,&pixel1); SetMagickPixelPacket(image2,q,indexes2+x,&pixel2); if (ComparePixels(method,&pixel1,&pixel2)) break; p++; q++; } if (y < (ssize_t) image1->rows) break; } if (x >= (ssize_t) image1->columns) { /* Images are identical, return a null image. */ bounds.x=-1; bounds.y=-1; bounds.width=1; bounds.height=1; return(bounds); } bounds.x=x; for (x=(ssize_t) image1->columns-1; x >= 0; x--) { p=GetVirtualPixels(image1,x,0,1,image1->rows,exception); q=GetVirtualPixels(image2,x,0,1,image2->rows,exception); if ((p == (const PixelPacket *) NULL) || (q == (const PixelPacket *) NULL)) break; indexes1=GetVirtualIndexQueue(image1); indexes2=GetVirtualIndexQueue(image2); for (y=0; y < (ssize_t) image1->rows; y++) { SetMagickPixelPacket(image1,p,indexes1+x,&pixel1); SetMagickPixelPacket(image2,q,indexes2+x,&pixel2); if (ComparePixels(method,&pixel1,&pixel2)) break; p++; q++; } if (y < (ssize_t) image1->rows) break; } bounds.width=(size_t) (x-bounds.x+1); for (y=0; y < (ssize_t) image1->rows; y++) { p=GetVirtualPixels(image1,0,y,image1->columns,1,exception); q=GetVirtualPixels(image2,0,y,image2->columns,1,exception); if ((p == (const PixelPacket *) NULL) || (q == (const PixelPacket *) NULL)) break; indexes1=GetVirtualIndexQueue(image1); indexes2=GetVirtualIndexQueue(image2); for (x=0; x < (ssize_t) image1->columns; x++) { SetMagickPixelPacket(image1,p,indexes1+x,&pixel1); SetMagickPixelPacket(image2,q,indexes2+x,&pixel2); if (ComparePixels(method,&pixel1,&pixel2)) break; p++; q++; } if (x < (ssize_t) image1->columns) break; } bounds.y=y; for (y=(ssize_t) image1->rows-1; y >= 0; y--) { p=GetVirtualPixels(image1,0,y,image1->columns,1,exception); q=GetVirtualPixels(image2,0,y,image2->columns,1,exception); if ((p == (const PixelPacket *) NULL) || (q == (const PixelPacket *) NULL)) break; indexes1=GetVirtualIndexQueue(image1); indexes2=GetVirtualIndexQueue(image2); for (x=0; x < (ssize_t) image1->columns; x++) { SetMagickPixelPacket(image1,p,indexes1+x,&pixel1); SetMagickPixelPacket(image2,q,indexes2+x,&pixel2); if (ComparePixels(method,&pixel1,&pixel2)) break; p++; q++; } if (x < (ssize_t) image1->columns) break; } bounds.height=(size_t) (y-bounds.y+1); return(bounds); }
static RectangleInfo CompareImageBounds(const Image *image1,const Image *image2, const ImageLayerMethod method,ExceptionInfo *exception) { RectangleInfo bounds; MagickPixelPacket pixel1, pixel2; register const IndexPacket *indexes1, *indexes2; register const PixelPacket *p, *q; register ssize_t x; ssize_t y; #if 0 /* only same sized images can be compared */ assert(image1->columns == image2->columns); assert(image1->rows == image2->rows); #endif /* Set bounding box of the differences between images */ GetMagickPixelPacket(image1,&pixel1); GetMagickPixelPacket(image2,&pixel2); for (x=0; x < (ssize_t) image1->columns; x++) { p=GetVirtualPixels(image1,x,0,1,image1->rows,exception); q=GetVirtualPixels(image2,x,0,1,image2->rows,exception); if ((p == (const PixelPacket *) NULL) || (q == (const PixelPacket *) NULL)) break; indexes1=GetVirtualIndexQueue(image1); indexes2=GetVirtualIndexQueue(image2); for (y=0; y < (ssize_t) image1->rows; y++) { SetMagickPixelPacket(image1,p,indexes1+x,&pixel1); SetMagickPixelPacket(image2,q,indexes2+x,&pixel2); if (ComparePixels(method,&pixel1,&pixel2)) break; p++; q++; } if (y < (ssize_t) image1->rows) break; } if (x >= (ssize_t) image1->columns) { /* Images are identical, return a null image. */ bounds.x=-1; bounds.y=-1; bounds.width=1; bounds.height=1; return(bounds); } bounds.x=x; for (x=(ssize_t) image1->columns-1; x >= 0; x--) { p=GetVirtualPixels(image1,x,0,1,image1->rows,exception); q=GetVirtualPixels(image2,x,0,1,image2->rows,exception); if ((p == (const PixelPacket *) NULL) || (q == (const PixelPacket *) NULL)) break; indexes1=GetVirtualIndexQueue(image1); indexes2=GetVirtualIndexQueue(image2); for (y=0; y < (ssize_t) image1->rows; y++) { SetMagickPixelPacket(image1,p,indexes1+x,&pixel1); SetMagickPixelPacket(image2,q,indexes2+x,&pixel2); if (ComparePixels(method,&pixel1,&pixel2)) break; p++; q++; } if (y < (ssize_t) image1->rows) break; } bounds.width=(size_t) (x-bounds.x+1); for (y=0; y < (ssize_t) image1->rows; y++) { p=GetVirtualPixels(image1,0,y,image1->columns,1,exception); q=GetVirtualPixels(image2,0,y,image2->columns,1,exception); if ((p == (const PixelPacket *) NULL) || (q == (const PixelPacket *) NULL)) break; indexes1=GetVirtualIndexQueue(image1); indexes2=GetVirtualIndexQueue(image2); for (x=0; x < (ssize_t) image1->columns; x++) { SetMagickPixelPacket(image1,p,indexes1+x,&pixel1); SetMagickPixelPacket(image2,q,indexes2+x,&pixel2); if (ComparePixels(method,&pixel1,&pixel2)) break; p++; q++; } if (x < (ssize_t) image1->columns) break; } bounds.y=y; for (y=(ssize_t) image1->rows-1; y >= 0; y--) { p=GetVirtualPixels(image1,0,y,image1->columns,1,exception); q=GetVirtualPixels(image2,0,y,image2->columns,1,exception); if ((p == (const PixelPacket *) NULL) || (q == (const PixelPacket *) NULL)) break; indexes1=GetVirtualIndexQueue(image1); indexes2=GetVirtualIndexQueue(image2); for (x=0; x < (ssize_t) image1->columns; x++) { SetMagickPixelPacket(image1,p,indexes1+x,&pixel1); SetMagickPixelPacket(image2,q,indexes2+x,&pixel2); if (ComparePixels(method,&pixel1,&pixel2)) break; p++; q++; } if (x < (ssize_t) image1->columns) break; } bounds.height=(size_t) (y-bounds.y+1); return(bounds); }
C
ImageMagick6
0
CVE-2014-7840
https://www.cvedetails.com/cve/CVE-2014-7840/
CWE-20
https://git.qemu.org/?p=qemu.git;a=commit;h=0be839a2701369f669532ea5884c15bead1c6e08
0be839a2701369f669532ea5884c15bead1c6e08
null
void do_acpitable_option(const QemuOpts *opts) { #ifdef TARGET_I386 Error *err = NULL; acpi_table_add(opts, &err); if (err) { error_report("Wrong acpi table provided: %s", error_get_pretty(err)); error_free(err); exit(1); } #endif }
void do_acpitable_option(const QemuOpts *opts) { #ifdef TARGET_I386 Error *err = NULL; acpi_table_add(opts, &err); if (err) { error_report("Wrong acpi table provided: %s", error_get_pretty(err)); error_free(err); exit(1); } #endif }
C
qemu
0
CVE-2011-3099
https://www.cvedetails.com/cve/CVE-2011-3099/
CWE-399
https://github.com/chromium/chromium/commit/3bbc818ed1a7b63b8290bbde9ae975956748cb8a
3bbc818ed1a7b63b8290bbde9ae975956748cb8a
[GTK] Inspector should set a default attached height before being attached https://bugs.webkit.org/show_bug.cgi?id=90767 Reviewed by Xan Lopez. We are currently using the minimum attached height in WebKitWebViewBase as the default height for the inspector when attached. It would be easier for WebKitWebViewBase and embedders implementing attach() if the inspector already had an attached height set when it's being attached. * UIProcess/API/gtk/WebKitWebViewBase.cpp: (webkitWebViewBaseContainerAdd): Don't initialize inspectorViewHeight. (webkitWebViewBaseSetInspectorViewHeight): Allow to set the inspector view height before having an inpector view, but only queue a resize when the view already has an inspector view. * UIProcess/API/gtk/tests/TestInspector.cpp: (testInspectorDefault): (testInspectorManualAttachDetach): * UIProcess/gtk/WebInspectorProxyGtk.cpp: (WebKit::WebInspectorProxy::platformAttach): Set the default attached height before attach the inspector view. git-svn-id: svn://svn.chromium.org/blink/trunk@124479 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void WebInspectorProxy::platformDetach() { if (!m_page->isValid()) return; GRefPtr<GtkWidget> inspectorView = m_inspectorView; if (!m_client.detach(this)) { GtkWidget* parent = gtk_widget_get_parent(m_inspectorView); ASSERT(parent); gtk_container_remove(GTK_CONTAINER(parent), m_inspectorView); } if (!m_isVisible) return; createInspectorWindow(); }
void WebInspectorProxy::platformDetach() { if (!m_page->isValid()) return; GRefPtr<GtkWidget> inspectorView = m_inspectorView; if (!m_client.detach(this)) { GtkWidget* parent = gtk_widget_get_parent(m_inspectorView); ASSERT(parent); gtk_container_remove(GTK_CONTAINER(parent), m_inspectorView); } if (!m_isVisible) return; createInspectorWindow(); }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/610f904d8215075c4681be4eb413f4348860bf9f
610f904d8215075c4681be4eb413f4348860bf9f
Retrieve per host storage usage from QuotaManager. [email protected] BUG=none TEST=QuotaManagerTest.GetUsage Review URL: http://codereview.chromium.org/8079004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103921 0039d316-1c4b-4281-b951-d872f2087c98
bool SortByHost(const GURL& lhs, const GURL& rhs) { return net::GetHostOrSpecFromURL(lhs) > net::GetHostOrSpecFromURL(rhs); }
bool SortByHost(const GURL& lhs, const GURL& rhs) { return net::GetHostOrSpecFromURL(lhs) > net::GetHostOrSpecFromURL(rhs); }
C
Chrome
0
CVE-2017-8068
https://www.cvedetails.com/cve/CVE-2017-8068/
CWE-119
https://github.com/torvalds/linux/commit/5593523f968bc86d42a035c6df47d5e0979b5ace
5593523f968bc86d42a035c6df47d5e0979b5ace
pegasus: Use heap buffers for all register access Allocating USB buffers on the stack is not portable, and no longer works on x86_64 (with VMAP_STACK enabled as per default). Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") References: https://bugs.debian.org/852556 Reported-by: Lisandro Damián Nicanor Pérez Meyer <[email protected]> Tested-by: Lisandro Damián Nicanor Pérez Meyer <[email protected]> Signed-off-by: Ben Hutchings <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static inline void disable_eprom_write(pegasus_t *pegasus) { __u8 tmp; get_registers(pegasus, EthCtrl2, 1, &tmp); set_register(pegasus, EpromCtrl, 0); set_register(pegasus, EthCtrl2, tmp & ~EPROM_WR_ENABLE); }
static inline void disable_eprom_write(pegasus_t *pegasus) { __u8 tmp; get_registers(pegasus, EthCtrl2, 1, &tmp); set_register(pegasus, EpromCtrl, 0); set_register(pegasus, EthCtrl2, tmp & ~EPROM_WR_ENABLE); }
C
linux
0
CVE-2019-5796
https://www.cvedetails.com/cve/CVE-2019-5796/
CWE-362
https://github.com/chromium/chromium/commit/5bb223676defeba9c44a5ce42460c86e24561e73
5bb223676defeba9c44a5ce42460c86e24561e73
[GuestView] - Introduce MimeHandlerViewAttachHelper This CL is for the most part a mechanical change which extracts almost all the frame-based MimeHandlerView code out of ExtensionsGuestViewMessageFilter. This change both removes the current clutter form EGVMF as well as fixesa race introduced when the frame-based logic was added to EGVMF. The reason for the race was that EGVMF is destroyed on IO thread but all the access to it (for frame-based MHV) are from UI. [email protected],[email protected] Bug: 659750, 896679, 911161, 918861 Change-Id: I6474b870e4d56daa68be03637bb633665d9f9dda Reviewed-on: https://chromium-review.googlesource.com/c/1401451 Commit-Queue: Ehsan Karamad <[email protected]> Reviewed-by: James MacLean <[email protected]> Reviewed-by: Ehsan Karamad <[email protected]> Cr-Commit-Position: refs/heads/master@{#621155}
void ChromeContentBrowserClient::RegisterOutOfProcessServices( OutOfProcessServiceMap* services) { #if BUILDFLAG(ENABLE_ISOLATED_XR_SERVICE) (*services)[device::mojom::kVrIsolatedServiceName] = base::BindRepeating( &l10n_util::GetStringUTF16, IDS_ISOLATED_XR_PROCESS_NAME); #endif #if BUILDFLAG(ENABLE_PRINTING) (*services)[printing::mojom::kServiceName] = base::BindRepeating(&l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_PDF_COMPOSITOR_SERVICE_NAME); #endif #if BUILDFLAG(ENABLE_PRINT_PREVIEW) || \ (BUILDFLAG(ENABLE_PRINTING) && defined(OS_WIN)) (*services)[printing::mojom::kChromePrintingServiceName] = base::BindRepeating(&l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_PRINTING_SERVICE_NAME); #endif (*services)[heap_profiling::mojom::kServiceName] = base::BindRepeating( &l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_PROFILING_SERVICE_NAME); #if BUILDFLAG(ENABLE_EXTENSIONS) || defined(OS_ANDROID) (*services)[chrome::mojom::kMediaGalleryUtilServiceName] = base::BindRepeating(&l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_MEDIA_GALLERY_UTILITY_NAME); #endif #if BUILDFLAG(ENABLE_EXTENSIONS) (*services)[chrome::mojom::kRemovableStorageWriterServiceName] = base::BindRepeating(&l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_IMAGE_WRITER_NAME); #endif #if defined(OS_WIN) (*services)[chrome::mojom::kUtilWinServiceName] = base::BindRepeating( &l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_UTILITY_WIN_NAME); #endif #if defined(OS_WIN) && BUILDFLAG(ENABLE_EXTENSIONS) (*services)[chrome::mojom::kWifiUtilWinServiceName] = base::BindRepeating(&l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_WIFI_CREDENTIALS_GETTER_NAME); #endif #if !defined(OS_ANDROID) (*services)[chrome::mojom::kProfileImportServiceName] = base::BindRepeating( &l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_PROFILE_IMPORTER_NAME); (*services)[proxy_resolver::mojom::kProxyResolverServiceName] = base::BindRepeating(&l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME); #endif #if BUILDFLAG(ENABLE_PRINTING) && defined(OS_CHROMEOS) (*services)[chrome::mojom::kCupsIppParserServiceName] = base::BindRepeating(&l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_CUPS_IPP_PARSER_SERVICE_NAME); #endif #if defined(FULL_SAFE_BROWSING) || defined(OS_CHROMEOS) (*services)[chrome::mojom::kFileUtilServiceName] = base::BindRepeating( &l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_FILE_UTILITY_NAME); #endif #if !defined(OS_ANDROID) (*services)[patch::mojom::kServiceName] = base::BindRepeating( &l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_PATCH_NAME); #endif (*services)[unzip::mojom::kServiceName] = base::BindRepeating( &l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_UNZIP_NAME); #if defined(OS_CHROMEOS) ash_service_registry::RegisterOutOfProcessServices(services); (*services)[chromeos::ime::mojom::kServiceName] = base::BindRepeating( &l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_IME_SERVICE_NAME); #endif #if BUILDFLAG(ENABLE_SIMPLE_BROWSER_SERVICE_OUT_OF_PROCESS) if (base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kLaunchSimpleBrowserSwitch)) { (*services)[simple_browser::mojom::kServiceName] = base::BindRepeating([]() -> base::string16 { return base::ASCIIToUTF16("Simple Browser"); }); } #endif #if !defined(OS_ANDROID) if (base::FeatureList::IsEnabled(mirroring::features::kMirroringService) && base::FeatureList::IsEnabled(features::kAudioServiceAudioStreams) && base::FeatureList::IsEnabled(network::features::kNetworkService)) { (*services)[mirroring::mojom::kServiceName] = base::BindRepeating(&base::ASCIIToUTF16, "Mirroring Service"); } #endif }
void ChromeContentBrowserClient::RegisterOutOfProcessServices( OutOfProcessServiceMap* services) { #if BUILDFLAG(ENABLE_ISOLATED_XR_SERVICE) (*services)[device::mojom::kVrIsolatedServiceName] = base::BindRepeating( &l10n_util::GetStringUTF16, IDS_ISOLATED_XR_PROCESS_NAME); #endif #if BUILDFLAG(ENABLE_PRINTING) (*services)[printing::mojom::kServiceName] = base::BindRepeating(&l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_PDF_COMPOSITOR_SERVICE_NAME); #endif #if BUILDFLAG(ENABLE_PRINT_PREVIEW) || \ (BUILDFLAG(ENABLE_PRINTING) && defined(OS_WIN)) (*services)[printing::mojom::kChromePrintingServiceName] = base::BindRepeating(&l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_PRINTING_SERVICE_NAME); #endif (*services)[heap_profiling::mojom::kServiceName] = base::BindRepeating( &l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_PROFILING_SERVICE_NAME); #if BUILDFLAG(ENABLE_EXTENSIONS) || defined(OS_ANDROID) (*services)[chrome::mojom::kMediaGalleryUtilServiceName] = base::BindRepeating(&l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_MEDIA_GALLERY_UTILITY_NAME); #endif #if BUILDFLAG(ENABLE_EXTENSIONS) (*services)[chrome::mojom::kRemovableStorageWriterServiceName] = base::BindRepeating(&l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_IMAGE_WRITER_NAME); #endif #if defined(OS_WIN) (*services)[chrome::mojom::kUtilWinServiceName] = base::BindRepeating( &l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_UTILITY_WIN_NAME); #endif #if defined(OS_WIN) && BUILDFLAG(ENABLE_EXTENSIONS) (*services)[chrome::mojom::kWifiUtilWinServiceName] = base::BindRepeating(&l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_WIFI_CREDENTIALS_GETTER_NAME); #endif #if !defined(OS_ANDROID) (*services)[chrome::mojom::kProfileImportServiceName] = base::BindRepeating( &l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_PROFILE_IMPORTER_NAME); (*services)[proxy_resolver::mojom::kProxyResolverServiceName] = base::BindRepeating(&l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME); #endif #if BUILDFLAG(ENABLE_PRINTING) && defined(OS_CHROMEOS) (*services)[chrome::mojom::kCupsIppParserServiceName] = base::BindRepeating(&l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_CUPS_IPP_PARSER_SERVICE_NAME); #endif #if defined(FULL_SAFE_BROWSING) || defined(OS_CHROMEOS) (*services)[chrome::mojom::kFileUtilServiceName] = base::BindRepeating( &l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_FILE_UTILITY_NAME); #endif #if !defined(OS_ANDROID) (*services)[patch::mojom::kServiceName] = base::BindRepeating( &l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_PATCH_NAME); #endif (*services)[unzip::mojom::kServiceName] = base::BindRepeating( &l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_UNZIP_NAME); #if defined(OS_CHROMEOS) ash_service_registry::RegisterOutOfProcessServices(services); (*services)[chromeos::ime::mojom::kServiceName] = base::BindRepeating( &l10n_util::GetStringUTF16, IDS_UTILITY_PROCESS_IME_SERVICE_NAME); #endif #if BUILDFLAG(ENABLE_SIMPLE_BROWSER_SERVICE_OUT_OF_PROCESS) if (base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kLaunchSimpleBrowserSwitch)) { (*services)[simple_browser::mojom::kServiceName] = base::BindRepeating([]() -> base::string16 { return base::ASCIIToUTF16("Simple Browser"); }); } #endif #if !defined(OS_ANDROID) if (base::FeatureList::IsEnabled(mirroring::features::kMirroringService) && base::FeatureList::IsEnabled(features::kAudioServiceAudioStreams) && base::FeatureList::IsEnabled(network::features::kNetworkService)) { (*services)[mirroring::mojom::kServiceName] = base::BindRepeating(&base::ASCIIToUTF16, "Mirroring Service"); } #endif }
C
Chrome
0
CVE-2019-5790
https://www.cvedetails.com/cve/CVE-2019-5790/
CWE-190
https://github.com/chromium/chromium/commit/88fcb3a6899d77b64195423333ad81a00803f997
88fcb3a6899d77b64195423333ad81a00803f997
Move user activation check to RemoteFrame::Navigate's callers. Currently RemoteFrame::Navigate is the user of Frame::HasTransientUserActivation that passes a RemoteFrame*, and it seems wrong because the user activation (user gesture) needed by the navigation should belong to the LocalFrame that initiated the navigation. Follow-up CLs after this one will update UserActivation code in Frame to take a LocalFrame* instead of a Frame*, and get rid of redundant IPCs. Bug: 811414 Change-Id: I771c1694043edb54374a44213d16715d9c7da704 Reviewed-on: https://chromium-review.googlesource.com/914736 Commit-Queue: Mustaq Ahmed <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Cr-Commit-Position: refs/heads/master@{#536728}
bool DragController::StartDrag(LocalFrame* src, const DragState& state, const WebMouseEvent& drag_event, const IntPoint& drag_origin) { #if DCHECK_IS_ON() DCHECK(DragTypeIsValid(state.drag_type_)); #endif DCHECK(src); if (!src->View() || !src->ContentLayoutObject()) return false; HitTestResult hit_test_result = src->GetEventHandler().HitTestResultAtPoint(drag_origin); if (!state.drag_src_->IsShadowIncludingInclusiveAncestorOf( hit_test_result.InnerNode())) { return false; } const KURL& link_url = hit_test_result.AbsoluteLinkURL(); const KURL& image_url = hit_test_result.AbsoluteImageURL(); IntPoint mouse_dragged_point = src->View()->RootFrameToContents( FlooredIntPoint(drag_event.PositionInRootFrame())); IntPoint drag_location; IntPoint drag_offset; DataTransfer* data_transfer = state.drag_data_transfer_.Get(); std::unique_ptr<DragImage> drag_image = data_transfer->CreateDragImage(drag_offset, src); if (drag_image) { drag_location = DragLocationForDHTMLDrag(mouse_dragged_point, drag_origin, drag_offset, !link_url.IsEmpty()); } Node* node = state.drag_src_.Get(); if (state.drag_type_ == kDragSourceActionSelection) { if (!drag_image) { drag_image = DragImageForSelection(*src, kDragImageAlpha); drag_location = DragLocationForSelectionDrag(*src); } DoSystemDrag(drag_image.get(), drag_location, drag_origin, data_transfer, src, false); } else if (state.drag_type_ == kDragSourceActionImage) { if (image_url.IsEmpty() || !node || !node->IsElementNode()) return false; Element* element = ToElement(node); Image* image = GetImage(element); if (!image || image->IsNull() || !image->Data() || !image->Data()->size()) return false; DCHECK(!image->FilenameExtension().IsEmpty()); if (!drag_image) { const IntRect& image_rect = hit_test_result.ImageRect(); IntSize image_size_in_pixels = image_rect.Size(); image_size_in_pixels.Scale(src->GetPage()->DeviceScaleFactorDeprecated() * src->GetPage()->GetVisualViewport().Scale()); float screen_device_scale_factor = src->GetPage()->GetChromeClient().GetScreenInfo().device_scale_factor; drag_image = DragImageForImage(element, image, screen_device_scale_factor, drag_origin, image_rect.Location(), image_size_in_pixels, drag_location); } DoSystemDrag(drag_image.get(), drag_location, drag_origin, data_transfer, src, false); } else if (state.drag_type_ == kDragSourceActionLink) { if (link_url.IsEmpty()) return false; if (src->Selection() .ComputeVisibleSelectionInDOMTreeDeprecated() .IsCaret() && src->Selection() .ComputeVisibleSelectionInDOMTreeDeprecated() .IsContentEditable()) { if (Node* node = EnclosingAnchorElement( src->Selection() .ComputeVisibleSelectionInDOMTreeDeprecated() .Base())) { src->Selection().SetSelectionAndEndTyping( SelectionInDOMTree::Builder().SelectAllChildren(*node).Build()); } } if (!drag_image) { DCHECK(src->GetPage()); float screen_device_scale_factor = src->GetPage()->GetChromeClient().GetScreenInfo().device_scale_factor; drag_image = DragImageForLink(link_url, hit_test_result.TextContent(), screen_device_scale_factor); drag_location = DragLocationForLink(drag_image.get(), mouse_dragged_point, screen_device_scale_factor, src->GetPage()->PageScaleFactor()); } DoSystemDrag(drag_image.get(), drag_location, mouse_dragged_point, data_transfer, src, true); } else if (state.drag_type_ == kDragSourceActionDHTML) { DoSystemDrag(drag_image.get(), drag_location, drag_origin, data_transfer, src, false); } else { NOTREACHED(); return false; } return true; }
bool DragController::StartDrag(LocalFrame* src, const DragState& state, const WebMouseEvent& drag_event, const IntPoint& drag_origin) { #if DCHECK_IS_ON() DCHECK(DragTypeIsValid(state.drag_type_)); #endif DCHECK(src); if (!src->View() || !src->ContentLayoutObject()) return false; HitTestResult hit_test_result = src->GetEventHandler().HitTestResultAtPoint(drag_origin); if (!state.drag_src_->IsShadowIncludingInclusiveAncestorOf( hit_test_result.InnerNode())) { return false; } const KURL& link_url = hit_test_result.AbsoluteLinkURL(); const KURL& image_url = hit_test_result.AbsoluteImageURL(); IntPoint mouse_dragged_point = src->View()->RootFrameToContents( FlooredIntPoint(drag_event.PositionInRootFrame())); IntPoint drag_location; IntPoint drag_offset; DataTransfer* data_transfer = state.drag_data_transfer_.Get(); std::unique_ptr<DragImage> drag_image = data_transfer->CreateDragImage(drag_offset, src); if (drag_image) { drag_location = DragLocationForDHTMLDrag(mouse_dragged_point, drag_origin, drag_offset, !link_url.IsEmpty()); } Node* node = state.drag_src_.Get(); if (state.drag_type_ == kDragSourceActionSelection) { if (!drag_image) { drag_image = DragImageForSelection(*src, kDragImageAlpha); drag_location = DragLocationForSelectionDrag(*src); } DoSystemDrag(drag_image.get(), drag_location, drag_origin, data_transfer, src, false); } else if (state.drag_type_ == kDragSourceActionImage) { if (image_url.IsEmpty() || !node || !node->IsElementNode()) return false; Element* element = ToElement(node); Image* image = GetImage(element); if (!image || image->IsNull() || !image->Data() || !image->Data()->size()) return false; DCHECK(!image->FilenameExtension().IsEmpty()); if (!drag_image) { const IntRect& image_rect = hit_test_result.ImageRect(); IntSize image_size_in_pixels = image_rect.Size(); image_size_in_pixels.Scale(src->GetPage()->DeviceScaleFactorDeprecated() * src->GetPage()->GetVisualViewport().Scale()); float screen_device_scale_factor = src->GetPage()->GetChromeClient().GetScreenInfo().device_scale_factor; drag_image = DragImageForImage(element, image, screen_device_scale_factor, drag_origin, image_rect.Location(), image_size_in_pixels, drag_location); } DoSystemDrag(drag_image.get(), drag_location, drag_origin, data_transfer, src, false); } else if (state.drag_type_ == kDragSourceActionLink) { if (link_url.IsEmpty()) return false; if (src->Selection() .ComputeVisibleSelectionInDOMTreeDeprecated() .IsCaret() && src->Selection() .ComputeVisibleSelectionInDOMTreeDeprecated() .IsContentEditable()) { if (Node* node = EnclosingAnchorElement( src->Selection() .ComputeVisibleSelectionInDOMTreeDeprecated() .Base())) { src->Selection().SetSelectionAndEndTyping( SelectionInDOMTree::Builder().SelectAllChildren(*node).Build()); } } if (!drag_image) { DCHECK(src->GetPage()); float screen_device_scale_factor = src->GetPage()->GetChromeClient().GetScreenInfo().device_scale_factor; drag_image = DragImageForLink(link_url, hit_test_result.TextContent(), screen_device_scale_factor); drag_location = DragLocationForLink(drag_image.get(), mouse_dragged_point, screen_device_scale_factor, src->GetPage()->PageScaleFactor()); } DoSystemDrag(drag_image.get(), drag_location, mouse_dragged_point, data_transfer, src, true); } else if (state.drag_type_ == kDragSourceActionDHTML) { DoSystemDrag(drag_image.get(), drag_location, drag_origin, data_transfer, src, false); } else { NOTREACHED(); return false; } return true; }
C
Chrome
0
CVE-2018-6158
https://www.cvedetails.com/cve/CVE-2018-6158/
CWE-362
https://github.com/chromium/chromium/commit/20b65d00ca3d8696430e22efad7485366f8c3a21
20b65d00ca3d8696430e22efad7485366f8c3a21
[oilpan] Fix GCInfoTable for multiple threads Previously, grow and access from different threads could lead to a race on the table backing; see bug. - Rework the table to work on an existing reservation. - Commit upon growing, avoiding any copies. Drive-by: Fix over-allocation of table. Bug: chromium:841280 Change-Id: I329cb6f40091e14e8c05334ba1104a9440c31d43 Reviewed-on: https://chromium-review.googlesource.com/1061525 Commit-Queue: Michael Lippautz <[email protected]> Reviewed-by: Kentaro Hara <[email protected]> Cr-Commit-Position: refs/heads/master@{#560434}
Address NormalPageArena::OutOfLineAllocate(size_t allocation_size, size_t gc_info_index) { DCHECK_GT(allocation_size, RemainingAllocationSize()); DCHECK_GE(allocation_size, kAllocationGranularity); if (allocation_size >= kLargeObjectSizeThreshold) return AllocateLargeObject(allocation_size, gc_info_index); UpdateRemainingAllocationSize(); Address result = AllocateFromFreeList(allocation_size, gc_info_index); if (result) return result; SetAllocationPoint(nullptr, 0); result = LazySweep(allocation_size, gc_info_index); if (result) return result; GetThreadState()->CompleteSweep(); GetThreadState()->ScheduleGCIfNeeded(); AllocatePage(); result = AllocateFromFreeList(allocation_size, gc_info_index); CHECK(result); return result; }
Address NormalPageArena::OutOfLineAllocate(size_t allocation_size, size_t gc_info_index) { DCHECK_GT(allocation_size, RemainingAllocationSize()); DCHECK_GE(allocation_size, kAllocationGranularity); if (allocation_size >= kLargeObjectSizeThreshold) return AllocateLargeObject(allocation_size, gc_info_index); UpdateRemainingAllocationSize(); Address result = AllocateFromFreeList(allocation_size, gc_info_index); if (result) return result; SetAllocationPoint(nullptr, 0); result = LazySweep(allocation_size, gc_info_index); if (result) return result; GetThreadState()->CompleteSweep(); GetThreadState()->ScheduleGCIfNeeded(); AllocatePage(); result = AllocateFromFreeList(allocation_size, gc_info_index); CHECK(result); return result; }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/8353baf8d1504dbdd4ad7584ff2466de657521cd
8353baf8d1504dbdd4ad7584ff2466de657521cd
Remove WebFrame::canHaveSecureChild To simplify the public API, ServiceWorkerNetworkProvider can do the parent walk itself. Follow-up to https://crrev.com/ad1850962644e19. BUG=607543 Review-Url: https://codereview.chromium.org/2082493002 Cr-Commit-Position: refs/heads/master@{#400896}
void Document::scheduleLayoutTreeUpdate() { DCHECK(!hasPendingVisualUpdate()); DCHECK(shouldScheduleLayoutTreeUpdate()); DCHECK(needsLayoutTreeUpdate()); if (!view()->canThrottleRendering()) page()->animator().scheduleVisualUpdate(frame()); m_lifecycle.ensureStateAtMost(DocumentLifecycle::VisualUpdatePending); TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ScheduleStyleRecalculation", TRACE_EVENT_SCOPE_THREAD, "data", InspectorRecalculateStylesEvent::data(frame())); InspectorInstrumentation::didScheduleStyleRecalculation(this); ++m_styleVersion; }
void Document::scheduleLayoutTreeUpdate() { DCHECK(!hasPendingVisualUpdate()); DCHECK(shouldScheduleLayoutTreeUpdate()); DCHECK(needsLayoutTreeUpdate()); if (!view()->canThrottleRendering()) page()->animator().scheduleVisualUpdate(frame()); m_lifecycle.ensureStateAtMost(DocumentLifecycle::VisualUpdatePending); TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ScheduleStyleRecalculation", TRACE_EVENT_SCOPE_THREAD, "data", InspectorRecalculateStylesEvent::data(frame())); InspectorInstrumentation::didScheduleStyleRecalculation(this); ++m_styleVersion; }
C
Chrome
0
CVE-2014-8172
https://www.cvedetails.com/cve/CVE-2014-8172/
CWE-17
https://github.com/torvalds/linux/commit/eee5cc2702929fd41cce28058dc6d6717f723f87
eee5cc2702929fd41cce28058dc6d6717f723f87
get rid of s_files and files_lock The only thing we need it for is alt-sysrq-r (emergency remount r/o) and these days we can do just as well without going through the list of files. Signed-off-by: Al Viro <[email protected]>
static void file_free_rcu(struct rcu_head *head) { struct file *f = container_of(head, struct file, f_u.fu_rcuhead); put_cred(f->f_cred); kmem_cache_free(filp_cachep, f); }
static void file_free_rcu(struct rcu_head *head) { struct file *f = container_of(head, struct file, f_u.fu_rcuhead); put_cred(f->f_cred); kmem_cache_free(filp_cachep, f); }
C
linux
0
CVE-2018-17204
https://www.cvedetails.com/cve/CVE-2018-17204/
CWE-617
https://github.com/openvswitch/ovs/commit/4af6da3b275b764b1afe194df6499b33d2bf4cde
4af6da3b275b764b1afe194df6499b33d2bf4cde
ofp-group: Don't assert-fail decoding bad OF1.5 group mod type or command. When decoding a group mod, the current code validates the group type and command after the whole group mod has been decoded. The OF1.5 decoder, however, tries to use the type and command earlier, when it might still be invalid. This caused an assertion failure (via OVS_NOT_REACHED). This commit fixes the problem. ovs-vswitchd does not enable support for OpenFlow 1.5 by default. Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9249 Signed-off-by: Ben Pfaff <[email protected]> Reviewed-by: Yifeng Sun <[email protected]>
ofputil_protocol_to_base(enum ofputil_protocol protocol) { return ofputil_protocol_set_tid(protocol, false); }
ofputil_protocol_to_base(enum ofputil_protocol protocol) { return ofputil_protocol_set_tid(protocol, false); }
C
ovs
0
CVE-2018-18352
https://www.cvedetails.com/cve/CVE-2018-18352/
CWE-732
https://github.com/chromium/chromium/commit/a9cbaa7a40e2b2723cfc2f266c42f4980038a949
a9cbaa7a40e2b2723cfc2f266c42f4980038a949
Simplify "WouldTaintOrigin" concept in media/blink Currently WebMediaPlayer has three predicates: - DidGetOpaqueResponseFromServiceWorker - HasSingleSecurityOrigin - DidPassCORSAccessCheck . These are used to determine whether the response body is available for scripts. They are known to be confusing, and actually MediaElementAudioSourceHandler::WouldTaintOrigin misuses them. This CL merges the three predicates to one, WouldTaintOrigin, to remove the confusion. Now the "response type" concept is available and we don't need a custom CORS check, so this CL removes BaseAudioContext::WouldTaintOrigin. This CL also renames URLData::has_opaque_data_ and its (direct and indirect) data accessors to match the spec. Bug: 849942, 875153 Change-Id: I6acf50169d7445c4ff614e80ac606f79ee577d2a Reviewed-on: https://chromium-review.googlesource.com/c/1238098 Reviewed-by: Fredrik Hubinette <[email protected]> Reviewed-by: Kinuko Yasuda <[email protected]> Reviewed-by: Raymond Toy <[email protected]> Commit-Queue: Yutaka Hirano <[email protected]> Cr-Commit-Position: refs/heads/master@{#598258}
void Respond(const WebURLResponse& response) { EXPECT_TRUE(active_loader()); data_provider()->DidReceiveResponse(response); base::RunLoop().RunUntilIdle(); }
void Respond(const WebURLResponse& response) { EXPECT_TRUE(active_loader()); data_provider()->DidReceiveResponse(response); base::RunLoop().RunUntilIdle(); }
C
Chrome
0
CVE-2016-10197
https://www.cvedetails.com/cve/CVE-2016-10197/
CWE-125
https://github.com/libevent/libevent/commit/ec65c42052d95d2c23d1d837136d1cf1d9ecef9e
ec65c42052d95d2c23d1d837136d1cf1d9ecef9e
evdns: fix searching empty hostnames From #332: Here follows a bug report by **Guido Vranken** via the _Tor bug bounty program_. Please credit Guido accordingly. ## Bug report The DNS code of Libevent contains this rather obvious OOB read: ```c static char * search_make_new(const struct search_state *const state, int n, const char *const base_name) { const size_t base_len = strlen(base_name); const char need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1; ``` If the length of ```base_name``` is 0, then line 3125 reads 1 byte before the buffer. This will trigger a crash on ASAN-protected builds. To reproduce: Build libevent with ASAN: ``` $ CFLAGS='-fomit-frame-pointer -fsanitize=address' ./configure && make -j4 ``` Put the attached ```resolv.conf``` and ```poc.c``` in the source directory and then do: ``` $ gcc -fsanitize=address -fomit-frame-pointer poc.c .libs/libevent.a $ ./a.out ================================================================= ==22201== ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60060000efdf at pc 0x4429da bp 0x7ffe1ed47300 sp 0x7ffe1ed472f8 READ of size 1 at 0x60060000efdf thread T0 ``` P.S. we can add a check earlier, but since this is very uncommon, I didn't add it. Fixes: #332
evdns_base_load_hosts_impl(struct evdns_base *base, const char *hosts_fname) { char *str=NULL, *cp, *eol; size_t len; int err=0; ASSERT_LOCKED(base); if (hosts_fname == NULL || (err = evutil_read_file_(hosts_fname, &str, &len, 0)) < 0) { char tmp[64]; strlcpy(tmp, "127.0.0.1 localhost", sizeof(tmp)); evdns_base_parse_hosts_line(base, tmp); strlcpy(tmp, "::1 localhost", sizeof(tmp)); evdns_base_parse_hosts_line(base, tmp); return err ? -1 : 0; } /* This will break early if there is a NUL in the hosts file. * Probably not a problem.*/ cp = str; for (;;) { eol = strchr(cp, '\n'); if (eol) { *eol = '\0'; evdns_base_parse_hosts_line(base, cp); cp = eol+1; } else { evdns_base_parse_hosts_line(base, cp); break; } } mm_free(str); return 0; }
evdns_base_load_hosts_impl(struct evdns_base *base, const char *hosts_fname) { char *str=NULL, *cp, *eol; size_t len; int err=0; ASSERT_LOCKED(base); if (hosts_fname == NULL || (err = evutil_read_file_(hosts_fname, &str, &len, 0)) < 0) { char tmp[64]; strlcpy(tmp, "127.0.0.1 localhost", sizeof(tmp)); evdns_base_parse_hosts_line(base, tmp); strlcpy(tmp, "::1 localhost", sizeof(tmp)); evdns_base_parse_hosts_line(base, tmp); return err ? -1 : 0; } /* This will break early if there is a NUL in the hosts file. * Probably not a problem.*/ cp = str; for (;;) { eol = strchr(cp, '\n'); if (eol) { *eol = '\0'; evdns_base_parse_hosts_line(base, cp); cp = eol+1; } else { evdns_base_parse_hosts_line(base, cp); break; } } mm_free(str); return 0; }
C
libevent
0
CVE-2018-16080
https://www.cvedetails.com/cve/CVE-2018-16080/
CWE-20
https://github.com/chromium/chromium/commit/c552cd7b8a0862f6b3c8c6a07f98bda3721101eb
c552cd7b8a0862f6b3c8c6a07f98bda3721101eb
Mac: turn popups into new tabs while in fullscreen. It's platform convention to show popups as new tabs while in non-HTML5 fullscreen. (Popups cause tabs to lose HTML5 fullscreen.) This was implemented for Cocoa in a BrowserWindow override, but it makes sense to just stick it into Browser and remove a ton of override code put in just to support this. BUG=858929, 868416 TEST=as in bugs Change-Id: I43471f242813ec1159d9c690bab73dab3e610b7d Reviewed-on: https://chromium-review.googlesource.com/1153455 Reviewed-by: Sidney San Martín <[email protected]> Commit-Queue: Avi Drissman <[email protected]> Cr-Commit-Position: refs/heads/master@{#578755}
bool BrowserView::GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) const { return toolbar_->GetAcceleratorForCommandId(command_id, accelerator); }
bool BrowserView::GetAcceleratorForCommandId( int command_id, ui::Accelerator* accelerator) const { return toolbar_->GetAcceleratorForCommandId(command_id, accelerator); }
C
Chrome
0
CVE-2019-17547
https://www.cvedetails.com/cve/CVE-2019-17547/
null
https://github.com/ImageMagick/ImageMagick/commit/ecf7c6b288e11e7e7f75387c5e9e93e423b98397
ecf7c6b288e11e7e7f75387c5e9e93e423b98397
...
static MagickBooleanType DrawPolygonPrimitive(Image *image, const DrawInfo *draw_info,const PrimitiveInfo *primitive_info, ExceptionInfo *exception) { CacheView *image_view; MagickBooleanType fill, status; double mid; PolygonInfo **magick_restrict polygon_info; register EdgeInfo *p; register ssize_t i; SegmentInfo bounds; ssize_t start_y, stop_y, y; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); assert(draw_info != (DrawInfo *) NULL); assert(draw_info->signature == MagickCoreSignature); assert(primitive_info != (PrimitiveInfo *) NULL); if (primitive_info->coordinates <= 1) return(MagickTrue); /* Compute bounding box. */ polygon_info=AcquirePolygonThreadSet(primitive_info); if (polygon_info == (PolygonInfo **) NULL) return(MagickFalse); DisableMSCWarning(4127) if (0) { status=DrawBoundingRectangles(image,draw_info,polygon_info[0],exception); if (status == MagickFalse) { polygon_info=DestroyPolygonThreadSet(polygon_info); return(status); } } RestoreMSCWarning if (image->debug != MagickFalse) (void) LogMagickEvent(DrawEvent,GetMagickModule()," begin draw-polygon"); fill=(primitive_info->method == FillToBorderMethod) || (primitive_info->method == FloodfillMethod) ? MagickTrue : MagickFalse; mid=ExpandAffine(&draw_info->affine)*SaneStrokeWidth(image,draw_info)/2.0; bounds=polygon_info[0]->edges[0].bounds; for (i=1; i < (ssize_t) polygon_info[0]->number_edges; i++) { p=polygon_info[0]->edges+i; if (p->bounds.x1 < bounds.x1) bounds.x1=p->bounds.x1; if (p->bounds.y1 < bounds.y1) bounds.y1=p->bounds.y1; if (p->bounds.x2 > bounds.x2) bounds.x2=p->bounds.x2; if (p->bounds.y2 > bounds.y2) bounds.y2=p->bounds.y2; } bounds.x1-=(mid+1.0); bounds.y1-=(mid+1.0); bounds.x2+=(mid+1.0); bounds.y2+=(mid+1.0); if ((bounds.x1 >= (double) image->columns) || (bounds.y1 >= (double) image->rows) || (bounds.x2 <= 0.0) || (bounds.y2 <= 0.0)) { polygon_info=DestroyPolygonThreadSet(polygon_info); return(MagickTrue); /* virtual polygon */ } bounds.x1=bounds.x1 < 0.0 ? 0.0 : bounds.x1 >= (double) image->columns-1.0 ? (double) image->columns-1.0 : bounds.x1; bounds.y1=bounds.y1 < 0.0 ? 0.0 : bounds.y1 >= (double) image->rows-1.0 ? (double) image->rows-1.0 : bounds.y1; bounds.x2=bounds.x2 < 0.0 ? 0.0 : bounds.x2 >= (double) image->columns-1.0 ? (double) image->columns-1.0 : bounds.x2; bounds.y2=bounds.y2 < 0.0 ? 0.0 : bounds.y2 >= (double) image->rows-1.0 ? (double) image->rows-1.0 : bounds.y2; status=MagickTrue; image_view=AcquireAuthenticCacheView(image,exception); if ((primitive_info->coordinates == 1) || (polygon_info[0]->number_edges == 0)) { /* Draw point. */ start_y=(ssize_t) ceil(bounds.y1-0.5); stop_y=(ssize_t) floor(bounds.y2+0.5); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(status) \ magick_number_threads(image,image,stop_y-start_y+1,1) #endif for (y=start_y; y <= stop_y; y++) { MagickBooleanType sync; PixelInfo pixel; register ssize_t x; register Quantum *magick_restrict q; ssize_t start_x, stop_x; if (status == MagickFalse) continue; start_x=(ssize_t) ceil(bounds.x1-0.5); stop_x=(ssize_t) floor(bounds.x2+0.5); x=start_x; q=GetCacheViewAuthenticPixels(image_view,x,y,(size_t) (stop_x-x+1),1, exception); if (q == (Quantum *) NULL) { status=MagickFalse; continue; } GetPixelInfo(image,&pixel); for ( ; x <= stop_x; x++) { if ((x == (ssize_t) ceil(primitive_info->point.x-0.5)) && (y == (ssize_t) ceil(primitive_info->point.y-0.5))) { GetFillColor(draw_info,x-start_x,y-start_y,&pixel,exception); SetPixelViaPixelInfo(image,&pixel,q); } q+=GetPixelChannels(image); } sync=SyncCacheViewAuthenticPixels(image_view,exception); if (sync == MagickFalse) status=MagickFalse; } image_view=DestroyCacheView(image_view); polygon_info=DestroyPolygonThreadSet(polygon_info); if (image->debug != MagickFalse) (void) LogMagickEvent(DrawEvent,GetMagickModule(), " end draw-polygon"); return(status); } /* Draw polygon or line. */ start_y=(ssize_t) ceil(bounds.y1-0.5); stop_y=(ssize_t) floor(bounds.y2+0.5); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(status) \ magick_number_threads(image,image,stop_y-start_y+1,1) #endif for (y=start_y; y <= stop_y; y++) { const int id = GetOpenMPThreadId(); register Quantum *magick_restrict q; register ssize_t x; ssize_t start_x, stop_x; if (status == MagickFalse) continue; start_x=(ssize_t) ceil(bounds.x1-0.5); stop_x=(ssize_t) floor(bounds.x2+0.5); q=GetCacheViewAuthenticPixels(image_view,start_x,y,(size_t) (stop_x-start_x+ 1),1,exception); if (q == (Quantum *) NULL) { status=MagickFalse; continue; } for (x=start_x; x <= stop_x; x++) { double fill_alpha, stroke_alpha; PixelInfo fill_color, stroke_color; /* Fill and/or stroke. */ fill_alpha=GetFillAlpha(polygon_info[id],mid,fill,draw_info->fill_rule, x,y,&stroke_alpha); if (draw_info->stroke_antialias == MagickFalse) { fill_alpha=fill_alpha > 0.25 ? 1.0 : 0.0; stroke_alpha=stroke_alpha > 0.25 ? 1.0 : 0.0; } GetFillColor(draw_info,x-start_x,y-start_y,&fill_color,exception); CompositePixelOver(image,&fill_color,fill_alpha*fill_color.alpha,q, (double) GetPixelAlpha(image,q),q); GetStrokeColor(draw_info,x-start_x,y-start_y,&stroke_color,exception); CompositePixelOver(image,&stroke_color,stroke_alpha*stroke_color.alpha,q, (double) GetPixelAlpha(image,q),q); q+=GetPixelChannels(image); } if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse) status=MagickFalse; } image_view=DestroyCacheView(image_view); polygon_info=DestroyPolygonThreadSet(polygon_info); if (image->debug != MagickFalse) (void) LogMagickEvent(DrawEvent,GetMagickModule()," end draw-polygon"); return(status); }
static MagickBooleanType DrawPolygonPrimitive(Image *image, const DrawInfo *draw_info,const PrimitiveInfo *primitive_info, ExceptionInfo *exception) { CacheView *image_view; MagickBooleanType fill, status; double mid; PolygonInfo **magick_restrict polygon_info; register EdgeInfo *p; register ssize_t i; SegmentInfo bounds; ssize_t start_y, stop_y, y; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); assert(draw_info != (DrawInfo *) NULL); assert(draw_info->signature == MagickCoreSignature); assert(primitive_info != (PrimitiveInfo *) NULL); if (primitive_info->coordinates <= 1) return(MagickTrue); /* Compute bounding box. */ polygon_info=AcquirePolygonThreadSet(primitive_info); if (polygon_info == (PolygonInfo **) NULL) return(MagickFalse); DisableMSCWarning(4127) if (0) { status=DrawBoundingRectangles(image,draw_info,polygon_info[0],exception); if (status == MagickFalse) { polygon_info=DestroyPolygonThreadSet(polygon_info); return(status); } } RestoreMSCWarning if (image->debug != MagickFalse) (void) LogMagickEvent(DrawEvent,GetMagickModule()," begin draw-polygon"); fill=(primitive_info->method == FillToBorderMethod) || (primitive_info->method == FloodfillMethod) ? MagickTrue : MagickFalse; mid=ExpandAffine(&draw_info->affine)*SaneStrokeWidth(image,draw_info)/2.0; bounds=polygon_info[0]->edges[0].bounds; for (i=1; i < (ssize_t) polygon_info[0]->number_edges; i++) { p=polygon_info[0]->edges+i; if (p->bounds.x1 < bounds.x1) bounds.x1=p->bounds.x1; if (p->bounds.y1 < bounds.y1) bounds.y1=p->bounds.y1; if (p->bounds.x2 > bounds.x2) bounds.x2=p->bounds.x2; if (p->bounds.y2 > bounds.y2) bounds.y2=p->bounds.y2; } bounds.x1-=(mid+1.0); bounds.y1-=(mid+1.0); bounds.x2+=(mid+1.0); bounds.y2+=(mid+1.0); if ((bounds.x1 >= (double) image->columns) || (bounds.y1 >= (double) image->rows) || (bounds.x2 <= 0.0) || (bounds.y2 <= 0.0)) { polygon_info=DestroyPolygonThreadSet(polygon_info); return(MagickTrue); /* virtual polygon */ } bounds.x1=bounds.x1 < 0.0 ? 0.0 : bounds.x1 >= (double) image->columns-1.0 ? (double) image->columns-1.0 : bounds.x1; bounds.y1=bounds.y1 < 0.0 ? 0.0 : bounds.y1 >= (double) image->rows-1.0 ? (double) image->rows-1.0 : bounds.y1; bounds.x2=bounds.x2 < 0.0 ? 0.0 : bounds.x2 >= (double) image->columns-1.0 ? (double) image->columns-1.0 : bounds.x2; bounds.y2=bounds.y2 < 0.0 ? 0.0 : bounds.y2 >= (double) image->rows-1.0 ? (double) image->rows-1.0 : bounds.y2; status=MagickTrue; image_view=AcquireAuthenticCacheView(image,exception); if ((primitive_info->coordinates == 1) || (polygon_info[0]->number_edges == 0)) { /* Draw point. */ start_y=(ssize_t) ceil(bounds.y1-0.5); stop_y=(ssize_t) floor(bounds.y2+0.5); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(status) \ magick_number_threads(image,image,stop_y-start_y+1,1) #endif for (y=start_y; y <= stop_y; y++) { MagickBooleanType sync; PixelInfo pixel; register ssize_t x; register Quantum *magick_restrict q; ssize_t start_x, stop_x; if (status == MagickFalse) continue; start_x=(ssize_t) ceil(bounds.x1-0.5); stop_x=(ssize_t) floor(bounds.x2+0.5); x=start_x; q=GetCacheViewAuthenticPixels(image_view,x,y,(size_t) (stop_x-x+1),1, exception); if (q == (Quantum *) NULL) { status=MagickFalse; continue; } GetPixelInfo(image,&pixel); for ( ; x <= stop_x; x++) { if ((x == (ssize_t) ceil(primitive_info->point.x-0.5)) && (y == (ssize_t) ceil(primitive_info->point.y-0.5))) { GetFillColor(draw_info,x-start_x,y-start_y,&pixel,exception); SetPixelViaPixelInfo(image,&pixel,q); } q+=GetPixelChannels(image); } sync=SyncCacheViewAuthenticPixels(image_view,exception); if (sync == MagickFalse) status=MagickFalse; } image_view=DestroyCacheView(image_view); polygon_info=DestroyPolygonThreadSet(polygon_info); if (image->debug != MagickFalse) (void) LogMagickEvent(DrawEvent,GetMagickModule(), " end draw-polygon"); return(status); } /* Draw polygon or line. */ start_y=(ssize_t) ceil(bounds.y1-0.5); stop_y=(ssize_t) floor(bounds.y2+0.5); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(status) \ magick_number_threads(image,image,stop_y-start_y+1,1) #endif for (y=start_y; y <= stop_y; y++) { const int id = GetOpenMPThreadId(); register Quantum *magick_restrict q; register ssize_t x; ssize_t start_x, stop_x; if (status == MagickFalse) continue; start_x=(ssize_t) ceil(bounds.x1-0.5); stop_x=(ssize_t) floor(bounds.x2+0.5); q=GetCacheViewAuthenticPixels(image_view,start_x,y,(size_t) (stop_x-start_x+ 1),1,exception); if (q == (Quantum *) NULL) { status=MagickFalse; continue; } for (x=start_x; x <= stop_x; x++) { double fill_alpha, stroke_alpha; PixelInfo fill_color, stroke_color; /* Fill and/or stroke. */ fill_alpha=GetFillAlpha(polygon_info[id],mid,fill,draw_info->fill_rule, x,y,&stroke_alpha); if (draw_info->stroke_antialias == MagickFalse) { fill_alpha=fill_alpha > 0.25 ? 1.0 : 0.0; stroke_alpha=stroke_alpha > 0.25 ? 1.0 : 0.0; } GetFillColor(draw_info,x-start_x,y-start_y,&fill_color,exception); CompositePixelOver(image,&fill_color,fill_alpha*fill_color.alpha,q, (double) GetPixelAlpha(image,q),q); GetStrokeColor(draw_info,x-start_x,y-start_y,&stroke_color,exception); CompositePixelOver(image,&stroke_color,stroke_alpha*stroke_color.alpha,q, (double) GetPixelAlpha(image,q),q); q+=GetPixelChannels(image); } if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse) status=MagickFalse; } image_view=DestroyCacheView(image_view); polygon_info=DestroyPolygonThreadSet(polygon_info); if (image->debug != MagickFalse) (void) LogMagickEvent(DrawEvent,GetMagickModule()," end draw-polygon"); return(status); }
C
ImageMagick
0
CVE-2013-2596
https://www.cvedetails.com/cve/CVE-2013-2596/
CWE-189
https://github.com/torvalds/linux/commit/b4cbb197c7e7a68dbad0d491242e3ca67420c13e
b4cbb197c7e7a68dbad0d491242e3ca67420c13e
vm: add vm_iomap_memory() helper function Various drivers end up replicating the code to mmap() their memory buffers into user space, and our core memory remapping function may be very flexible but it is unnecessarily complicated for the common cases to use. Our internal VM uses pfn's ("page frame numbers") which simplifies things for the VM, and allows us to pass physical addresses around in a denser and more efficient format than passing a "phys_addr_t" around, and having to shift it up and down by the page size. But it just means that drivers end up doing that shifting instead at the interface level. It also means that drivers end up mucking around with internal VM things like the vma details (vm_pgoff, vm_start/end) way more than they really need to. So this just exports a function to map a certain physical memory range into user space (using a phys_addr_t based interface that is much more natural for a driver) and hides all the complexity from the driver. Some drivers will still end up tweaking the vm_page_prot details for things like prefetching or cacheability etc, but that's actually relevant to the driver, rather than caring about what the page offset of the mapping is into the particular IO memory region. Acked-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
void print_vma_addr(char *prefix, unsigned long ip) { struct mm_struct *mm = current->mm; struct vm_area_struct *vma; /* * Do not print if we are in atomic * contexts (in exception stacks, etc.): */ if (preempt_count()) return; down_read(&mm->mmap_sem); vma = find_vma(mm, ip); if (vma && vma->vm_file) { struct file *f = vma->vm_file; char *buf = (char *)__get_free_page(GFP_KERNEL); if (buf) { char *p; p = d_path(&f->f_path, buf, PAGE_SIZE); if (IS_ERR(p)) p = "?"; printk("%s%s[%lx+%lx]", prefix, kbasename(p), vma->vm_start, vma->vm_end - vma->vm_start); free_page((unsigned long)buf); } } up_read(&mm->mmap_sem); }
void print_vma_addr(char *prefix, unsigned long ip) { struct mm_struct *mm = current->mm; struct vm_area_struct *vma; /* * Do not print if we are in atomic * contexts (in exception stacks, etc.): */ if (preempt_count()) return; down_read(&mm->mmap_sem); vma = find_vma(mm, ip); if (vma && vma->vm_file) { struct file *f = vma->vm_file; char *buf = (char *)__get_free_page(GFP_KERNEL); if (buf) { char *p; p = d_path(&f->f_path, buf, PAGE_SIZE); if (IS_ERR(p)) p = "?"; printk("%s%s[%lx+%lx]", prefix, kbasename(p), vma->vm_start, vma->vm_end - vma->vm_start); free_page((unsigned long)buf); } } up_read(&mm->mmap_sem); }
C
linux
0
CVE-2014-9322
https://www.cvedetails.com/cve/CVE-2014-9322/
CWE-264
https://github.com/torvalds/linux/commit/6f442be2fb22be02cafa606f1769fa1e6f894441
6f442be2fb22be02cafa606f1769fa1e6f894441
x86_64, traps: Stop using IST for #SS On a 32-bit kernel, this has no effect, since there are no IST stacks. On a 64-bit kernel, #SS can only happen in user code, on a failed iret to user space, a canonical violation on access via RSP or RBP, or a genuine stack segment violation in 32-bit kernel code. The first two cases don't need IST, and the latter two cases are unlikely fatal bugs, and promoting them to double faults would be fine. This fixes a bug in which the espfix64 code mishandles a stack segment violation. This saves 4k of memory per CPU and a tiny bit of code. Signed-off-by: Andy Lutomirski <[email protected]> Reviewed-by: Thomas Gleixner <[email protected]> Cc: [email protected] Signed-off-by: Linus Torvalds <[email protected]>
static inline void preempt_conditional_cli(struct pt_regs *regs) { if (regs->flags & X86_EFLAGS_IF) local_irq_disable(); preempt_count_dec(); }
static inline void preempt_conditional_cli(struct pt_regs *regs) { if (regs->flags & X86_EFLAGS_IF) local_irq_disable(); preempt_count_dec(); }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/0e3d721470add955c056e3051614f58c7220e85b
0e3d721470add955c056e3051614f58c7220e85b
webview: Initialize synchronous compositor after first activation. Drawing before the first activation produces no results but can cause cc DCHECKs to fail. To prevent this SynchronousCompositorImpl doesn't register with it's client until the first activation. BUG=492815 Review URL: https://codereview.chromium.org/1150423003 Cr-Commit-Position: refs/heads/master@{#332334}
void SynchronousCompositorImpl::DidChangeRootLayerScrollOffset() { if (input_handler_) input_handler_->OnRootLayerDelegatedScrollOffsetChanged(); }
void SynchronousCompositorImpl::DidChangeRootLayerScrollOffset() { if (input_handler_) input_handler_->OnRootLayerDelegatedScrollOffsetChanged(); }
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 int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb) { struct request_sock *req; struct dccp_request_sock *dreq; struct inet6_request_sock *ireq6; struct ipv6_pinfo *np = inet6_sk(sk); const __be32 service = dccp_hdr_request(skb)->dccph_req_service; struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb); if (skb->protocol == htons(ETH_P_IP)) return dccp_v4_conn_request(sk, skb); if (!ipv6_unicast_destination(skb)) return 0; /* discard, don't send a reset here */ if (dccp_bad_service_code(sk, service)) { dcb->dccpd_reset_code = DCCP_RESET_CODE_BAD_SERVICE_CODE; goto drop; } /* * There are no SYN attacks on IPv6, yet... */ dcb->dccpd_reset_code = DCCP_RESET_CODE_TOO_BUSY; if (inet_csk_reqsk_queue_is_full(sk)) goto drop; if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) goto drop; req = inet6_reqsk_alloc(&dccp6_request_sock_ops); if (req == NULL) goto drop; if (dccp_reqsk_init(req, dccp_sk(sk), skb)) goto drop_and_free; dreq = dccp_rsk(req); if (dccp_parse_options(sk, dreq, skb)) goto drop_and_free; if (security_inet_conn_request(sk, skb, req)) goto drop_and_free; ireq6 = inet6_rsk(req); ipv6_addr_copy(&ireq6->rmt_addr, &ipv6_hdr(skb)->saddr); ipv6_addr_copy(&ireq6->loc_addr, &ipv6_hdr(skb)->daddr); if (ipv6_opt_accepted(sk, skb) || np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo || np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) { atomic_inc(&skb->users); ireq6->pktopts = skb; } ireq6->iif = sk->sk_bound_dev_if; /* So that link locals have meaning */ if (!sk->sk_bound_dev_if && ipv6_addr_type(&ireq6->rmt_addr) & IPV6_ADDR_LINKLOCAL) ireq6->iif = inet6_iif(skb); /* * Step 3: Process LISTEN state * * Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init Cookie * * In fact we defer setting S.GSR, S.SWL, S.SWH to * dccp_create_openreq_child. */ dreq->dreq_isr = dcb->dccpd_seq; dreq->dreq_iss = dccp_v6_init_sequence(skb); dreq->dreq_service = service; if (dccp_v6_send_response(sk, req, NULL)) goto drop_and_free; inet6_csk_reqsk_queue_hash_add(sk, req, DCCP_TIMEOUT_INIT); return 0; drop_and_free: reqsk_free(req); drop: DCCP_INC_STATS_BH(DCCP_MIB_ATTEMPTFAILS); return -1; }
static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb) { struct request_sock *req; struct dccp_request_sock *dreq; struct inet6_request_sock *ireq6; struct ipv6_pinfo *np = inet6_sk(sk); const __be32 service = dccp_hdr_request(skb)->dccph_req_service; struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb); if (skb->protocol == htons(ETH_P_IP)) return dccp_v4_conn_request(sk, skb); if (!ipv6_unicast_destination(skb)) return 0; /* discard, don't send a reset here */ if (dccp_bad_service_code(sk, service)) { dcb->dccpd_reset_code = DCCP_RESET_CODE_BAD_SERVICE_CODE; goto drop; } /* * There are no SYN attacks on IPv6, yet... */ dcb->dccpd_reset_code = DCCP_RESET_CODE_TOO_BUSY; if (inet_csk_reqsk_queue_is_full(sk)) goto drop; if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) goto drop; req = inet6_reqsk_alloc(&dccp6_request_sock_ops); if (req == NULL) goto drop; if (dccp_reqsk_init(req, dccp_sk(sk), skb)) goto drop_and_free; dreq = dccp_rsk(req); if (dccp_parse_options(sk, dreq, skb)) goto drop_and_free; if (security_inet_conn_request(sk, skb, req)) goto drop_and_free; ireq6 = inet6_rsk(req); ipv6_addr_copy(&ireq6->rmt_addr, &ipv6_hdr(skb)->saddr); ipv6_addr_copy(&ireq6->loc_addr, &ipv6_hdr(skb)->daddr); if (ipv6_opt_accepted(sk, skb) || np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo || np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) { atomic_inc(&skb->users); ireq6->pktopts = skb; } ireq6->iif = sk->sk_bound_dev_if; /* So that link locals have meaning */ if (!sk->sk_bound_dev_if && ipv6_addr_type(&ireq6->rmt_addr) & IPV6_ADDR_LINKLOCAL) ireq6->iif = inet6_iif(skb); /* * Step 3: Process LISTEN state * * Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init Cookie * * In fact we defer setting S.GSR, S.SWL, S.SWH to * dccp_create_openreq_child. */ dreq->dreq_isr = dcb->dccpd_seq; dreq->dreq_iss = dccp_v6_init_sequence(skb); dreq->dreq_service = service; if (dccp_v6_send_response(sk, req, NULL)) goto drop_and_free; inet6_csk_reqsk_queue_hash_add(sk, req, DCCP_TIMEOUT_INIT); return 0; drop_and_free: reqsk_free(req); drop: DCCP_INC_STATS_BH(DCCP_MIB_ATTEMPTFAILS); return -1; }
C
linux
0
CVE-2012-5112
https://www.cvedetails.com/cve/CVE-2012-5112/
CWE-399
https://github.com/chromium/chromium/commit/d65b01ca819881a507b5e60c25a2f9caff58cd57
d65b01ca819881a507b5e60c25a2f9caff58cd57
Wipe out QuotaThreadTask. This is a one of a series of refactoring patches for QuotaManager. http://codereview.chromium.org/10872054/ http://codereview.chromium.org/10917060/ BUG=139270 Review URL: https://chromiumcodereview.appspot.com/10919070 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@154987 0039d316-1c4b-4281-b951-d872f2087c98
void QuotaManager::DumpOriginInfoTable( const DumpOriginInfoTableCallback& callback) { DumpOriginInfoTableHelper* helper = new DumpOriginInfoTableHelper; PostTaskAndReplyWithResultForDBThread( FROM_HERE, base::Bind(&DumpOriginInfoTableHelper::DumpOriginInfoTableOnDBThread, base::Unretained(helper)), base::Bind(&DumpOriginInfoTableHelper::DidDumpOriginInfoTable, base::Owned(helper), weak_factory_.GetWeakPtr(), callback)); }
void QuotaManager::DumpOriginInfoTable( const DumpOriginInfoTableCallback& callback) { DumpOriginInfoTableHelper* helper = new DumpOriginInfoTableHelper; PostTaskAndReplyWithResultForDBThread( FROM_HERE, base::Bind(&DumpOriginInfoTableHelper::DumpOriginInfoTableOnDBThread, base::Unretained(helper)), base::Bind(&DumpOriginInfoTableHelper::DidDumpOriginInfoTable, base::Owned(helper), weak_factory_.GetWeakPtr(), callback)); }
C
Chrome
0
CVE-2014-3200
https://www.cvedetails.com/cve/CVE-2014-3200/
null
https://github.com/chromium/chromium/commit/c0947dabeaa10da67798c1bbc668dca4b280cad5
c0947dabeaa10da67798c1bbc668dca4b280cad5
[Contextual Search] Change "Now on Tap" to "Contextual Cards" BUG=644934 Review-Url: https://codereview.chromium.org/2361163003 Cr-Commit-Position: refs/heads/master@{#420899}
TemplateURL::~TemplateURL() { }
TemplateURL::~TemplateURL() { }
C
Chrome
0
CVE-2013-2887
https://www.cvedetails.com/cve/CVE-2013-2887/
null
https://github.com/chromium/chromium/commit/01924fbe6c0e0f059ca46a03f9f6b2670ae3e0fa
01924fbe6c0e0f059ca46a03f9f6b2670ae3e0fa
Pass ui::LatencyInfo correct with unified gesture detector on Aura. BUG=379812 TEST=GestureRecognizerTest.LatencyPassedFromTouchEvent Review URL: https://codereview.chromium.org/309823002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274602 0039d316-1c4b-4281-b951-d872f2087c98
bool pinch_begin() const { return pinch_begin_; }
bool pinch_begin() const { return pinch_begin_; }
C
Chrome
0
CVE-2012-2891
https://www.cvedetails.com/cve/CVE-2012-2891/
CWE-200
https://github.com/chromium/chromium/commit/116d0963cadfbf55ef2ec3d13781987c4d80517a
116d0963cadfbf55ef2ec3d13781987c4d80517a
Print preview: Use an ID instead of memory pointer string in WebUI. BUG=144051 Review URL: https://chromiumcodereview.appspot.com/10870003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153342 0039d316-1c4b-4281-b951-d872f2087c98
void PrintPreviewHandler::ClearInitiatorTabDetails() { TabContents* initiator_tab = GetInitiatorTab(); if (!initiator_tab) return; printing::PrintPreviewTabController* tab_controller = printing::PrintPreviewTabController::GetInstance(); if (tab_controller) tab_controller->EraseInitiatorTabInfo(preview_tab_contents()); }
void PrintPreviewHandler::ClearInitiatorTabDetails() { TabContents* initiator_tab = GetInitiatorTab(); if (!initiator_tab) return; printing::PrintPreviewTabController* tab_controller = printing::PrintPreviewTabController::GetInstance(); if (tab_controller) tab_controller->EraseInitiatorTabInfo(preview_tab_contents()); }
C
Chrome
0
CVE-2017-17434
https://www.cvedetails.com/cve/CVE-2017-17434/
null
https://git.samba.org/?p=rsync.git;a=commit;h=5509597decdbd7b91994210f700329d8a35e70a1
5509597decdbd7b91994210f700329d8a35e70a1
null
static void discard_receive_data(int f_in, OFF_T length) { receive_data(f_in, NULL, -1, 0, NULL, -1, length); }
static void discard_receive_data(int f_in, OFF_T length) { receive_data(f_in, NULL, -1, 0, NULL, -1, length); }
C
samba
0
CVE-2013-6640
https://www.cvedetails.com/cve/CVE-2013-6640/
CWE-119
https://github.com/chromium/chromium/commit/516abadc2553489ce28faeea4917280032fbe91d
516abadc2553489ce28faeea4917280032fbe91d
Update AffiliationFetcher to use new Affiliation API wire format. The new format is not backward compatible with the old one, therefore this CL updates the client side protobuf definitions to be in line with the API definition. However, this CL does not yet make use of any additional fields introduced in the new wire format. BUG=437865 Review URL: https://codereview.chromium.org/996613002 Cr-Commit-Position: refs/heads/master@{#319860}
MockAffiliationFetcherDelegate() {}
MockAffiliationFetcherDelegate() {}
C
Chrome
0
CVE-2017-6991
https://www.cvedetails.com/cve/CVE-2017-6991/
CWE-119
https://github.com/chromium/chromium/commit/3bfe67c9c4b45eb713326aae7a67c8f7390dae08
3bfe67c9c4b45eb713326aae7a67c8f7390dae08
sqlite: safely move pointer values through SQL. This lands https://www.sqlite.org/src/timeline?c=d6a44b35 in third_party/sqlite/src/ and third_party/sqlite/patches/0013-Add-new-interfaces-sqlite3_bind_pointer-sqlite3_resu.patch and re-generates third_party/sqlite/amalgamation/* using the script at third_party/sqlite/google_generate_amalgamation.sh. The CL also adds a layout test that verifies the patch works as intended. BUG=742407 Change-Id: I2e1a457459cd2e975e6241b630e7b79c82545981 Reviewed-on: https://chromium-review.googlesource.com/572976 Reviewed-by: Chris Mumford <[email protected]> Commit-Queue: Victor Costan <[email protected]> Cr-Commit-Position: refs/heads/master@{#487275}
static int allowedOp(int op){ assert( TK_GT>TK_EQ && TK_GT<TK_GE ); assert( TK_LT>TK_EQ && TK_LT<TK_GE ); assert( TK_LE>TK_EQ && TK_LE<TK_GE ); assert( TK_GE==TK_EQ+4 ); return op==TK_IN || (op>=TK_EQ && op<=TK_GE) || op==TK_ISNULL || op==TK_IS; }
static int allowedOp(int op){ assert( TK_GT>TK_EQ && TK_GT<TK_GE ); assert( TK_LT>TK_EQ && TK_LT<TK_GE ); assert( TK_LE>TK_EQ && TK_LE<TK_GE ); assert( TK_GE==TK_EQ+4 ); return op==TK_IN || (op>=TK_EQ && op<=TK_GE) || op==TK_ISNULL || op==TK_IS; }
C
Chrome
0
CVE-2014-8133
https://www.cvedetails.com/cve/CVE-2014-8133/
CWE-264
https://github.com/torvalds/linux/commit/41bdc78544b8a93a9c6814b8bbbfef966272abbe
41bdc78544b8a93a9c6814b8bbbfef966272abbe
x86/tls: Validate TLS entries to protect espfix Installing a 16-bit RW data segment into the GDT defeats espfix. AFAICT this will not affect glibc, Wine, or dosemu at all. Signed-off-by: Andy Lutomirski <[email protected]> Acked-by: H. Peter Anvin <[email protected]> Cc: [email protected] Cc: Konrad Rzeszutek Wilk <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: [email protected] <[email protected]> Cc: Willy Tarreau <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
int regset_tls_set(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf) { struct user_desc infobuf[GDT_ENTRY_TLS_ENTRIES]; const struct user_desc *info; int i; if (pos >= GDT_ENTRY_TLS_ENTRIES * sizeof(struct user_desc) || (pos % sizeof(struct user_desc)) != 0 || (count % sizeof(struct user_desc)) != 0) return -EINVAL; if (kbuf) info = kbuf; else if (__copy_from_user(infobuf, ubuf, count)) return -EFAULT; else info = infobuf; for (i = 0; i < count / sizeof(struct user_desc); i++) if (!tls_desc_okay(info + i)) return -EINVAL; set_tls_desc(target, GDT_ENTRY_TLS_MIN + (pos / sizeof(struct user_desc)), info, count / sizeof(struct user_desc)); return 0; }
int regset_tls_set(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf) { struct user_desc infobuf[GDT_ENTRY_TLS_ENTRIES]; const struct user_desc *info; if (pos >= GDT_ENTRY_TLS_ENTRIES * sizeof(struct user_desc) || (pos % sizeof(struct user_desc)) != 0 || (count % sizeof(struct user_desc)) != 0) return -EINVAL; if (kbuf) info = kbuf; else if (__copy_from_user(infobuf, ubuf, count)) return -EFAULT; else info = infobuf; set_tls_desc(target, GDT_ENTRY_TLS_MIN + (pos / sizeof(struct user_desc)), info, count / sizeof(struct user_desc)); return 0; }
C
linux
1
CVE-2011-4930
https://www.cvedetails.com/cve/CVE-2011-4930/
CWE-134
https://htcondor-git.cs.wisc.edu/?p=condor.git;a=commitdiff;h=5e5571d1a431eb3c61977b6dd6ec90186ef79867
5e5571d1a431eb3c61977b6dd6ec90186ef79867
null
int param_integer_c( const char *name, int default_value, int min_value, int max_value, bool use_param_table ) { return param_integer( name, default_value, min_value, max_value, use_param_table ); }
int param_integer_c( const char *name, int default_value, int min_value, int max_value, bool use_param_table ) { return param_integer( name, default_value, min_value, max_value, use_param_table ); }
CPP
htcondor
0
CVE-2017-6435
https://www.cvedetails.com/cve/CVE-2017-6435/
CWE-119
https://github.com/libimobiledevice/libplist/commit/fbd8494d5e4e46bf2e90cb6116903e404374fb56
fbd8494d5e4e46bf2e90cb6116903e404374fb56
bplist: Make sure to bail out if malloc() fails in parse_string_node() Credit to Wang Junjie <[email protected]> (#93)
static void serialize_plist(node_t* node, void* data) { uint64_t *index_val = NULL; struct serialize_s *ser = (struct serialize_s *) data; uint64_t current_index = ser->objects->len; void* val = hash_table_lookup(ser->ref_table, node); if (val) { return; } index_val = (uint64_t *) malloc(sizeof(uint64_t)); *index_val = current_index; hash_table_insert(ser->ref_table, node, index_val); ptr_array_add(ser->objects, node); node_iterator_t *ni = node_iterator_create(node->children); node_t *ch; while ((ch = node_iterator_next(ni))) { serialize_plist(ch, data); } node_iterator_destroy(ni); return; }
static void serialize_plist(node_t* node, void* data) { uint64_t *index_val = NULL; struct serialize_s *ser = (struct serialize_s *) data; uint64_t current_index = ser->objects->len; void* val = hash_table_lookup(ser->ref_table, node); if (val) { return; } index_val = (uint64_t *) malloc(sizeof(uint64_t)); *index_val = current_index; hash_table_insert(ser->ref_table, node, index_val); ptr_array_add(ser->objects, node); node_iterator_t *ni = node_iterator_create(node->children); node_t *ch; while ((ch = node_iterator_next(ni))) { serialize_plist(ch, data); } node_iterator_destroy(ni); return; }
C
libplist
0
CVE-2016-5353
https://www.cvedetails.com/cve/CVE-2016-5353/
CWE-20
https://github.com/wireshark/wireshark/commit/7d7190695ce2ff269fdffb04e87139995cde21f4
7d7190695ce2ff269fdffb04e87139995cde21f4
UMTS_FP: fix handling reserved C/T value The spec puts the reserved value at 0xf but our internal table has 'unknown' at 0; since all the other values seem to be offset-by-one, just take the modulus 0xf to avoid running off the end of the table. Bug: 12191 Change-Id: I83c8fb66797bbdee52a2246fb1eea6e37cbc7eb0 Reviewed-on: https://code.wireshark.org/review/15722 Reviewed-by: Evan Huus <[email protected]> Petri-Dish: Evan Huus <[email protected]> Tested-by: Petri Dish Buildbot <[email protected]> Reviewed-by: Michael Mann <[email protected]>
dissect_e_dch_t2_or_common_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, struct fp_info *p_fp_info, int number_of_subframes, gboolean is_common, guint16 header_crc, proto_item * header_crc_pi, void *data) { int n; int pdu_no; guint64 total_macis_sdus; guint16 macis_sdus_found = 0; guint16 macis_pdus = 0; gboolean F = TRUE; /* We want to continue loop if get E-RNTI indication... */ gint bit_offset; proto_item *subframe_macis_descriptors_ti = NULL; static struct edch_t2_subframe_info subframes[16]; guint header_length = 0; /* User Buffer size */ proto_tree_add_bits_item(tree, hf_fp_edch_user_buffer_size, tvb, offset*8, 18, ENC_BIG_ENDIAN); offset += 2; /* Spare is in-between... */ /* Total number of MAC-is SDUs */ proto_tree_add_bits_ret_val(tree, hf_fp_edch_no_macid_sdus, tvb, offset*8+4, 12, &total_macis_sdus, ENC_BIG_ENDIAN); offset += 2; if (is_common) { /* E-RNTI */ proto_tree_add_item(tree, hf_fp_edch_e_rnti, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; } bit_offset = offset*8; /* EDCH subframe header list */ for (n=0; n < number_of_subframes; n++) { guint64 subframe_number; guint64 no_of_macis_pdus; proto_item *subframe_header_ti; proto_tree *subframe_header_tree; /* Add subframe header subtree */ subframe_header_ti = proto_tree_add_string_format(tree, hf_fp_edch_subframe_header, tvb, offset, 0, "", "Subframe"); subframe_header_tree = proto_item_add_subtree(subframe_header_ti, ett_fp_edch_subframe_header); /* Spare bit */ bit_offset++; if (!is_common) { /* Number of HARQ Retransmissions */ proto_tree_add_item(subframe_header_tree, hf_fp_edch_harq_retransmissions, tvb, bit_offset/8, 1, ENC_BIG_ENDIAN); bit_offset += 4; } /* Subframe number */ proto_tree_add_bits_ret_val(subframe_header_tree, hf_fp_edch_subframe_number, tvb, bit_offset, 3, &subframe_number, ENC_BIG_ENDIAN); subframes[n].subframe_number = (guint8)subframe_number; bit_offset += 3; /* Number of MAC-is PDUs */ proto_tree_add_bits_ret_val(subframe_header_tree, hf_fp_edch_number_of_mac_is_pdus, tvb, bit_offset, 4, &no_of_macis_pdus, ENC_BIG_ENDIAN); bit_offset += 4; subframes[n].number_of_mac_is_pdus = (guint8)no_of_macis_pdus; macis_pdus += subframes[n].number_of_mac_is_pdus; /* Next 4 bits are spare for T2*/ if (!is_common) { bit_offset += 4; } /* Show summary in root */ proto_item_append_text(subframe_header_ti, " (SFN %u, %u MAC-is PDUs)", subframes[n].subframe_number, subframes[n].number_of_mac_is_pdus); proto_item_set_len(subframe_header_ti, is_common ? 1 : 2); } offset = bit_offset / 8; /* MAC-is PDU descriptors for each subframe follow */ for (n=0; n < number_of_subframes; n++) { proto_tree *subframe_macis_descriptors_tree; /* Add subframe header subtree */ subframe_macis_descriptors_ti = proto_tree_add_string_format(tree, hf_fp_edch_macis_descriptors, tvb, offset, 0, "", "MAC-is descriptors (SFN %u)", subframes[n].subframe_number); proto_item_set_len(subframe_macis_descriptors_ti, subframes[n].number_of_mac_is_pdus*2); subframe_macis_descriptors_tree = proto_item_add_subtree(subframe_macis_descriptors_ti, ett_fp_edch_macis_descriptors); /* Find a sequence of descriptors for each MAC-is PDU in this subframe */ for (pdu_no=0; pdu_no < subframes[n].number_of_mac_is_pdus; pdu_no++) { proto_item *f_ti = NULL; subframes[n].number_of_mac_is_sdus[pdu_no] = 0; do { /* Check we haven't gone past the limit */ if (macis_sdus_found++ > total_macis_sdus) { expert_add_info_format(pinfo, f_ti, &ei_fp_mac_is_sdus_miscount, "Found too many (%u) MAC-is SDUs - header said there were %u", macis_sdus_found, (guint16)total_macis_sdus); } /* LCH-ID */ subframes[n].mac_is_lchid[pdu_no][subframes[n].number_of_mac_is_sdus[pdu_no]] = (tvb_get_guint8(tvb, offset) & 0xf0) >> 4; proto_tree_add_item(subframe_macis_descriptors_tree, hf_fp_edch_macis_lchid, tvb, offset, 1, ENC_BIG_ENDIAN); if (subframes[n].mac_is_lchid[pdu_no][subframes[n].number_of_mac_is_sdus[pdu_no]] == 15) { proto_item *ti; /* 4 bits of spare */ offset++; /* E-RNTI */ ti = proto_tree_add_item(tree, hf_fp_edch_e_rnti, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; /* This is only allowed if: - it's the common case AND - it's the first descriptor */ if (!is_common) { expert_add_info(pinfo, ti, &ei_fp_e_rnti_t2_edch_frames); } if (subframes[n].number_of_mac_is_sdus[pdu_no] > 0) { expert_add_info(pinfo, ti, &ei_fp_e_rnti_first_entry); } continue; } /* Length */ subframes[n].mac_is_length[pdu_no][subframes[n].number_of_mac_is_sdus[pdu_no]] = (tvb_get_ntohs(tvb, offset) & 0x0ffe) >> 1; proto_tree_add_item(subframe_macis_descriptors_tree, hf_fp_edch_macis_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset++; /* Flag */ F = tvb_get_guint8(tvb, offset) & 0x01; f_ti = proto_tree_add_item(subframe_macis_descriptors_tree, hf_fp_edch_macis_flag, tvb, offset, 1, ENC_BIG_ENDIAN); subframes[n].number_of_mac_is_sdus[pdu_no]++; offset++; } while (F == 0); } } /* Check overall count of MAC-is SDUs */ if (macis_sdus_found != total_macis_sdus) { expert_add_info_format(pinfo, subframe_macis_descriptors_ti, &ei_fp_mac_is_sdus_miscount, "Frame contains %u MAC-is SDUs - header said there would be %u!", macis_sdus_found, (guint16)total_macis_sdus); } header_length = offset; /* Now PDUs */ for (n=0; n < number_of_subframes; n++) { /* MAC-is PDU */ for (pdu_no=0; pdu_no < subframes[n].number_of_mac_is_pdus; pdu_no++) { int i; guint length = 0; umts_mac_is_info * mac_is_info = wmem_new(wmem_file_scope(), umts_mac_is_info); mac_is_info->number_of_mac_is_sdus = subframes[n].number_of_mac_is_sdus[pdu_no]; DISSECTOR_ASSERT(subframes[n].number_of_mac_is_sdus[pdu_no] <= MAX_MAC_FRAMES); for (i = 0; i < subframes[n].number_of_mac_is_sdus[pdu_no]; i++) { mac_is_info->sdulength[i] = subframes[n].mac_is_length[pdu_no][i]; mac_is_info->lchid[i] = subframes[n].mac_is_lchid[pdu_no][i]; length += subframes[n].mac_is_length[pdu_no][i]; } /* Call MAC for this PDU if configured to */ if (preferences_call_mac_dissectors) { p_add_proto_data(wmem_file_scope(), pinfo, proto_umts_mac, 0, mac_is_info); call_dissector_with_data(mac_fdd_edch_type2_handle, tvb_new_subset_remaining(tvb, offset), pinfo, top_level_tree, data); } else { /* Still show data if not decoding as MAC PDU */ proto_tree_add_item(tree, hf_fp_edch_mac_is_pdu, tvb, offset, length, ENC_NA); } /* get_mac_tsn_size in packet-umts_mac.h, gets the global_mac_tsn_size preference in umts_mac.c */ if (get_mac_tsn_size() == MAC_TSN_14BITS) { offset += length + 2; /* Plus 2 bytes for TSN 14 bits and SS 2 bit. */ } else { offset += length + 1; /* Plus 1 byte for TSN 6 bits and SS 2 bit. */ } } } if (preferences_header_checksum) { verify_header_crc_edch(tvb, pinfo, header_crc_pi, header_crc, header_length); } /* Spare extension and payload CRC (optional) */ dissect_spare_extension_and_crc(tvb, pinfo, tree, p_fp_info->dch_crc_present, offset, header_length); }
dissect_e_dch_t2_or_common_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, struct fp_info *p_fp_info, int number_of_subframes, gboolean is_common, guint16 header_crc, proto_item * header_crc_pi, void *data) { int n; int pdu_no; guint64 total_macis_sdus; guint16 macis_sdus_found = 0; guint16 macis_pdus = 0; gboolean F = TRUE; /* We want to continue loop if get E-RNTI indication... */ gint bit_offset; proto_item *subframe_macis_descriptors_ti = NULL; static struct edch_t2_subframe_info subframes[16]; guint header_length = 0; /* User Buffer size */ proto_tree_add_bits_item(tree, hf_fp_edch_user_buffer_size, tvb, offset*8, 18, ENC_BIG_ENDIAN); offset += 2; /* Spare is in-between... */ /* Total number of MAC-is SDUs */ proto_tree_add_bits_ret_val(tree, hf_fp_edch_no_macid_sdus, tvb, offset*8+4, 12, &total_macis_sdus, ENC_BIG_ENDIAN); offset += 2; if (is_common) { /* E-RNTI */ proto_tree_add_item(tree, hf_fp_edch_e_rnti, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; } bit_offset = offset*8; /* EDCH subframe header list */ for (n=0; n < number_of_subframes; n++) { guint64 subframe_number; guint64 no_of_macis_pdus; proto_item *subframe_header_ti; proto_tree *subframe_header_tree; /* Add subframe header subtree */ subframe_header_ti = proto_tree_add_string_format(tree, hf_fp_edch_subframe_header, tvb, offset, 0, "", "Subframe"); subframe_header_tree = proto_item_add_subtree(subframe_header_ti, ett_fp_edch_subframe_header); /* Spare bit */ bit_offset++; if (!is_common) { /* Number of HARQ Retransmissions */ proto_tree_add_item(subframe_header_tree, hf_fp_edch_harq_retransmissions, tvb, bit_offset/8, 1, ENC_BIG_ENDIAN); bit_offset += 4; } /* Subframe number */ proto_tree_add_bits_ret_val(subframe_header_tree, hf_fp_edch_subframe_number, tvb, bit_offset, 3, &subframe_number, ENC_BIG_ENDIAN); subframes[n].subframe_number = (guint8)subframe_number; bit_offset += 3; /* Number of MAC-is PDUs */ proto_tree_add_bits_ret_val(subframe_header_tree, hf_fp_edch_number_of_mac_is_pdus, tvb, bit_offset, 4, &no_of_macis_pdus, ENC_BIG_ENDIAN); bit_offset += 4; subframes[n].number_of_mac_is_pdus = (guint8)no_of_macis_pdus; macis_pdus += subframes[n].number_of_mac_is_pdus; /* Next 4 bits are spare for T2*/ if (!is_common) { bit_offset += 4; } /* Show summary in root */ proto_item_append_text(subframe_header_ti, " (SFN %u, %u MAC-is PDUs)", subframes[n].subframe_number, subframes[n].number_of_mac_is_pdus); proto_item_set_len(subframe_header_ti, is_common ? 1 : 2); } offset = bit_offset / 8; /* MAC-is PDU descriptors for each subframe follow */ for (n=0; n < number_of_subframes; n++) { proto_tree *subframe_macis_descriptors_tree; /* Add subframe header subtree */ subframe_macis_descriptors_ti = proto_tree_add_string_format(tree, hf_fp_edch_macis_descriptors, tvb, offset, 0, "", "MAC-is descriptors (SFN %u)", subframes[n].subframe_number); proto_item_set_len(subframe_macis_descriptors_ti, subframes[n].number_of_mac_is_pdus*2); subframe_macis_descriptors_tree = proto_item_add_subtree(subframe_macis_descriptors_ti, ett_fp_edch_macis_descriptors); /* Find a sequence of descriptors for each MAC-is PDU in this subframe */ for (pdu_no=0; pdu_no < subframes[n].number_of_mac_is_pdus; pdu_no++) { proto_item *f_ti = NULL; subframes[n].number_of_mac_is_sdus[pdu_no] = 0; do { /* Check we haven't gone past the limit */ if (macis_sdus_found++ > total_macis_sdus) { expert_add_info_format(pinfo, f_ti, &ei_fp_mac_is_sdus_miscount, "Found too many (%u) MAC-is SDUs - header said there were %u", macis_sdus_found, (guint16)total_macis_sdus); } /* LCH-ID */ subframes[n].mac_is_lchid[pdu_no][subframes[n].number_of_mac_is_sdus[pdu_no]] = (tvb_get_guint8(tvb, offset) & 0xf0) >> 4; proto_tree_add_item(subframe_macis_descriptors_tree, hf_fp_edch_macis_lchid, tvb, offset, 1, ENC_BIG_ENDIAN); if (subframes[n].mac_is_lchid[pdu_no][subframes[n].number_of_mac_is_sdus[pdu_no]] == 15) { proto_item *ti; /* 4 bits of spare */ offset++; /* E-RNTI */ ti = proto_tree_add_item(tree, hf_fp_edch_e_rnti, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; /* This is only allowed if: - it's the common case AND - it's the first descriptor */ if (!is_common) { expert_add_info(pinfo, ti, &ei_fp_e_rnti_t2_edch_frames); } if (subframes[n].number_of_mac_is_sdus[pdu_no] > 0) { expert_add_info(pinfo, ti, &ei_fp_e_rnti_first_entry); } continue; } /* Length */ subframes[n].mac_is_length[pdu_no][subframes[n].number_of_mac_is_sdus[pdu_no]] = (tvb_get_ntohs(tvb, offset) & 0x0ffe) >> 1; proto_tree_add_item(subframe_macis_descriptors_tree, hf_fp_edch_macis_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset++; /* Flag */ F = tvb_get_guint8(tvb, offset) & 0x01; f_ti = proto_tree_add_item(subframe_macis_descriptors_tree, hf_fp_edch_macis_flag, tvb, offset, 1, ENC_BIG_ENDIAN); subframes[n].number_of_mac_is_sdus[pdu_no]++; offset++; } while (F == 0); } } /* Check overall count of MAC-is SDUs */ if (macis_sdus_found != total_macis_sdus) { expert_add_info_format(pinfo, subframe_macis_descriptors_ti, &ei_fp_mac_is_sdus_miscount, "Frame contains %u MAC-is SDUs - header said there would be %u!", macis_sdus_found, (guint16)total_macis_sdus); } header_length = offset; /* Now PDUs */ for (n=0; n < number_of_subframes; n++) { /* MAC-is PDU */ for (pdu_no=0; pdu_no < subframes[n].number_of_mac_is_pdus; pdu_no++) { int i; guint length = 0; umts_mac_is_info * mac_is_info = wmem_new(wmem_file_scope(), umts_mac_is_info); mac_is_info->number_of_mac_is_sdus = subframes[n].number_of_mac_is_sdus[pdu_no]; DISSECTOR_ASSERT(subframes[n].number_of_mac_is_sdus[pdu_no] <= MAX_MAC_FRAMES); for (i = 0; i < subframes[n].number_of_mac_is_sdus[pdu_no]; i++) { mac_is_info->sdulength[i] = subframes[n].mac_is_length[pdu_no][i]; mac_is_info->lchid[i] = subframes[n].mac_is_lchid[pdu_no][i]; length += subframes[n].mac_is_length[pdu_no][i]; } /* Call MAC for this PDU if configured to */ if (preferences_call_mac_dissectors) { p_add_proto_data(wmem_file_scope(), pinfo, proto_umts_mac, 0, mac_is_info); call_dissector_with_data(mac_fdd_edch_type2_handle, tvb_new_subset_remaining(tvb, offset), pinfo, top_level_tree, data); } else { /* Still show data if not decoding as MAC PDU */ proto_tree_add_item(tree, hf_fp_edch_mac_is_pdu, tvb, offset, length, ENC_NA); } /* get_mac_tsn_size in packet-umts_mac.h, gets the global_mac_tsn_size preference in umts_mac.c */ if (get_mac_tsn_size() == MAC_TSN_14BITS) { offset += length + 2; /* Plus 2 bytes for TSN 14 bits and SS 2 bit. */ } else { offset += length + 1; /* Plus 1 byte for TSN 6 bits and SS 2 bit. */ } } } if (preferences_header_checksum) { verify_header_crc_edch(tvb, pinfo, header_crc_pi, header_crc, header_length); } /* Spare extension and payload CRC (optional) */ dissect_spare_extension_and_crc(tvb, pinfo, tree, p_fp_info->dch_crc_present, offset, header_length); }
C
wireshark
0
CVE-2015-8963
https://www.cvedetails.com/cve/CVE-2015-8963/
CWE-416
https://github.com/torvalds/linux/commit/12ca6ad2e3a896256f086497a7c7406a547ee373
12ca6ad2e3a896256f086497a7c7406a547ee373
perf: Fix race in swevent hash There's a race on CPU unplug where we free the swevent hash array while it can still have events on. This will result in a use-after-free which is BAD. Simply do not free the hash array on unplug. This leaves the thing around and no use-after-free takes place. When the last swevent dies, we do a for_each_possible_cpu() iteration anyway to clean these up, at which time we'll free it, so no leakage will occur. Reported-by: Sasha Levin <[email protected]> Tested-by: Sasha Levin <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vince Weaver <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
static int perf_event_period(struct perf_event *event, u64 __user *arg) { struct period_event pe = { .event = event, }; struct perf_event_context *ctx = event->ctx; struct task_struct *task; u64 value; if (!is_sampling_event(event)) return -EINVAL; if (copy_from_user(&value, arg, sizeof(value))) return -EFAULT; if (!value) return -EINVAL; if (event->attr.freq && value > sysctl_perf_event_sample_rate) return -EINVAL; task = ctx->task; pe.value = value; if (!task) { cpu_function_call(event->cpu, __perf_event_period, &pe); return 0; } retry: if (!task_function_call(task, __perf_event_period, &pe)) return 0; raw_spin_lock_irq(&ctx->lock); if (ctx->is_active) { raw_spin_unlock_irq(&ctx->lock); task = ctx->task; goto retry; } if (event->attr.freq) { event->attr.sample_freq = value; } else { event->attr.sample_period = value; event->hw.sample_period = value; } local64_set(&event->hw.period_left, 0); raw_spin_unlock_irq(&ctx->lock); return 0; }
static int perf_event_period(struct perf_event *event, u64 __user *arg) { struct period_event pe = { .event = event, }; struct perf_event_context *ctx = event->ctx; struct task_struct *task; u64 value; if (!is_sampling_event(event)) return -EINVAL; if (copy_from_user(&value, arg, sizeof(value))) return -EFAULT; if (!value) return -EINVAL; if (event->attr.freq && value > sysctl_perf_event_sample_rate) return -EINVAL; task = ctx->task; pe.value = value; if (!task) { cpu_function_call(event->cpu, __perf_event_period, &pe); return 0; } retry: if (!task_function_call(task, __perf_event_period, &pe)) return 0; raw_spin_lock_irq(&ctx->lock); if (ctx->is_active) { raw_spin_unlock_irq(&ctx->lock); task = ctx->task; goto retry; } if (event->attr.freq) { event->attr.sample_freq = value; } else { event->attr.sample_period = value; event->hw.sample_period = value; } local64_set(&event->hw.period_left, 0); raw_spin_unlock_irq(&ctx->lock); return 0; }
C
linux
0
CVE-2015-3212
https://www.cvedetails.com/cve/CVE-2015-3212/
CWE-362
https://github.com/torvalds/linux/commit/2d45a02d0166caf2627fe91897c6ffc3b19514c4
2d45a02d0166caf2627fe91897c6ffc3b19514c4
sctp: fix ASCONF list handling ->auto_asconf_splist is per namespace and mangled by functions like sctp_setsockopt_auto_asconf() which doesn't guarantee any serialization. Also, the call to inet_sk_copy_descendant() was backuping ->auto_asconf_list through the copy but was not honoring ->do_auto_asconf, which could lead to list corruption if it was different between both sockets. This commit thus fixes the list handling by using ->addr_wq_lock spinlock to protect the list. A special handling is done upon socket creation and destruction for that. Error handlig on sctp_init_sock() will never return an error after having initialized asconf, so sctp_destroy_sock() can be called without addrq_wq_lock. The lock now will be take on sctp_close_sock(), before locking the socket, so we don't do it in inverse order compared to sctp_addr_wq_timeout_handler(). Instead of taking the lock on sctp_sock_migrate() for copying and restoring the list values, it's preferred to avoid rewritting it by implementing sctp_copy_descendant(). Issue was found with a test application that kept flipping sysctl default_auto_asconf on and off, but one could trigger it by issuing simultaneous setsockopt() calls on multiple sockets or by creating/destroying sockets fast enough. This is only triggerable locally. Fixes: 9f7d653b67ae ("sctp: Add Auto-ASCONF support (core).") Reported-by: Ji Jianwen <[email protected]> Suggested-by: Neil Horman <[email protected]> Suggested-by: Hannes Frederic Sowa <[email protected]> Acked-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: Marcelo Ricardo Leitner <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr) { struct sctp_bind_hashbucket *head; /* hash list */ struct sctp_bind_bucket *pp; unsigned short snum; int ret; snum = ntohs(addr->v4.sin_port); pr_debug("%s: begins, snum:%d\n", __func__, snum); local_bh_disable(); if (snum == 0) { /* Search for an available port. */ int low, high, remaining, index; unsigned int rover; struct net *net = sock_net(sk); inet_get_local_port_range(net, &low, &high); remaining = (high - low) + 1; rover = prandom_u32() % remaining + low; do { rover++; if ((rover < low) || (rover > high)) rover = low; if (inet_is_local_reserved_port(net, rover)) continue; index = sctp_phashfn(sock_net(sk), rover); head = &sctp_port_hashtable[index]; spin_lock(&head->lock); sctp_for_each_hentry(pp, &head->chain) if ((pp->port == rover) && net_eq(sock_net(sk), pp->net)) goto next; break; next: spin_unlock(&head->lock); } while (--remaining > 0); /* Exhausted local port range during search? */ ret = 1; if (remaining <= 0) goto fail; /* OK, here is the one we will use. HEAD (the port * hash table list entry) is non-NULL and we hold it's * mutex. */ snum = rover; } else { /* We are given an specific port number; we verify * that it is not being used. If it is used, we will * exahust the search in the hash list corresponding * to the port number (snum) - we detect that with the * port iterator, pp being NULL. */ head = &sctp_port_hashtable[sctp_phashfn(sock_net(sk), snum)]; spin_lock(&head->lock); sctp_for_each_hentry(pp, &head->chain) { if ((pp->port == snum) && net_eq(pp->net, sock_net(sk))) goto pp_found; } } pp = NULL; goto pp_not_found; pp_found: if (!hlist_empty(&pp->owner)) { /* We had a port hash table hit - there is an * available port (pp != NULL) and it is being * used by other socket (pp->owner not empty); that other * socket is going to be sk2. */ int reuse = sk->sk_reuse; struct sock *sk2; pr_debug("%s: found a possible match\n", __func__); if (pp->fastreuse && sk->sk_reuse && sk->sk_state != SCTP_SS_LISTENING) goto success; /* Run through the list of sockets bound to the port * (pp->port) [via the pointers bind_next and * bind_pprev in the struct sock *sk2 (pp->sk)]. On each one, * we get the endpoint they describe and run through * the endpoint's list of IP (v4 or v6) addresses, * comparing each of the addresses with the address of * the socket sk. If we find a match, then that means * that this port/socket (sk) combination are already * in an endpoint. */ sk_for_each_bound(sk2, &pp->owner) { struct sctp_endpoint *ep2; ep2 = sctp_sk(sk2)->ep; if (sk == sk2 || (reuse && sk2->sk_reuse && sk2->sk_state != SCTP_SS_LISTENING)) continue; if (sctp_bind_addr_conflict(&ep2->base.bind_addr, addr, sctp_sk(sk2), sctp_sk(sk))) { ret = (long)sk2; goto fail_unlock; } } pr_debug("%s: found a match\n", __func__); } pp_not_found: /* If there was a hash table miss, create a new port. */ ret = 1; if (!pp && !(pp = sctp_bucket_create(head, sock_net(sk), snum))) goto fail_unlock; /* In either case (hit or miss), make sure fastreuse is 1 only * if sk->sk_reuse is too (that is, if the caller requested * SO_REUSEADDR on this socket -sk-). */ if (hlist_empty(&pp->owner)) { if (sk->sk_reuse && sk->sk_state != SCTP_SS_LISTENING) pp->fastreuse = 1; else pp->fastreuse = 0; } else if (pp->fastreuse && (!sk->sk_reuse || sk->sk_state == SCTP_SS_LISTENING)) pp->fastreuse = 0; /* We are set, so fill up all the data in the hash table * entry, tie the socket list information with the rest of the * sockets FIXME: Blurry, NPI (ipg). */ success: if (!sctp_sk(sk)->bind_hash) { inet_sk(sk)->inet_num = snum; sk_add_bind_node(sk, &pp->owner); sctp_sk(sk)->bind_hash = pp; } ret = 0; fail_unlock: spin_unlock(&head->lock); fail: local_bh_enable(); return ret; }
static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr) { struct sctp_bind_hashbucket *head; /* hash list */ struct sctp_bind_bucket *pp; unsigned short snum; int ret; snum = ntohs(addr->v4.sin_port); pr_debug("%s: begins, snum:%d\n", __func__, snum); local_bh_disable(); if (snum == 0) { /* Search for an available port. */ int low, high, remaining, index; unsigned int rover; struct net *net = sock_net(sk); inet_get_local_port_range(net, &low, &high); remaining = (high - low) + 1; rover = prandom_u32() % remaining + low; do { rover++; if ((rover < low) || (rover > high)) rover = low; if (inet_is_local_reserved_port(net, rover)) continue; index = sctp_phashfn(sock_net(sk), rover); head = &sctp_port_hashtable[index]; spin_lock(&head->lock); sctp_for_each_hentry(pp, &head->chain) if ((pp->port == rover) && net_eq(sock_net(sk), pp->net)) goto next; break; next: spin_unlock(&head->lock); } while (--remaining > 0); /* Exhausted local port range during search? */ ret = 1; if (remaining <= 0) goto fail; /* OK, here is the one we will use. HEAD (the port * hash table list entry) is non-NULL and we hold it's * mutex. */ snum = rover; } else { /* We are given an specific port number; we verify * that it is not being used. If it is used, we will * exahust the search in the hash list corresponding * to the port number (snum) - we detect that with the * port iterator, pp being NULL. */ head = &sctp_port_hashtable[sctp_phashfn(sock_net(sk), snum)]; spin_lock(&head->lock); sctp_for_each_hentry(pp, &head->chain) { if ((pp->port == snum) && net_eq(pp->net, sock_net(sk))) goto pp_found; } } pp = NULL; goto pp_not_found; pp_found: if (!hlist_empty(&pp->owner)) { /* We had a port hash table hit - there is an * available port (pp != NULL) and it is being * used by other socket (pp->owner not empty); that other * socket is going to be sk2. */ int reuse = sk->sk_reuse; struct sock *sk2; pr_debug("%s: found a possible match\n", __func__); if (pp->fastreuse && sk->sk_reuse && sk->sk_state != SCTP_SS_LISTENING) goto success; /* Run through the list of sockets bound to the port * (pp->port) [via the pointers bind_next and * bind_pprev in the struct sock *sk2 (pp->sk)]. On each one, * we get the endpoint they describe and run through * the endpoint's list of IP (v4 or v6) addresses, * comparing each of the addresses with the address of * the socket sk. If we find a match, then that means * that this port/socket (sk) combination are already * in an endpoint. */ sk_for_each_bound(sk2, &pp->owner) { struct sctp_endpoint *ep2; ep2 = sctp_sk(sk2)->ep; if (sk == sk2 || (reuse && sk2->sk_reuse && sk2->sk_state != SCTP_SS_LISTENING)) continue; if (sctp_bind_addr_conflict(&ep2->base.bind_addr, addr, sctp_sk(sk2), sctp_sk(sk))) { ret = (long)sk2; goto fail_unlock; } } pr_debug("%s: found a match\n", __func__); } pp_not_found: /* If there was a hash table miss, create a new port. */ ret = 1; if (!pp && !(pp = sctp_bucket_create(head, sock_net(sk), snum))) goto fail_unlock; /* In either case (hit or miss), make sure fastreuse is 1 only * if sk->sk_reuse is too (that is, if the caller requested * SO_REUSEADDR on this socket -sk-). */ if (hlist_empty(&pp->owner)) { if (sk->sk_reuse && sk->sk_state != SCTP_SS_LISTENING) pp->fastreuse = 1; else pp->fastreuse = 0; } else if (pp->fastreuse && (!sk->sk_reuse || sk->sk_state == SCTP_SS_LISTENING)) pp->fastreuse = 0; /* We are set, so fill up all the data in the hash table * entry, tie the socket list information with the rest of the * sockets FIXME: Blurry, NPI (ipg). */ success: if (!sctp_sk(sk)->bind_hash) { inet_sk(sk)->inet_num = snum; sk_add_bind_node(sk, &pp->owner); sctp_sk(sk)->bind_hash = pp; } ret = 0; fail_unlock: spin_unlock(&head->lock); fail: local_bh_enable(); return ret; }
C
linux
0
CVE-2016-7970
https://www.cvedetails.com/cve/CVE-2016-7970/
CWE-119
https://github.com/libass/libass/pull/240/commits/08e754612019ed84d1db0d1fc4f5798248decd75
08e754612019ed84d1db0d1fc4f5798248decd75
Fix blur coefficient calculation buffer overflow Found by fuzzer test case id:000082,sig:11,src:002579,op:havoc,rep:8. Correctness should be checked, but this fixes the overflow for good.
void ass_pre_blur3_horz_c(int16_t *dst, const int16_t *src, uintptr_t src_width, uintptr_t src_height) { uintptr_t dst_width = src_width + 6; uintptr_t size = ((src_width + STRIPE_MASK) & ~STRIPE_MASK) * src_height; uintptr_t step = STRIPE_WIDTH * src_height; uintptr_t offs = 0; int16_t buf[2 * STRIPE_WIDTH]; int16_t *ptr = buf + STRIPE_WIDTH; for (uintptr_t x = 0; x < dst_width; x += STRIPE_WIDTH) { for (uintptr_t y = 0; y < src_height; ++y) { copy_line(ptr - 1 * STRIPE_WIDTH, src, offs - 1 * step, size); copy_line(ptr - 0 * STRIPE_WIDTH, src, offs - 0 * step, size); for (int k = 0; k < STRIPE_WIDTH; ++k) dst[k] = pre_blur3_func(ptr[k - 6], ptr[k - 5], ptr[k - 4], ptr[k - 3], ptr[k - 2], ptr[k - 1], ptr[k]); dst += STRIPE_WIDTH; offs += STRIPE_WIDTH; } } }
void ass_pre_blur3_horz_c(int16_t *dst, const int16_t *src, uintptr_t src_width, uintptr_t src_height) { uintptr_t dst_width = src_width + 6; uintptr_t size = ((src_width + STRIPE_MASK) & ~STRIPE_MASK) * src_height; uintptr_t step = STRIPE_WIDTH * src_height; uintptr_t offs = 0; int16_t buf[2 * STRIPE_WIDTH]; int16_t *ptr = buf + STRIPE_WIDTH; for (uintptr_t x = 0; x < dst_width; x += STRIPE_WIDTH) { for (uintptr_t y = 0; y < src_height; ++y) { copy_line(ptr - 1 * STRIPE_WIDTH, src, offs - 1 * step, size); copy_line(ptr - 0 * STRIPE_WIDTH, src, offs - 0 * step, size); for (int k = 0; k < STRIPE_WIDTH; ++k) dst[k] = pre_blur3_func(ptr[k - 6], ptr[k - 5], ptr[k - 4], ptr[k - 3], ptr[k - 2], ptr[k - 1], ptr[k]); dst += STRIPE_WIDTH; offs += STRIPE_WIDTH; } } }
C
libass
0
CVE-2014-7145
https://www.cvedetails.com/cve/CVE-2014-7145/
CWE-399
https://github.com/torvalds/linux/commit/18f39e7be0121317550d03e267e3ebd4dbfbb3ce
18f39e7be0121317550d03e267e3ebd4dbfbb3ce
[CIFS] Possible null ptr deref in SMB2_tcon As Raphael Geissert pointed out, tcon_error_exit can dereference tcon and there is one path in which tcon can be null. Signed-off-by: Steve French <[email protected]> CC: Stable <[email protected]> # v3.7+ Reported-by: Raphael Geissert <[email protected]>
create_durable_buf(void) { struct create_durable *buf; buf = kzalloc(sizeof(struct create_durable), GFP_KERNEL); if (!buf) return NULL; buf->ccontext.DataOffset = cpu_to_le16(offsetof (struct create_durable, Data)); buf->ccontext.DataLength = cpu_to_le32(16); buf->ccontext.NameOffset = cpu_to_le16(offsetof (struct create_durable, Name)); buf->ccontext.NameLength = cpu_to_le16(4); /* SMB2_CREATE_DURABLE_HANDLE_REQUEST is "DHnQ" */ buf->Name[0] = 'D'; buf->Name[1] = 'H'; buf->Name[2] = 'n'; buf->Name[3] = 'Q'; return buf; }
create_durable_buf(void) { struct create_durable *buf; buf = kzalloc(sizeof(struct create_durable), GFP_KERNEL); if (!buf) return NULL; buf->ccontext.DataOffset = cpu_to_le16(offsetof (struct create_durable, Data)); buf->ccontext.DataLength = cpu_to_le32(16); buf->ccontext.NameOffset = cpu_to_le16(offsetof (struct create_durable, Name)); buf->ccontext.NameLength = cpu_to_le16(4); /* SMB2_CREATE_DURABLE_HANDLE_REQUEST is "DHnQ" */ buf->Name[0] = 'D'; buf->Name[1] = 'H'; buf->Name[2] = 'n'; buf->Name[3] = 'Q'; return buf; }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/b9e2ecab97a8a7f3cce06951ab92a3eaef559206
b9e2ecab97a8a7f3cce06951ab92a3eaef559206
Do not discount a MANUAL_SUBFRAME load just because it involved some redirects. R=brettw BUG=21353 TEST=none Review URL: http://codereview.chromium.org/246073 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27887 0039d316-1c4b-4281-b951-d872f2087c98
void ConfigureEntriesForRestore( std::vector<linked_ptr<NavigationEntry> >* entries) { for (size_t i = 0; i < entries->size(); ++i) { (*entries)[i]->set_transition_type(PageTransition::RELOAD); (*entries)[i]->set_restored(true); SetContentStateIfEmpty((*entries)[i].get()); } }
void ConfigureEntriesForRestore( std::vector<linked_ptr<NavigationEntry> >* entries) { for (size_t i = 0; i < entries->size(); ++i) { (*entries)[i]->set_transition_type(PageTransition::RELOAD); (*entries)[i]->set_restored(true); SetContentStateIfEmpty((*entries)[i].get()); } }
C
Chrome
0
CVE-2015-1213
https://www.cvedetails.com/cve/CVE-2015-1213/
CWE-119
https://github.com/chromium/chromium/commit/faaa2fd0a05f1622d9a8806da118d4f3b602e707
faaa2fd0a05f1622d9a8806da118d4f3b602e707
[Blink>Media] Allow autoplay muted on Android by default There was a mistake causing autoplay muted is shipped on Android but it will be disabled if the chromium embedder doesn't specify content setting for "AllowAutoplay" preference. This CL makes the AllowAutoplay preference true by default so that it is allowed by embedders (including AndroidWebView) unless they explicitly disable it. Intent to ship: https://groups.google.com/a/chromium.org/d/msg/blink-dev/Q1cnzNI2GpI/AL_eyUNABgAJ BUG=689018 Review-Url: https://codereview.chromium.org/2677173002 Cr-Commit-Position: refs/heads/master@{#448423}
void HTMLMediaElement::setNetworkState(WebMediaPlayer::NetworkState state) { BLINK_MEDIA_LOG << "setNetworkState(" << (void*)this << ", " << static_cast<int>(state) << ") - current state is " << static_cast<int>(m_networkState); if (state == WebMediaPlayer::NetworkStateEmpty) { setNetworkState(kNetworkEmpty); return; } if (state == WebMediaPlayer::NetworkStateFormatError || state == WebMediaPlayer::NetworkStateNetworkError || state == WebMediaPlayer::NetworkStateDecodeError) { mediaLoadingFailed(state); return; } if (state == WebMediaPlayer::NetworkStateIdle) { if (m_networkState > kNetworkIdle) { changeNetworkStateFromLoadingToIdle(); setShouldDelayLoadEvent(false); } else { setNetworkState(kNetworkIdle); } } if (state == WebMediaPlayer::NetworkStateLoading) { if (m_networkState < kNetworkLoading || m_networkState == kNetworkNoSource) startProgressEventTimer(); setNetworkState(kNetworkLoading); } if (state == WebMediaPlayer::NetworkStateLoaded) { if (m_networkState != kNetworkIdle) changeNetworkStateFromLoadingToIdle(); } }
void HTMLMediaElement::setNetworkState(WebMediaPlayer::NetworkState state) { BLINK_MEDIA_LOG << "setNetworkState(" << (void*)this << ", " << static_cast<int>(state) << ") - current state is " << static_cast<int>(m_networkState); if (state == WebMediaPlayer::NetworkStateEmpty) { setNetworkState(kNetworkEmpty); return; } if (state == WebMediaPlayer::NetworkStateFormatError || state == WebMediaPlayer::NetworkStateNetworkError || state == WebMediaPlayer::NetworkStateDecodeError) { mediaLoadingFailed(state); return; } if (state == WebMediaPlayer::NetworkStateIdle) { if (m_networkState > kNetworkIdle) { changeNetworkStateFromLoadingToIdle(); setShouldDelayLoadEvent(false); } else { setNetworkState(kNetworkIdle); } } if (state == WebMediaPlayer::NetworkStateLoading) { if (m_networkState < kNetworkLoading || m_networkState == kNetworkNoSource) startProgressEventTimer(); setNetworkState(kNetworkLoading); } if (state == WebMediaPlayer::NetworkStateLoaded) { if (m_networkState != kNetworkIdle) changeNetworkStateFromLoadingToIdle(); } }
C
Chrome
0
CVE-2017-5061
https://www.cvedetails.com/cve/CVE-2017-5061/
CWE-362
https://github.com/chromium/chromium/commit/5d78b84d39bd34bc9fce9d01c0dcd5a22a330d34
5d78b84d39bd34bc9fce9d01c0dcd5a22a330d34
(Reland) Discard compositor frames from unloaded web content This is a reland of https://codereview.chromium.org/2707243005/ with a small change to fix an uninitialized memory error that fails on MSAN bots. BUG=672847 [email protected], [email protected] CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_site_isolation Review-Url: https://codereview.chromium.org/2731283003 Cr-Commit-Position: refs/heads/master@{#454954}
bool LayerTreeHost::PaintContent(const LayerList& update_layer_list, bool* content_is_suitable_for_gpu) { base::AutoReset<bool> painting(&in_paint_layer_contents_, true); bool did_paint_content = false; for (const auto& layer : update_layer_list) { did_paint_content |= layer->Update(); *content_is_suitable_for_gpu &= layer->IsSuitableForGpuRasterization(); } return did_paint_content; }
bool LayerTreeHost::PaintContent(const LayerList& update_layer_list, bool* content_is_suitable_for_gpu) { base::AutoReset<bool> painting(&in_paint_layer_contents_, true); bool did_paint_content = false; for (const auto& layer : update_layer_list) { did_paint_content |= layer->Update(); *content_is_suitable_for_gpu &= layer->IsSuitableForGpuRasterization(); } return did_paint_content; }
C
Chrome
0
CVE-2012-2896
https://www.cvedetails.com/cve/CVE-2012-2896/
CWE-189
https://github.com/chromium/chromium/commit/3aad1a37affb1ab70d1897f2b03eb8c077264984
3aad1a37affb1ab70d1897f2b03eb8c077264984
Fix SafeAdd and SafeMultiply BUG=145648,145544 Review URL: https://chromiumcodereview.appspot.com/10916165 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155478 0039d316-1c4b-4281-b951-d872f2087c98
void GLES2DecoderImpl::DoUniform2iv( GLint fake_location, GLsizei count, const GLint* value) { GLenum type = 0; GLint real_location = -1; if (!PrepForSetUniformByLocation( fake_location, "glUniform2iv", &real_location, &type, &count)) { return; } glUniform2iv(real_location, count, value); }
void GLES2DecoderImpl::DoUniform2iv( GLint fake_location, GLsizei count, const GLint* value) { GLenum type = 0; GLint real_location = -1; if (!PrepForSetUniformByLocation( fake_location, "glUniform2iv", &real_location, &type, &count)) { return; } glUniform2iv(real_location, count, value); }
C
Chrome
0
CVE-2015-6780
https://www.cvedetails.com/cve/CVE-2015-6780/
null
https://github.com/chromium/chromium/commit/f2cba0d13b3a6d76dedede66731e5ca253d3b2af
f2cba0d13b3a6d76dedede66731e5ca253d3b2af
Fix UAF in Origin Info Bubble and permission settings UI. In addition to fixing the UAF, will this also fix the problem of the bubble showing over the previous tab (if the bubble is open when the tab it was opened for closes). BUG=490492 TBR=tedchoc Review URL: https://codereview.chromium.org/1317443002 Cr-Commit-Position: refs/heads/master@{#346023}
views::View* WebsiteSettingsPopupView::CreateConnectionTab() { views::View* pane = new views::View(); pane->SetLayoutManager( new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1)); identity_info_content_ = new views::View(); pane->AddChildView(identity_info_content_); pane->AddChildView(new views::Separator(views::Separator::HORIZONTAL)); connection_info_content_ = new views::View(); pane->AddChildView(connection_info_content_); pane->AddChildView(new views::Separator(views::Separator::HORIZONTAL)); help_center_link_ = new views::Link( l10n_util::GetStringUTF16(IDS_PAGE_INFO_HELP_CENTER_LINK)); help_center_link_->set_listener(this); help_center_content_ = new views::View(); views::View* link_section = CreateSection(base::string16(), help_center_content_, help_center_link_); link_section->AddChildView(help_center_link_); pane->AddChildView(link_section); return pane; }
views::View* WebsiteSettingsPopupView::CreateConnectionTab() { views::View* pane = new views::View(); pane->SetLayoutManager( new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1)); identity_info_content_ = new views::View(); pane->AddChildView(identity_info_content_); pane->AddChildView(new views::Separator(views::Separator::HORIZONTAL)); connection_info_content_ = new views::View(); pane->AddChildView(connection_info_content_); pane->AddChildView(new views::Separator(views::Separator::HORIZONTAL)); help_center_link_ = new views::Link( l10n_util::GetStringUTF16(IDS_PAGE_INFO_HELP_CENTER_LINK)); help_center_link_->set_listener(this); help_center_content_ = new views::View(); views::View* link_section = CreateSection(base::string16(), help_center_content_, help_center_link_); link_section->AddChildView(help_center_link_); pane->AddChildView(link_section); return pane; }
C
Chrome
0
CVE-2014-4978
https://www.cvedetails.com/cve/CVE-2014-4978/
CWE-59
https://github.com/rawstudio/rawstudio/commit/9c2cd3c93c05d009a91d84eedbb85873b0cb505d
9c2cd3c93c05d009a91d84eedbb85873b0cb505d
Fixes insecure use of temporary file (CVE-2014-4978).
rs_filter_new(const gchar *name, RSFilter *previous) { RS_DEBUG(FILTERS, "rs_filter_new(%s, %s [%p])", name, RS_FILTER_NAME(previous), previous); g_return_val_if_fail(name != NULL, NULL); g_return_val_if_fail((previous == NULL) || RS_IS_FILTER(previous), NULL); GType type = g_type_from_name(name); RSFilter *filter = NULL; if (g_type_is_a (type, RS_TYPE_FILTER)) filter = g_object_new(type, NULL); if (!RS_IS_FILTER(filter)) g_warning("Could not instantiate filter of type \"%s\"", name); if (previous) rs_filter_set_previous(filter, previous); return filter; }
rs_filter_new(const gchar *name, RSFilter *previous) { RS_DEBUG(FILTERS, "rs_filter_new(%s, %s [%p])", name, RS_FILTER_NAME(previous), previous); g_return_val_if_fail(name != NULL, NULL); g_return_val_if_fail((previous == NULL) || RS_IS_FILTER(previous), NULL); GType type = g_type_from_name(name); RSFilter *filter = NULL; if (g_type_is_a (type, RS_TYPE_FILTER)) filter = g_object_new(type, NULL); if (!RS_IS_FILTER(filter)) g_warning("Could not instantiate filter of type \"%s\"", name); if (previous) rs_filter_set_previous(filter, previous); return filter; }
C
rawstudio
0
CVE-2012-5112
https://www.cvedetails.com/cve/CVE-2012-5112/
CWE-399
https://github.com/chromium/chromium/commit/d65b01ca819881a507b5e60c25a2f9caff58cd57
d65b01ca819881a507b5e60c25a2f9caff58cd57
Wipe out QuotaThreadTask. This is a one of a series of refactoring patches for QuotaManager. http://codereview.chromium.org/10872054/ http://codereview.chromium.org/10917060/ BUG=139270 Review URL: https://chromiumcodereview.appspot.com/10919070 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@154987 0039d316-1c4b-4281-b951-d872f2087c98
void QuotaManagerProxy::NotifyStorageAccessed( QuotaClient::ID client_id, const GURL& origin, StorageType type) { if (!io_thread_->BelongsToCurrentThread()) { io_thread_->PostTask( FROM_HERE, base::Bind(&QuotaManagerProxy::NotifyStorageAccessed, this, client_id, origin, type)); return; } if (manager_) manager_->NotifyStorageAccessed(client_id, origin, type); }
void QuotaManagerProxy::NotifyStorageAccessed( QuotaClient::ID client_id, const GURL& origin, StorageType type) { if (!io_thread_->BelongsToCurrentThread()) { io_thread_->PostTask( FROM_HERE, base::Bind(&QuotaManagerProxy::NotifyStorageAccessed, this, client_id, origin, type)); return; } if (manager_) manager_->NotifyStorageAccessed(client_id, origin, type); }
C
Chrome
0
CVE-2017-1000201
https://www.cvedetails.com/cve/CVE-2017-1000201/
CWE-20
https://github.com/open-iscsi/tcmu-runner/pull/200/commits/e2d953050766ac538615a811c64b34358614edce
e2d953050766ac538615a811c64b34358614edce
fixed local DoS when UnregisterHandler was called for a not existing handler Any user with DBUS access could cause a SEGFAULT in tcmu-runner by running something like this: dbus-send --system --print-reply --dest=org.kernel.TCMUService1 /org/kernel/TCMUService1/HandlerManager1 org.kernel.TCMUService1.HandlerManager1.UnregisterHandler string:123
static struct tcmur_handler *find_handler_by_subtype(gchar *subtype) { struct tcmur_handler **handler; darray_foreach(handler, g_runner_handlers) { if (strcmp((*handler)->subtype, subtype) == 0) return *handler; } return NULL; }
static struct tcmur_handler *find_handler_by_subtype(gchar *subtype) { struct tcmur_handler **handler; darray_foreach(handler, g_runner_handlers) { if (strcmp((*handler)->subtype, subtype) == 0) return *handler; } return NULL; }
C
tcmu-runner
0
null
null
null
https://github.com/chromium/chromium/commit/27c68f543e5eba779902447445dfb05ec3f5bf75
27c68f543e5eba779902447445dfb05ec3f5bf75
Revert of Add accelerated VP9 decode infrastructure and an implementation for VA-API. (patchset #7 id:260001 of https://codereview.chromium.org/1318863003/ ) Reason for revert: I think this patch broke compile step for Chromium Linux ChromeOS MSan Builder. First failing build: http://build.chromium.org/p/chromium.memory.fyi/builders/Chromium%20Linux%20ChromeOS%20MSan%20Builder/builds/8310 All recent builds: http://build.chromium.org/p/chromium.memory.fyi/builders/Chromium%20Linux%20ChromeOS%20MSan%20Builder?numbuilds=200 Sorry for the revert. I'll re-revert if I'm wrong. Cheers, Tommy Original issue's description: > Add accelerated VP9 decode infrastructure and an implementation for VA-API. > > - Add a hardware/platform-independent VP9Decoder class and related > infrastructure, implementing AcceleratedVideoDecoder interface. VP9Decoder > performs the initial stages of the decode process, which are to be done > on host/in software, such as stream parsing and reference frame management. > > - Add a VP9Accelerator interface, used by the VP9Decoder to offload the > remaining stages of the decode process to hardware. VP9Accelerator > implementations are platform-specific. > > - Add the first implementation of VP9Accelerator - VaapiVP9Accelerator - and > integrate it with VaapiVideoDecodeAccelerator, for devices which provide > hardware VP9 acceleration through VA-API. Hook it up to the new > infrastructure and VP9Decoder. > > - Extend Vp9Parser to provide functionality required by VP9Decoder and > VP9Accelerator, including superframe parsing, handling of loop filter > and segmentation initialization, state persistence across frames and > resetting when needed. Also add code calculating segmentation dequants > and loop filter levels. > > - Update vp9_parser_unittest to the new Vp9Parser interface and flow. > > TEST=vp9_parser_unittest,vda_unittest,Chrome VP9 playback > BUG=chrome-os-partner:41469,chrome-os-partner:41470,chromium:525331 > [email protected] > > Committed: https://crrev.com/e3cc0a661b8abfdc74f569940949bc1f336ece40 > Cr-Commit-Position: refs/heads/master@{#349312} [email protected],[email protected],[email protected],[email protected],[email protected] NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=chrome-os-partner:41469,chrome-os-partner:41470,chromium:525331 Review URL: https://codereview.chromium.org/1357513002 Cr-Commit-Position: refs/heads/master@{#349443}
void VaapiVideoDecodeAccelerator::AssignPictureBuffers( const std::vector<media::PictureBuffer>& buffers) { DCHECK_EQ(message_loop_, base::MessageLoop::current()); base::AutoLock auto_lock(lock_); DCHECK(pictures_.empty()); while (!output_buffers_.empty()) output_buffers_.pop(); RETURN_AND_NOTIFY_ON_FAILURE( buffers.size() >= requested_num_pics_, "Got an invalid number of picture buffers. (Got " << buffers.size() << ", requested " << requested_num_pics_ << ")", INVALID_ARGUMENT, ); DCHECK(requested_pic_size_ == buffers[0].size()); std::vector<VASurfaceID> va_surface_ids; RETURN_AND_NOTIFY_ON_FAILURE( vaapi_wrapper_->CreateSurfaces(VA_RT_FORMAT_YUV420, requested_pic_size_, buffers.size(), &va_surface_ids), "Failed creating VA Surfaces", PLATFORM_FAILURE, ); DCHECK_EQ(va_surface_ids.size(), buffers.size()); for (size_t i = 0; i < buffers.size(); ++i) { DVLOG(2) << "Assigning picture id: " << buffers[i].id() << " to texture id: " << buffers[i].texture_id() << " VASurfaceID: " << va_surface_ids[i]; linked_ptr<VaapiPicture> picture(VaapiPicture::CreatePicture( vaapi_wrapper_.get(), make_context_current_, buffers[i].id(), buffers[i].texture_id(), requested_pic_size_)); scoped_refptr<gfx::GLImage> image = picture->GetImageToBind(); if (image) { bind_image_.Run(buffers[i].internal_texture_id(), VaapiPicture::GetGLTextureTarget(), image); } RETURN_AND_NOTIFY_ON_FAILURE( picture.get(), "Failed assigning picture buffer to a texture.", PLATFORM_FAILURE, ); bool inserted = pictures_.insert(std::make_pair(buffers[i].id(), picture)).second; DCHECK(inserted); output_buffers_.push(buffers[i].id()); available_va_surfaces_.push_back(va_surface_ids[i]); surfaces_available_.Signal(); } state_ = kDecoding; decoder_thread_task_runner_->PostTask( FROM_HERE, base::Bind(&VaapiVideoDecodeAccelerator::DecodeTask, base::Unretained(this))); }
void VaapiVideoDecodeAccelerator::AssignPictureBuffers( const std::vector<media::PictureBuffer>& buffers) { DCHECK_EQ(message_loop_, base::MessageLoop::current()); base::AutoLock auto_lock(lock_); DCHECK(pictures_.empty()); while (!output_buffers_.empty()) output_buffers_.pop(); RETURN_AND_NOTIFY_ON_FAILURE( buffers.size() >= requested_num_pics_, "Got an invalid number of picture buffers. (Got " << buffers.size() << ", requested " << requested_num_pics_ << ")", INVALID_ARGUMENT, ); DCHECK(requested_pic_size_ == buffers[0].size()); std::vector<VASurfaceID> va_surface_ids; RETURN_AND_NOTIFY_ON_FAILURE( vaapi_wrapper_->CreateSurfaces(VA_RT_FORMAT_YUV420, requested_pic_size_, buffers.size(), &va_surface_ids), "Failed creating VA Surfaces", PLATFORM_FAILURE, ); DCHECK_EQ(va_surface_ids.size(), buffers.size()); for (size_t i = 0; i < buffers.size(); ++i) { DVLOG(2) << "Assigning picture id: " << buffers[i].id() << " to texture id: " << buffers[i].texture_id() << " VASurfaceID: " << va_surface_ids[i]; linked_ptr<VaapiPicture> picture(VaapiPicture::CreatePicture( vaapi_wrapper_.get(), make_context_current_, buffers[i].id(), buffers[i].texture_id(), requested_pic_size_)); scoped_refptr<gfx::GLImage> image = picture->GetImageToBind(); if (image) { bind_image_.Run(buffers[i].internal_texture_id(), VaapiPicture::GetGLTextureTarget(), image); } RETURN_AND_NOTIFY_ON_FAILURE( picture.get(), "Failed assigning picture buffer to a texture.", PLATFORM_FAILURE, ); bool inserted = pictures_.insert(std::make_pair(buffers[i].id(), picture)).second; DCHECK(inserted); output_buffers_.push(buffers[i].id()); available_va_surfaces_.push_back(va_surface_ids[i]); surfaces_available_.Signal(); } state_ = kDecoding; decoder_thread_task_runner_->PostTask( FROM_HERE, base::Bind(&VaapiVideoDecodeAccelerator::DecodeTask, base::Unretained(this))); }
C
Chrome
0
CVE-2015-6763
https://www.cvedetails.com/cve/CVE-2015-6763/
null
https://github.com/chromium/chromium/commit/f1574f25e1402e748bf2bd7e28ce3dd96ceb1ca4
f1574f25e1402e748bf2bd7e28ce3dd96ceb1ca4
MacViews: Enable secure text input for password Textfields. In Cocoa the NSTextInputContext automatically enables secure text input when activated and it's in the secure text entry mode. RenderWidgetHostViewMac did the similar thing for ages following the WebKit example. views::Textfield needs to do the same thing in a fashion that's sycnrhonized with RenderWidgetHostViewMac, otherwise the race conditions are possible when the Textfield gets focus, activates the secure text input mode and the RWHVM loses focus immediately afterwards and disables the secure text input instead of leaving it in the enabled state. BUG=818133,677220 Change-Id: I6db6c4b59e4a1a72cbb7f8c7056f71b04a3df08b Reviewed-on: https://chromium-review.googlesource.com/943064 Commit-Queue: Michail Pishchagin <[email protected]> Reviewed-by: Pavel Feldman <[email protected]> Reviewed-by: Avi Drissman <[email protected]> Reviewed-by: Peter Kasting <[email protected]> Cr-Commit-Position: refs/heads/master@{#542517}
void MockInputMethod::SetResultTextForNextKey(const base::string16& result) { result_text_ = result; }
void MockInputMethod::SetResultTextForNextKey(const base::string16& result) { result_text_ = result; }
C
Chrome
0
CVE-2016-4558
https://www.cvedetails.com/cve/CVE-2016-4558/
null
https://github.com/torvalds/linux/commit/92117d8443bc5afacc8d5ba82e541946310f106e
92117d8443bc5afacc8d5ba82e541946310f106e
bpf: fix refcnt overflow On a system with >32Gbyte of phyiscal memory and infinite RLIMIT_MEMLOCK, the malicious application may overflow 32-bit bpf program refcnt. It's also possible to overflow map refcnt on 1Tb system. Impose 32k hard limit which means that the same bpf program or map cannot be shared by more than 32k processes. Fixes: 1be7f75d1668 ("bpf: enable non-root eBPF programs") Reported-by: Jann Horn <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Acked-by: Daniel Borkmann <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static void free_used_maps(struct bpf_prog_aux *aux) { int i; for (i = 0; i < aux->used_map_cnt; i++) bpf_map_put(aux->used_maps[i]); kfree(aux->used_maps); }
static void free_used_maps(struct bpf_prog_aux *aux) { int i; for (i = 0; i < aux->used_map_cnt; i++) bpf_map_put(aux->used_maps[i]); kfree(aux->used_maps); }
C
linux
0
CVE-2016-4303
https://www.cvedetails.com/cve/CVE-2016-4303/
CWE-119
https://github.com/esnet/iperf/commit/91f2fa59e8ed80dfbf400add0164ee0e508e412a
91f2fa59e8ed80dfbf400add0164ee0e508e412a
Fix a buffer overflow / heap corruption issue that could occur if a malformed JSON string was passed on the control channel. This issue, present in the cJSON library, was already fixed upstream, so was addressed here in iperf3 by importing a newer version of cJSON (plus local ESnet modifications). Discovered and reported by Dave McDaniel, Cisco Talos. Based on a patch by @dopheide-esnet, with input from @DaveGamble. Cross-references: TALOS-CAN-0164, ESNET-SECADV-2016-0001, CVE-2016-4303 (cherry picked from commit ed94082be27d971a5e1b08b666e2c217cf470a40) Signed-off-by: Bruce A. Mah <[email protected]>
iperf_exchange_results(struct iperf_test *test) { if (test->role == 'c') { /* Send results to server. */ if (send_results(test) < 0) return -1; /* Get server results. */ if (get_results(test) < 0) return -1; } else { /* Get client results. */ if (get_results(test) < 0) return -1; /* Send results to client. */ if (send_results(test) < 0) return -1; } return 0; }
iperf_exchange_results(struct iperf_test *test) { if (test->role == 'c') { /* Send results to server. */ if (send_results(test) < 0) return -1; /* Get server results. */ if (get_results(test) < 0) return -1; } else { /* Get client results. */ if (get_results(test) < 0) return -1; /* Send results to client. */ if (send_results(test) < 0) return -1; } return 0; }
C
iperf
0
CVE-2017-8067
https://www.cvedetails.com/cve/CVE-2017-8067/
CWE-119
https://github.com/torvalds/linux/commit/c4baad50297d84bde1a7ad45e50c73adae4a2192
c4baad50297d84bde1a7ad45e50c73adae4a2192
virtio-console: avoid DMA from stack put_chars() stuffs the buffer it gets into an sg, but that buffer may be on the stack. This breaks with CONFIG_VMAP_STACK=y (for me, it manifested as printks getting turned into NUL bytes). Signed-off-by: Omar Sandoval <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Reviewed-by: Amit Shah <[email protected]>
static void control_intr(struct virtqueue *vq) { struct ports_device *portdev; portdev = vq->vdev->priv; schedule_work(&portdev->control_work); }
static void control_intr(struct virtqueue *vq) { struct ports_device *portdev; portdev = vq->vdev->priv; schedule_work(&portdev->control_work); }
C
linux
0
CVE-2014-3668
https://www.cvedetails.com/cve/CVE-2014-3668/
CWE-119
https://git.php.net/?p=php-src.git;a=commit;h=88412772d295ebf7dd34409534507dc9bcac726e
88412772d295ebf7dd34409534507dc9bcac726e
null
XMLRPC_VALUE XMLRPC_CreateValueDateTime_ISO8601(const char* id, const char *s) { XMLRPC_VALUE val = XMLRPC_CreateValueEmpty(); if(val) { XMLRPC_SetValueDateTime_ISO8601(val, s); if(id) { XMLRPC_SetValueID(val, id, 0); } } return val; }
XMLRPC_VALUE XMLRPC_CreateValueDateTime_ISO8601(const char* id, const char *s) { XMLRPC_VALUE val = XMLRPC_CreateValueEmpty(); if(val) { XMLRPC_SetValueDateTime_ISO8601(val, s); if(id) { XMLRPC_SetValueID(val, id, 0); } } return val; }
C
php
0
CVE-2013-2871
https://www.cvedetails.com/cve/CVE-2013-2871/
CWE-20
https://github.com/chromium/chromium/commit/bb9cfb0aba25f4b13e57bdd4a9fac80ba071e7b9
bb9cfb0aba25f4b13e57bdd4a9fac80ba071e7b9
Setting input.x-webkit-speech should not cause focus change In r150866, we introduced element()->focus() in destroyShadowSubtree() to retain focus on <input> when its type attribute gets changed. But when x-webkit-speech attribute is changed, the element is detached before calling destroyShadowSubtree() and element()->focus() failed This patch moves detach() after destroyShadowSubtree() to fix the problem. BUG=243818 TEST=fast/forms/input-type-change-focusout.html NOTRY=true Review URL: https://chromiumcodereview.appspot.com/16084005 git-svn-id: svn://svn.chromium.org/blink/trunk@151444 bbb929c8-8fbe-4397-9dbb-9b2b20218538
const AtomicString& HTMLInputElement::formControlType() const { return m_inputType->formControlType(); }
const AtomicString& HTMLInputElement::formControlType() const { return m_inputType->formControlType(); }
C
Chrome
0
CVE-2017-13030
https://www.cvedetails.com/cve/CVE-2017-13030/
CWE-125
https://github.com/the-tcpdump-group/tcpdump/commit/5dc1860d8267b1e0cb78c9ffa2a40bea2fdb3ddc
5dc1860d8267b1e0cb78c9ffa2a40bea2fdb3ddc
CVE-2017-13030/PIM: Redo bounds checks and add length checks. Use ND_TCHECK macros to do bounds checking, and add length checks before the bounds checks. Add a bounds check that the review process found was missing. This fixes a buffer over-read discovered by Bhargava Shastry, SecT/TU Berlin. Add a test using the capture file supplied by the reporter(s), modified so the capture file won't be rejected as an invalid capture. Update one test output file to reflect the changes.
cisco_autorp_print(netdissect_options *ndo, register const u_char *bp, register u_int len) { int type; int numrps; int hold; if (len < 8) goto trunc; ND_TCHECK(bp[0]); ND_PRINT((ndo, " auto-rp ")); type = bp[0]; switch (type) { case 0x11: ND_PRINT((ndo, "candidate-advert")); break; case 0x12: ND_PRINT((ndo, "mapping")); break; default: ND_PRINT((ndo, "type-0x%02x", type)); break; } ND_TCHECK(bp[1]); numrps = bp[1]; ND_TCHECK2(bp[2], 2); ND_PRINT((ndo, " Hold ")); hold = EXTRACT_16BITS(&bp[2]); if (hold) unsigned_relts_print(ndo, EXTRACT_16BITS(&bp[2])); else ND_PRINT((ndo, "FOREVER")); /* Next 4 bytes are reserved. */ bp += 8; len -= 8; /*XXX skip unless -v? */ /* * Rest of packet: * numrps entries of the form: * 32 bits: RP * 6 bits: reserved * 2 bits: PIM version supported, bit 0 is "supports v1", 1 is "v2". * 8 bits: # of entries for this RP * each entry: 7 bits: reserved, 1 bit: negative, * 8 bits: mask 32 bits: source * lather, rinse, repeat. */ while (numrps--) { int nentries; char s; if (len < 4) goto trunc; ND_TCHECK2(bp[0], 4); ND_PRINT((ndo, " RP %s", ipaddr_string(ndo, bp))); bp += 4; len -= 4; if (len < 1) goto trunc; ND_TCHECK(bp[0]); switch (bp[0] & 0x3) { case 0: ND_PRINT((ndo, " PIMv?")); break; case 1: ND_PRINT((ndo, " PIMv1")); break; case 2: ND_PRINT((ndo, " PIMv2")); break; case 3: ND_PRINT((ndo, " PIMv1+2")); break; } if (bp[0] & 0xfc) ND_PRINT((ndo, " [rsvd=0x%02x]", bp[0] & 0xfc)); bp += 1; len -= 1; if (len < 1) goto trunc; ND_TCHECK(bp[0]); nentries = bp[0]; bp += 1; len -= 1; s = ' '; for (; nentries; nentries--) { if (len < 6) goto trunc; ND_TCHECK2(bp[0], 6); ND_PRINT((ndo, "%c%s%s/%d", s, bp[0] & 1 ? "!" : "", ipaddr_string(ndo, &bp[2]), bp[1])); if (bp[0] & 0x02) { ND_PRINT((ndo, " bidir")); } if (bp[0] & 0xfc) { ND_PRINT((ndo, "[rsvd=0x%02x]", bp[0] & 0xfc)); } s = ','; bp += 6; len -= 6; } } return; trunc: ND_PRINT((ndo, "[|autorp]")); return; }
cisco_autorp_print(netdissect_options *ndo, register const u_char *bp, register u_int len) { int type; int numrps; int hold; ND_TCHECK(bp[0]); ND_PRINT((ndo, " auto-rp ")); type = bp[0]; switch (type) { case 0x11: ND_PRINT((ndo, "candidate-advert")); break; case 0x12: ND_PRINT((ndo, "mapping")); break; default: ND_PRINT((ndo, "type-0x%02x", type)); break; } ND_TCHECK(bp[1]); numrps = bp[1]; ND_TCHECK2(bp[2], 2); ND_PRINT((ndo, " Hold ")); hold = EXTRACT_16BITS(&bp[2]); if (hold) unsigned_relts_print(ndo, EXTRACT_16BITS(&bp[2])); else ND_PRINT((ndo, "FOREVER")); /* Next 4 bytes are reserved. */ bp += 8; len -= 8; /*XXX skip unless -v? */ /* * Rest of packet: * numrps entries of the form: * 32 bits: RP * 6 bits: reserved * 2 bits: PIM version supported, bit 0 is "supports v1", 1 is "v2". * 8 bits: # of entries for this RP * each entry: 7 bits: reserved, 1 bit: negative, * 8 bits: mask 32 bits: source * lather, rinse, repeat. */ while (numrps--) { int nentries; char s; ND_TCHECK2(bp[0], 4); ND_PRINT((ndo, " RP %s", ipaddr_string(ndo, bp))); ND_TCHECK(bp[4]); switch (bp[4] & 0x3) { case 0: ND_PRINT((ndo, " PIMv?")); break; case 1: ND_PRINT((ndo, " PIMv1")); break; case 2: ND_PRINT((ndo, " PIMv2")); break; case 3: ND_PRINT((ndo, " PIMv1+2")); break; } if (bp[4] & 0xfc) ND_PRINT((ndo, " [rsvd=0x%02x]", bp[4] & 0xfc)); ND_TCHECK(bp[5]); nentries = bp[5]; bp += 6; len -= 6; s = ' '; for (; nentries; nentries--) { ND_TCHECK2(bp[0], 6); ND_PRINT((ndo, "%c%s%s/%d", s, bp[0] & 1 ? "!" : "", ipaddr_string(ndo, &bp[2]), bp[1])); if (bp[0] & 0x02) { ND_PRINT((ndo, " bidir")); } if (bp[0] & 0xfc) { ND_PRINT((ndo, "[rsvd=0x%02x]", bp[0] & 0xfc)); } s = ','; bp += 6; len -= 6; } } return; trunc: ND_PRINT((ndo, "[|autorp]")); return; }
C
tcpdump
1
CVE-2017-13006
https://www.cvedetails.com/cve/CVE-2017-13006/
CWE-125
https://github.com/the-tcpdump-group/tcpdump/commit/cc4a7391c616be7a64ed65742ef9ed3f106eb165
cc4a7391c616be7a64ed65742ef9ed3f106eb165
CVE-2017-13006/L2TP: Check whether an AVP's content exceeds the AVP length. It's not good enough to check whether all the data specified by the AVP length was captured - you also have to check whether that length is large enough for all the required data in the AVP. This fixes a buffer over-read discovered by Yannick Formaggio. Add a test using the capture file supplied by the reporter(s).
l2tp_proxy_auth_type_print(netdissect_options *ndo, const u_char *dat) l2tp_proxy_auth_type_print(netdissect_options *ndo, const u_char *dat, u_int length) { const uint16_t *ptr = (const uint16_t *)dat; if (length < 2) { ND_PRINT((ndo, "AVP too short")); return; } ND_PRINT((ndo, "%s", tok2str(l2tp_authentype2str, "AuthType-#%u", EXTRACT_16BITS(ptr)))); }
l2tp_proxy_auth_type_print(netdissect_options *ndo, const u_char *dat) { const uint16_t *ptr = (const uint16_t *)dat; ND_PRINT((ndo, "%s", tok2str(l2tp_authentype2str, "AuthType-#%u", EXTRACT_16BITS(ptr)))); }
C
tcpdump
1
CVE-2011-4328
https://www.cvedetails.com/cve/CVE-2011-4328/
CWE-264
https://git.savannah.gnu.org/gitweb/?p=gnash.git;a=commitdiff;h=fa481c116e65ccf9137c7ddc8abc3cf05dc12f55
fa481c116e65ccf9137c7ddc8abc3cf05dc12f55
null
nsPluginInstance::GetValue(NPPVariable aVariable, void *aValue) { if (aVariable == NPPVpluginScriptableNPObject) { if (_scriptObject) { void **v = (void **)aValue; NPN_RetainObject(_scriptObject); *v = _scriptObject; } else { gnash::log_debug("_scriptObject is not assigned"); } } return NS_PluginGetValue(aVariable, aValue); }
nsPluginInstance::GetValue(NPPVariable aVariable, void *aValue) { if (aVariable == NPPVpluginScriptableNPObject) { if (_scriptObject) { void **v = (void **)aValue; NPN_RetainObject(_scriptObject); *v = _scriptObject; } else { gnash::log_debug("_scriptObject is not assigned"); } } return NS_PluginGetValue(aVariable, aValue); }
CPP
savannah
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 WebGL2RenderingContextBase::texImage3D(ExecutionContext* execution_context, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, HTMLVideoElement* video, ExceptionState& exception_state) { if (isContextLost()) return; if (bound_pixel_unpack_buffer_) { SynthesizeGLError(GL_INVALID_OPERATION, "texImage3D", "a buffer is bound to PIXEL_UNPACK_BUFFER"); return; } TexImageHelperHTMLVideoElement(execution_context->GetSecurityOrigin(), kTexImage3D, target, level, internalformat, format, type, 0, 0, 0, video, GetTextureSourceSubRectangle(width, height), depth, unpack_image_height_, exception_state); }
void WebGL2RenderingContextBase::texImage3D(ExecutionContext* execution_context, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, HTMLVideoElement* video, ExceptionState& exception_state) { if (isContextLost()) return; if (bound_pixel_unpack_buffer_) { SynthesizeGLError(GL_INVALID_OPERATION, "texImage3D", "a buffer is bound to PIXEL_UNPACK_BUFFER"); return; } TexImageHelperHTMLVideoElement(execution_context->GetSecurityOrigin(), kTexImage3D, target, level, internalformat, format, type, 0, 0, 0, video, GetTextureSourceSubRectangle(width, height), depth, unpack_image_height_, exception_state); }
C
Chrome
0
CVE-2016-5164
https://www.cvedetails.com/cve/CVE-2016-5164/
CWE-79
https://github.com/chromium/chromium/commit/93bc623489bdcfc7e9127614fcfb3258edf3f0f9
93bc623489bdcfc7e9127614fcfb3258edf3f0f9
[DevTools] Copy objects from debugger context to inspected context properly. BUG=637594 Review-Url: https://codereview.chromium.org/2253643002 Cr-Commit-Position: refs/heads/master@{#412436}
void V8Console::monitorFunctionCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { ConsoleHelper helper(info); v8::Local<v8::Function> function; if (!helper.firstArgAsFunction().ToLocal(&function)) return; v8::Local<v8::Value> name = function->GetName(); if (!name->IsString() || !v8::Local<v8::String>::Cast(name)->Length()) name = function->GetInferredName(); String16 functionName = toProtocolStringWithTypeCheck(name); String16Builder builder; builder.append("console.log(\"function "); if (functionName.isEmpty()) builder.append("(anonymous function)"); else builder.append(functionName); builder.append(" called\" + (arguments.length > 0 ? \" with arguments: \" + Array.prototype.join.call(arguments, \", \") : \"\")) && false"); setFunctionBreakpoint(helper, function, V8DebuggerAgentImpl::MonitorCommandBreakpointSource, builder.toString(), true); }
void V8Console::monitorFunctionCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { ConsoleHelper helper(info); v8::Local<v8::Function> function; if (!helper.firstArgAsFunction().ToLocal(&function)) return; v8::Local<v8::Value> name = function->GetName(); if (!name->IsString() || !v8::Local<v8::String>::Cast(name)->Length()) name = function->GetInferredName(); String16 functionName = toProtocolStringWithTypeCheck(name); String16Builder builder; builder.append("console.log(\"function "); if (functionName.isEmpty()) builder.append("(anonymous function)"); else builder.append(functionName); builder.append(" called\" + (arguments.length > 0 ? \" with arguments: \" + Array.prototype.join.call(arguments, \", \") : \"\")) && false"); setFunctionBreakpoint(helper, function, V8DebuggerAgentImpl::MonitorCommandBreakpointSource, builder.toString(), true); }
C
Chrome
0
CVE-2015-6763
https://www.cvedetails.com/cve/CVE-2015-6763/
null
https://github.com/chromium/chromium/commit/f1574f25e1402e748bf2bd7e28ce3dd96ceb1ca4
f1574f25e1402e748bf2bd7e28ce3dd96ceb1ca4
MacViews: Enable secure text input for password Textfields. In Cocoa the NSTextInputContext automatically enables secure text input when activated and it's in the secure text entry mode. RenderWidgetHostViewMac did the similar thing for ages following the WebKit example. views::Textfield needs to do the same thing in a fashion that's sycnrhonized with RenderWidgetHostViewMac, otherwise the race conditions are possible when the Textfield gets focus, activates the secure text input mode and the RWHVM loses focus immediately afterwards and disables the secure text input instead of leaving it in the enabled state. BUG=818133,677220 Change-Id: I6db6c4b59e4a1a72cbb7f8c7056f71b04a3df08b Reviewed-on: https://chromium-review.googlesource.com/943064 Commit-Queue: Michail Pishchagin <[email protected]> Reviewed-by: Pavel Feldman <[email protected]> Reviewed-by: Avi Drissman <[email protected]> Reviewed-by: Peter Kasting <[email protected]> Cr-Commit-Position: refs/heads/master@{#542517}
void set_consume(bool consume) { consume_ = consume; }
void set_consume(bool consume) { consume_ = consume; }
C
Chrome
0
CVE-2018-18354
https://www.cvedetails.com/cve/CVE-2018-18354/
CWE-20
https://github.com/chromium/chromium/commit/d19a75fc26fd0ab1ce79ef3d1c1c9b3cc1fbd098
d19a75fc26fd0ab1ce79ef3d1c1c9b3cc1fbd098
Validate external protocols before launching on Windows Bug: 889459 Change-Id: Id33ca6444bff1e6dd71b6000823cf6fec09746ef Reviewed-on: https://chromium-review.googlesource.com/c/1256208 Reviewed-by: Greg Thompson <[email protected]> Commit-Queue: Mustafa Emre Acer <[email protected]> Cr-Commit-Position: refs/heads/master@{#597611}
bool SetAsDefaultProtocolClientUsingIntentPicker(const std::string& protocol) { base::ScopedBlockingCall scoped_blocking_call(base::BlockingType::MAY_BLOCK); base::FilePath chrome_exe; if (!base::PathService::Get(base::FILE_EXE, &chrome_exe)) { NOTREACHED() << "Error getting app exe path"; return false; } base::string16 wprotocol(base::UTF8ToUTF16(protocol)); if (!ShellUtil::ShowMakeChromeDefaultProtocolClientSystemUI(chrome_exe, wprotocol)) { LOG(ERROR) << "Failed to launch the set-default-client Windows UI."; return false; } VLOG(1) << "Set-default-client Windows UI completed."; return true; }
bool SetAsDefaultProtocolClientUsingIntentPicker(const std::string& protocol) { base::ScopedBlockingCall scoped_blocking_call(base::BlockingType::MAY_BLOCK); base::FilePath chrome_exe; if (!base::PathService::Get(base::FILE_EXE, &chrome_exe)) { NOTREACHED() << "Error getting app exe path"; return false; } base::string16 wprotocol(base::UTF8ToUTF16(protocol)); if (!ShellUtil::ShowMakeChromeDefaultProtocolClientSystemUI(chrome_exe, wprotocol)) { LOG(ERROR) << "Failed to launch the set-default-client Windows UI."; return false; } VLOG(1) << "Set-default-client Windows UI completed."; return true; }
C
Chrome
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 void crypto_rfc4543_free(struct crypto_instance *inst) { struct crypto_rfc4543_instance_ctx *ctx = crypto_instance_ctx(inst); crypto_drop_aead(&ctx->aead); crypto_drop_skcipher(&ctx->null); kfree(inst); }
static void crypto_rfc4543_free(struct crypto_instance *inst) { struct crypto_rfc4543_instance_ctx *ctx = crypto_instance_ctx(inst); crypto_drop_aead(&ctx->aead); crypto_drop_skcipher(&ctx->null); kfree(inst); }
C
linux
0
CVE-2015-8543
https://www.cvedetails.com/cve/CVE-2015-8543/
null
https://github.com/torvalds/linux/commit/79462ad02e861803b3840cc782248c7359451cd9
79462ad02e861803b3840cc782248c7359451cd9
net: add validation for the socket syscall protocol argument 郭永刚 reported that one could simply crash the kernel as root by using a simple program: int socket_fd; struct sockaddr_in addr; addr.sin_port = 0; addr.sin_addr.s_addr = INADDR_ANY; addr.sin_family = 10; socket_fd = socket(10,3,0x40000000); connect(socket_fd , &addr,16); AF_INET, AF_INET6 sockets actually only support 8-bit protocol identifiers. inet_sock's skc_protocol field thus is sized accordingly, thus larger protocol identifiers simply cut off the higher bits and store a zero in the protocol fields. This could lead to e.g. NULL function pointer because as a result of the cut off inet_num is zero and we call down to inet_autobind, which is NULL for raw sockets. kernel: Call Trace: kernel: [<ffffffff816db90e>] ? inet_autobind+0x2e/0x70 kernel: [<ffffffff816db9a4>] inet_dgram_connect+0x54/0x80 kernel: [<ffffffff81645069>] SYSC_connect+0xd9/0x110 kernel: [<ffffffff810ac51b>] ? ptrace_notify+0x5b/0x80 kernel: [<ffffffff810236d8>] ? syscall_trace_enter_phase2+0x108/0x200 kernel: [<ffffffff81645e0e>] SyS_connect+0xe/0x10 kernel: [<ffffffff81779515>] tracesys_phase2+0x84/0x89 I found no particular commit which introduced this problem. CVE: CVE-2015-8543 Cc: Cong Wang <[email protected]> Reported-by: 郭永刚 <[email protected]> Signed-off-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static int inet_sk_reselect_saddr(struct sock *sk) { struct inet_sock *inet = inet_sk(sk); __be32 old_saddr = inet->inet_saddr; __be32 daddr = inet->inet_daddr; struct flowi4 *fl4; struct rtable *rt; __be32 new_saddr; struct ip_options_rcu *inet_opt; inet_opt = rcu_dereference_protected(inet->inet_opt, sock_owned_by_user(sk)); if (inet_opt && inet_opt->opt.srr) daddr = inet_opt->opt.faddr; /* Query new route. */ fl4 = &inet->cork.fl.u.ip4; rt = ip_route_connect(fl4, daddr, 0, RT_CONN_FLAGS(sk), sk->sk_bound_dev_if, sk->sk_protocol, inet->inet_sport, inet->inet_dport, sk); if (IS_ERR(rt)) return PTR_ERR(rt); sk_setup_caps(sk, &rt->dst); new_saddr = fl4->saddr; if (new_saddr == old_saddr) return 0; if (sysctl_ip_dynaddr > 1) { pr_info("%s(): shifting inet->saddr from %pI4 to %pI4\n", __func__, &old_saddr, &new_saddr); } inet->inet_saddr = inet->inet_rcv_saddr = new_saddr; /* * XXX The only one ugly spot where we need to * XXX really change the sockets identity after * XXX it has entered the hashes. -DaveM * * Besides that, it does not check for connection * uniqueness. Wait for troubles. */ __sk_prot_rehash(sk); return 0; }
static int inet_sk_reselect_saddr(struct sock *sk) { struct inet_sock *inet = inet_sk(sk); __be32 old_saddr = inet->inet_saddr; __be32 daddr = inet->inet_daddr; struct flowi4 *fl4; struct rtable *rt; __be32 new_saddr; struct ip_options_rcu *inet_opt; inet_opt = rcu_dereference_protected(inet->inet_opt, sock_owned_by_user(sk)); if (inet_opt && inet_opt->opt.srr) daddr = inet_opt->opt.faddr; /* Query new route. */ fl4 = &inet->cork.fl.u.ip4; rt = ip_route_connect(fl4, daddr, 0, RT_CONN_FLAGS(sk), sk->sk_bound_dev_if, sk->sk_protocol, inet->inet_sport, inet->inet_dport, sk); if (IS_ERR(rt)) return PTR_ERR(rt); sk_setup_caps(sk, &rt->dst); new_saddr = fl4->saddr; if (new_saddr == old_saddr) return 0; if (sysctl_ip_dynaddr > 1) { pr_info("%s(): shifting inet->saddr from %pI4 to %pI4\n", __func__, &old_saddr, &new_saddr); } inet->inet_saddr = inet->inet_rcv_saddr = new_saddr; /* * XXX The only one ugly spot where we need to * XXX really change the sockets identity after * XXX it has entered the hashes. -DaveM * * Besides that, it does not check for connection * uniqueness. Wait for troubles. */ __sk_prot_rehash(sk); return 0; }
C
linux
0
CVE-2018-10191
https://www.cvedetails.com/cve/CVE-2018-10191/
CWE-190
https://github.com/mruby/mruby/commit/1905091634a6a2925c911484434448e568330626
1905091634a6a2925c911484434448e568330626
Check length of env stack before accessing upvar; fix #3995
mrb_exec_irep(mrb_state *mrb, mrb_value self, struct RProc *p) { mrb_callinfo *ci = mrb->c->ci; int keep; mrb->c->stack[0] = self; ci->proc = p; if (MRB_PROC_CFUNC_P(p)) { return MRB_PROC_CFUNC(p)(mrb, self); } ci->nregs = p->body.irep->nregs; if (ci->argc < 0) keep = 3; else keep = ci->argc + 2; if (ci->nregs < keep) { stack_extend(mrb, keep); } else { stack_extend(mrb, ci->nregs); stack_clear(mrb->c->stack+keep, ci->nregs-keep); } ci = cipush(mrb); ci->nregs = 0; ci->target_class = 0; ci->pc = p->body.irep->iseq; ci->stackent = mrb->c->stack; ci->acc = 0; return self; }
mrb_exec_irep(mrb_state *mrb, mrb_value self, struct RProc *p) { mrb_callinfo *ci = mrb->c->ci; int keep; mrb->c->stack[0] = self; ci->proc = p; if (MRB_PROC_CFUNC_P(p)) { return MRB_PROC_CFUNC(p)(mrb, self); } ci->nregs = p->body.irep->nregs; if (ci->argc < 0) keep = 3; else keep = ci->argc + 2; if (ci->nregs < keep) { stack_extend(mrb, keep); } else { stack_extend(mrb, ci->nregs); stack_clear(mrb->c->stack+keep, ci->nregs-keep); } ci = cipush(mrb); ci->nregs = 0; ci->target_class = 0; ci->pc = p->body.irep->iseq; ci->stackent = mrb->c->stack; ci->acc = 0; return self; }
C
mruby
0
CVE-2012-4530
https://www.cvedetails.com/cve/CVE-2012-4530/
CWE-200
https://github.com/torvalds/linux/commit/b66c5984017533316fd1951770302649baf1aa33
b66c5984017533316fd1951770302649baf1aa33
exec: do not leave bprm->interp on stack If a series of scripts are executed, each triggering module loading via unprintable bytes in the script header, kernel stack contents can leak into the command line. Normally execution of binfmt_script and binfmt_misc happens recursively. However, when modules are enabled, and unprintable bytes exist in the bprm->buf, execution will restart after attempting to load matching binfmt modules. Unfortunately, the logic in binfmt_script and binfmt_misc does not expect to get restarted. They leave bprm->interp pointing to their local stack. This means on restart bprm->interp is left pointing into unused stack memory which can then be copied into the userspace argv areas. After additional study, it seems that both recursion and restart remains the desirable way to handle exec with scripts, misc, and modules. As such, we need to protect the changes to interp. This changes the logic to require allocation for any changes to the bprm->interp. To avoid adding a new kmalloc to every exec, the default value is left as-is. Only when passing through binfmt_script or binfmt_misc does an allocation take place. For a proof of concept, see DoTest.sh from: http://www.halfdog.net/Security/2012/LinuxKernelBinfmtScriptStackDataDisclosure/ Signed-off-by: Kees Cook <[email protected]> Cc: halfdog <[email protected]> Cc: P J P <[email protected]> Cc: Alexander Viro <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
static ssize_t bm_entry_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct dentry *root; Node *e = file->f_path.dentry->d_inode->i_private; int res = parse_command(buffer, count); switch (res) { case 1: clear_bit(Enabled, &e->flags); break; case 2: set_bit(Enabled, &e->flags); break; case 3: root = dget(file->f_path.dentry->d_sb->s_root); mutex_lock(&root->d_inode->i_mutex); kill_node(e); mutex_unlock(&root->d_inode->i_mutex); dput(root); break; default: return res; } return count; }
static ssize_t bm_entry_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct dentry *root; Node *e = file->f_path.dentry->d_inode->i_private; int res = parse_command(buffer, count); switch (res) { case 1: clear_bit(Enabled, &e->flags); break; case 2: set_bit(Enabled, &e->flags); break; case 3: root = dget(file->f_path.dentry->d_sb->s_root); mutex_lock(&root->d_inode->i_mutex); kill_node(e); mutex_unlock(&root->d_inode->i_mutex); dput(root); break; default: return res; } return count; }
C
linux
0
CVE-2017-13143
https://www.cvedetails.com/cve/CVE-2017-13143/
CWE-200
https://github.com/ImageMagick/ImageMagick/commit/51b0ae01709adc1e4a9245e158ef17b85a110960
51b0ae01709adc1e4a9245e158ef17b85a110960
https://github.com/ImageMagick/ImageMagick/issues/362
static Image *ReadMATImage(const ImageInfo *image_info,ExceptionInfo *exception) { Image *image, *image2=NULL, *rotated_image; register Quantum *q; unsigned int status; MATHeader MATLAB_HDR; size_t size; size_t CellType; QuantumInfo *quantum_info; ImageInfo *clone_info; int i; ssize_t ldblk; unsigned char *BImgBuff = NULL; double MinVal, MaxVal; unsigned z, z2; unsigned Frames; int logging; int sample_size; MagickOffsetType filepos=0x80; BlobInfo *blob; size_t one; unsigned int (*ReadBlobXXXLong)(Image *image); unsigned short (*ReadBlobXXXShort)(Image *image); void (*ReadBlobDoublesXXX)(Image * image, size_t len, double *data); void (*ReadBlobFloatsXXX)(Image * image, size_t len, float *data); assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); logging = LogMagickEvent(CoderEvent,GetMagickModule(),"enter"); /* Open image file. */ image = AcquireImage(image_info,exception); status = OpenBlob(image_info, image, ReadBinaryBlobMode, exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } /* Read MATLAB image. */ clone_info=CloneImageInfo(image_info); if (ReadBlob(image,124,(unsigned char *) &MATLAB_HDR.identific) != 124) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); if (strncmp(MATLAB_HDR.identific,"MATLAB",6) != 0) { image2=ReadMATImageV4(image_info,image,exception); if (image2 == NULL) goto MATLAB_KO; image=image2; goto END_OF_READING; } MATLAB_HDR.Version = ReadBlobLSBShort(image); if(ReadBlob(image,2,(unsigned char *) &MATLAB_HDR.EndianIndicator) != 2) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); if (logging) (void) LogMagickEvent(CoderEvent,GetMagickModule()," Endian %c%c", MATLAB_HDR.EndianIndicator[0],MATLAB_HDR.EndianIndicator[1]); if (!strncmp(MATLAB_HDR.EndianIndicator, "IM", 2)) { ReadBlobXXXLong = ReadBlobLSBLong; ReadBlobXXXShort = ReadBlobLSBShort; ReadBlobDoublesXXX = ReadBlobDoublesLSB; ReadBlobFloatsXXX = ReadBlobFloatsLSB; image->endian = LSBEndian; } else if (!strncmp(MATLAB_HDR.EndianIndicator, "MI", 2)) { ReadBlobXXXLong = ReadBlobMSBLong; ReadBlobXXXShort = ReadBlobMSBShort; ReadBlobDoublesXXX = ReadBlobDoublesMSB; ReadBlobFloatsXXX = ReadBlobFloatsMSB; image->endian = MSBEndian; } else goto MATLAB_KO; /* unsupported endian */ if (strncmp(MATLAB_HDR.identific, "MATLAB", 6)) MATLAB_KO: ThrowReaderException(CorruptImageError,"ImproperImageHeader"); filepos = TellBlob(image); while(!EOFBlob(image)) /* object parser loop */ { Frames = 1; (void) SeekBlob(image,filepos,SEEK_SET); /* printf("pos=%X\n",TellBlob(image)); */ MATLAB_HDR.DataType = ReadBlobXXXLong(image); if(EOFBlob(image)) break; MATLAB_HDR.ObjectSize = ReadBlobXXXLong(image); if(EOFBlob(image)) break; filepos += MATLAB_HDR.ObjectSize + 4 + 4; image2 = image; #if defined(MAGICKCORE_ZLIB_DELEGATE) if(MATLAB_HDR.DataType == miCOMPRESSED) { image2 = DecompressBlock(image,MATLAB_HDR.ObjectSize,clone_info,exception); if(image2==NULL) continue; MATLAB_HDR.DataType = ReadBlobXXXLong(image2); /* replace compressed object type. */ } #endif if(MATLAB_HDR.DataType!=miMATRIX) continue; /* skip another objects. */ MATLAB_HDR.unknown1 = ReadBlobXXXLong(image2); MATLAB_HDR.unknown2 = ReadBlobXXXLong(image2); MATLAB_HDR.unknown5 = ReadBlobXXXLong(image2); MATLAB_HDR.StructureClass = MATLAB_HDR.unknown5 & 0xFF; MATLAB_HDR.StructureFlag = (MATLAB_HDR.unknown5>>8) & 0xFF; MATLAB_HDR.unknown3 = ReadBlobXXXLong(image2); if(image!=image2) MATLAB_HDR.unknown4 = ReadBlobXXXLong(image2); /* ??? don't understand why ?? */ MATLAB_HDR.unknown4 = ReadBlobXXXLong(image2); MATLAB_HDR.DimFlag = ReadBlobXXXLong(image2); MATLAB_HDR.SizeX = ReadBlobXXXLong(image2); MATLAB_HDR.SizeY = ReadBlobXXXLong(image2); switch(MATLAB_HDR.DimFlag) { case 8: z2=z=1; break; /* 2D matrix*/ case 12: z2=z = ReadBlobXXXLong(image2); /* 3D matrix RGB*/ (void) ReadBlobXXXLong(image2); if(z!=3) ThrowReaderException(CoderError, "MultidimensionalMatricesAreNotSupported"); break; case 16: z2=z = ReadBlobXXXLong(image2); /* 4D matrix animation */ if(z!=3 && z!=1) ThrowReaderException(CoderError, "MultidimensionalMatricesAreNotSupported"); Frames = ReadBlobXXXLong(image2); if (Frames == 0) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); break; default: ThrowReaderException(CoderError, "MultidimensionalMatricesAreNotSupported"); } MATLAB_HDR.Flag1 = ReadBlobXXXShort(image2); MATLAB_HDR.NameFlag = ReadBlobXXXShort(image2); if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(), "MATLAB_HDR.StructureClass %d",MATLAB_HDR.StructureClass); if (MATLAB_HDR.StructureClass != mxCHAR_CLASS && MATLAB_HDR.StructureClass != mxSINGLE_CLASS && /* float + complex float */ MATLAB_HDR.StructureClass != mxDOUBLE_CLASS && /* double + complex double */ MATLAB_HDR.StructureClass != mxINT8_CLASS && MATLAB_HDR.StructureClass != mxUINT8_CLASS && /* uint8 + uint8 3D */ MATLAB_HDR.StructureClass != mxINT16_CLASS && MATLAB_HDR.StructureClass != mxUINT16_CLASS && /* uint16 + uint16 3D */ MATLAB_HDR.StructureClass != mxINT32_CLASS && MATLAB_HDR.StructureClass != mxUINT32_CLASS && /* uint32 + uint32 3D */ MATLAB_HDR.StructureClass != mxINT64_CLASS && MATLAB_HDR.StructureClass != mxUINT64_CLASS) /* uint64 + uint64 3D */ ThrowReaderException(CoderError,"UnsupportedCellTypeInTheMatrix"); switch (MATLAB_HDR.NameFlag) { case 0: size = ReadBlobXXXLong(image2); /* Object name string size */ size = 4 * (ssize_t) ((size + 3 + 1) / 4); (void) SeekBlob(image2, size, SEEK_CUR); break; case 1: case 2: case 3: case 4: (void) ReadBlob(image2, 4, (unsigned char *) &size); /* Object name string */ break; default: goto MATLAB_KO; } CellType = ReadBlobXXXLong(image2); /* Additional object type */ if (logging) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "MATLAB_HDR.CellType: %.20g",(double) CellType); (void) ReadBlob(image2, 4, (unsigned char *) &size); /* data size */ NEXT_FRAME: switch (CellType) { case miINT8: case miUINT8: sample_size = 8; if(MATLAB_HDR.StructureFlag & FLAG_LOGICAL) image->depth = 1; else image->depth = 8; /* Byte type cell */ ldblk = (ssize_t) MATLAB_HDR.SizeX; break; case miINT16: case miUINT16: sample_size = 16; image->depth = 16; /* Word type cell */ ldblk = (ssize_t) (2 * MATLAB_HDR.SizeX); break; case miINT32: case miUINT32: sample_size = 32; image->depth = 32; /* Dword type cell */ ldblk = (ssize_t) (4 * MATLAB_HDR.SizeX); break; case miINT64: case miUINT64: sample_size = 64; image->depth = 64; /* Qword type cell */ ldblk = (ssize_t) (8 * MATLAB_HDR.SizeX); break; case miSINGLE: sample_size = 32; image->depth = 32; /* double type cell */ (void) SetImageOption(clone_info,"quantum:format","floating-point"); if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX) { /* complex float type cell */ } ldblk = (ssize_t) (4 * MATLAB_HDR.SizeX); break; case miDOUBLE: sample_size = 64; image->depth = 64; /* double type cell */ (void) SetImageOption(clone_info,"quantum:format","floating-point"); DisableMSCWarning(4127) if (sizeof(double) != 8) RestoreMSCWarning ThrowReaderException(CoderError, "IncompatibleSizeOfDouble"); if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX) { /* complex double type cell */ } ldblk = (ssize_t) (8 * MATLAB_HDR.SizeX); break; default: ThrowReaderException(CoderError, "UnsupportedCellTypeInTheMatrix"); } (void) sample_size; image->columns = MATLAB_HDR.SizeX; image->rows = MATLAB_HDR.SizeY; quantum_info=AcquireQuantumInfo(clone_info,image); if (quantum_info == (QuantumInfo *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); one=1; image->colors = one << image->depth; if (image->columns == 0 || image->rows == 0) goto MATLAB_KO; /* Image is gray when no complex flag is set and 2D Matrix */ if ((MATLAB_HDR.DimFlag == 8) && ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0)) { image->type=GrayscaleType; SetImageColorspace(image,GRAYColorspace,exception); } /* If ping is true, then only set image size and colors without reading any image data. */ if (image_info->ping) { size_t temp = image->columns; image->columns = image->rows; image->rows = temp; goto done_reading; /* !!!!!! BAD !!!! */ } status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) return(DestroyImageList(image)); /* ----- Load raster data ----- */ BImgBuff = (unsigned char *) AcquireQuantumMemory((size_t) (ldblk),sizeof(double)); /* Ldblk was set in the check phase */ if (BImgBuff == NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); (void) ResetMagickMemory(BImgBuff,0,ldblk*sizeof(double)); MinVal = 0; MaxVal = 0; if (CellType==miDOUBLE || CellType==miSINGLE) /* Find Min and Max Values for floats */ { CalcMinMax(image2, image_info->endian, MATLAB_HDR.SizeX, MATLAB_HDR.SizeY, CellType, ldblk, BImgBuff, &quantum_info->minimum, &quantum_info->maximum); } /* Main loop for reading all scanlines */ if(z==1) z=0; /* read grey scanlines */ /* else read color scanlines */ do { for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++) { q=GetAuthenticPixels(image,0,MATLAB_HDR.SizeY-i-1,image->columns,1,exception); if (q == (Quantum *) NULL) { if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(), " MAT set image pixels returns unexpected NULL on a row %u.", (unsigned)(MATLAB_HDR.SizeY-i-1)); goto done_reading; /* Skip image rotation, when cannot set image pixels */ } if(ReadBlob(image2,ldblk,(unsigned char *)BImgBuff) != (ssize_t) ldblk) { if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(), " MAT cannot read scanrow %u from a file.", (unsigned)(MATLAB_HDR.SizeY-i-1)); goto ExitLoop; } if((CellType==miINT8 || CellType==miUINT8) && (MATLAB_HDR.StructureFlag & FLAG_LOGICAL)) { FixLogical((unsigned char *)BImgBuff,ldblk); if(ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,z2qtype[z],BImgBuff,exception) <= 0) { ImportQuantumPixelsFailed: if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(), " MAT failed to ImportQuantumPixels for a row %u", (unsigned)(MATLAB_HDR.SizeY-i-1)); break; } } else { if(ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,z2qtype[z],BImgBuff,exception) <= 0) goto ImportQuantumPixelsFailed; if (z<=1 && /* fix only during a last pass z==0 || z==1 */ (CellType==miINT8 || CellType==miINT16 || CellType==miINT32 || CellType==miINT64)) FixSignedValues(image,q,MATLAB_HDR.SizeX); } if (!SyncAuthenticPixels(image,exception)) { if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(), " MAT failed to sync image pixels for a row %u", (unsigned)(MATLAB_HDR.SizeY-i-1)); goto ExitLoop; } } } while(z-- >= 2); quantum_info=DestroyQuantumInfo(quantum_info); ExitLoop: /* Read complex part of numbers here */ if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX) { /* Find Min and Max Values for complex parts of floats */ CellType = ReadBlobXXXLong(image2); /* Additional object type */ i = ReadBlobXXXLong(image2); /* size of a complex part - toss away*/ if (CellType==miDOUBLE || CellType==miSINGLE) { CalcMinMax(image2, image_info->endian, MATLAB_HDR.SizeX, MATLAB_HDR.SizeY, CellType, ldblk, BImgBuff, &MinVal, &MaxVal); } if (CellType==miDOUBLE) for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++) { ReadBlobDoublesXXX(image2, ldblk, (double *)BImgBuff); InsertComplexDoubleRow(image, (double *)BImgBuff, i, MinVal, MaxVal, exception); } if (CellType==miSINGLE) for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++) { ReadBlobFloatsXXX(image2, ldblk, (float *)BImgBuff); InsertComplexFloatRow(image,(float *)BImgBuff,i,MinVal,MaxVal, exception); } } /* Image is gray when no complex flag is set and 2D Matrix AGAIN!!! */ if ((MATLAB_HDR.DimFlag == 8) && ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0)) image->type=GrayscaleType; if (image->depth == 1) image->type=BilevelType; if(image2==image) image2 = NULL; /* Remove shadow copy to an image before rotation. */ /* Rotate image. */ rotated_image = RotateImage(image, 90.0, exception); if (rotated_image != (Image *) NULL) { /* Remove page offsets added by RotateImage */ rotated_image->page.x=0; rotated_image->page.y=0; blob = rotated_image->blob; rotated_image->blob = image->blob; rotated_image->colors = image->colors; image->blob = blob; AppendImageToList(&image,rotated_image); DeleteImageFromList(&image); } done_reading: if(image2!=NULL) if(image2!=image) { DeleteImageFromList(&image2); if(clone_info) { if(clone_info->file) { fclose(clone_info->file); clone_info->file = NULL; (void) remove_utf8(clone_info->filename); } } } /* Allocate next image structure. */ AcquireNextImage(image_info,image,exception); if (image->next == (Image *) NULL) break; image=SyncNextImageInList(image); image->columns=image->rows=0; image->colors=0; /* row scan buffer is no longer needed */ RelinquishMagickMemory(BImgBuff); BImgBuff = NULL; if(--Frames>0) { z = z2; if(image2==NULL) image2 = image; goto NEXT_FRAME; } if ((image2!=NULL) && (image2!=image)) /* Does shadow temporary decompressed image exist? */ { /* CloseBlob(image2); */ DeleteImageFromList(&image2); if(clone_info) { if(clone_info->file) { fclose(clone_info->file); clone_info->file = NULL; (void) remove_utf8(clone_info->filename); } } } } RelinquishMagickMemory(BImgBuff); END_OF_READING: clone_info=DestroyImageInfo(clone_info); CloseBlob(image); { Image *p; ssize_t scene=0; /* Rewind list, removing any empty images while rewinding. */ p=image; image=NULL; while (p != (Image *) NULL) { Image *tmp=p; if ((p->rows == 0) || (p->columns == 0)) { p=p->previous; DeleteImageFromList(&tmp); } else { image=p; p=p->previous; } } /* Fix scene numbers */ for (p=image; p != (Image *) NULL; p=p->next) p->scene=scene++; } if(clone_info != NULL) /* cleanup garbage file from compression */ { if(clone_info->file) { fclose(clone_info->file); clone_info->file = NULL; (void) remove_utf8(clone_info->filename); } DestroyImageInfo(clone_info); clone_info = NULL; } if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),"return"); if(image==NULL) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); return (image); }
static Image *ReadMATImage(const ImageInfo *image_info,ExceptionInfo *exception) { Image *image, *image2=NULL, *rotated_image; register Quantum *q; unsigned int status; MATHeader MATLAB_HDR; size_t size; size_t CellType; QuantumInfo *quantum_info; ImageInfo *clone_info; int i; ssize_t ldblk; unsigned char *BImgBuff = NULL; double MinVal, MaxVal; unsigned z, z2; unsigned Frames; int logging; int sample_size; MagickOffsetType filepos=0x80; BlobInfo *blob; size_t one; unsigned int (*ReadBlobXXXLong)(Image *image); unsigned short (*ReadBlobXXXShort)(Image *image); void (*ReadBlobDoublesXXX)(Image * image, size_t len, double *data); void (*ReadBlobFloatsXXX)(Image * image, size_t len, float *data); assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); logging = LogMagickEvent(CoderEvent,GetMagickModule(),"enter"); /* Open image file. */ image = AcquireImage(image_info,exception); status = OpenBlob(image_info, image, ReadBinaryBlobMode, exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } /* Read MATLAB image. */ clone_info=CloneImageInfo(image_info); if (ReadBlob(image,124,(unsigned char *) &MATLAB_HDR.identific) != 124) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); if (strncmp(MATLAB_HDR.identific,"MATLAB",6) != 0) { image2=ReadMATImageV4(image_info,image,exception); if (image2 == NULL) goto MATLAB_KO; image=image2; goto END_OF_READING; } MATLAB_HDR.Version = ReadBlobLSBShort(image); if(ReadBlob(image,2,(unsigned char *) &MATLAB_HDR.EndianIndicator) != 2) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); if (logging) (void) LogMagickEvent(CoderEvent,GetMagickModule()," Endian %c%c", MATLAB_HDR.EndianIndicator[0],MATLAB_HDR.EndianIndicator[1]); if (!strncmp(MATLAB_HDR.EndianIndicator, "IM", 2)) { ReadBlobXXXLong = ReadBlobLSBLong; ReadBlobXXXShort = ReadBlobLSBShort; ReadBlobDoublesXXX = ReadBlobDoublesLSB; ReadBlobFloatsXXX = ReadBlobFloatsLSB; image->endian = LSBEndian; } else if (!strncmp(MATLAB_HDR.EndianIndicator, "MI", 2)) { ReadBlobXXXLong = ReadBlobMSBLong; ReadBlobXXXShort = ReadBlobMSBShort; ReadBlobDoublesXXX = ReadBlobDoublesMSB; ReadBlobFloatsXXX = ReadBlobFloatsMSB; image->endian = MSBEndian; } else goto MATLAB_KO; /* unsupported endian */ if (strncmp(MATLAB_HDR.identific, "MATLAB", 6)) MATLAB_KO: ThrowReaderException(CorruptImageError,"ImproperImageHeader"); filepos = TellBlob(image); while(!EOFBlob(image)) /* object parser loop */ { Frames = 1; (void) SeekBlob(image,filepos,SEEK_SET); /* printf("pos=%X\n",TellBlob(image)); */ MATLAB_HDR.DataType = ReadBlobXXXLong(image); if(EOFBlob(image)) break; MATLAB_HDR.ObjectSize = ReadBlobXXXLong(image); if(EOFBlob(image)) break; filepos += MATLAB_HDR.ObjectSize + 4 + 4; image2 = image; #if defined(MAGICKCORE_ZLIB_DELEGATE) if(MATLAB_HDR.DataType == miCOMPRESSED) { image2 = DecompressBlock(image,MATLAB_HDR.ObjectSize,clone_info,exception); if(image2==NULL) continue; MATLAB_HDR.DataType = ReadBlobXXXLong(image2); /* replace compressed object type. */ } #endif if(MATLAB_HDR.DataType!=miMATRIX) continue; /* skip another objects. */ MATLAB_HDR.unknown1 = ReadBlobXXXLong(image2); MATLAB_HDR.unknown2 = ReadBlobXXXLong(image2); MATLAB_HDR.unknown5 = ReadBlobXXXLong(image2); MATLAB_HDR.StructureClass = MATLAB_HDR.unknown5 & 0xFF; MATLAB_HDR.StructureFlag = (MATLAB_HDR.unknown5>>8) & 0xFF; MATLAB_HDR.unknown3 = ReadBlobXXXLong(image2); if(image!=image2) MATLAB_HDR.unknown4 = ReadBlobXXXLong(image2); /* ??? don't understand why ?? */ MATLAB_HDR.unknown4 = ReadBlobXXXLong(image2); MATLAB_HDR.DimFlag = ReadBlobXXXLong(image2); MATLAB_HDR.SizeX = ReadBlobXXXLong(image2); MATLAB_HDR.SizeY = ReadBlobXXXLong(image2); switch(MATLAB_HDR.DimFlag) { case 8: z2=z=1; break; /* 2D matrix*/ case 12: z2=z = ReadBlobXXXLong(image2); /* 3D matrix RGB*/ (void) ReadBlobXXXLong(image2); if(z!=3) ThrowReaderException(CoderError, "MultidimensionalMatricesAreNotSupported"); break; case 16: z2=z = ReadBlobXXXLong(image2); /* 4D matrix animation */ if(z!=3 && z!=1) ThrowReaderException(CoderError, "MultidimensionalMatricesAreNotSupported"); Frames = ReadBlobXXXLong(image2); if (Frames == 0) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); break; default: ThrowReaderException(CoderError, "MultidimensionalMatricesAreNotSupported"); } MATLAB_HDR.Flag1 = ReadBlobXXXShort(image2); MATLAB_HDR.NameFlag = ReadBlobXXXShort(image2); if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(), "MATLAB_HDR.StructureClass %d",MATLAB_HDR.StructureClass); if (MATLAB_HDR.StructureClass != mxCHAR_CLASS && MATLAB_HDR.StructureClass != mxSINGLE_CLASS && /* float + complex float */ MATLAB_HDR.StructureClass != mxDOUBLE_CLASS && /* double + complex double */ MATLAB_HDR.StructureClass != mxINT8_CLASS && MATLAB_HDR.StructureClass != mxUINT8_CLASS && /* uint8 + uint8 3D */ MATLAB_HDR.StructureClass != mxINT16_CLASS && MATLAB_HDR.StructureClass != mxUINT16_CLASS && /* uint16 + uint16 3D */ MATLAB_HDR.StructureClass != mxINT32_CLASS && MATLAB_HDR.StructureClass != mxUINT32_CLASS && /* uint32 + uint32 3D */ MATLAB_HDR.StructureClass != mxINT64_CLASS && MATLAB_HDR.StructureClass != mxUINT64_CLASS) /* uint64 + uint64 3D */ ThrowReaderException(CoderError,"UnsupportedCellTypeInTheMatrix"); switch (MATLAB_HDR.NameFlag) { case 0: size = ReadBlobXXXLong(image2); /* Object name string size */ size = 4 * (ssize_t) ((size + 3 + 1) / 4); (void) SeekBlob(image2, size, SEEK_CUR); break; case 1: case 2: case 3: case 4: (void) ReadBlob(image2, 4, (unsigned char *) &size); /* Object name string */ break; default: goto MATLAB_KO; } CellType = ReadBlobXXXLong(image2); /* Additional object type */ if (logging) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "MATLAB_HDR.CellType: %.20g",(double) CellType); (void) ReadBlob(image2, 4, (unsigned char *) &size); /* data size */ NEXT_FRAME: switch (CellType) { case miINT8: case miUINT8: sample_size = 8; if(MATLAB_HDR.StructureFlag & FLAG_LOGICAL) image->depth = 1; else image->depth = 8; /* Byte type cell */ ldblk = (ssize_t) MATLAB_HDR.SizeX; break; case miINT16: case miUINT16: sample_size = 16; image->depth = 16; /* Word type cell */ ldblk = (ssize_t) (2 * MATLAB_HDR.SizeX); break; case miINT32: case miUINT32: sample_size = 32; image->depth = 32; /* Dword type cell */ ldblk = (ssize_t) (4 * MATLAB_HDR.SizeX); break; case miINT64: case miUINT64: sample_size = 64; image->depth = 64; /* Qword type cell */ ldblk = (ssize_t) (8 * MATLAB_HDR.SizeX); break; case miSINGLE: sample_size = 32; image->depth = 32; /* double type cell */ (void) SetImageOption(clone_info,"quantum:format","floating-point"); if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX) { /* complex float type cell */ } ldblk = (ssize_t) (4 * MATLAB_HDR.SizeX); break; case miDOUBLE: sample_size = 64; image->depth = 64; /* double type cell */ (void) SetImageOption(clone_info,"quantum:format","floating-point"); DisableMSCWarning(4127) if (sizeof(double) != 8) RestoreMSCWarning ThrowReaderException(CoderError, "IncompatibleSizeOfDouble"); if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX) { /* complex double type cell */ } ldblk = (ssize_t) (8 * MATLAB_HDR.SizeX); break; default: ThrowReaderException(CoderError, "UnsupportedCellTypeInTheMatrix"); } (void) sample_size; image->columns = MATLAB_HDR.SizeX; image->rows = MATLAB_HDR.SizeY; quantum_info=AcquireQuantumInfo(clone_info,image); if (quantum_info == (QuantumInfo *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); one=1; image->colors = one << image->depth; if (image->columns == 0 || image->rows == 0) goto MATLAB_KO; /* Image is gray when no complex flag is set and 2D Matrix */ if ((MATLAB_HDR.DimFlag == 8) && ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0)) { image->type=GrayscaleType; SetImageColorspace(image,GRAYColorspace,exception); } /* If ping is true, then only set image size and colors without reading any image data. */ if (image_info->ping) { size_t temp = image->columns; image->columns = image->rows; image->rows = temp; goto done_reading; /* !!!!!! BAD !!!! */ } status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) return(DestroyImageList(image)); /* ----- Load raster data ----- */ BImgBuff = (unsigned char *) AcquireQuantumMemory((size_t) (ldblk),sizeof(double)); /* Ldblk was set in the check phase */ if (BImgBuff == NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); MinVal = 0; MaxVal = 0; if (CellType==miDOUBLE || CellType==miSINGLE) /* Find Min and Max Values for floats */ { CalcMinMax(image2, image_info->endian, MATLAB_HDR.SizeX, MATLAB_HDR.SizeY, CellType, ldblk, BImgBuff, &quantum_info->minimum, &quantum_info->maximum); } /* Main loop for reading all scanlines */ if(z==1) z=0; /* read grey scanlines */ /* else read color scanlines */ do { for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++) { q=GetAuthenticPixels(image,0,MATLAB_HDR.SizeY-i-1,image->columns,1,exception); if (q == (Quantum *) NULL) { if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(), " MAT set image pixels returns unexpected NULL on a row %u.", (unsigned)(MATLAB_HDR.SizeY-i-1)); goto done_reading; /* Skip image rotation, when cannot set image pixels */ } if(ReadBlob(image2,ldblk,(unsigned char *)BImgBuff) != (ssize_t) ldblk) { if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(), " MAT cannot read scanrow %u from a file.", (unsigned)(MATLAB_HDR.SizeY-i-1)); goto ExitLoop; } if((CellType==miINT8 || CellType==miUINT8) && (MATLAB_HDR.StructureFlag & FLAG_LOGICAL)) { FixLogical((unsigned char *)BImgBuff,ldblk); if(ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,z2qtype[z],BImgBuff,exception) <= 0) { ImportQuantumPixelsFailed: if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(), " MAT failed to ImportQuantumPixels for a row %u", (unsigned)(MATLAB_HDR.SizeY-i-1)); break; } } else { if(ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,z2qtype[z],BImgBuff,exception) <= 0) goto ImportQuantumPixelsFailed; if (z<=1 && /* fix only during a last pass z==0 || z==1 */ (CellType==miINT8 || CellType==miINT16 || CellType==miINT32 || CellType==miINT64)) FixSignedValues(image,q,MATLAB_HDR.SizeX); } if (!SyncAuthenticPixels(image,exception)) { if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(), " MAT failed to sync image pixels for a row %u", (unsigned)(MATLAB_HDR.SizeY-i-1)); goto ExitLoop; } } } while(z-- >= 2); quantum_info=DestroyQuantumInfo(quantum_info); ExitLoop: /* Read complex part of numbers here */ if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX) { /* Find Min and Max Values for complex parts of floats */ CellType = ReadBlobXXXLong(image2); /* Additional object type */ i = ReadBlobXXXLong(image2); /* size of a complex part - toss away*/ if (CellType==miDOUBLE || CellType==miSINGLE) { CalcMinMax(image2, image_info->endian, MATLAB_HDR.SizeX, MATLAB_HDR.SizeY, CellType, ldblk, BImgBuff, &MinVal, &MaxVal); } if (CellType==miDOUBLE) for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++) { ReadBlobDoublesXXX(image2, ldblk, (double *)BImgBuff); InsertComplexDoubleRow(image, (double *)BImgBuff, i, MinVal, MaxVal, exception); } if (CellType==miSINGLE) for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++) { ReadBlobFloatsXXX(image2, ldblk, (float *)BImgBuff); InsertComplexFloatRow(image,(float *)BImgBuff,i,MinVal,MaxVal, exception); } } /* Image is gray when no complex flag is set and 2D Matrix AGAIN!!! */ if ((MATLAB_HDR.DimFlag == 8) && ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0)) image->type=GrayscaleType; if (image->depth == 1) image->type=BilevelType; if(image2==image) image2 = NULL; /* Remove shadow copy to an image before rotation. */ /* Rotate image. */ rotated_image = RotateImage(image, 90.0, exception); if (rotated_image != (Image *) NULL) { /* Remove page offsets added by RotateImage */ rotated_image->page.x=0; rotated_image->page.y=0; blob = rotated_image->blob; rotated_image->blob = image->blob; rotated_image->colors = image->colors; image->blob = blob; AppendImageToList(&image,rotated_image); DeleteImageFromList(&image); } done_reading: if(image2!=NULL) if(image2!=image) { DeleteImageFromList(&image2); if(clone_info) { if(clone_info->file) { fclose(clone_info->file); clone_info->file = NULL; (void) remove_utf8(clone_info->filename); } } } /* Allocate next image structure. */ AcquireNextImage(image_info,image,exception); if (image->next == (Image *) NULL) break; image=SyncNextImageInList(image); image->columns=image->rows=0; image->colors=0; /* row scan buffer is no longer needed */ RelinquishMagickMemory(BImgBuff); BImgBuff = NULL; if(--Frames>0) { z = z2; if(image2==NULL) image2 = image; goto NEXT_FRAME; } if ((image2!=NULL) && (image2!=image)) /* Does shadow temporary decompressed image exist? */ { /* CloseBlob(image2); */ DeleteImageFromList(&image2); if(clone_info) { if(clone_info->file) { fclose(clone_info->file); clone_info->file = NULL; (void) remove_utf8(clone_info->filename); } } } } RelinquishMagickMemory(BImgBuff); END_OF_READING: clone_info=DestroyImageInfo(clone_info); CloseBlob(image); { Image *p; ssize_t scene=0; /* Rewind list, removing any empty images while rewinding. */ p=image; image=NULL; while (p != (Image *) NULL) { Image *tmp=p; if ((p->rows == 0) || (p->columns == 0)) { p=p->previous; DeleteImageFromList(&tmp); } else { image=p; p=p->previous; } } /* Fix scene numbers */ for (p=image; p != (Image *) NULL; p=p->next) p->scene=scene++; } if(clone_info != NULL) /* cleanup garbage file from compression */ { if(clone_info->file) { fclose(clone_info->file); clone_info->file = NULL; (void) remove_utf8(clone_info->filename); } DestroyImageInfo(clone_info); clone_info = NULL; } if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),"return"); if(image==NULL) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); return (image); }
C
ImageMagick
1
CVE-2019-14459
https://www.cvedetails.com/cve/CVE-2019-14459/
CWE-190
https://github.com/phaag/nfdump/commit/3b006ededaf351f1723aea6c727c9edd1b1fff9b
3b006ededaf351f1723aea6c727c9edd1b1fff9b
Fix potential unsigned integer underflow
static int reorder_sequencer(input_translation_t *table) { int i, n; sequence_map_t *sequence = table->sequence; #ifdef DEVEL printf("\nReorder Sequencer. Sequence steps: %u\n", table->number_of_sequences); for ( i=0; i<table->number_of_sequences; i++ ) { printf("Order: %i, Sequence: %u, Type: %u, Input length: %u, Output offset: %u, Skip Count: %u\n", i, sequence[i].id, sequence[i].type, sequence[i].input_length, sequence[i].output_offset, sequence[i].skip_count); } #endif n = 0; // index into sequencer table for ( i=0; i<cache.input_count; i++ ) { if ( cache.input_order[i].type == SKIP_ELEMENT ) { if ( cache.input_order[i].length == DYN_FIELD_LENGTH || n == 0 ) { int j; if ( !CheckSequenceMap(table) ) return 0; for ( j=table->number_of_sequences-1; j>=n; j-- ) { sequence[j+1] = sequence[j]; } if ( cache.input_order[i].length == DYN_FIELD_LENGTH ) { sequence[n].id = dyn_skip; sequence[n].skip_count = 0; } else { sequence[n].id = nop; sequence[n].skip_count = cache.input_order[i].length; } sequence[n].type = SKIP_ELEMENT; sequence[n].input_length = 0; sequence[n].stack = NULL; table->number_of_sequences++; dbg_printf("Insert skip sequence in slot: %u, skip count: %u, dyn: %u\n", n, sequence[n].skip_count, cache.input_order[i].length == DYN_FIELD_LENGTH ? 1 : 0); } else { sequence[n-1].skip_count += cache.input_order[i].length; dbg_printf("Merge skip count: %u into previous sequence: %u\n", cache.input_order[i].length, n-1); continue; } } else { if ( sequence[n].type != cache.input_order[i].type ) { sequence_map_t _s; int j = n+1; while ( sequence[j].type != cache.input_order[i].type && j < table->number_of_sequences ) j++; if ( j == table->number_of_sequences ) { if ( n == 0 ) { return 0; } else { sequence[n-1].skip_count += cache.input_order[i].length; dbg_printf("Merge skip count: %u into previous sequence: %u\n", cache.input_order[i].length, n-1); continue; } return 0; } _s = sequence[n]; sequence[n] = sequence[j]; sequence[j] = _s; dbg_printf("Swap slots %u <-> %u\n", n, j); } else { dbg_printf("In order slot %u\n", n); } } n++; } #ifdef DEVEL printf("\nReordered Sequencer. Sequence steps: %u\n", table->number_of_sequences); for ( int i=0; i<table->number_of_sequences; i++ ) { printf("Order: %i, Sequence: %u, Type: %u, Input length: %u, Output offset: %u, Skip Count: %u\n", i, sequence[i].id, sequence[i].type, sequence[i].input_length, sequence[i].output_offset, sequence[i].skip_count); } printf("\n"); #endif return 1; } // End of reorder_sequencer
static int reorder_sequencer(input_translation_t *table) { int i, n; sequence_map_t *sequence = table->sequence; #ifdef DEVEL printf("\nReorder Sequencer. Sequence steps: %u\n", table->number_of_sequences); for ( i=0; i<table->number_of_sequences; i++ ) { printf("Order: %i, Sequence: %u, Type: %u, Input length: %u, Output offset: %u, Skip Count: %u\n", i, sequence[i].id, sequence[i].type, sequence[i].input_length, sequence[i].output_offset, sequence[i].skip_count); } #endif n = 0; // index into sequencer table for ( i=0; i<cache.input_count; i++ ) { if ( cache.input_order[i].type == SKIP_ELEMENT ) { if ( cache.input_order[i].length == DYN_FIELD_LENGTH || n == 0 ) { int j; if ( !CheckSequenceMap(table) ) return 0; for ( j=table->number_of_sequences-1; j>=n; j-- ) { sequence[j+1] = sequence[j]; } if ( cache.input_order[i].length == DYN_FIELD_LENGTH ) { sequence[n].id = dyn_skip; sequence[n].skip_count = 0; } else { sequence[n].id = nop; sequence[n].skip_count = cache.input_order[i].length; } sequence[n].type = SKIP_ELEMENT; sequence[n].input_length = 0; sequence[n].stack = NULL; table->number_of_sequences++; dbg_printf("Insert skip sequence in slot: %u, skip count: %u, dyn: %u\n", n, sequence[n].skip_count, cache.input_order[i].length == DYN_FIELD_LENGTH ? 1 : 0); } else { sequence[n-1].skip_count += cache.input_order[i].length; dbg_printf("Merge skip count: %u into previous sequence: %u\n", cache.input_order[i].length, n-1); continue; } } else { if ( sequence[n].type != cache.input_order[i].type ) { sequence_map_t _s; int j = n+1; while ( sequence[j].type != cache.input_order[i].type && j < table->number_of_sequences ) j++; if ( j == table->number_of_sequences ) { if ( n == 0 ) { return 0; } else { sequence[n-1].skip_count += cache.input_order[i].length; dbg_printf("Merge skip count: %u into previous sequence: %u\n", cache.input_order[i].length, n-1); continue; } return 0; } _s = sequence[n]; sequence[n] = sequence[j]; sequence[j] = _s; dbg_printf("Swap slots %u <-> %u\n", n, j); } else { dbg_printf("In order slot %u\n", n); } } n++; } #ifdef DEVEL printf("\nReordered Sequencer. Sequence steps: %u\n", table->number_of_sequences); for ( int i=0; i<table->number_of_sequences; i++ ) { printf("Order: %i, Sequence: %u, Type: %u, Input length: %u, Output offset: %u, Skip Count: %u\n", i, sequence[i].id, sequence[i].type, sequence[i].input_length, sequence[i].output_offset, sequence[i].skip_count); } printf("\n"); #endif return 1; } // End of reorder_sequencer
C
nfdump
0
CVE-2015-8750
https://www.cvedetails.com/cve/CVE-2015-8750/
CWE-476
https://github.com/tomhughes/libdwarf/commit/11750a2838e52953013e3114ef27b3c7b1780697
11750a2838e52953013e3114ef27b3c7b1780697
A DWARF related section marked SHT_NOBITS (elf section type) is an error in the elf object. Now detected. dwarf_elf_access.c
is_32bit_abs_reloc(unsigned int type, Dwarf_Half machine) { Dwarf_Bool r = 0; switch (machine) { #if defined(EM_MIPS) && defined (R_MIPS_32) case EM_MIPS: r = (0 #if defined (R_MIPS_32) | (type == R_MIPS_32) #endif #if defined (R_MIPS_TLS_DTPREL32) | (type == R_MIPS_TLS_DTPREL32) #endif /* DTPREL32 */ ); break; #endif /* MIPS case */ #if defined(EM_SPARC32PLUS) && defined (R_SPARC_UA32) case EM_SPARC32PLUS: r = (type == R_SPARC_UA32); break; #endif #if defined(EM_SPARCV9) && defined (R_SPARC_UA32) case EM_SPARCV9: r = (type == R_SPARC_UA32); break; #endif #if defined(EM_SPARC) && defined (R_SPARC_UA32) case EM_SPARC: r = (0 #if defined(R_SPARC_UA32) | (type == R_SPARC_UA32) #endif #if (R_SPARC_TLS_DTPOFF32) | (type == R_SPARC_TLS_DTPOFF32) #endif ); break; #endif /* EM_SPARC */ #if defined(EM_386) && defined (R_386_32) case EM_386: r = (0 #if defined (R_386_32) | (type == R_386_32) #endif #if defined (R_386_TLS_LDO_32) | (type == R_386_TLS_LDO_32) #endif #if defined (R_386_TLS_DTPOFF32) | (type == R_386_TLS_DTPOFF32) #endif ); break; #endif /* EM_386 */ #if defined (EM_SH) && defined (R_SH_DIR32) case EM_SH: r = (0 #if defined (R_SH_DIR32) | (type == R_SH_DIR32) #endif #if defined (R_SH_DTPOFF32) | (type == R_SH_TLS_DTPOFF32) #endif ); break; #endif /* SH */ #if defined(EM_IA_64) && defined (R_IA64_SECREL32LSB) case EM_IA_64: /* 32bit? ! */ r = (0 #if defined (R_IA64_SECREL32LSB) | (type == R_IA64_SECREL32LSB) #endif #if defined (R_IA64_DIR32LSB) | (type == R_IA64_DIR32LSB) #endif #if defined (R_IA64_DTPREL32LSB) | (type == R_IA64_DTPREL32LSB) #endif ); break; #endif /* EM_IA_64 */ #if defined(EM_ARM) && defined (R_ARM_ABS32) case EM_ARM: case EM_AARCH64: r = (0 #if defined (R_ARM_ABS32) | ( type == R_ARM_ABS32) #endif #if defined (R_AARCH64_ABS32) | ( type == R_AARCH64_ABS32) #endif #if defined (R_ARM_TLS_LDO32) | ( type == R_ARM_TLS_LDO32) #endif ); break; #endif /* EM_ARM */ /* On FreeBSD R_PPC64_ADDR32 not defined so we use the R_PPC_ names which have the proper value. Our headers have: R_PPC64_ADDR64 38 R_PPC_ADDR32 1 so we use this one R_PPC64_ADDR32 R_PPC_ADDR32 R_PPC64_DTPREL32 110 which may be wrong/unavailable R_PPC64_DTPREL64 78 R_PPC_DTPREL32 78 */ #if defined(EM_PPC64) && defined (R_PPC_ADDR32) case EM_PPC64: r = (0 #if defined(R_PPC_ADDR32) | (type == R_PPC_ADDR32) #endif #if defined(R_PPC64_DTPREL32) | (type == R_PPC64_DTPREL32) #endif ); break; #endif /* EM_PPC64 */ #if defined(EM_PPC) && defined (R_PPC_ADDR32) case EM_PPC: r = (0 #if defined (R_PPC_ADDR32) | (type == R_PPC_ADDR32) #endif #if defined (R_PPC_DTPREL32) | (type == R_PPC_DTPREL32) #endif ); break; #endif /* EM_PPC */ #if defined(EM_S390) && defined (R_390_32) case EM_S390: r = (0 #if defined (R_390_32) | (type == R_390_32) #endif #if defined (R_390_TLS_LDO32) | (type == R_390_TLS_LDO32) #endif ); break; #endif /* EM_S390 */ #if defined(EM_X86_64) && defined (R_X86_64_32) #if defined(EM_K10M) case EM_K10M: #endif #if defined(EM_L10M) case EM_L10M: #endif case EM_X86_64: r = (0 #if defined (R_X86_64_32) | (type == R_X86_64_32) #endif #if defined (R_X86_64_DTPOFF32) | (type == R_X86_64_DTPOFF32) #endif ); break; #endif /* EM_X86_64 */ case EM_QUALCOMM_DSP6: r = (type == QUALCOMM_REL32); break; } return r; }
is_32bit_abs_reloc(unsigned int type, Dwarf_Half machine) { Dwarf_Bool r = 0; switch (machine) { #if defined(EM_MIPS) && defined (R_MIPS_32) case EM_MIPS: r = (0 #if defined (R_MIPS_32) | (type == R_MIPS_32) #endif #if defined (R_MIPS_TLS_DTPREL32) | (type == R_MIPS_TLS_DTPREL32) #endif /* DTPREL32 */ ); break; #endif /* MIPS case */ #if defined(EM_SPARC32PLUS) && defined (R_SPARC_UA32) case EM_SPARC32PLUS: r = (type == R_SPARC_UA32); break; #endif #if defined(EM_SPARCV9) && defined (R_SPARC_UA32) case EM_SPARCV9: r = (type == R_SPARC_UA32); break; #endif #if defined(EM_SPARC) && defined (R_SPARC_UA32) case EM_SPARC: r = (0 #if defined(R_SPARC_UA32) | (type == R_SPARC_UA32) #endif #if (R_SPARC_TLS_DTPOFF32) | (type == R_SPARC_TLS_DTPOFF32) #endif ); break; #endif /* EM_SPARC */ #if defined(EM_386) && defined (R_386_32) case EM_386: r = (0 #if defined (R_386_32) | (type == R_386_32) #endif #if defined (R_386_TLS_LDO_32) | (type == R_386_TLS_LDO_32) #endif #if defined (R_386_TLS_DTPOFF32) | (type == R_386_TLS_DTPOFF32) #endif ); break; #endif /* EM_386 */ #if defined (EM_SH) && defined (R_SH_DIR32) case EM_SH: r = (0 #if defined (R_SH_DIR32) | (type == R_SH_DIR32) #endif #if defined (R_SH_DTPOFF32) | (type == R_SH_TLS_DTPOFF32) #endif ); break; #endif /* SH */ #if defined(EM_IA_64) && defined (R_IA64_SECREL32LSB) case EM_IA_64: /* 32bit? ! */ r = (0 #if defined (R_IA64_SECREL32LSB) | (type == R_IA64_SECREL32LSB) #endif #if defined (R_IA64_DIR32LSB) | (type == R_IA64_DIR32LSB) #endif #if defined (R_IA64_DTPREL32LSB) | (type == R_IA64_DTPREL32LSB) #endif ); break; #endif /* EM_IA_64 */ #if defined(EM_ARM) && defined (R_ARM_ABS32) case EM_ARM: case EM_AARCH64: r = (0 #if defined (R_ARM_ABS32) | ( type == R_ARM_ABS32) #endif #if defined (R_AARCH64_ABS32) | ( type == R_AARCH64_ABS32) #endif #if defined (R_ARM_TLS_LDO32) | ( type == R_ARM_TLS_LDO32) #endif ); break; #endif /* EM_ARM */ /* On FreeBSD R_PPC64_ADDR32 not defined so we use the R_PPC_ names which have the proper value. Our headers have: R_PPC64_ADDR64 38 R_PPC_ADDR32 1 so we use this one R_PPC64_ADDR32 R_PPC_ADDR32 R_PPC64_DTPREL32 110 which may be wrong/unavailable R_PPC64_DTPREL64 78 R_PPC_DTPREL32 78 */ #if defined(EM_PPC64) && defined (R_PPC_ADDR32) case EM_PPC64: r = (0 #if defined(R_PPC_ADDR32) | (type == R_PPC_ADDR32) #endif #if defined(R_PPC64_DTPREL32) | (type == R_PPC64_DTPREL32) #endif ); break; #endif /* EM_PPC64 */ #if defined(EM_PPC) && defined (R_PPC_ADDR32) case EM_PPC: r = (0 #if defined (R_PPC_ADDR32) | (type == R_PPC_ADDR32) #endif #if defined (R_PPC_DTPREL32) | (type == R_PPC_DTPREL32) #endif ); break; #endif /* EM_PPC */ #if defined(EM_S390) && defined (R_390_32) case EM_S390: r = (0 #if defined (R_390_32) | (type == R_390_32) #endif #if defined (R_390_TLS_LDO32) | (type == R_390_TLS_LDO32) #endif ); break; #endif /* EM_S390 */ #if defined(EM_X86_64) && defined (R_X86_64_32) #if defined(EM_K10M) case EM_K10M: #endif #if defined(EM_L10M) case EM_L10M: #endif case EM_X86_64: r = (0 #if defined (R_X86_64_32) | (type == R_X86_64_32) #endif #if defined (R_X86_64_DTPOFF32) | (type == R_X86_64_DTPOFF32) #endif ); break; #endif /* EM_X86_64 */ case EM_QUALCOMM_DSP6: r = (type == QUALCOMM_REL32); break; } return r; }
C
libdwarf
0
CVE-2016-9137
https://www.cvedetails.com/cve/CVE-2016-9137/
CWE-416
https://git.php.net/?p=php-src.git;a=commit;h=0e6fe3a4c96be2d3e88389a5776f878021b4c59f
0e6fe3a4c96be2d3e88389a5776f878021b4c59f
null
ZEND_API int _array_init(zval *arg, uint size ZEND_FILE_LINE_DC) /* {{{ */ { ALLOC_HASHTABLE_REL(Z_ARRVAL_P(arg)); _zend_hash_init(Z_ARRVAL_P(arg), size, ZVAL_PTR_DTOR, 0 ZEND_FILE_LINE_RELAY_CC); Z_TYPE_P(arg) = IS_ARRAY; return SUCCESS; } /* }}} */
ZEND_API int _array_init(zval *arg, uint size ZEND_FILE_LINE_DC) /* {{{ */ { ALLOC_HASHTABLE_REL(Z_ARRVAL_P(arg)); _zend_hash_init(Z_ARRVAL_P(arg), size, ZVAL_PTR_DTOR, 0 ZEND_FILE_LINE_RELAY_CC); Z_TYPE_P(arg) = IS_ARRAY; return SUCCESS; } /* }}} */
C
php
0
CVE-2017-9761
https://www.cvedetails.com/cve/CVE-2017-9761/
CWE-119
https://github.com/radare/radare2/commit/00e8f205475332d7842d0f0d1481eeab4e83017c
00e8f205475332d7842d0f0d1481eeab4e83017c
Fix #7727 - undefined pointers and out of band string access fixes
static int getArg(char ch, int def) { switch (ch) { case '&': case '-': return ch; } return def; }
static int getArg(char ch, int def) { switch (ch) { case '&': case '-': return ch; } return def; }
C
radare2
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]>
void inet_csk_reqsk_queue_hash_add(struct sock *sk, struct request_sock *req, unsigned long timeout) { struct inet_connection_sock *icsk = inet_csk(sk); struct listen_sock *lopt = icsk->icsk_accept_queue.listen_opt; const u32 h = inet_synq_hash(inet_rsk(req)->rmt_addr, inet_rsk(req)->rmt_port, lopt->hash_rnd, lopt->nr_table_entries); reqsk_queue_hash_req(&icsk->icsk_accept_queue, h, req, timeout); inet_csk_reqsk_queue_added(sk, timeout); }
void inet_csk_reqsk_queue_hash_add(struct sock *sk, struct request_sock *req, unsigned long timeout) { struct inet_connection_sock *icsk = inet_csk(sk); struct listen_sock *lopt = icsk->icsk_accept_queue.listen_opt; const u32 h = inet_synq_hash(inet_rsk(req)->rmt_addr, inet_rsk(req)->rmt_port, lopt->hash_rnd, lopt->nr_table_entries); reqsk_queue_hash_req(&icsk->icsk_accept_queue, h, req, timeout); inet_csk_reqsk_queue_added(sk, timeout); }
C
linux
0
CVE-2016-0838
https://www.cvedetails.com/cve/CVE-2016-0838/
CWE-119
https://android.googlesource.com/platform/external/sonivox/+/24d7c408c52143bce7b49de82f3913fd8d1219cf
24d7c408c52143bce7b49de82f3913fd8d1219cf
Sonivox: add SafetyNet log. Bug: 26366256 Change-Id: Ief72e01b7cc6d87a015105af847a99d3d9b03cb0
void WT_VoiceGain (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame) { EAS_I32 *pMixBuffer; EAS_PCM *pInputBuffer; EAS_I32 gain; EAS_I32 gainIncrement; EAS_I32 tmp0; EAS_I32 tmp1; EAS_I32 tmp2; EAS_I32 numSamples; #if (NUM_OUTPUT_CHANNELS == 2) EAS_I32 gainLeft, gainRight; #endif /* initialize some local variables */ numSamples = pWTIntFrame->numSamples; if (numSamples <= 0) { ALOGE("b/26366256"); android_errorWriteLog(0x534e4554, "26366256"); return; } pMixBuffer = pWTIntFrame->pMixBuffer; pInputBuffer = pWTIntFrame->pAudioBuffer; /*lint -e{703} <avoid multiply for performance>*/ gainIncrement = (pWTIntFrame->frame.gainTarget - pWTIntFrame->prevGain) << (16 - SYNTH_UPDATE_PERIOD_IN_BITS); if (gainIncrement < 0) gainIncrement++; /*lint -e{703} <avoid multiply for performance>*/ gain = pWTIntFrame->prevGain << 16; #if (NUM_OUTPUT_CHANNELS == 2) gainLeft = pWTVoice->gainLeft; gainRight = pWTVoice->gainRight; #endif while (numSamples--) { /* incremental gain step to prevent zipper noise */ tmp0 = *pInputBuffer++; gain += gainIncrement; /*lint -e{704} <avoid divide>*/ tmp2 = gain >> 16; /* scale sample by gain */ tmp2 *= tmp0; /* stereo output */ #if (NUM_OUTPUT_CHANNELS == 2) /*lint -e{704} <avoid divide>*/ tmp2 = tmp2 >> 14; /* get the current sample in the final mix buffer */ tmp1 = *pMixBuffer; /* left channel */ tmp0 = tmp2 * gainLeft; /*lint -e{704} <avoid divide>*/ tmp0 = tmp0 >> NUM_MIXER_GUARD_BITS; tmp1 += tmp0; *pMixBuffer++ = tmp1; /* get the current sample in the final mix buffer */ tmp1 = *pMixBuffer; /* right channel */ tmp0 = tmp2 * gainRight; /*lint -e{704} <avoid divide>*/ tmp0 = tmp0 >> NUM_MIXER_GUARD_BITS; tmp1 += tmp0; *pMixBuffer++ = tmp1; /* mono output */ #else /* get the current sample in the final mix buffer */ tmp1 = *pMixBuffer; /*lint -e{704} <avoid divide>*/ tmp2 = tmp2 >> (NUM_MIXER_GUARD_BITS - 1); tmp1 += tmp2; *pMixBuffer++ = tmp1; #endif } }
void WT_VoiceGain (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame) { EAS_I32 *pMixBuffer; EAS_PCM *pInputBuffer; EAS_I32 gain; EAS_I32 gainIncrement; EAS_I32 tmp0; EAS_I32 tmp1; EAS_I32 tmp2; EAS_I32 numSamples; #if (NUM_OUTPUT_CHANNELS == 2) EAS_I32 gainLeft, gainRight; #endif /* initialize some local variables */ numSamples = pWTIntFrame->numSamples; if (numSamples <= 0) { ALOGE("b/26366256"); return; } pMixBuffer = pWTIntFrame->pMixBuffer; pInputBuffer = pWTIntFrame->pAudioBuffer; /*lint -e{703} <avoid multiply for performance>*/ gainIncrement = (pWTIntFrame->frame.gainTarget - pWTIntFrame->prevGain) << (16 - SYNTH_UPDATE_PERIOD_IN_BITS); if (gainIncrement < 0) gainIncrement++; /*lint -e{703} <avoid multiply for performance>*/ gain = pWTIntFrame->prevGain << 16; #if (NUM_OUTPUT_CHANNELS == 2) gainLeft = pWTVoice->gainLeft; gainRight = pWTVoice->gainRight; #endif while (numSamples--) { /* incremental gain step to prevent zipper noise */ tmp0 = *pInputBuffer++; gain += gainIncrement; /*lint -e{704} <avoid divide>*/ tmp2 = gain >> 16; /* scale sample by gain */ tmp2 *= tmp0; /* stereo output */ #if (NUM_OUTPUT_CHANNELS == 2) /*lint -e{704} <avoid divide>*/ tmp2 = tmp2 >> 14; /* get the current sample in the final mix buffer */ tmp1 = *pMixBuffer; /* left channel */ tmp0 = tmp2 * gainLeft; /*lint -e{704} <avoid divide>*/ tmp0 = tmp0 >> NUM_MIXER_GUARD_BITS; tmp1 += tmp0; *pMixBuffer++ = tmp1; /* get the current sample in the final mix buffer */ tmp1 = *pMixBuffer; /* right channel */ tmp0 = tmp2 * gainRight; /*lint -e{704} <avoid divide>*/ tmp0 = tmp0 >> NUM_MIXER_GUARD_BITS; tmp1 += tmp0; *pMixBuffer++ = tmp1; /* mono output */ #else /* get the current sample in the final mix buffer */ tmp1 = *pMixBuffer; /*lint -e{704} <avoid divide>*/ tmp2 = tmp2 >> (NUM_MIXER_GUARD_BITS - 1); tmp1 += tmp2; *pMixBuffer++ = tmp1; #endif } }
C
Android
1
CVE-2016-0846
https://www.cvedetails.com/cve/CVE-2016-0846/
CWE-264
https://android.googlesource.com/platform/frameworks/native/+/f3199c228aced7858b75a8070b8358c155ae0149
f3199c228aced7858b75a8070b8358c155ae0149
Sanity check IMemory access versus underlying mmap Bug 26877992 Change-Id: Ibbf4b1061e4675e4e96bc944a865b53eaf6984fe
HeapCache::HeapCache() : DeathRecipient() { }
HeapCache::HeapCache() : DeathRecipient() { }
C
Android
0
CVE-2012-1174
https://www.cvedetails.com/cve/CVE-2012-1174/
CWE-362
https://cgit.freedesktop.org/systemd/systemd/commit/?id=5ebff5337594d690b322078c512eb222d34aaa82
5ebff5337594d690b322078c512eb222d34aaa82
null
int get_parent_of_pid(pid_t pid, pid_t *_ppid) { int r; FILE *f; char fn[PATH_MAX], line[LINE_MAX], *p; long unsigned ppid; assert(pid > 0); assert(_ppid); assert_se(snprintf(fn, sizeof(fn)-1, "/proc/%lu/stat", (unsigned long) pid) < (int) (sizeof(fn)-1)); char_array_0(fn); if (!(f = fopen(fn, "re"))) return -errno; if (!(fgets(line, sizeof(line), f))) { r = feof(f) ? -EIO : -errno; fclose(f); return r; } fclose(f); /* Let's skip the pid and comm fields. The latter is enclosed * in () but does not escape any () in its value, so let's * skip over it manually */ if (!(p = strrchr(line, ')'))) return -EIO; p++; if (sscanf(p, " " "%*c " /* state */ "%lu ", /* ppid */ &ppid) != 1) return -EIO; if ((long unsigned) (pid_t) ppid != ppid) return -ERANGE; *_ppid = (pid_t) ppid; return 0; }
int get_parent_of_pid(pid_t pid, pid_t *_ppid) { int r; FILE *f; char fn[PATH_MAX], line[LINE_MAX], *p; long unsigned ppid; assert(pid > 0); assert(_ppid); assert_se(snprintf(fn, sizeof(fn)-1, "/proc/%lu/stat", (unsigned long) pid) < (int) (sizeof(fn)-1)); char_array_0(fn); if (!(f = fopen(fn, "re"))) return -errno; if (!(fgets(line, sizeof(line), f))) { r = feof(f) ? -EIO : -errno; fclose(f); return r; } fclose(f); /* Let's skip the pid and comm fields. The latter is enclosed * in () but does not escape any () in its value, so let's * skip over it manually */ if (!(p = strrchr(line, ')'))) return -EIO; p++; if (sscanf(p, " " "%*c " /* state */ "%lu ", /* ppid */ &ppid) != 1) return -EIO; if ((long unsigned) (pid_t) ppid != ppid) return -ERANGE; *_ppid = (pid_t) ppid; return 0; }
C
systemd
0
CVE-2013-3236
https://www.cvedetails.com/cve/CVE-2013-3236/
CWE-200
https://github.com/torvalds/linux/commit/680d04e0ba7e926233e3b9cee59125ce181f66ba
680d04e0ba7e926233e3b9cee59125ce181f66ba
VSOCK: vmci - fix possible info leak in vmci_transport_dgram_dequeue() In case we received no data on the call to skb_recv_datagram(), i.e. skb->data is NULL, vmci_transport_dgram_dequeue() will return with 0 without updating msg_namelen leading to net/socket.c leaking the local, uninitialized sockaddr_storage variable to userland -- 128 bytes of kernel stack memory. Fix this by moving the already existing msg_namelen assignment a few lines above. Cc: Andy King <[email protected]> Cc: Dmitry Torokhov <[email protected]> Cc: George Zhang <[email protected]> Signed-off-by: Mathias Krause <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static void __exit vmci_transport_exit(void) { if (!vmci_handle_is_invalid(vmci_transport_stream_handle)) { if (vmci_datagram_destroy_handle( vmci_transport_stream_handle) != VMCI_SUCCESS) pr_err("Couldn't destroy datagram handle\n"); vmci_transport_stream_handle = VMCI_INVALID_HANDLE; } if (vmci_transport_qp_resumed_sub_id != VMCI_INVALID_ID) { vmci_event_unsubscribe(vmci_transport_qp_resumed_sub_id); vmci_transport_qp_resumed_sub_id = VMCI_INVALID_ID; } vsock_core_exit(); }
static void __exit vmci_transport_exit(void) { if (!vmci_handle_is_invalid(vmci_transport_stream_handle)) { if (vmci_datagram_destroy_handle( vmci_transport_stream_handle) != VMCI_SUCCESS) pr_err("Couldn't destroy datagram handle\n"); vmci_transport_stream_handle = VMCI_INVALID_HANDLE; } if (vmci_transport_qp_resumed_sub_id != VMCI_INVALID_ID) { vmci_event_unsubscribe(vmci_transport_qp_resumed_sub_id); vmci_transport_qp_resumed_sub_id = VMCI_INVALID_ID; } vsock_core_exit(); }
C
linux
0
CVE-2015-8543
https://www.cvedetails.com/cve/CVE-2015-8543/
null
https://github.com/torvalds/linux/commit/79462ad02e861803b3840cc782248c7359451cd9
79462ad02e861803b3840cc782248c7359451cd9
net: add validation for the socket syscall protocol argument 郭永刚 reported that one could simply crash the kernel as root by using a simple program: int socket_fd; struct sockaddr_in addr; addr.sin_port = 0; addr.sin_addr.s_addr = INADDR_ANY; addr.sin_family = 10; socket_fd = socket(10,3,0x40000000); connect(socket_fd , &addr,16); AF_INET, AF_INET6 sockets actually only support 8-bit protocol identifiers. inet_sock's skc_protocol field thus is sized accordingly, thus larger protocol identifiers simply cut off the higher bits and store a zero in the protocol fields. This could lead to e.g. NULL function pointer because as a result of the cut off inet_num is zero and we call down to inet_autobind, which is NULL for raw sockets. kernel: Call Trace: kernel: [<ffffffff816db90e>] ? inet_autobind+0x2e/0x70 kernel: [<ffffffff816db9a4>] inet_dgram_connect+0x54/0x80 kernel: [<ffffffff81645069>] SYSC_connect+0xd9/0x110 kernel: [<ffffffff810ac51b>] ? ptrace_notify+0x5b/0x80 kernel: [<ffffffff810236d8>] ? syscall_trace_enter_phase2+0x108/0x200 kernel: [<ffffffff81645e0e>] SyS_connect+0xe/0x10 kernel: [<ffffffff81779515>] tracesys_phase2+0x84/0x89 I found no particular commit which introduced this problem. CVE: CVE-2015-8543 Cc: Cong Wang <[email protected]> Reported-by: 郭永刚 <[email protected]> Signed-off-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: David S. Miller <[email protected]>
int inet_stream_connect(struct socket *sock, struct sockaddr *uaddr, int addr_len, int flags) { int err; lock_sock(sock->sk); err = __inet_stream_connect(sock, uaddr, addr_len, flags); release_sock(sock->sk); return err; }
int inet_stream_connect(struct socket *sock, struct sockaddr *uaddr, int addr_len, int flags) { int err; lock_sock(sock->sk); err = __inet_stream_connect(sock, uaddr, addr_len, flags); release_sock(sock->sk); return err; }
C
linux
0
CVE-2014-3198
https://www.cvedetails.com/cve/CVE-2014-3198/
CWE-119
https://github.com/chromium/chromium/commit/9b04ffd8e7a07e9b2947fe5b71acf85dff38a63f
9b04ffd8e7a07e9b2947fe5b71acf85dff38a63f
Let PDFium handle event when there is not yet a visible page. Speculative fix for 415307. CF will confirm. The stack trace for that bug indicates an attempt to index by -1, which is consistent with no visible page. BUG=415307 Review URL: https://codereview.chromium.org/560133004 Cr-Commit-Position: refs/heads/master@{#295421}
void Instance::ConfigureNumberImageGenerator() { std::vector<pp::ImageData> num_images = GetThumbnailResources(); pp::ImageData number_background = CreateResourceImage( PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_NUM_BACKGROUND); number_image_generator_->Configure(number_background, num_images, device_scale_); }
void Instance::ConfigureNumberImageGenerator() { std::vector<pp::ImageData> num_images = GetThumbnailResources(); pp::ImageData number_background = CreateResourceImage( PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_NUM_BACKGROUND); number_image_generator_->Configure(number_background, num_images, device_scale_); }
C
Chrome
0
CVE-2017-9211
https://www.cvedetails.com/cve/CVE-2017-9211/
CWE-476
https://github.com/torvalds/linux/commit/9933e113c2e87a9f46a40fde8dafbf801dca1ab9
9933e113c2e87a9f46a40fde8dafbf801dca1ab9
crypto: skcipher - Add missing API setkey checks The API setkey checks for key sizes and alignment went AWOL during the skcipher conversion. This patch restores them. Cc: <[email protected]> Fixes: 4e6c3df4d729 ("crypto: skcipher - Add low-level skcipher...") Reported-by: Baozeng <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
static inline void skcipher_unmap_dst(struct skcipher_walk *walk) { skcipher_unmap(&walk->out, walk->dst.virt.addr); }
static inline void skcipher_unmap_dst(struct skcipher_walk *walk) { skcipher_unmap(&walk->out, walk->dst.virt.addr); }
C
linux
0
CVE-2016-5199
https://www.cvedetails.com/cve/CVE-2016-5199/
CWE-119
https://github.com/chromium/chromium/commit/c995d4fe5e96f4d6d4a88b7867279b08e72d2579
c995d4fe5e96f4d6d4a88b7867279b08e72d2579
Move IsDataSaverEnabledByUser to be a static method and use it This method now officially becomes the source of truth that everything in the code base eventually calls into to determine whether or not DataSaver is enabled. Bug: 934399 Change-Id: Iae837b710ace8cc3101188f79d02cbc2d4f0fd93 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1537242 Reviewed-by: Joshua Pawlicki <[email protected]> Reviewed-by: Tarun Bansal <[email protected]> Commit-Queue: Robert Ogden <[email protected]> Cr-Commit-Position: refs/heads/master@{#643948}
void ChromeContentBrowserClient::SetBrowserStartupIsCompleteForTesting() { AfterStartupTaskUtils::SetBrowserStartupIsCompleteForTesting(); }
void ChromeContentBrowserClient::SetBrowserStartupIsCompleteForTesting() { AfterStartupTaskUtils::SetBrowserStartupIsCompleteForTesting(); }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/87190165c55bcf3eecd8824dd8d083f5e3236552
87190165c55bcf3eecd8824dd8d083f5e3236552
Put browser side mixing back behind a flag. BUG=140247 TEST=Tried --enable-audio-mixer flag and observed regression. Review URL: https://chromiumcodereview.appspot.com/10834159 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149906 0039d316-1c4b-4281-b951-d872f2087c98
AudioInputStream* AudioManagerBase::MakeAudioInputStream( const AudioParameters& params, const std::string& device_id) { if (!params.IsValid() || (params.channels() > kMaxInputChannels) || device_id.empty()) { DLOG(ERROR) << "Audio parameters are invalid for device " << device_id; return NULL; } if (num_input_streams_ >= max_num_input_streams_) { DLOG(ERROR) << "Number of opened input audio streams " << num_input_streams_ << " exceed the max allowed number " << max_num_input_streams_; return NULL; } AudioInputStream* stream = NULL; if (params.format() == AudioParameters::AUDIO_MOCK) { stream = FakeAudioInputStream::MakeFakeStream(this, params); } else if (params.format() == AudioParameters::AUDIO_PCM_LINEAR) { stream = MakeLinearInputStream(params, device_id); } else if (params.format() == AudioParameters::AUDIO_PCM_LOW_LATENCY) { stream = MakeLowLatencyInputStream(params, device_id); } if (stream) ++num_input_streams_; return stream; }
AudioInputStream* AudioManagerBase::MakeAudioInputStream( const AudioParameters& params, const std::string& device_id) { if (!params.IsValid() || (params.channels() > kMaxInputChannels) || device_id.empty()) { DLOG(ERROR) << "Audio parameters are invalid for device " << device_id; return NULL; } if (num_input_streams_ >= max_num_input_streams_) { DLOG(ERROR) << "Number of opened input audio streams " << num_input_streams_ << " exceed the max allowed number " << max_num_input_streams_; return NULL; } AudioInputStream* stream = NULL; if (params.format() == AudioParameters::AUDIO_MOCK) { stream = FakeAudioInputStream::MakeFakeStream(this, params); } else if (params.format() == AudioParameters::AUDIO_PCM_LINEAR) { stream = MakeLinearInputStream(params, device_id); } else if (params.format() == AudioParameters::AUDIO_PCM_LOW_LATENCY) { stream = MakeLowLatencyInputStream(params, device_id); } if (stream) ++num_input_streams_; return stream; }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/b7e899141194fa27d55a990e38ae8bdcc5183a90
b7e899141194fa27d55a990e38ae8bdcc5183a90
C++ readability change for cindylau. BUG=none TEST=none Review URL: http://codereview.chromium.org/2090008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48733 0039d316-1c4b-4281-b951-d872f2087c98
virtual Profile* GetOffTheRecordProfile() { if (IsOffTheRecord()) return this; else return linked_profile_; }
virtual Profile* GetOffTheRecordProfile() { if (IsOffTheRecord()) return this; else return linked_profile_; }
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_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create) { DECODE_HEAD; READ_BUF(4); create->cr_type = be32_to_cpup(p++); switch (create->cr_type) { case NF4LNK: READ_BUF(4); create->cr_datalen = be32_to_cpup(p++); READ_BUF(create->cr_datalen); create->cr_data = svcxdr_dupstr(argp, p, create->cr_datalen); if (!create->cr_data) return nfserr_jukebox; break; case NF4BLK: case NF4CHR: READ_BUF(8); create->cr_specdata1 = be32_to_cpup(p++); create->cr_specdata2 = be32_to_cpup(p++); break; case NF4SOCK: case NF4FIFO: case NF4DIR: default: break; } READ_BUF(4); create->cr_namelen = be32_to_cpup(p++); READ_BUF(create->cr_namelen); SAVEMEM(create->cr_name, create->cr_namelen); if ((status = check_filename(create->cr_name, create->cr_namelen))) return status; status = nfsd4_decode_fattr(argp, create->cr_bmval, &create->cr_iattr, &create->cr_acl, &create->cr_label, &current->fs->umask); if (status) goto out; DECODE_TAIL; }
nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create) { DECODE_HEAD; READ_BUF(4); create->cr_type = be32_to_cpup(p++); switch (create->cr_type) { case NF4LNK: READ_BUF(4); create->cr_datalen = be32_to_cpup(p++); READ_BUF(create->cr_datalen); create->cr_data = svcxdr_dupstr(argp, p, create->cr_datalen); if (!create->cr_data) return nfserr_jukebox; break; case NF4BLK: case NF4CHR: READ_BUF(8); create->cr_specdata1 = be32_to_cpup(p++); create->cr_specdata2 = be32_to_cpup(p++); break; case NF4SOCK: case NF4FIFO: case NF4DIR: default: break; } READ_BUF(4); create->cr_namelen = be32_to_cpup(p++); READ_BUF(create->cr_namelen); SAVEMEM(create->cr_name, create->cr_namelen); if ((status = check_filename(create->cr_name, create->cr_namelen))) return status; status = nfsd4_decode_fattr(argp, create->cr_bmval, &create->cr_iattr, &create->cr_acl, &create->cr_label, &current->fs->umask); if (status) goto out; DECODE_TAIL; }
C
linux
0
CVE-2013-2887
https://www.cvedetails.com/cve/CVE-2013-2887/
null
https://github.com/chromium/chromium/commit/01924fbe6c0e0f059ca46a03f9f6b2670ae3e0fa
01924fbe6c0e0f059ca46a03f9f6b2670ae3e0fa
Pass ui::LatencyInfo correct with unified gesture detector on Aura. BUG=379812 TEST=GestureRecognizerTest.LatencyPassedFromTouchEvent Review URL: https://codereview.chromium.org/309823002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274602 0039d316-1c4b-4281-b951-d872f2087c98
void ReceivedAckPreventDefaulted() { ReceivedAckImpl(true); }
void ReceivedAckPreventDefaulted() { ReceivedAckImpl(true); }
C
Chrome
0
CVE-2013-0910
https://www.cvedetails.com/cve/CVE-2013-0910/
CWE-287
https://github.com/chromium/chromium/commit/ac8bd041b81e46e4e4fcd5021aaa5499703952e6
ac8bd041b81e46e4e4fcd5021aaa5499703952e6
Follow-on fixes and naming changes for https://codereview.chromium.org/12086077/ BUG=172573 Review URL: https://codereview.chromium.org/12177018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180600 0039d316-1c4b-4281-b951-d872f2087c98
void PluginServiceImpl::UnregisterInternalPlugin(const FilePath& path) { plugin_list_->UnregisterInternalPlugin(path); }
void PluginServiceImpl::UnregisterInternalPlugin(const FilePath& path) { plugin_list_->UnregisterInternalPlugin(path); }
C
Chrome
0
CVE-2010-1149
https://www.cvedetails.com/cve/CVE-2010-1149/
CWE-200
https://cgit.freedesktop.org/udisks/commit/?id=0fcc7cb3b66f23fac53ae08647aa0007a2bd56c4
0fcc7cb3b66f23fac53ae08647aa0007a2bd56c4
null
linux_md_remove_component_completed_cb (DBusGMethodInvocation *context, Device *device, gboolean job_was_cancelled, int status, const char *stderr, const char *stdout, gpointer user_data) { RemoveComponentData *data = user_data; /* the slave got new metadata on it; reread that */ device_generate_kernel_change_event (data->slave); /* the kernel side of md currently doesn't emit a 'changed' event so * generate one since state may have changed (e.g. rebuild started etc.) */ device_generate_kernel_change_event (device); if (WEXITSTATUS (status) == 0 && !job_was_cancelled) { /* wait for the slave to be busy, then start erasing it */ data->device_changed_signal_handler_id = g_signal_connect_after (device->priv->daemon, "device-changed", (GCallback) linux_md_remove_component_device_changed_cb, remove_component_data_ref (data)); /* set up timeout for error reporting if waiting failed * * (the signal handler and the timeout handler share the ref to data * as one will cancel the other) */ data->device_changed_timeout_id = g_timeout_add (10 * 1000, linux_md_remove_component_device_not_seen_cb, data); } else { if (job_was_cancelled) { throw_error (context, ERROR_CANCELLED, "Job was cancelled"); } else { throw_error (context, ERROR_FAILED, "Error removing component: helper exited with exit code %d: %s", WEXITSTATUS (status), stderr); } } }
linux_md_remove_component_completed_cb (DBusGMethodInvocation *context, Device *device, gboolean job_was_cancelled, int status, const char *stderr, const char *stdout, gpointer user_data) { RemoveComponentData *data = user_data; /* the slave got new metadata on it; reread that */ device_generate_kernel_change_event (data->slave); /* the kernel side of md currently doesn't emit a 'changed' event so * generate one since state may have changed (e.g. rebuild started etc.) */ device_generate_kernel_change_event (device); if (WEXITSTATUS (status) == 0 && !job_was_cancelled) { /* wait for the slave to be busy, then start erasing it */ data->device_changed_signal_handler_id = g_signal_connect_after (device->priv->daemon, "device-changed", (GCallback) linux_md_remove_component_device_changed_cb, remove_component_data_ref (data)); /* set up timeout for error reporting if waiting failed * * (the signal handler and the timeout handler share the ref to data * as one will cancel the other) */ data->device_changed_timeout_id = g_timeout_add (10 * 1000, linux_md_remove_component_device_not_seen_cb, data); } else { if (job_was_cancelled) { throw_error (context, ERROR_CANCELLED, "Job was cancelled"); } else { throw_error (context, ERROR_FAILED, "Error removing component: helper exited with exit code %d: %s", WEXITSTATUS (status), stderr); } } }
C
udisks
0
CVE-2012-2895
https://www.cvedetails.com/cve/CVE-2012-2895/
CWE-119
https://github.com/chromium/chromium/commit/16dcd30c215801941d9890859fd79a234128fc3e
16dcd30c215801941d9890859fd79a234128fc3e
Refactors to simplify rename pathway in DownloadFileManager. This is https://chromiumcodereview.appspot.com/10668004 / r144817 (reverted due to CrOS failure) with the completion logic moved to after the auto-opening. The tests that test the auto-opening (for web store install) were waiting for download completion to check install, and hence were failing when completion was moved earlier. Doing this right would probably require another state (OPENED). BUG=123998 BUG-134930 [email protected] Review URL: https://chromiumcodereview.appspot.com/10701040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145157 0039d316-1c4b-4281-b951-d872f2087c98
NullDownloadRequestHandle() {}
NullDownloadRequestHandle() {}
C
Chrome
0