CVE ID
stringlengths
13
43
CVE Page
stringlengths
45
48
CWE ID
stringclasses
90 values
codeLink
stringlengths
46
139
commit_id
stringlengths
6
81
commit_message
stringlengths
3
13.3k
func_after
stringlengths
14
241k
func_before
stringlengths
14
241k
lang
stringclasses
3 values
project
stringclasses
309 values
vul
int8
0
1
CVE-2019-10131
https://www.cvedetails.com/cve/CVE-2019-10131/
CWE-119
https://github.com/ImageMagick/ImageMagick/commit/cb1214c124e1bd61f7dd551b94a794864861592e
cb1214c124e1bd61f7dd551b94a794864861592e
...
static int jpeg_extract(Image *ifile, Image *ofile) { unsigned int marker; unsigned int done = 0; if (jpeg_skip_1(ifile) != 0xff) return 0; if (jpeg_skip_1(ifile) != M_SOI) return 0; while (done == MagickFalse) { marker = jpeg_skip_till_marker(ifile, M_APP13); if (marker == M_APP13) { marker = jpeg_nextmarker(ifile, ofile); break; } } return 1; }
static int jpeg_extract(Image *ifile, Image *ofile) { unsigned int marker; unsigned int done = 0; if (jpeg_skip_1(ifile) != 0xff) return 0; if (jpeg_skip_1(ifile) != M_SOI) return 0; while (done == MagickFalse) { marker = jpeg_skip_till_marker(ifile, M_APP13); if (marker == M_APP13) { marker = jpeg_nextmarker(ifile, ofile); break; } } return 1; }
C
ImageMagick
0
null
null
null
https://github.com/chromium/chromium/commit/dc3857aac17be72c96f28d860d875235b3be349a
dc3857aac17be72c96f28d860d875235b3be349a
Unreviewed, rolling out r142736. http://trac.webkit.org/changeset/142736 https://bugs.webkit.org/show_bug.cgi?id=109716 Broke ABI, nightly builds crash on launch (Requested by ap on #webkit). Patch by Sheriff Bot <[email protected]> on 2013-02-13 Source/WebKit2: * Shared/APIClientTraits.cpp: (WebKit): * Shared/APIClientTraits.h: * UIProcess/API/C/WKPage.h: * UIProcess/API/gtk/WebKitLoaderClient.cpp: (attachLoaderClientToView): * WebProcess/InjectedBundle/API/c/WKBundlePage.h: * WebProcess/qt/QtBuiltinBundlePage.cpp: (WebKit::QtBuiltinBundlePage::QtBuiltinBundlePage): Tools: * MiniBrowser/mac/WK2BrowserWindowController.m: (-[WK2BrowserWindowController awakeFromNib]): * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: (WTR::InjectedBundlePage::InjectedBundlePage): * WebKitTestRunner/TestController.cpp: (WTR::TestController::createWebViewWithOptions): git-svn-id: svn://svn.chromium.org/blink/trunk@142762 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void InjectedBundlePage::enterFullScreenForElement(WKBundlePageRef pageRef, WKBundleNodeHandleRef elementRef) { if (InjectedBundle::shared().testRunner()->shouldDumpFullScreenCallbacks()) InjectedBundle::shared().outputText("enterFullScreenForElement()\n"); if (!InjectedBundle::shared().testRunner()->hasCustomFullScreenBehavior()) { WKBundlePageWillEnterFullScreen(pageRef); WKBundlePageDidEnterFullScreen(pageRef); } }
void InjectedBundlePage::enterFullScreenForElement(WKBundlePageRef pageRef, WKBundleNodeHandleRef elementRef) { if (InjectedBundle::shared().testRunner()->shouldDumpFullScreenCallbacks()) InjectedBundle::shared().outputText("enterFullScreenForElement()\n"); if (!InjectedBundle::shared().testRunner()->hasCustomFullScreenBehavior()) { WKBundlePageWillEnterFullScreen(pageRef); WKBundlePageDidEnterFullScreen(pageRef); } }
C
Chrome
0
CVE-2018-17467
https://www.cvedetails.com/cve/CVE-2018-17467/
CWE-20
https://github.com/chromium/chromium/commit/7da6c3419fd172405bcece1ae4ec6ec8316cd345
7da6c3419fd172405bcece1ae4ec6ec8316cd345
Start rendering timer after first navigation Currently the new content rendering timer in the browser process, which clears an old page's contents 4 seconds after a navigation if the new page doesn't draw in that time, is not set on the first navigation for a top-level frame. This is problematic because content can exist before the first navigation, for instance if it was created by a javascript: URL. This CL removes the code that skips the timer activation on the first navigation. Bug: 844881 Change-Id: I19b3ad1ff62c69ded3a5f7b1c0afde191aaf4584 Reviewed-on: https://chromium-review.googlesource.com/1188589 Reviewed-by: Fady Samuel <[email protected]> Reviewed-by: ccameron <[email protected]> Commit-Queue: Ken Buchanan <[email protected]> Cr-Commit-Position: refs/heads/master@{#586913}
bool RenderWidgetHostImpl::SynchronizeVisualProperties( bool scroll_focused_node_into_view) { if (visual_properties_ack_pending_ || !process_->IsInitializedAndNotDead() || !view_ || !view_->HasSize() || !renderer_initialized_ || !delegate_) { return false; } std::unique_ptr<VisualProperties> visual_properties(new VisualProperties); bool needs_ack = false; if (!GetVisualProperties(visual_properties.get(), &needs_ack)) return false; visual_properties->scroll_focused_node_into_view = scroll_focused_node_into_view; ScreenInfo screen_info = visual_properties->screen_info; bool width_changed = !old_visual_properties_ || old_visual_properties_->new_size.width() != visual_properties->new_size.width(); bool sent_visual_properties = false; if (Send(new ViewMsg_SynchronizeVisualProperties(routing_id_, *visual_properties))) { visual_properties_ack_pending_ = needs_ack; old_visual_properties_.swap(visual_properties); sent_visual_properties = true; } if (delegate_) delegate_->RenderWidgetWasResized(this, screen_info, width_changed); return sent_visual_properties; }
bool RenderWidgetHostImpl::SynchronizeVisualProperties( bool scroll_focused_node_into_view) { if (visual_properties_ack_pending_ || !process_->IsInitializedAndNotDead() || !view_ || !view_->HasSize() || !renderer_initialized_ || !delegate_) { return false; } std::unique_ptr<VisualProperties> visual_properties(new VisualProperties); bool needs_ack = false; if (!GetVisualProperties(visual_properties.get(), &needs_ack)) return false; visual_properties->scroll_focused_node_into_view = scroll_focused_node_into_view; ScreenInfo screen_info = visual_properties->screen_info; bool width_changed = !old_visual_properties_ || old_visual_properties_->new_size.width() != visual_properties->new_size.width(); bool sent_visual_properties = false; if (Send(new ViewMsg_SynchronizeVisualProperties(routing_id_, *visual_properties))) { visual_properties_ack_pending_ = needs_ack; old_visual_properties_.swap(visual_properties); sent_visual_properties = true; } if (delegate_) delegate_->RenderWidgetWasResized(this, screen_info, width_changed); return sent_visual_properties; }
C
Chrome
0
CVE-2013-0896
https://www.cvedetails.com/cve/CVE-2013-0896/
CWE-119
https://github.com/chromium/chromium/commit/58c433b2426f8d23ad27f1976635506ee3643034
58c433b2426f8d23ad27f1976635506ee3643034
Fix uninitialized access in QuicConnectionHelperTest BUG=159928 Review URL: https://chromiumcodereview.appspot.com/11360153 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166708 0039d316-1c4b-4281-b951-d872f2087c98
TestConnectionHelper(base::TaskRunner* runner, QuicClock* clock, MockUDPClientSocket* socket) : QuicConnectionHelper(runner, clock, socket) { }
TestConnectionHelper(base::TaskRunner* runner, QuicClock* clock, MockUDPClientSocket* socket) : QuicConnectionHelper(runner, clock, socket) { }
C
Chrome
0
CVE-2012-2880
https://www.cvedetails.com/cve/CVE-2012-2880/
CWE-362
https://github.com/chromium/chromium/commit/fcd3a7a671ecf2d5f46ea34787d27507a914d2f5
fcd3a7a671ecf2d5f46ea34787d27507a914d2f5
[Sync] Cleanup all tab sync enabling logic now that its on by default. BUG=none TEST= Review URL: https://chromiumcodereview.appspot.com/10443046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139462 0039d316-1c4b-4281-b951-d872f2087c98
void FlagsState::RemoveFlagsSwitches( std::map<std::string, CommandLine::StringType>* switch_list) { for (std::map<std::string, std::string>::const_iterator it = flags_switches_.begin(); it != flags_switches_.end(); ++it) { switch_list->erase(it->first); } }
void FlagsState::RemoveFlagsSwitches( std::map<std::string, CommandLine::StringType>* switch_list) { for (std::map<std::string, std::string>::const_iterator it = flags_switches_.begin(); it != flags_switches_.end(); ++it) { switch_list->erase(it->first); } }
C
Chrome
0
CVE-2016-10066
https://www.cvedetails.com/cve/CVE-2016-10066/
CWE-119
https://github.com/ImageMagick/ImageMagick/commit/f6e9d0d9955e85bdd7540b251cd50d598dacc5e6
f6e9d0d9955e85bdd7540b251cd50d598dacc5e6
null
ModuleExport void UnregisterMONOImage(void) { (void) UnregisterMagickInfo("MONO"); }
ModuleExport void UnregisterMONOImage(void) { (void) UnregisterMagickInfo("MONO"); }
C
ImageMagick
0
CVE-2017-18190
https://www.cvedetails.com/cve/CVE-2017-18190/
CWE-290
https://github.com/apple/cups/commit/afa80cb2b457bf8d64f775bed307588610476c41
afa80cb2b457bf8d64f775bed307588610476c41
Don't treat "localhost.localdomain" as an allowed replacement for localhost, since it isn't.
is_cgi(cupsd_client_t *con, /* I - Client connection */ const char *filename, /* I - Real filename */ struct stat *filestats, /* I - File information */ mime_type_t *type) /* I - MIME type */ { const char *options; /* Options on URL */ /* * Get the options, if any... */ if ((options = strchr(con->uri, '?')) != NULL) { options ++; cupsdSetStringf(&(con->query_string), "QUERY_STRING=%s", options); } /* * Check for known types... */ if (!type || _cups_strcasecmp(type->super, "application")) { cupsdLogClient(con, CUPSD_LOG_DEBUG2, "is_cgi: filename=\"%s\", filestats=%p, type=%s/%s, returning 0.", filename, filestats, type ? type->super : "unknown", type ? type->type : "unknown"); return (0); } if (!_cups_strcasecmp(type->type, "x-httpd-cgi") && (filestats->st_mode & 0111)) { /* * "application/x-httpd-cgi" is a CGI script. */ cupsdSetString(&con->command, filename); if (options) cupsdSetStringf(&con->options, " %s", options); cupsdLogClient(con, CUPSD_LOG_DEBUG2, "is_cgi: filename=\"%s\", filestats=%p, type=%s/%s, returning 1.", filename, filestats, type->super, type->type); return (1); } #ifdef HAVE_JAVA else if (!_cups_strcasecmp(type->type, "x-httpd-java")) { /* * "application/x-httpd-java" is a Java servlet. */ cupsdSetString(&con->command, CUPS_JAVA); if (options) cupsdSetStringf(&con->options, " %s %s", filename, options); else cupsdSetStringf(&con->options, " %s", filename); cupsdLogClient(con, CUPSD_LOG_DEBUG2, "is_cgi: filename=\"%s\", filestats=%p, type=%s/%s, returning 1.", filename, filestats, type->super, type->type); return (1); } #endif /* HAVE_JAVA */ #ifdef HAVE_PERL else if (!_cups_strcasecmp(type->type, "x-httpd-perl")) { /* * "application/x-httpd-perl" is a Perl page. */ cupsdSetString(&con->command, CUPS_PERL); if (options) cupsdSetStringf(&con->options, " %s %s", filename, options); else cupsdSetStringf(&con->options, " %s", filename); cupsdLogClient(con, CUPSD_LOG_DEBUG2, "is_cgi: filename=\"%s\", filestats=%p, type=%s/%s, returning 1.", filename, filestats, type->super, type->type); return (1); } #endif /* HAVE_PERL */ #ifdef HAVE_PHP else if (!_cups_strcasecmp(type->type, "x-httpd-php")) { /* * "application/x-httpd-php" is a PHP page. */ cupsdSetString(&con->command, CUPS_PHP); if (options) cupsdSetStringf(&con->options, " %s %s", filename, options); else cupsdSetStringf(&con->options, " %s", filename); cupsdLogClient(con, CUPSD_LOG_DEBUG2, "is_cgi: filename=\"%s\", filestats=%p, type=%s/%s, returning 1.", filename, filestats, type->super, type->type); return (1); } #endif /* HAVE_PHP */ #ifdef HAVE_PYTHON else if (!_cups_strcasecmp(type->type, "x-httpd-python")) { /* * "application/x-httpd-python" is a Python page. */ cupsdSetString(&con->command, CUPS_PYTHON); if (options) cupsdSetStringf(&con->options, " %s %s", filename, options); else cupsdSetStringf(&con->options, " %s", filename); cupsdLogClient(con, CUPSD_LOG_DEBUG2, "is_cgi: filename=\"%s\", filestats=%p, type=%s/%s, returning 1.", filename, filestats, type->super, type->type); return (1); } #endif /* HAVE_PYTHON */ cupsdLogClient(con, CUPSD_LOG_DEBUG2, "is_cgi: filename=\"%s\", filestats=%p, type=%s/%s, returning 0.", filename, filestats, type->super, type->type); return (0); }
is_cgi(cupsd_client_t *con, /* I - Client connection */ const char *filename, /* I - Real filename */ struct stat *filestats, /* I - File information */ mime_type_t *type) /* I - MIME type */ { const char *options; /* Options on URL */ /* * Get the options, if any... */ if ((options = strchr(con->uri, '?')) != NULL) { options ++; cupsdSetStringf(&(con->query_string), "QUERY_STRING=%s", options); } /* * Check for known types... */ if (!type || _cups_strcasecmp(type->super, "application")) { cupsdLogClient(con, CUPSD_LOG_DEBUG2, "is_cgi: filename=\"%s\", filestats=%p, type=%s/%s, returning 0.", filename, filestats, type ? type->super : "unknown", type ? type->type : "unknown"); return (0); } if (!_cups_strcasecmp(type->type, "x-httpd-cgi") && (filestats->st_mode & 0111)) { /* * "application/x-httpd-cgi" is a CGI script. */ cupsdSetString(&con->command, filename); if (options) cupsdSetStringf(&con->options, " %s", options); cupsdLogClient(con, CUPSD_LOG_DEBUG2, "is_cgi: filename=\"%s\", filestats=%p, type=%s/%s, returning 1.", filename, filestats, type->super, type->type); return (1); } #ifdef HAVE_JAVA else if (!_cups_strcasecmp(type->type, "x-httpd-java")) { /* * "application/x-httpd-java" is a Java servlet. */ cupsdSetString(&con->command, CUPS_JAVA); if (options) cupsdSetStringf(&con->options, " %s %s", filename, options); else cupsdSetStringf(&con->options, " %s", filename); cupsdLogClient(con, CUPSD_LOG_DEBUG2, "is_cgi: filename=\"%s\", filestats=%p, type=%s/%s, returning 1.", filename, filestats, type->super, type->type); return (1); } #endif /* HAVE_JAVA */ #ifdef HAVE_PERL else if (!_cups_strcasecmp(type->type, "x-httpd-perl")) { /* * "application/x-httpd-perl" is a Perl page. */ cupsdSetString(&con->command, CUPS_PERL); if (options) cupsdSetStringf(&con->options, " %s %s", filename, options); else cupsdSetStringf(&con->options, " %s", filename); cupsdLogClient(con, CUPSD_LOG_DEBUG2, "is_cgi: filename=\"%s\", filestats=%p, type=%s/%s, returning 1.", filename, filestats, type->super, type->type); return (1); } #endif /* HAVE_PERL */ #ifdef HAVE_PHP else if (!_cups_strcasecmp(type->type, "x-httpd-php")) { /* * "application/x-httpd-php" is a PHP page. */ cupsdSetString(&con->command, CUPS_PHP); if (options) cupsdSetStringf(&con->options, " %s %s", filename, options); else cupsdSetStringf(&con->options, " %s", filename); cupsdLogClient(con, CUPSD_LOG_DEBUG2, "is_cgi: filename=\"%s\", filestats=%p, type=%s/%s, returning 1.", filename, filestats, type->super, type->type); return (1); } #endif /* HAVE_PHP */ #ifdef HAVE_PYTHON else if (!_cups_strcasecmp(type->type, "x-httpd-python")) { /* * "application/x-httpd-python" is a Python page. */ cupsdSetString(&con->command, CUPS_PYTHON); if (options) cupsdSetStringf(&con->options, " %s %s", filename, options); else cupsdSetStringf(&con->options, " %s", filename); cupsdLogClient(con, CUPSD_LOG_DEBUG2, "is_cgi: filename=\"%s\", filestats=%p, type=%s/%s, returning 1.", filename, filestats, type->super, type->type); return (1); } #endif /* HAVE_PYTHON */ cupsdLogClient(con, CUPSD_LOG_DEBUG2, "is_cgi: filename=\"%s\", filestats=%p, type=%s/%s, returning 0.", filename, filestats, type->super, type->type); return (0); }
C
cups
0
CVE-2010-0011
https://www.cvedetails.com/cve/CVE-2010-0011/
CWE-264
https://github.com/Dieterbe/uzbl/commit/1958b52d41cba96956dc1995660de49525ed1047
1958b52d41cba96956dc1995660de49525ed1047
disable Uzbl javascript object because of security problem.
scroll_cmd(WebKitWebView* page, GArray *argv, GString *result) { (void) page; (void) result; gchar *direction = g_array_index(argv, gchar*, 0); gchar *argv1 = g_array_index(argv, gchar*, 1); if (g_strcmp0(direction, "horizontal") == 0) { if (g_strcmp0(argv1, "begin") == 0) gtk_adjustment_set_value(uzbl.gui.bar_h, gtk_adjustment_get_lower(uzbl.gui.bar_h)); else if (g_strcmp0(argv1, "end") == 0) gtk_adjustment_set_value (uzbl.gui.bar_h, gtk_adjustment_get_upper(uzbl.gui.bar_h) - gtk_adjustment_get_page_size(uzbl.gui.bar_h)); else scroll(uzbl.gui.bar_h, argv1); } else if (g_strcmp0(direction, "vertical") == 0) { if (g_strcmp0(argv1, "begin") == 0) gtk_adjustment_set_value(uzbl.gui.bar_v, gtk_adjustment_get_lower(uzbl.gui.bar_v)); else if (g_strcmp0(argv1, "end") == 0) gtk_adjustment_set_value (uzbl.gui.bar_v, gtk_adjustment_get_upper(uzbl.gui.bar_v) - gtk_adjustment_get_page_size(uzbl.gui.bar_v)); else scroll(uzbl.gui.bar_v, argv1); } else if(uzbl.state.verbose) puts("Unrecognized scroll format"); }
scroll_cmd(WebKitWebView* page, GArray *argv, GString *result) { (void) page; (void) result; gchar *direction = g_array_index(argv, gchar*, 0); gchar *argv1 = g_array_index(argv, gchar*, 1); if (g_strcmp0(direction, "horizontal") == 0) { if (g_strcmp0(argv1, "begin") == 0) gtk_adjustment_set_value(uzbl.gui.bar_h, gtk_adjustment_get_lower(uzbl.gui.bar_h)); else if (g_strcmp0(argv1, "end") == 0) gtk_adjustment_set_value (uzbl.gui.bar_h, gtk_adjustment_get_upper(uzbl.gui.bar_h) - gtk_adjustment_get_page_size(uzbl.gui.bar_h)); else scroll(uzbl.gui.bar_h, argv1); } else if (g_strcmp0(direction, "vertical") == 0) { if (g_strcmp0(argv1, "begin") == 0) gtk_adjustment_set_value(uzbl.gui.bar_v, gtk_adjustment_get_lower(uzbl.gui.bar_v)); else if (g_strcmp0(argv1, "end") == 0) gtk_adjustment_set_value (uzbl.gui.bar_v, gtk_adjustment_get_upper(uzbl.gui.bar_v) - gtk_adjustment_get_page_size(uzbl.gui.bar_v)); else scroll(uzbl.gui.bar_v, argv1); } else if(uzbl.state.verbose) puts("Unrecognized scroll format"); }
C
uzbl
0
null
null
null
https://github.com/chromium/chromium/commit/790613cb3725005dda8f7fbfaa344a9e99a8f2a8
790613cb3725005dda8f7fbfaa344a9e99a8f2a8
Replaces the % character with \x when generating Windows shortcuts via File->"Create application shortcuts." The \x is converted back to % in handling the --app switch. BUG=23693 TEST=None Review URL: http://codereview.chromium.org/515028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35377 0039d316-1c4b-4281-b951-d872f2087c98
ScopableCPRequest::~ScopableCPRequest() { pdata = NULL; data = NULL; free(const_cast<char*>(url)); free(const_cast<char*>(method)); }
ScopableCPRequest::~ScopableCPRequest() { pdata = NULL; data = NULL; free(const_cast<char*>(url)); free(const_cast<char*>(method)); }
C
Chrome
0
CVE-2011-2880
https://www.cvedetails.com/cve/CVE-2011-2880/
CWE-399
https://github.com/chromium/chromium/commit/244c78b3f737f2cacab2d212801b0524cbcc3a7b
244c78b3f737f2cacab2d212801b0524cbcc3a7b
Reset the device policy machinery upon retrying enrollment. BUG=chromium-os:18208 TEST=See bug description Review URL: http://codereview.chromium.org/7676005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97615 0039d316-1c4b-4281-b951-d872f2087c98
CloudPolicyController::~CloudPolicyController() { data_store_->RemoveObserver(this); scheduler_->CancelDelayedWork(); }
CloudPolicyController::~CloudPolicyController() { data_store_->RemoveObserver(this); scheduler_->CancelDelayedWork(); }
C
Chrome
0
CVE-2016-6321
https://www.cvedetails.com/cve/CVE-2016-6321/
CWE-22
https://git.savannah.gnu.org/cgit/tar.git/commit/?id=7340f67b9860ea0531c1450e5aa261c50f67165d
7340f67b9860ea0531c1450e5aa261c50f67165d
null
check_time (char const *file_name, struct timespec t) { if (t.tv_sec < 0) WARNOPT (WARN_TIMESTAMP, (0, 0, _("%s: implausibly old time stamp %s"), file_name, tartime (t, true))); else if (timespec_cmp (volume_start_time, t) < 0) { struct timespec now; gettime (&now); if (timespec_cmp (now, t) < 0) { char buf[TIMESPEC_STRSIZE_BOUND]; struct timespec diff; diff.tv_sec = t.tv_sec - now.tv_sec; diff.tv_nsec = t.tv_nsec - now.tv_nsec; if (diff.tv_nsec < 0) { diff.tv_nsec += BILLION; diff.tv_sec--; } WARNOPT (WARN_TIMESTAMP, (0, 0, _("%s: time stamp %s is %s s in the future"), file_name, tartime (t, true), code_timespec (diff, buf))); } } }
check_time (char const *file_name, struct timespec t) { if (t.tv_sec < 0) WARNOPT (WARN_TIMESTAMP, (0, 0, _("%s: implausibly old time stamp %s"), file_name, tartime (t, true))); else if (timespec_cmp (volume_start_time, t) < 0) { struct timespec now; gettime (&now); if (timespec_cmp (now, t) < 0) { char buf[TIMESPEC_STRSIZE_BOUND]; struct timespec diff; diff.tv_sec = t.tv_sec - now.tv_sec; diff.tv_nsec = t.tv_nsec - now.tv_nsec; if (diff.tv_nsec < 0) { diff.tv_nsec += BILLION; diff.tv_sec--; } WARNOPT (WARN_TIMESTAMP, (0, 0, _("%s: time stamp %s is %s s in the future"), file_name, tartime (t, true), code_timespec (diff, buf))); } } }
C
savannah
0
CVE-2013-2878
https://www.cvedetails.com/cve/CVE-2013-2878/
CWE-119
https://github.com/chromium/chromium/commit/09fbb829eab7ee25e90bb4e9c2f4973c6c62d0f3
09fbb829eab7ee25e90bb4e9c2f4973c6c62d0f3
Upgrade a TextIterator ASSERT to a RELEASE_ASSERT as a defensive measure. BUG=156930,177197 [email protected] Review URL: https://codereview.chromium.org/15057010 git-svn-id: svn://svn.chromium.org/blink/trunk@150123 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void BitStack::push(bool bit) { unsigned index = m_size / bitsInWord; unsigned shift = m_size & bitInWordMask; if (!shift && index == m_words.size()) { m_words.grow(index + 1); m_words[index] = 0; } unsigned& word = m_words[index]; unsigned mask = 1U << shift; if (bit) word |= mask; else word &= ~mask; ++m_size; }
void BitStack::push(bool bit) { unsigned index = m_size / bitsInWord; unsigned shift = m_size & bitInWordMask; if (!shift && index == m_words.size()) { m_words.grow(index + 1); m_words[index] = 0; } unsigned& word = m_words[index]; unsigned mask = 1U << shift; if (bit) word |= mask; else word &= ~mask; ++m_size; }
C
Chrome
0
CVE-2014-2669
https://www.cvedetails.com/cve/CVE-2014-2669/
CWE-189
https://github.com/postgres/postgres/commit/31400a673325147e1205326008e32135a78b4d8a
31400a673325147e1205326008e32135a78b4d8a
Predict integer overflow to avoid buffer overruns. Several functions, mostly type input functions, calculated an allocation size such that the calculation wrapped to a small positive value when arguments implied a sufficiently-large requirement. Writes past the end of the inadvertent small allocation followed shortly thereafter. Coverity identified the path_in() vulnerability; code inspection led to the rest. In passing, add check_stack_depth() to prevent stack overflow in related functions. Back-patch to 8.4 (all supported versions). The non-comment hstore changes touch code that did not exist in 8.4, so that part stops at 9.0. Noah Misch and Heikki Linnakangas, reviewed by Tom Lane. Security: CVE-2014-0064
hstore_le(PG_FUNCTION_ARGS) { int res = DatumGetInt32(DirectFunctionCall2(hstore_cmp, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1))); PG_RETURN_BOOL(res <= 0); }
hstore_le(PG_FUNCTION_ARGS) { int res = DatumGetInt32(DirectFunctionCall2(hstore_cmp, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1))); PG_RETURN_BOOL(res <= 0); }
C
postgres
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 ...
nfs4_release_reclaim(struct nfsd_net *nn) { struct nfs4_client_reclaim *crp = NULL; int i; for (i = 0; i < CLIENT_HASH_SIZE; i++) { while (!list_empty(&nn->reclaim_str_hashtbl[i])) { crp = list_entry(nn->reclaim_str_hashtbl[i].next, struct nfs4_client_reclaim, cr_strhash); nfs4_remove_reclaim_record(crp, nn); } } WARN_ON_ONCE(nn->reclaim_str_hashtbl_size); }
nfs4_release_reclaim(struct nfsd_net *nn) { struct nfs4_client_reclaim *crp = NULL; int i; for (i = 0; i < CLIENT_HASH_SIZE; i++) { while (!list_empty(&nn->reclaim_str_hashtbl[i])) { crp = list_entry(nn->reclaim_str_hashtbl[i].next, struct nfs4_client_reclaim, cr_strhash); nfs4_remove_reclaim_record(crp, nn); } } WARN_ON_ONCE(nn->reclaim_str_hashtbl_size); }
C
linux
0
CVE-2016-7480
https://www.cvedetails.com/cve/CVE-2016-7480/
CWE-119
https://github.com/php/php-src/commit/61cdd1255d5b9c8453be71aacbbf682796ac77d4
61cdd1255d5b9c8453be71aacbbf682796ac77d4
Fix bug #73257 and bug #73258 - SplObjectStorage unserialize allows use of non-object as key
void spl_object_storage_addall(spl_SplObjectStorage *intern, zval *this, spl_SplObjectStorage *other) { /* {{{ */ spl_SplObjectStorageElement *element; ZEND_HASH_FOREACH_PTR(&other->storage, element) { spl_object_storage_attach(intern, this, &element->obj, &element->inf); } ZEND_HASH_FOREACH_END(); intern->index = 0; } /* }}} */
void spl_object_storage_addall(spl_SplObjectStorage *intern, zval *this, spl_SplObjectStorage *other) { /* {{{ */ spl_SplObjectStorageElement *element; ZEND_HASH_FOREACH_PTR(&other->storage, element) { spl_object_storage_attach(intern, this, &element->obj, &element->inf); } ZEND_HASH_FOREACH_END(); intern->index = 0; } /* }}} */
C
php-src
0
CVE-2014-3175
https://www.cvedetails.com/cve/CVE-2014-3175/
null
https://github.com/chromium/chromium/commit/4843d98517bd37e5940cd04627c6cfd2ac774d11
4843d98517bd37e5940cd04627c6cfd2ac774d11
Remove clock resolution page load histograms. These were temporary metrics intended to understand whether high/low resolution clocks adversely impact page load metrics. After collecting a few months of data it was determined that clock resolution doesn't adversely impact our metrics, and it that these histograms were no longer needed. BUG=394757 Review-Url: https://codereview.chromium.org/2155143003 Cr-Commit-Position: refs/heads/master@{#406143}
void CorePageLoadMetricsObserver::OnFirstTextPaint( const page_load_metrics::PageLoadTiming& timing, const page_load_metrics::PageLoadExtraInfo& info) { if (WasStartedInForegroundOptionalEventInForeground(timing.first_text_paint, info)) { PAGE_LOAD_HISTOGRAM(internal::kHistogramFirstTextPaintImmediate, timing.first_text_paint.value()); } else { PAGE_LOAD_HISTOGRAM(internal::kBackgroundHistogramFirstTextPaintImmediate, timing.first_text_paint.value()); } }
void CorePageLoadMetricsObserver::OnFirstTextPaint( const page_load_metrics::PageLoadTiming& timing, const page_load_metrics::PageLoadExtraInfo& info) { if (WasStartedInForegroundOptionalEventInForeground(timing.first_text_paint, info)) { PAGE_LOAD_HISTOGRAM(internal::kHistogramFirstTextPaintImmediate, timing.first_text_paint.value()); } else { PAGE_LOAD_HISTOGRAM(internal::kBackgroundHistogramFirstTextPaintImmediate, timing.first_text_paint.value()); } }
C
Chrome
0
CVE-2013-7271
https://www.cvedetails.com/cve/CVE-2013-7271/
CWE-20
https://github.com/torvalds/linux/commit/f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
net: rework recvmsg handler msg_name and msg_namelen logic This patch now always passes msg->msg_namelen as 0. recvmsg handlers must set msg_namelen to the proper size <= sizeof(struct sockaddr_storage) to return msg_name to the user. This prevents numerous uninitialized memory leaks we had in the recvmsg handlers and makes it harder for new code to accidentally leak uninitialized memory. Optimize for the case recvfrom is called with NULL as address. We don't need to copy the address at all, so set it to NULL before invoking the recvmsg handler. We can do so, because all the recvmsg handlers must cope with the case a plain read() is called on them. read() also sets msg_name to NULL. Also document these changes in include/linux/net.h as suggested by David Miller. Changes since RFC: Set msg->msg_name = NULL if user specified a NULL in msg_name but had a non-null msg_namelen in verify_iovec/verify_compat_iovec. This doesn't affect sendto as it would bail out earlier while trying to copy-in the address. It also more naturally reflects the logic by the callers of verify_iovec. With this change in place I could remove " if (!uaddr || msg_sys->msg_namelen == 0) msg->msg_name = NULL ". This change does not alter the user visible error logic as we ignore msg_namelen as long as msg_name is NULL. Also remove two unnecessary curly brackets in ___sys_recvmsg and change comments to netdev style. Cc: David Miller <[email protected]> Suggested-by: Eric Dumazet <[email protected]> Signed-off-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static int ipxitf_rcv(struct ipx_interface *intrfc, struct sk_buff *skb) { struct ipxhdr *ipx = ipx_hdr(skb); int rc = 0; ipxitf_hold(intrfc); /* See if we should update our network number */ if (!intrfc->if_netnum) /* net number of intrfc not known yet */ ipxitf_discover_netnum(intrfc, skb); IPX_SKB_CB(skb)->last_hop.index = -1; if (ipx->ipx_type == IPX_TYPE_PPROP) { rc = ipxitf_pprop(intrfc, skb); if (rc) goto out_free_skb; } /* local processing follows */ if (!IPX_SKB_CB(skb)->ipx_dest_net) IPX_SKB_CB(skb)->ipx_dest_net = intrfc->if_netnum; if (!IPX_SKB_CB(skb)->ipx_source_net) IPX_SKB_CB(skb)->ipx_source_net = intrfc->if_netnum; /* it doesn't make sense to route a pprop packet, there's no meaning * in the ipx_dest_net for such packets */ if (ipx->ipx_type != IPX_TYPE_PPROP && intrfc->if_netnum != IPX_SKB_CB(skb)->ipx_dest_net) { /* We only route point-to-point packets. */ if (skb->pkt_type == PACKET_HOST) { skb = skb_unshare(skb, GFP_ATOMIC); if (skb) rc = ipxrtr_route_skb(skb); goto out_intrfc; } goto out_free_skb; } /* see if we should keep it */ if (!memcmp(ipx_broadcast_node, ipx->ipx_dest.node, IPX_NODE_LEN) || !memcmp(intrfc->if_node, ipx->ipx_dest.node, IPX_NODE_LEN)) { rc = ipxitf_demux_socket(intrfc, skb, 0); goto out_intrfc; } /* we couldn't pawn it off so unload it */ out_free_skb: kfree_skb(skb); out_intrfc: ipxitf_put(intrfc); return rc; }
static int ipxitf_rcv(struct ipx_interface *intrfc, struct sk_buff *skb) { struct ipxhdr *ipx = ipx_hdr(skb); int rc = 0; ipxitf_hold(intrfc); /* See if we should update our network number */ if (!intrfc->if_netnum) /* net number of intrfc not known yet */ ipxitf_discover_netnum(intrfc, skb); IPX_SKB_CB(skb)->last_hop.index = -1; if (ipx->ipx_type == IPX_TYPE_PPROP) { rc = ipxitf_pprop(intrfc, skb); if (rc) goto out_free_skb; } /* local processing follows */ if (!IPX_SKB_CB(skb)->ipx_dest_net) IPX_SKB_CB(skb)->ipx_dest_net = intrfc->if_netnum; if (!IPX_SKB_CB(skb)->ipx_source_net) IPX_SKB_CB(skb)->ipx_source_net = intrfc->if_netnum; /* it doesn't make sense to route a pprop packet, there's no meaning * in the ipx_dest_net for such packets */ if (ipx->ipx_type != IPX_TYPE_PPROP && intrfc->if_netnum != IPX_SKB_CB(skb)->ipx_dest_net) { /* We only route point-to-point packets. */ if (skb->pkt_type == PACKET_HOST) { skb = skb_unshare(skb, GFP_ATOMIC); if (skb) rc = ipxrtr_route_skb(skb); goto out_intrfc; } goto out_free_skb; } /* see if we should keep it */ if (!memcmp(ipx_broadcast_node, ipx->ipx_dest.node, IPX_NODE_LEN) || !memcmp(intrfc->if_node, ipx->ipx_dest.node, IPX_NODE_LEN)) { rc = ipxitf_demux_socket(intrfc, skb, 0); goto out_intrfc; } /* we couldn't pawn it off so unload it */ out_free_skb: kfree_skb(skb); out_intrfc: ipxitf_put(intrfc); return rc; }
C
linux
0
CVE-2012-5131
https://www.cvedetails.com/cve/CVE-2012-5131/
null
https://github.com/chromium/chromium/commit/d0c31f0342cefc46a3b3d80359a9779d044d4c0d
d0c31f0342cefc46a3b3d80359a9779d044d4c0d
Remove BlobRegistry indirection since there is only one implementation. BUG= Review URL: https://chromiumcodereview.appspot.com/15851008 git-svn-id: svn://svn.chromium.org/blink/trunk@152746 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void AsyncFileSystemChromium::directoryExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { m_webFileSystem->directoryExists(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); }
void AsyncFileSystemChromium::directoryExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { m_webFileSystem->directoryExists(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/93dd81929416a0170935e6eeac03d10aed60df18
93dd81929416a0170935e6eeac03d10aed60df18
Implement NPN_RemoveProperty https://bugs.webkit.org/show_bug.cgi?id=43315 Reviewed by Sam Weinig. WebKit2: * WebProcess/Plugins/NPJSObject.cpp: (WebKit::NPJSObject::removeProperty): Try to remove the property. (WebKit::NPJSObject::npClass): Add NP_RemoveProperty. (WebKit::NPJSObject::NP_RemoveProperty): Call NPJSObject::removeProperty. * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: (WebKit::NPN_RemoveProperty): Call the NPClass::removeProperty function. WebKitTools: * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj: Add NPRuntimeRemoveProperty.cpp * DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp: (PluginTest::NPN_GetStringIdentifier): (PluginTest::NPN_GetIntIdentifier): (PluginTest::NPN_RemoveProperty): Add NPN_ helpers. * DumpRenderTree/TestNetscapePlugIn/PluginTest.h: Support more NPClass functions. * DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp: Added. (NPRuntimeRemoveProperty::NPRuntimeRemoveProperty): Test for NPN_RemoveProperty. (NPRuntimeRemoveProperty::TestObject::hasMethod): (NPRuntimeRemoveProperty::TestObject::invoke): Add a testRemoveProperty method. (NPRuntimeRemoveProperty::NPP_GetValue): Return the test object. * DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj: * DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro: * GNUmakefile.am: Add NPRuntimeRemoveProperty.cpp LayoutTests: Add a test for NPN_RemoveProperty. * plugins/npruntime/remove-property-expected.txt: Added. * plugins/npruntime/remove-property.html: Added. git-svn-id: svn://svn.chromium.org/blink/trunk@64444 bbb929c8-8fbe-4397-9dbb-9b2b20218538
static NPError NPN_PostURL(NPP npp, const char* url, const char* target, uint32_t len, const char* buf, NPBool file) { HTTPHeaderMap headerFields; Vector<char> postData; bool parseHeaders = file; NPError error = parsePostBuffer(file, buf, len, parseHeaders, headerFields, postData); if (error != NPERR_NO_ERROR) return error; RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); plugin->loadURL("POST", makeURLString(url), target, headerFields, postData, false, 0); return NPERR_NO_ERROR; }
static NPError NPN_PostURL(NPP npp, const char* url, const char* target, uint32_t len, const char* buf, NPBool file) { HTTPHeaderMap headerFields; Vector<char> postData; bool parseHeaders = file; NPError error = parsePostBuffer(file, buf, len, parseHeaders, headerFields, postData); if (error != NPERR_NO_ERROR) return error; RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); plugin->loadURL("POST", makeURLString(url), target, headerFields, postData, false, 0); return NPERR_NO_ERROR; }
C
Chrome
0
CVE-2017-5120
https://www.cvedetails.com/cve/CVE-2017-5120/
null
https://github.com/chromium/chromium/commit/b7277af490d28ac7f802c015bb0ff31395768556
b7277af490d28ac7f802c015bb0ff31395768556
bindings: Support "attribute FrozenArray<T>?" Adds a quick hack to support a case of "attribute FrozenArray<T>?". Bug: 1028047 Change-Id: Ib3cecc4beb6bcc0fb0dbc667aca595454cc90c86 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1933866 Reviewed-by: Hitoshi Yoshida <[email protected]> Commit-Queue: Yuki Shiino <[email protected]> Cr-Commit-Position: refs/heads/master@{#718676}
static void OriginTrialEnabledLongAttributeAttributeSetter( v8::Local<v8::Value> v8_value, const v8::FunctionCallbackInfo<v8::Value>& info) { v8::Isolate* isolate = info.GetIsolate(); ALLOW_UNUSED_LOCAL(isolate); v8::Local<v8::Object> holder = info.Holder(); ALLOW_UNUSED_LOCAL(holder); TestObject* impl = V8TestObject::ToImpl(holder); ExceptionState exception_state(isolate, ExceptionState::kSetterContext, "TestObject", "originTrialEnabledLongAttribute"); int32_t cpp_value = NativeValueTraits<IDLLong>::NativeValue(info.GetIsolate(), v8_value, exception_state); if (exception_state.HadException()) return; impl->setOriginTrialEnabledLongAttribute(cpp_value); }
static void OriginTrialEnabledLongAttributeAttributeSetter( v8::Local<v8::Value> v8_value, const v8::FunctionCallbackInfo<v8::Value>& info) { v8::Isolate* isolate = info.GetIsolate(); ALLOW_UNUSED_LOCAL(isolate); v8::Local<v8::Object> holder = info.Holder(); ALLOW_UNUSED_LOCAL(holder); TestObject* impl = V8TestObject::ToImpl(holder); ExceptionState exception_state(isolate, ExceptionState::kSetterContext, "TestObject", "originTrialEnabledLongAttribute"); int32_t cpp_value = NativeValueTraits<IDLLong>::NativeValue(info.GetIsolate(), v8_value, exception_state); if (exception_state.HadException()) return; impl->setOriginTrialEnabledLongAttribute(cpp_value); }
C
Chrome
0
CVE-2016-7418
https://www.cvedetails.com/cve/CVE-2016-7418/
CWE-119
https://github.com/php/php-src/commit/c4cca4c20e75359c9a13a1f9a36cb7b4e9601d29?w=1
c4cca4c20e75359c9a13a1f9a36cb7b4e9601d29?w=1
Fix bug #73065: Out-Of-Bounds Read in php_wddx_push_element of wddx.c
PHP_FUNCTION(wddx_add_vars) { int num_args, i; zval ***args = NULL; zval *packet_id; wddx_packet *packet = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r+", &packet_id, &args, &num_args) == FAILURE) { return; } if (!ZEND_FETCH_RESOURCE_NO_RETURN(packet, wddx_packet *, &packet_id, -1, "WDDX packet ID", le_wddx)) { efree(args); RETURN_FALSE; } if (!packet) { efree(args); RETURN_FALSE; } for (i=0; i<num_args; i++) { if (Z_TYPE_PP(args[i]) != IS_ARRAY && Z_TYPE_PP(args[i]) != IS_OBJECT) { convert_to_string_ex(args[i]); } php_wddx_add_var(packet, (*args[i])); } efree(args); RETURN_TRUE; }
PHP_FUNCTION(wddx_add_vars) { int num_args, i; zval ***args = NULL; zval *packet_id; wddx_packet *packet = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r+", &packet_id, &args, &num_args) == FAILURE) { return; } if (!ZEND_FETCH_RESOURCE_NO_RETURN(packet, wddx_packet *, &packet_id, -1, "WDDX packet ID", le_wddx)) { efree(args); RETURN_FALSE; } if (!packet) { efree(args); RETURN_FALSE; } for (i=0; i<num_args; i++) { if (Z_TYPE_PP(args[i]) != IS_ARRAY && Z_TYPE_PP(args[i]) != IS_OBJECT) { convert_to_string_ex(args[i]); } php_wddx_add_var(packet, (*args[i])); } efree(args); RETURN_TRUE; }
C
php-src
0
CVE-2013-0884
https://www.cvedetails.com/cve/CVE-2013-0884/
null
https://github.com/chromium/chromium/commit/4c39b8e5670c4a0f2bb06008502ebb0c4fe322e0
4c39b8e5670c4a0f2bb06008502ebb0c4fe322e0
[4/4] Process clearBrowserCahce/cookies commands in browser. BUG=366585 Review URL: https://codereview.chromium.org/251183005 git-svn-id: svn://svn.chromium.org/blink/trunk@172984 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void InspectorController::didBeginFrame(int frameId) { if (InspectorTimelineAgent* timelineAgent = m_instrumentingAgents->inspectorTimelineAgent()) timelineAgent->didBeginFrame(frameId); if (InspectorCanvasAgent* canvasAgent = m_instrumentingAgents->inspectorCanvasAgent()) canvasAgent->didBeginFrame(); }
void InspectorController::didBeginFrame(int frameId) { if (InspectorTimelineAgent* timelineAgent = m_instrumentingAgents->inspectorTimelineAgent()) timelineAgent->didBeginFrame(frameId); if (InspectorCanvasAgent* canvasAgent = m_instrumentingAgents->inspectorCanvasAgent()) canvasAgent->didBeginFrame(); }
C
Chrome
0
CVE-2014-3179
https://www.cvedetails.com/cve/CVE-2014-3179/
null
https://github.com/chromium/chromium/commit/d800220da9f744779f1989e2092c88770adcd20a
d800220da9f744779f1989e2092c88770adcd20a
Remove blink::ReadableStream This CL removes two stable runtime enabled flags - ResponseConstructedWithReadableStream - ResponseBodyWithV8ExtraStream and related code including blink::ReadableStream. BUG=613435 Review-Url: https://codereview.chromium.org/2227403002 Cr-Commit-Position: refs/heads/master@{#411014}
ReadableByteStreamReader* ReadableByteStream::getBytesReader(ExecutionContext* executionContext, ExceptionState& es) { ReadableStreamReader* reader = getReader(executionContext, es); if (es.hadException()) return nullptr; return new ReadableByteStreamReader(reader); }
ReadableByteStreamReader* ReadableByteStream::getBytesReader(ExecutionContext* executionContext, ExceptionState& es) { ReadableStreamReader* reader = getReader(executionContext, es); if (es.hadException()) return nullptr; return new ReadableByteStreamReader(reader); }
C
Chrome
0
CVE-2017-14041
https://www.cvedetails.com/cve/CVE-2017-14041/
CWE-787
https://github.com/uclouvain/openjpeg/commit/e5285319229a5d77bf316bb0d3a6cbd3cb8666d9
e5285319229a5d77bf316bb0d3a6cbd3cb8666d9
pgxtoimage(): fix write stack buffer overflow (#997)
static char *skip_int(char *start, int *out_n) { char *s; char c; *out_n = 0; s = skip_white(start); if (s == NULL) { return NULL; } start = s; while (*s) { if (!isdigit(*s)) { break; } ++s; } c = *s; *s = 0; *out_n = atoi(start); *s = c; return s; }
static char *skip_int(char *start, int *out_n) { char *s; char c; *out_n = 0; s = skip_white(start); if (s == NULL) { return NULL; } start = s; while (*s) { if (!isdigit(*s)) { break; } ++s; } c = *s; *s = 0; *out_n = atoi(start); *s = c; return s; }
C
openjpeg
0
CVE-2018-14469
https://www.cvedetails.com/cve/CVE-2018-14469/
CWE-125
https://github.com/the-tcpdump-group/tcpdump/commit/396e94ff55a80d554b1fe46bf107db1e91008d6c
396e94ff55a80d554b1fe46bf107db1e91008d6c
(for 4.9.3) CVE-2018-14469/ISAKMP: Add a missing bounds check In ikev1_n_print() check bounds before trying to fetch the replay detection status. This fixes a buffer over-read discovered by Bhargava Shastry. Add a test using the capture file supplied by the reporter(s).
ikev1_hash_print(netdissect_options *ndo, u_char tpay _U_, const struct isakmp_gen *ext, u_int item_len _U_, const u_char *ep _U_, uint32_t phase _U_, uint32_t doi _U_, uint32_t proto _U_, int depth _U_) { struct isakmp_gen e; ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_HASH))); ND_TCHECK(*ext); UNALIGNED_MEMCPY(&e, ext, sizeof(e)); ND_PRINT((ndo," len=%d", ntohs(e.len) - 4)); if (2 < ndo->ndo_vflag && 4 < ntohs(e.len)) { /* Print the entire payload in hex */ ND_PRINT((ndo," ")); if (!rawprint(ndo, (const uint8_t *)(ext + 1), ntohs(e.len) - 4)) goto trunc; } return (const u_char *)ext + ntohs(e.len); trunc: ND_PRINT((ndo," [|%s]", NPSTR(ISAKMP_NPTYPE_HASH))); return NULL; }
ikev1_hash_print(netdissect_options *ndo, u_char tpay _U_, const struct isakmp_gen *ext, u_int item_len _U_, const u_char *ep _U_, uint32_t phase _U_, uint32_t doi _U_, uint32_t proto _U_, int depth _U_) { struct isakmp_gen e; ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_HASH))); ND_TCHECK(*ext); UNALIGNED_MEMCPY(&e, ext, sizeof(e)); ND_PRINT((ndo," len=%d", ntohs(e.len) - 4)); if (2 < ndo->ndo_vflag && 4 < ntohs(e.len)) { /* Print the entire payload in hex */ ND_PRINT((ndo," ")); if (!rawprint(ndo, (const uint8_t *)(ext + 1), ntohs(e.len) - 4)) goto trunc; } return (const u_char *)ext + ntohs(e.len); trunc: ND_PRINT((ndo," [|%s]", NPSTR(ISAKMP_NPTYPE_HASH))); return NULL; }
C
tcpdump
0
CVE-2017-7277
https://www.cvedetails.com/cve/CVE-2017-7277/
CWE-125
https://github.com/torvalds/linux/commit/8605330aac5a5785630aec8f64378a54891937cc
8605330aac5a5785630aec8f64378a54891937cc
tcp: fix SCM_TIMESTAMPING_OPT_STATS for normal skbs __sock_recv_timestamp can be called for both normal skbs (for receive timestamps) and for skbs on the error queue (for transmit timestamps). Commit 1c885808e456 (tcp: SOF_TIMESTAMPING_OPT_STATS option for SO_TIMESTAMPING) assumes any skb passed to __sock_recv_timestamp are from the error queue, containing OPT_STATS in the content of the skb. This results in accessing invalid memory or generating junk data. To fix this, set skb->pkt_type to PACKET_OUTGOING for packets on the error queue. This is safe because on the receive path on local sockets skb->pkt_type is never set to PACKET_OUTGOING. With that, copy OPT_STATS from a packet, only if its pkt_type is PACKET_OUTGOING. Fixes: 1c885808e456 ("tcp: SOF_TIMESTAMPING_OPT_STATS option for SO_TIMESTAMPING") Reported-by: JongHwan Kim <[email protected]> Signed-off-by: Soheil Hassas Yeganeh <[email protected]> Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: Willem de Bruijn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
int skb_checksum_setup(struct sk_buff *skb, bool recalculate) { int err; switch (skb->protocol) { case htons(ETH_P_IP): err = skb_checksum_setup_ipv4(skb, recalculate); break; case htons(ETH_P_IPV6): err = skb_checksum_setup_ipv6(skb, recalculate); break; default: err = -EPROTO; break; } return err; }
int skb_checksum_setup(struct sk_buff *skb, bool recalculate) { int err; switch (skb->protocol) { case htons(ETH_P_IP): err = skb_checksum_setup_ipv4(skb, recalculate); break; case htons(ETH_P_IPV6): err = skb_checksum_setup_ipv6(skb, recalculate); break; default: err = -EPROTO; break; } return err; }
C
linux
0
CVE-2016-5400
https://www.cvedetails.com/cve/CVE-2016-5400/
CWE-119
https://github.com/torvalds/linux/commit/aa93d1fee85c890a34f2510a310e55ee76a27848
aa93d1fee85c890a34f2510a310e55ee76a27848
media: fix airspy usb probe error path Fix a memory leak on probe error of the airspy usb device driver. The problem is triggered when more than 64 usb devices register with v4l2 of type VFL_TYPE_SDR or VFL_TYPE_SUBDEV. The memory leak is caused by the probe function of the airspy driver mishandeling errors and not freeing the corresponding control structures when an error occours registering the device to v4l2 core. A badusb device can emulate 64 of these devices, and then through continual emulated connect/disconnect of the 65th device, cause the kernel to run out of RAM and crash the kernel, thus causing a local DOS vulnerability. Fixes CVE-2016-5400 Signed-off-by: James Patrick-Evans <[email protected]> Reviewed-by: Kees Cook <[email protected]> Cc: [email protected] # 3.17+ Signed-off-by: Linus Torvalds <[email protected]>
static int airspy_s_frequency(struct file *file, void *priv, const struct v4l2_frequency *f) { struct airspy *s = video_drvdata(file); int ret; u8 buf[4]; if (f->tuner == 0) { s->f_adc = clamp_t(unsigned int, f->frequency, bands[0].rangelow, bands[0].rangehigh); dev_dbg(s->dev, "ADC frequency=%u Hz\n", s->f_adc); ret = 0; } else if (f->tuner == 1) { s->f_rf = clamp_t(unsigned int, f->frequency, bands_rf[0].rangelow, bands_rf[0].rangehigh); dev_dbg(s->dev, "RF frequency=%u Hz\n", s->f_rf); buf[0] = (s->f_rf >> 0) & 0xff; buf[1] = (s->f_rf >> 8) & 0xff; buf[2] = (s->f_rf >> 16) & 0xff; buf[3] = (s->f_rf >> 24) & 0xff; ret = airspy_ctrl_msg(s, CMD_SET_FREQ, 0, 0, buf, 4); } else { ret = -EINVAL; } return ret; }
static int airspy_s_frequency(struct file *file, void *priv, const struct v4l2_frequency *f) { struct airspy *s = video_drvdata(file); int ret; u8 buf[4]; if (f->tuner == 0) { s->f_adc = clamp_t(unsigned int, f->frequency, bands[0].rangelow, bands[0].rangehigh); dev_dbg(s->dev, "ADC frequency=%u Hz\n", s->f_adc); ret = 0; } else if (f->tuner == 1) { s->f_rf = clamp_t(unsigned int, f->frequency, bands_rf[0].rangelow, bands_rf[0].rangehigh); dev_dbg(s->dev, "RF frequency=%u Hz\n", s->f_rf); buf[0] = (s->f_rf >> 0) & 0xff; buf[1] = (s->f_rf >> 8) & 0xff; buf[2] = (s->f_rf >> 16) & 0xff; buf[3] = (s->f_rf >> 24) & 0xff; ret = airspy_ctrl_msg(s, CMD_SET_FREQ, 0, 0, buf, 4); } else { ret = -EINVAL; } return ret; }
C
linux
0
CVE-2012-2384
https://www.cvedetails.com/cve/CVE-2012-2384/
CWE-189
https://github.com/torvalds/linux/commit/44afb3a04391a74309d16180d1e4f8386fdfa745
44afb3a04391a74309d16180d1e4f8386fdfa745
drm/i915: fix integer overflow in i915_gem_do_execbuffer() On 32-bit systems, a large args->num_cliprects from userspace via ioctl may overflow the allocation size, leading to out-of-bounds access. This vulnerability was introduced in commit 432e58ed ("drm/i915: Avoid allocation for execbuffer object list"). Signed-off-by: Xi Wang <[email protected]> Reviewed-by: Chris Wilson <[email protected]> Cc: [email protected] Signed-off-by: Daniel Vetter <[email protected]>
i915_gem_execbuffer_wait_for_flips(struct intel_ring_buffer *ring, u32 flips) { u32 plane, flip_mask; int ret; /* Check for any pending flips. As we only maintain a flip queue depth * of 1, we can simply insert a WAIT for the next display flip prior * to executing the batch and avoid stalling the CPU. */ for (plane = 0; flips >> plane; plane++) { if (((flips >> plane) & 1) == 0) continue; if (plane) flip_mask = MI_WAIT_FOR_PLANE_B_FLIP; else flip_mask = MI_WAIT_FOR_PLANE_A_FLIP; ret = intel_ring_begin(ring, 2); if (ret) return ret; intel_ring_emit(ring, MI_WAIT_FOR_EVENT | flip_mask); intel_ring_emit(ring, MI_NOOP); intel_ring_advance(ring); } return 0; }
i915_gem_execbuffer_wait_for_flips(struct intel_ring_buffer *ring, u32 flips) { u32 plane, flip_mask; int ret; /* Check for any pending flips. As we only maintain a flip queue depth * of 1, we can simply insert a WAIT for the next display flip prior * to executing the batch and avoid stalling the CPU. */ for (plane = 0; flips >> plane; plane++) { if (((flips >> plane) & 1) == 0) continue; if (plane) flip_mask = MI_WAIT_FOR_PLANE_B_FLIP; else flip_mask = MI_WAIT_FOR_PLANE_A_FLIP; ret = intel_ring_begin(ring, 2); if (ret) return ret; intel_ring_emit(ring, MI_WAIT_FOR_EVENT | flip_mask); intel_ring_emit(ring, MI_NOOP); intel_ring_advance(ring); } return 0; }
C
linux
0
CVE-2013-6636
https://www.cvedetails.com/cve/CVE-2013-6636/
CWE-20
https://github.com/chromium/chromium/commit/5cfe3023574666663d970ce48cdbc8ed15ce61d9
5cfe3023574666663d970ce48cdbc8ed15ce61d9
Clear out some minor TODOs. BUG=none Review URL: https://codereview.chromium.org/1047063002 Cr-Commit-Position: refs/heads/master@{#322959}
bool ValidityMessages::HasSureError(ServerFieldType field) const { return IsSureError(GetMessageOrDefault(field)); }
bool ValidityMessages::HasSureError(ServerFieldType field) const { return IsSureError(GetMessageOrDefault(field)); }
C
Chrome
0
CVE-2013-7271
https://www.cvedetails.com/cve/CVE-2013-7271/
CWE-20
https://github.com/torvalds/linux/commit/f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
net: rework recvmsg handler msg_name and msg_namelen logic This patch now always passes msg->msg_namelen as 0. recvmsg handlers must set msg_namelen to the proper size <= sizeof(struct sockaddr_storage) to return msg_name to the user. This prevents numerous uninitialized memory leaks we had in the recvmsg handlers and makes it harder for new code to accidentally leak uninitialized memory. Optimize for the case recvfrom is called with NULL as address. We don't need to copy the address at all, so set it to NULL before invoking the recvmsg handler. We can do so, because all the recvmsg handlers must cope with the case a plain read() is called on them. read() also sets msg_name to NULL. Also document these changes in include/linux/net.h as suggested by David Miller. Changes since RFC: Set msg->msg_name = NULL if user specified a NULL in msg_name but had a non-null msg_namelen in verify_iovec/verify_compat_iovec. This doesn't affect sendto as it would bail out earlier while trying to copy-in the address. It also more naturally reflects the logic by the callers of verify_iovec. With this change in place I could remove " if (!uaddr || msg_sys->msg_namelen == 0) msg->msg_name = NULL ". This change does not alter the user visible error logic as we ignore msg_namelen as long as msg_name is NULL. Also remove two unnecessary curly brackets in ___sys_recvmsg and change comments to netdev style. Cc: David Miller <[email protected]> Suggested-by: Eric Dumazet <[email protected]> Signed-off-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static int hci_sock_release(struct socket *sock) { struct sock *sk = sock->sk; struct hci_dev *hdev; BT_DBG("sock %p sk %p", sock, sk); if (!sk) return 0; hdev = hci_pi(sk)->hdev; if (hci_pi(sk)->channel == HCI_CHANNEL_MONITOR) atomic_dec(&monitor_promisc); bt_sock_unlink(&hci_sk_list, sk); if (hdev) { if (hci_pi(sk)->channel == HCI_CHANNEL_USER) { mgmt_index_added(hdev); clear_bit(HCI_USER_CHANNEL, &hdev->dev_flags); hci_dev_close(hdev->id); } atomic_dec(&hdev->promisc); hci_dev_put(hdev); } sock_orphan(sk); skb_queue_purge(&sk->sk_receive_queue); skb_queue_purge(&sk->sk_write_queue); sock_put(sk); return 0; }
static int hci_sock_release(struct socket *sock) { struct sock *sk = sock->sk; struct hci_dev *hdev; BT_DBG("sock %p sk %p", sock, sk); if (!sk) return 0; hdev = hci_pi(sk)->hdev; if (hci_pi(sk)->channel == HCI_CHANNEL_MONITOR) atomic_dec(&monitor_promisc); bt_sock_unlink(&hci_sk_list, sk); if (hdev) { if (hci_pi(sk)->channel == HCI_CHANNEL_USER) { mgmt_index_added(hdev); clear_bit(HCI_USER_CHANNEL, &hdev->dev_flags); hci_dev_close(hdev->id); } atomic_dec(&hdev->promisc); hci_dev_put(hdev); } sock_orphan(sk); skb_queue_purge(&sk->sk_receive_queue); skb_queue_purge(&sk->sk_write_queue); sock_put(sk); return 0; }
C
linux
0
CVE-2018-10017
https://www.cvedetails.com/cve/CVE-2018-10017/
CWE-125
https://github.com/OpenMPT/openmpt/commit/492022c7297ede682161d9c0ec2de15526424e76
492022c7297ede682161d9c0ec2de15526424e76
[Fix] Possible out-of-bounds read when computing length of some IT files with pattern loops (OpenMPT: formats that are converted to IT, libopenmpt: IT/ITP/MO3), caught with afl-fuzz. git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@10027 56274372-70c3-4bfc-bfc3-4c3a0b034d27
CHANNELINDEX CSoundFile::CheckNNA(CHANNELINDEX nChn, uint32 instr, int note, bool forceCut) { CHANNELINDEX nnaChn = CHANNELINDEX_INVALID; ModChannel &srcChn = m_PlayState.Chn[nChn]; const ModInstrument *pIns = nullptr; if(!ModCommand::IsNote(static_cast<ModCommand::NOTE>(note))) { return nnaChn; } if((!(GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_MT2)) || !m_nInstruments || forceCut) && !srcChn.HasMIDIOutput()) { if(!srcChn.nLength || srcChn.dwFlags[CHN_MUTE] || !(srcChn.rightVol | srcChn.leftVol)) { return CHANNELINDEX_INVALID; } nnaChn = GetNNAChannel(nChn); if(!nnaChn) return CHANNELINDEX_INVALID; ModChannel &chn = m_PlayState.Chn[nnaChn]; chn = srcChn; chn.dwFlags.reset(CHN_VIBRATO | CHN_TREMOLO | CHN_MUTE | CHN_PORTAMENTO); chn.nPanbrelloOffset = 0; chn.nMasterChn = nChn + 1; chn.nCommand = CMD_NONE; chn.rowCommand.Clear(); chn.nFadeOutVol = 0; chn.dwFlags.set(CHN_NOTEFADE | CHN_FASTVOLRAMP); srcChn.nLength = 0; srcChn.position.Set(0); srcChn.nROfs = srcChn.nLOfs = 0; srcChn.rightVol = srcChn.leftVol = 0; return nnaChn; } if(instr > GetNumInstruments()) instr = 0; const ModSample *pSample = srcChn.pModSample; pIns = instr > 0 ? Instruments[instr] : srcChn.pModInstrument; if(pIns != nullptr) { uint32 n = pIns->Keyboard[note - NOTE_MIN]; note = pIns->NoteMap[note - NOTE_MIN]; if ((n) && (n < MAX_SAMPLES)) { pSample = &Samples[n]; } else if(m_playBehaviour[kITEmptyNoteMapSlot] && !pIns->HasValidMIDIChannel()) { return CHANNELINDEX_INVALID; } } if (srcChn.dwFlags[CHN_MUTE]) return CHANNELINDEX_INVALID; for(CHANNELINDEX i = nChn; i < MAX_CHANNELS; i++) if(i >= m_nChannels || i == nChn) { ModChannel &chn = m_PlayState.Chn[i]; bool applyDNAtoPlug = false; if((chn.nMasterChn == nChn + 1 || i == nChn) && chn.pModInstrument != nullptr) { bool bOk = false; switch(chn.pModInstrument->nDCT) { case DCT_NOTE: if(note && chn.nNote == note && pIns == chn.pModInstrument) bOk = true; if(pIns && pIns->nMixPlug) applyDNAtoPlug = true; break; case DCT_SAMPLE: if(pSample != nullptr && pSample == chn.pModSample) bOk = true; break; case DCT_INSTRUMENT: if(pIns == chn.pModInstrument) bOk = true; if(pIns && pIns->nMixPlug) applyDNAtoPlug = true; break; case DCT_PLUGIN: if(pIns && (pIns->nMixPlug) && (pIns->nMixPlug == chn.pModInstrument->nMixPlug)) { applyDNAtoPlug = true; bOk = true; } break; } if (bOk) { #ifndef NO_PLUGINS if (applyDNAtoPlug && chn.nNote != NOTE_NONE) { switch(chn.pModInstrument->nDNA) { case DNA_NOTECUT: case DNA_NOTEOFF: case DNA_NOTEFADE: SendMIDINote(i, chn.GetPluginNote(m_playBehaviour[kITRealNoteMapping]) + NOTE_MAX_SPECIAL, 0); chn.nArpeggioLastNote = NOTE_NONE; break; } } #endif // NO_PLUGINS switch(chn.pModInstrument->nDNA) { case DNA_NOTECUT: KeyOff(&chn); chn.nVolume = 0; break; case DNA_NOTEOFF: KeyOff(&chn); break; case DNA_NOTEFADE: chn.dwFlags.set(CHN_NOTEFADE); break; } if(!chn.nVolume) { chn.nFadeOutVol = 0; chn.dwFlags.set(CHN_NOTEFADE | CHN_FASTVOLRAMP); } } } } bool applyNNAtoPlug = false; #ifndef NO_PLUGINS IMixPlugin *pPlugin = nullptr; if(srcChn.HasMIDIOutput() && ModCommand::IsNote(srcChn.nNote)) // instro sends to a midi chan { PLUGINDEX nPlugin = GetBestPlugin(nChn, PrioritiseInstrument, RespectMutes); if(nPlugin > 0 && nPlugin <= MAX_MIXPLUGINS) { pPlugin = m_MixPlugins[nPlugin-1].pMixPlugin; if(pPlugin) { applyNNAtoPlug = pPlugin->IsNotePlaying(srcChn.GetPluginNote(m_playBehaviour[kITRealNoteMapping]), GetBestMidiChannel(nChn), nChn); } } } #endif // NO_PLUGINS if((srcChn.nRealVolume > 0 && srcChn.nLength > 0) || applyNNAtoPlug) { nnaChn = GetNNAChannel(nChn); if(nnaChn != 0) { ModChannel &chn = m_PlayState.Chn[nnaChn]; chn = srcChn; chn.dwFlags.reset(CHN_VIBRATO | CHN_TREMOLO | CHN_PORTAMENTO); chn.nPanbrelloOffset = 0; chn.nMasterChn = nChn < GetNumChannels() ? nChn + 1 : 0; chn.nCommand = CMD_NONE; #ifndef NO_PLUGINS if(applyNNAtoPlug && pPlugin) { switch(srcChn.nNNA) { case NNA_NOTEOFF: case NNA_NOTECUT: case NNA_NOTEFADE: SendMIDINote(nChn, NOTE_KEYOFF, 0); srcChn.nArpeggioLastNote = NOTE_NONE; break; } } #endif // NO_PLUGINS switch(srcChn.nNNA) { case NNA_NOTEOFF: KeyOff(&chn); break; case NNA_NOTECUT: chn.nFadeOutVol = 0; chn.dwFlags.set(CHN_NOTEFADE); break; case NNA_NOTEFADE: chn.dwFlags.set(CHN_NOTEFADE); break; } if(!chn.nVolume) { chn.nFadeOutVol = 0; chn.dwFlags.set(CHN_NOTEFADE | CHN_FASTVOLRAMP); } srcChn.nLength = 0; srcChn.position.Set(0); srcChn.nROfs = srcChn.nLOfs = 0; } } return nnaChn; }
CHANNELINDEX CSoundFile::CheckNNA(CHANNELINDEX nChn, uint32 instr, int note, bool forceCut) { CHANNELINDEX nnaChn = CHANNELINDEX_INVALID; ModChannel &srcChn = m_PlayState.Chn[nChn]; const ModInstrument *pIns = nullptr; if(!ModCommand::IsNote(static_cast<ModCommand::NOTE>(note))) { return nnaChn; } if((!(GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_MT2)) || !m_nInstruments || forceCut) && !srcChn.HasMIDIOutput()) { if(!srcChn.nLength || srcChn.dwFlags[CHN_MUTE] || !(srcChn.rightVol | srcChn.leftVol)) { return CHANNELINDEX_INVALID; } nnaChn = GetNNAChannel(nChn); if(!nnaChn) return CHANNELINDEX_INVALID; ModChannel &chn = m_PlayState.Chn[nnaChn]; chn = srcChn; chn.dwFlags.reset(CHN_VIBRATO | CHN_TREMOLO | CHN_MUTE | CHN_PORTAMENTO); chn.nPanbrelloOffset = 0; chn.nMasterChn = nChn + 1; chn.nCommand = CMD_NONE; chn.rowCommand.Clear(); chn.nFadeOutVol = 0; chn.dwFlags.set(CHN_NOTEFADE | CHN_FASTVOLRAMP); srcChn.nLength = 0; srcChn.position.Set(0); srcChn.nROfs = srcChn.nLOfs = 0; srcChn.rightVol = srcChn.leftVol = 0; return nnaChn; } if(instr > GetNumInstruments()) instr = 0; const ModSample *pSample = srcChn.pModSample; pIns = instr > 0 ? Instruments[instr] : srcChn.pModInstrument; if(pIns != nullptr) { uint32 n = pIns->Keyboard[note - NOTE_MIN]; note = pIns->NoteMap[note - NOTE_MIN]; if ((n) && (n < MAX_SAMPLES)) { pSample = &Samples[n]; } else if(m_playBehaviour[kITEmptyNoteMapSlot] && !pIns->HasValidMIDIChannel()) { return CHANNELINDEX_INVALID; } } if (srcChn.dwFlags[CHN_MUTE]) return CHANNELINDEX_INVALID; for(CHANNELINDEX i = nChn; i < MAX_CHANNELS; i++) if(i >= m_nChannels || i == nChn) { ModChannel &chn = m_PlayState.Chn[i]; bool applyDNAtoPlug = false; if((chn.nMasterChn == nChn + 1 || i == nChn) && chn.pModInstrument != nullptr) { bool bOk = false; switch(chn.pModInstrument->nDCT) { case DCT_NOTE: if(note && chn.nNote == note && pIns == chn.pModInstrument) bOk = true; if(pIns && pIns->nMixPlug) applyDNAtoPlug = true; break; case DCT_SAMPLE: if(pSample != nullptr && pSample == chn.pModSample) bOk = true; break; case DCT_INSTRUMENT: if(pIns == chn.pModInstrument) bOk = true; if(pIns && pIns->nMixPlug) applyDNAtoPlug = true; break; case DCT_PLUGIN: if(pIns && (pIns->nMixPlug) && (pIns->nMixPlug == chn.pModInstrument->nMixPlug)) { applyDNAtoPlug = true; bOk = true; } break; } if (bOk) { #ifndef NO_PLUGINS if (applyDNAtoPlug && chn.nNote != NOTE_NONE) { switch(chn.pModInstrument->nDNA) { case DNA_NOTECUT: case DNA_NOTEOFF: case DNA_NOTEFADE: SendMIDINote(i, chn.GetPluginNote(m_playBehaviour[kITRealNoteMapping]) + NOTE_MAX_SPECIAL, 0); chn.nArpeggioLastNote = NOTE_NONE; break; } } #endif // NO_PLUGINS switch(chn.pModInstrument->nDNA) { case DNA_NOTECUT: KeyOff(&chn); chn.nVolume = 0; break; case DNA_NOTEOFF: KeyOff(&chn); break; case DNA_NOTEFADE: chn.dwFlags.set(CHN_NOTEFADE); break; } if(!chn.nVolume) { chn.nFadeOutVol = 0; chn.dwFlags.set(CHN_NOTEFADE | CHN_FASTVOLRAMP); } } } } bool applyNNAtoPlug = false; #ifndef NO_PLUGINS IMixPlugin *pPlugin = nullptr; if(srcChn.HasMIDIOutput() && ModCommand::IsNote(srcChn.nNote)) // instro sends to a midi chan { PLUGINDEX nPlugin = GetBestPlugin(nChn, PrioritiseInstrument, RespectMutes); if(nPlugin > 0 && nPlugin <= MAX_MIXPLUGINS) { pPlugin = m_MixPlugins[nPlugin-1].pMixPlugin; if(pPlugin) { applyNNAtoPlug = pPlugin->IsNotePlaying(srcChn.GetPluginNote(m_playBehaviour[kITRealNoteMapping]), GetBestMidiChannel(nChn), nChn); } } } #endif // NO_PLUGINS if((srcChn.nRealVolume > 0 && srcChn.nLength > 0) || applyNNAtoPlug) { nnaChn = GetNNAChannel(nChn); if(nnaChn != 0) { ModChannel &chn = m_PlayState.Chn[nnaChn]; chn = srcChn; chn.dwFlags.reset(CHN_VIBRATO | CHN_TREMOLO | CHN_PORTAMENTO); chn.nPanbrelloOffset = 0; chn.nMasterChn = nChn < GetNumChannels() ? nChn + 1 : 0; chn.nCommand = CMD_NONE; #ifndef NO_PLUGINS if(applyNNAtoPlug && pPlugin) { switch(srcChn.nNNA) { case NNA_NOTEOFF: case NNA_NOTECUT: case NNA_NOTEFADE: SendMIDINote(nChn, NOTE_KEYOFF, 0); srcChn.nArpeggioLastNote = NOTE_NONE; break; } } #endif // NO_PLUGINS switch(srcChn.nNNA) { case NNA_NOTEOFF: KeyOff(&chn); break; case NNA_NOTECUT: chn.nFadeOutVol = 0; chn.dwFlags.set(CHN_NOTEFADE); break; case NNA_NOTEFADE: chn.dwFlags.set(CHN_NOTEFADE); break; } if(!chn.nVolume) { chn.nFadeOutVol = 0; chn.dwFlags.set(CHN_NOTEFADE | CHN_FASTVOLRAMP); } srcChn.nLength = 0; srcChn.position.Set(0); srcChn.nROfs = srcChn.nLOfs = 0; } } return nnaChn; }
C
openmpt
0
CVE-2008-1950
https://www.cvedetails.com/cve/CVE-2008-1950/
CWE-189
https://git.savannah.gnu.org/gitweb/?p=gnutls.git;a=commitdiff;h=bc8102405fda11ea00ca3b42acc4f4bce9d6e97b
bc8102405fda11ea00ca3b42acc4f4bce9d6e97b
null
_gnutls_recv_finished (gnutls_session_t session) { uint8_t data[36], *vrfy; int data_size; int ret; int vrfysize; ret = _gnutls_recv_handshake (session, &vrfy, &vrfysize, GNUTLS_HANDSHAKE_FINISHED, MANDATORY_PACKET); if (ret < 0) { ERR ("recv finished int", ret); gnutls_assert (); return ret; } if (gnutls_protocol_get_version (session) == GNUTLS_SSL3) { data_size = 36; } else { data_size = 12; } if (vrfysize != data_size) { gnutls_assert (); gnutls_free (vrfy); return GNUTLS_E_ERROR_IN_FINISHED_PACKET; } if (gnutls_protocol_get_version (session) == GNUTLS_SSL3) { ret = _gnutls_ssl3_finished (session, (session->security_parameters. entity + 1) % 2, data); } else { /* TLS 1.0 */ ret = _gnutls_finished (session, (session->security_parameters.entity + 1) % 2, data); } if (ret < 0) { gnutls_assert (); gnutls_free (vrfy); return ret; } if (memcmp (vrfy, data, data_size) != 0) { gnutls_assert (); ret = GNUTLS_E_ERROR_IN_FINISHED_PACKET; } gnutls_free (vrfy); return ret; }
_gnutls_recv_finished (gnutls_session_t session) { uint8_t data[36], *vrfy; int data_size; int ret; int vrfysize; ret = _gnutls_recv_handshake (session, &vrfy, &vrfysize, GNUTLS_HANDSHAKE_FINISHED, MANDATORY_PACKET); if (ret < 0) { ERR ("recv finished int", ret); gnutls_assert (); return ret; } if (gnutls_protocol_get_version (session) == GNUTLS_SSL3) { data_size = 36; } else { data_size = 12; } if (vrfysize != data_size) { gnutls_assert (); gnutls_free (vrfy); return GNUTLS_E_ERROR_IN_FINISHED_PACKET; } if (gnutls_protocol_get_version (session) == GNUTLS_SSL3) { ret = _gnutls_ssl3_finished (session, (session->security_parameters. entity + 1) % 2, data); } else { /* TLS 1.0 */ ret = _gnutls_finished (session, (session->security_parameters.entity + 1) % 2, data); } if (ret < 0) { gnutls_assert (); gnutls_free (vrfy); return ret; } if (memcmp (vrfy, data, data_size) != 0) { gnutls_assert (); ret = GNUTLS_E_ERROR_IN_FINISHED_PACKET; } gnutls_free (vrfy); return ret; }
C
savannah
0
CVE-2017-6001
https://www.cvedetails.com/cve/CVE-2017-6001/
CWE-362
https://github.com/torvalds/linux/commit/321027c1fe77f892f4ea07846aeae08cefbbb290
321027c1fe77f892f4ea07846aeae08cefbbb290
perf/core: Fix concurrent sys_perf_event_open() vs. 'move_group' race Di Shen reported a race between two concurrent sys_perf_event_open() calls where both try and move the same pre-existing software group into a hardware context. The problem is exactly that described in commit: f63a8daa5812 ("perf: Fix event->ctx locking") ... where, while we wait for a ctx->mutex acquisition, the event->ctx relation can have changed under us. That very same commit failed to recognise sys_perf_event_context() as an external access vector to the events and thereby didn't apply the established locking rules correctly. So while one sys_perf_event_open() call is stuck waiting on mutex_lock_double(), the other (which owns said locks) moves the group about. So by the time the former sys_perf_event_open() acquires the locks, the context we've acquired is stale (and possibly dead). Apply the established locking rules as per perf_event_ctx_lock_nested() to the mutex_lock_double() for the 'move_group' case. This obviously means we need to validate state after we acquire the locks. Reported-by: Di Shen (Keen Lab) Tested-by: John Dias <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kees Cook <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Min Chong <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vince Weaver <[email protected]> Fixes: f63a8daa5812 ("perf: Fix event->ctx locking") Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
static void sw_perf_event_destroy(struct perf_event *event) { u64 event_id = event->attr.config; WARN_ON(event->parent); static_key_slow_dec(&perf_swevent_enabled[event_id]); swevent_hlist_put(); }
static void sw_perf_event_destroy(struct perf_event *event) { u64 event_id = event->attr.config; WARN_ON(event->parent); static_key_slow_dec(&perf_swevent_enabled[event_id]); swevent_hlist_put(); }
C
linux
0
CVE-2012-0036
https://www.cvedetails.com/cve/CVE-2012-0036/
CWE-89
https://github.com/bagder/curl/commit/75ca568fa1c19de4c5358fed246686de8467c238
75ca568fa1c19de4c5358fed246686de8467c238
URL sanitize: reject URLs containing bad data Protocols (IMAP, POP3 and SMTP) that use the path part of a URL in a decoded manner now use the new Curl_urldecode() function to reject URLs with embedded control codes (anything that is or decodes to a byte value less than 32). URLs containing such codes could easily otherwise be used to do harm and allow users to do unintended actions with otherwise innocent tools and applications. Like for example using a URL like pop3://pop3.example.com/1%0d%0aDELE%201 when the app wants a URL to get a mail and instead this would delete one. This flaw is considered a security vulnerability: CVE-2012-0036 Security advisory at: http://curl.haxx.se/docs/adv_20120124.html Reported by: Dan Fandrich
static CURLcode imap_done(struct connectdata *conn, CURLcode status, bool premature) { struct SessionHandle *data = conn->data; struct FTP *imap = data->state.proto.imap; CURLcode result=CURLE_OK; (void)premature; if(!imap) /* When the easy handle is removed from the multi while libcurl is still * trying to resolve the host name, it seems that the imap struct is not * yet initialized, but the removal action calls Curl_done() which calls * this function. So we simply return success if no imap pointer is set. */ return CURLE_OK; if(status) { conn->bits.close = TRUE; /* marked for closure */ result = status; /* use the already set error code */ } /* clear these for next connection */ imap->transfer = FTPTRANSFER_BODY; return result; }
static CURLcode imap_done(struct connectdata *conn, CURLcode status, bool premature) { struct SessionHandle *data = conn->data; struct FTP *imap = data->state.proto.imap; CURLcode result=CURLE_OK; (void)premature; if(!imap) /* When the easy handle is removed from the multi while libcurl is still * trying to resolve the host name, it seems that the imap struct is not * yet initialized, but the removal action calls Curl_done() which calls * this function. So we simply return success if no imap pointer is set. */ return CURLE_OK; if(status) { conn->bits.close = TRUE; /* marked for closure */ result = status; /* use the already set error code */ } /* clear these for next connection */ imap->transfer = FTPTRANSFER_BODY; return result; }
C
curl
0
CVE-2015-1285
https://www.cvedetails.com/cve/CVE-2015-1285/
CWE-200
https://github.com/chromium/chromium/commit/39595f8d4dffcb644d438106dcb64a30c139ff0e
39595f8d4dffcb644d438106dcb64a30c139ff0e
[reland] Do not set default wallpaper unless it should do so. [email protected], [email protected] Bug: 751382 Change-Id: Id0793dfe467f737526a95b1e66ed01fbb8860bda Reviewed-on: https://chromium-review.googlesource.com/619754 Commit-Queue: Xiaoqian Dai <[email protected]> Reviewed-by: Alexander Alekseev <[email protected]> Reviewed-by: Biao She <[email protected]> Cr-Original-Commit-Position: refs/heads/master@{#498325} Reviewed-on: https://chromium-review.googlesource.com/646430 Cr-Commit-Position: refs/heads/master@{#498982}
void SetWallpaper(const gfx::ImageSkia& image, wallpaper::WallpaperInfo info) { if (ash_util::IsRunningInMash()) { service_manager::Connector* connector = content::ServiceManagerConnection::GetForProcess()->GetConnector(); if (!connector) return; ash::mojom::WallpaperControllerPtr wallpaper_controller; connector->BindInterface(ash::mojom::kServiceName, &wallpaper_controller); wallpaper_controller->SetWallpaper(*image.bitmap(), info); } else if (ash::Shell::HasInstance()) { ash::Shell::Get()->wallpaper_controller()->SetWallpaperImage(image, info); } }
void SetWallpaper(const gfx::ImageSkia& image, wallpaper::WallpaperInfo info) { if (ash_util::IsRunningInMash()) { service_manager::Connector* connector = content::ServiceManagerConnection::GetForProcess()->GetConnector(); if (!connector) return; ash::mojom::WallpaperControllerPtr wallpaper_controller; connector->BindInterface(ash::mojom::kServiceName, &wallpaper_controller); wallpaper_controller->SetWallpaper(*image.bitmap(), info); } else if (ash::Shell::HasInstance()) { ash::Shell::Get()->wallpaper_controller()->SetWallpaperImage(image, info); } }
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
IPC::Message* ExecuteBrowserCommandObserver::ReleaseReply() { return reply_message_.release(); }
IPC::Message* ExecuteBrowserCommandObserver::ReleaseReply() { return reply_message_.release(); }
C
Chrome
0
CVE-2015-7566
https://www.cvedetails.com/cve/CVE-2015-7566/
null
https://github.com/torvalds/linux/commit/cb3232138e37129e88240a98a1d2aba2187ff57c
cb3232138e37129e88240a98a1d2aba2187ff57c
USB: serial: visor: fix crash on detecting device without write_urbs The visor driver crashes in clie_5_attach() when a specially crafted USB device without bulk-out endpoint is detected. This fix adds a check that the device has proper configuration expected by the driver. Reported-by: Ralf Spenneberg <[email protected]> Signed-off-by: Vladis Dronov <[email protected]> Fixes: cfb8da8f69b8 ("USB: visor: fix initialisation of UX50/TH55 devices") Cc: stable <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
static int clie_5_attach(struct usb_serial *serial) { struct usb_serial_port *port; unsigned int pipe; int j; /* TH55 registers 2 ports. Communication in from the UX50/TH55 uses bulk_in_endpointAddress from port 0. Communication out to the UX50/TH55 uses bulk_out_endpointAddress from port 1 Lets do a quick and dirty mapping */ /* some sanity check */ if (serial->num_bulk_out < 2) { dev_err(&serial->interface->dev, "missing bulk out endpoints\n"); return -ENODEV; } /* port 0 now uses the modified endpoint Address */ port = serial->port[0]; port->bulk_out_endpointAddress = serial->port[1]->bulk_out_endpointAddress; pipe = usb_sndbulkpipe(serial->dev, port->bulk_out_endpointAddress); for (j = 0; j < ARRAY_SIZE(port->write_urbs); ++j) port->write_urbs[j]->pipe = pipe; return 0; }
static int clie_5_attach(struct usb_serial *serial) { struct usb_serial_port *port; unsigned int pipe; int j; /* TH55 registers 2 ports. Communication in from the UX50/TH55 uses bulk_in_endpointAddress from port 0. Communication out to the UX50/TH55 uses bulk_out_endpointAddress from port 1 Lets do a quick and dirty mapping */ /* some sanity check */ if (serial->num_ports < 2) return -1; /* port 0 now uses the modified endpoint Address */ port = serial->port[0]; port->bulk_out_endpointAddress = serial->port[1]->bulk_out_endpointAddress; pipe = usb_sndbulkpipe(serial->dev, port->bulk_out_endpointAddress); for (j = 0; j < ARRAY_SIZE(port->write_urbs); ++j) port->write_urbs[j]->pipe = pipe; return 0; }
C
linux
1
CVE-2012-2816
https://www.cvedetails.com/cve/CVE-2012-2816/
null
https://github.com/chromium/chromium/commit/cd0bd79d6ebdb72183e6f0833673464cc10b3600
cd0bd79d6ebdb72183e6f0833673464cc10b3600
Convert plugin and GPU process to brokered handle duplication. BUG=119250 Review URL: https://chromiumcodereview.appspot.com/9958034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132303 0039d316-1c4b-4281-b951-d872f2087c98
void RenderThreadImpl::OnSetZoomLevelForCurrentURL(const std::string& host, double zoom_level) { RenderViewZoomer zoomer(host, zoom_level); content::RenderView::ForEach(&zoomer); }
void RenderThreadImpl::OnSetZoomLevelForCurrentURL(const std::string& host, double zoom_level) { RenderViewZoomer zoomer(host, zoom_level); content::RenderView::ForEach(&zoomer); }
C
Chrome
0
CVE-2017-15419
https://www.cvedetails.com/cve/CVE-2017-15419/
CWE-601
https://github.com/chromium/chromium/commit/fa17c9878dbeebf991b25ac0deb2b4635d85f1b6
fa17c9878dbeebf991b25ac0deb2b4635d85f1b6
Resource Timing: Do not report subsequent navigations within subframes We only want to record resource timing for the load that was initiated by parent document. We filter out subsequent navigations for <iframe>, but we should do it for other types of subframes too. Bug: 780312 Change-Id: I3a7b9e1a365c99e24bb8dac190e88c7099fc3da5 Reviewed-on: https://chromium-review.googlesource.com/750487 Reviewed-by: Nate Chapin <[email protected]> Commit-Queue: Kunihiko Sakamoto <[email protected]> Cr-Commit-Position: refs/heads/master@{#513665}
ReferrerPolicy HTMLIFrameElement::ReferrerPolicyAttribute() { return referrer_policy_; }
ReferrerPolicy HTMLIFrameElement::ReferrerPolicyAttribute() { return referrer_policy_; }
C
Chrome
0
CVE-2012-2136
https://www.cvedetails.com/cve/CVE-2012-2136/
CWE-20
https://github.com/torvalds/linux/commit/cc9b17ad29ecaa20bfe426a8d4dbfb94b13ff1cc
cc9b17ad29ecaa20bfe426a8d4dbfb94b13ff1cc
net: sock: validate data_len before allocating skb in sock_alloc_send_pskb() We need to validate the number of pages consumed by data_len, otherwise frags array could be overflowed by userspace. So this patch validate data_len and return -EMSGSIZE when data_len may occupies more frags than MAX_SKB_FRAGS. Signed-off-by: Jason Wang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static void sock_def_wakeup(struct sock *sk) { struct socket_wq *wq; rcu_read_lock(); wq = rcu_dereference(sk->sk_wq); if (wq_has_sleeper(wq)) wake_up_interruptible_all(&wq->wait); rcu_read_unlock(); }
static void sock_def_wakeup(struct sock *sk) { struct socket_wq *wq; rcu_read_lock(); wq = rcu_dereference(sk->sk_wq); if (wq_has_sleeper(wq)) wake_up_interruptible_all(&wq->wait); rcu_read_unlock(); }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/820957a3386e960334be3b93b48636e749d38ea3
820957a3386e960334be3b93b48636e749d38ea3
Make WebContentsDelegate::OpenColorChooser return NULL on failure Changing WebContentsDelegate::OpenColorChooser to return NULL on failure so we don't put the same ColorChooser into two scoped_ptrs(WebContentsImpl::color_chooser_) BUG=331790 Review URL: https://codereview.chromium.org/128053002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244710 0039d316-1c4b-4281-b951-d872f2087c98
WebUI* WebContentsImpl::GetWebUI() const { return GetRenderManager()->web_ui() ? GetRenderManager()->web_ui() : GetRenderManager()->pending_web_ui(); }
WebUI* WebContentsImpl::GetWebUI() const { return GetRenderManager()->web_ui() ? GetRenderManager()->web_ui() : GetRenderManager()->pending_web_ui(); }
C
Chrome
0
CVE-2013-2884
https://www.cvedetails.com/cve/CVE-2013-2884/
CWE-399
https://github.com/chromium/chromium/commit/4ac8bc08e3306f38a5ab3e551aef6ad43753579c
4ac8bc08e3306f38a5ab3e551aef6ad43753579c
Set Attr.ownerDocument in Element#setAttributeNode() Attr objects can move across documents by setAttributeNode(). So It needs to reset ownerDocument through TreeScopeAdoptr::adoptIfNeeded(). BUG=248950 TEST=set-attribute-node-from-iframe.html Review URL: https://chromiumcodereview.appspot.com/17583003 git-svn-id: svn://svn.chromium.org/blink/trunk@152938 bbb929c8-8fbe-4397-9dbb-9b2b20218538
RenderStyle* Element::computedStyle(PseudoId pseudoElementSpecifier) { if (PseudoElement* element = pseudoElement(pseudoElementSpecifier)) return element->computedStyle(); if (RenderStyle* usedStyle = renderStyle()) { if (pseudoElementSpecifier) { RenderStyle* cachedPseudoStyle = usedStyle->getCachedPseudoStyle(pseudoElementSpecifier); return cachedPseudoStyle ? cachedPseudoStyle : usedStyle; } else return usedStyle; } if (!attached()) return 0; ElementRareData* data = ensureElementRareData(); if (!data->computedStyle()) data->setComputedStyle(document()->styleForElementIgnoringPendingStylesheets(this)); return pseudoElementSpecifier ? data->computedStyle()->getCachedPseudoStyle(pseudoElementSpecifier) : data->computedStyle(); }
RenderStyle* Element::computedStyle(PseudoId pseudoElementSpecifier) { if (PseudoElement* element = pseudoElement(pseudoElementSpecifier)) return element->computedStyle(); if (RenderStyle* usedStyle = renderStyle()) { if (pseudoElementSpecifier) { RenderStyle* cachedPseudoStyle = usedStyle->getCachedPseudoStyle(pseudoElementSpecifier); return cachedPseudoStyle ? cachedPseudoStyle : usedStyle; } else return usedStyle; } if (!attached()) return 0; ElementRareData* data = ensureElementRareData(); if (!data->computedStyle()) data->setComputedStyle(document()->styleForElementIgnoringPendingStylesheets(this)); return pseudoElementSpecifier ? data->computedStyle()->getCachedPseudoStyle(pseudoElementSpecifier) : data->computedStyle(); }
C
Chrome
0
CVE-2015-4471
https://www.cvedetails.com/cve/CVE-2015-4471/
CWE-189
https://github.com/kyz/libmspack/commit/18b6a2cc0b87536015bedd4f7763e6b02d5aa4f3
18b6a2cc0b87536015bedd4f7763e6b02d5aa4f3
Prevent a 1-byte underread of the input buffer if an odd-sized data block comes just before an uncompressed block header
static void lzxd_reset_state(struct lzxd_stream *lzx) { int i; lzx->R0 = 1; lzx->R1 = 1; lzx->R2 = 1; lzx->header_read = 0; lzx->block_remaining = 0; lzx->block_type = LZX_BLOCKTYPE_INVALID; /* initialise tables to 0 (because deltas will be applied to them) */ for (i = 0; i < LZX_MAINTREE_MAXSYMBOLS; i++) lzx->MAINTREE_len[i] = 0; for (i = 0; i < LZX_LENGTH_MAXSYMBOLS; i++) lzx->LENGTH_len[i] = 0; }
static void lzxd_reset_state(struct lzxd_stream *lzx) { int i; lzx->R0 = 1; lzx->R1 = 1; lzx->R2 = 1; lzx->header_read = 0; lzx->block_remaining = 0; lzx->block_type = LZX_BLOCKTYPE_INVALID; /* initialise tables to 0 (because deltas will be applied to them) */ for (i = 0; i < LZX_MAINTREE_MAXSYMBOLS; i++) lzx->MAINTREE_len[i] = 0; for (i = 0; i < LZX_LENGTH_MAXSYMBOLS; i++) lzx->LENGTH_len[i] = 0; }
C
libmspack
0
CVE-2016-5829
https://www.cvedetails.com/cve/CVE-2016-5829/
CWE-119
https://github.com/torvalds/linux/commit/93a2001bdfd5376c3dc2158653034c20392d15c5
93a2001bdfd5376c3dc2158653034c20392d15c5
HID: hiddev: validate num_values for HIDIOCGUSAGES, HIDIOCSUSAGES commands This patch validates the num_values parameter from userland during the HIDIOCGUSAGES and HIDIOCSUSAGES commands. Previously, if the report id was set to HID_REPORT_ID_UNKNOWN, we would fail to validate the num_values parameter leading to a heap overflow. Cc: [email protected] Signed-off-by: Scott Bauer <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
static noinline int hiddev_ioctl_string(struct hiddev *hiddev, unsigned int cmd, void __user *user_arg) { struct hid_device *hid = hiddev->hid; struct usb_device *dev = hid_to_usb_dev(hid); int idx, len; char *buf; if (get_user(idx, (int __user *)user_arg)) return -EFAULT; if ((buf = kmalloc(HID_STRING_SIZE, GFP_KERNEL)) == NULL) return -ENOMEM; if ((len = usb_string(dev, idx, buf, HID_STRING_SIZE-1)) < 0) { kfree(buf); return -EINVAL; } if (copy_to_user(user_arg+sizeof(int), buf, len+1)) { kfree(buf); return -EFAULT; } kfree(buf); return len; }
static noinline int hiddev_ioctl_string(struct hiddev *hiddev, unsigned int cmd, void __user *user_arg) { struct hid_device *hid = hiddev->hid; struct usb_device *dev = hid_to_usb_dev(hid); int idx, len; char *buf; if (get_user(idx, (int __user *)user_arg)) return -EFAULT; if ((buf = kmalloc(HID_STRING_SIZE, GFP_KERNEL)) == NULL) return -ENOMEM; if ((len = usb_string(dev, idx, buf, HID_STRING_SIZE-1)) < 0) { kfree(buf); return -EINVAL; } if (copy_to_user(user_arg+sizeof(int), buf, len+1)) { kfree(buf); return -EFAULT; } kfree(buf); return len; }
C
linux
0
CVE-2013-2884
https://www.cvedetails.com/cve/CVE-2013-2884/
CWE-399
https://github.com/chromium/chromium/commit/4ac8bc08e3306f38a5ab3e551aef6ad43753579c
4ac8bc08e3306f38a5ab3e551aef6ad43753579c
Set Attr.ownerDocument in Element#setAttributeNode() Attr objects can move across documents by setAttributeNode(). So It needs to reset ownerDocument through TreeScopeAdoptr::adoptIfNeeded(). BUG=248950 TEST=set-attribute-node-from-iframe.html Review URL: https://chromiumcodereview.appspot.com/17583003 git-svn-id: svn://svn.chromium.org/blink/trunk@152938 bbb929c8-8fbe-4397-9dbb-9b2b20218538
inline ElementRareData* Element::ensureElementRareData() { return static_cast<ElementRareData*>(ensureRareData()); }
inline ElementRareData* Element::ensureElementRareData() { return static_cast<ElementRareData*>(ensureRareData()); }
C
Chrome
0
CVE-2010-2527
https://www.cvedetails.com/cve/CVE-2010-2527/
CWE-119
https://git.savannah.gnu.org/cgit/freetype/freetype2-demos.git/commit/?id=b995299b73ba4cd259f221f500d4e63095508bec
b995299b73ba4cd259f221f500d4e63095508bec
null
usage( char* execname ) { fprintf( stderr, "\n" ); fprintf( stderr, "ftstring: string viewer -- part of the FreeType project\n" ); fprintf( stderr, "-------------------------------------------------------\n" ); fprintf( stderr, "\n" ); fprintf( stderr, "Usage: %s [options below] ppem fontname[.ttf|.ttc] ...\n", execname ); fprintf( stderr, "\n" ); fprintf( stderr, " -e enc specify encoding tag (default: unic)\n" ); fprintf( stderr, " -r R use resolution R dpi (default: 72 dpi)\n" ); fprintf( stderr, " -m message message to display\n" ); fprintf( stderr, "\n" ); exit( 1 ); }
usage( char* execname ) { fprintf( stderr, "\n" ); fprintf( stderr, "ftstring: string viewer -- part of the FreeType project\n" ); fprintf( stderr, "-------------------------------------------------------\n" ); fprintf( stderr, "\n" ); fprintf( stderr, "Usage: %s [options below] ppem fontname[.ttf|.ttc] ...\n", execname ); fprintf( stderr, "\n" ); fprintf( stderr, " -e enc specify encoding tag (default: unic)\n" ); fprintf( stderr, " -r R use resolution R dpi (default: 72 dpi)\n" ); fprintf( stderr, " -m message message to display\n" ); fprintf( stderr, "\n" ); exit( 1 ); }
C
savannah
0
CVE-2017-5077
https://www.cvedetails.com/cve/CVE-2017-5077/
CWE-125
https://github.com/chromium/chromium/commit/fec26ff33bf372476a70326f3669a35f34a9d474
fec26ff33bf372476a70326f3669a35f34a9d474
Origins should be represented as url::Origin (not as GURL). As pointed out in //docs/security/origin-vs-url.md, origins should be represented as url::Origin (not as GURL). This CL applies this guideline to predictor-related code and changes the type of the following fields from GURL to url::Origin: - OriginRequestSummary::origin - PreconnectedRequestStats::origin - PreconnectRequest::origin The old code did not depend on any non-origin parts of GURL (like path and/or query). Therefore, this CL has no intended behavior change. Bug: 973885 Change-Id: Idd14590b4834cb9d50c74ed747b595fe1a4ba357 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1895167 Commit-Queue: Łukasz Anforowicz <[email protected]> Reviewed-by: Alex Ilin <[email protected]> Cr-Commit-Position: refs/heads/master@{#716311}
ConnectionTracker* preconnecting_server_connection_tracker() const { return preconnecting_server_connection_tracker_.get(); }
ConnectionTracker* preconnecting_server_connection_tracker() const { return preconnecting_server_connection_tracker_.get(); }
C
Chrome
0
CVE-2017-8284
https://www.cvedetails.com/cve/CVE-2017-8284/
CWE-94
https://github.com/qemu/qemu/commit/30663fd26c0307e414622c7a8607fbc04f92ec14
30663fd26c0307e414622c7a8607fbc04f92ec14
tcg/i386: Check the size of instruction being translated This fixes the bug: 'user-to-root privesc inside VM via bad translation caching' reported by Jann Horn here: https://bugs.chromium.org/p/project-zero/issues/detail?id=1122 Reviewed-by: Richard Henderson <[email protected]> CC: Peter Maydell <[email protected]> CC: Paolo Bonzini <[email protected]> Reported-by: Jann Horn <[email protected]> Signed-off-by: Pranith Kumar <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
gen_svm_check_intercept(DisasContext *s, target_ulong pc_start, uint64_t type) { gen_svm_check_intercept_param(s, pc_start, type, 0); }
gen_svm_check_intercept(DisasContext *s, target_ulong pc_start, uint64_t type) { gen_svm_check_intercept_param(s, pc_start, type, 0); }
C
qemu
0
CVE-2015-8952
https://www.cvedetails.com/cve/CVE-2015-8952/
CWE-19
https://github.com/torvalds/linux/commit/be0726d33cb8f411945884664924bed3cb8c70ee
be0726d33cb8f411945884664924bed3cb8c70ee
ext2: convert to mbcache2 The conversion is generally straightforward. We convert filesystem from a global cache to per-fs one. Similarly to ext4 the tricky part is that xattr block corresponding to found mbcache entry can get freed before we get buffer lock for that block. So we have to check whether the entry is still valid after getting the buffer lock. Signed-off-by: Jan Kara <[email protected]> Signed-off-by: Theodore Ts'o <[email protected]>
static void init_once(void *foo) { struct ext2_inode_info *ei = (struct ext2_inode_info *) foo; rwlock_init(&ei->i_meta_lock); #ifdef CONFIG_EXT2_FS_XATTR init_rwsem(&ei->xattr_sem); #endif mutex_init(&ei->truncate_mutex); #ifdef CONFIG_FS_DAX init_rwsem(&ei->dax_sem); #endif inode_init_once(&ei->vfs_inode); }
static void init_once(void *foo) { struct ext2_inode_info *ei = (struct ext2_inode_info *) foo; rwlock_init(&ei->i_meta_lock); #ifdef CONFIG_EXT2_FS_XATTR init_rwsem(&ei->xattr_sem); #endif mutex_init(&ei->truncate_mutex); #ifdef CONFIG_FS_DAX init_rwsem(&ei->dax_sem); #endif inode_init_once(&ei->vfs_inode); }
C
linux
0
CVE-2013-2141
https://www.cvedetails.com/cve/CVE-2013-2141/
CWE-399
https://github.com/torvalds/linux/commit/b9e146d8eb3b9ecae5086d373b50fa0c1f3e7f0f
b9e146d8eb3b9ecae5086d373b50fa0c1f3e7f0f
kernel/signal.c: stop info leak via the tkill and the tgkill syscalls This fixes a kernel memory contents leak via the tkill and tgkill syscalls for compat processes. This is visible in the siginfo_t->_sifields._rt.si_sigval.sival_ptr field when handling signals delivered from tkill. The place of the infoleak: int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) { ... put_user_ex(ptr_to_compat(from->si_ptr), &to->si_ptr); ... } Signed-off-by: Emese Revfy <[email protected]> Reviewed-by: PaX Team <[email protected]> Signed-off-by: Kees Cook <[email protected]> Cc: Al Viro <[email protected]> Cc: Oleg Nesterov <[email protected]> Cc: "Eric W. Biederman" <[email protected]> Cc: Serge Hallyn <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
void signal_delivered(int sig, siginfo_t *info, struct k_sigaction *ka, struct pt_regs *regs, int stepping) { sigset_t blocked; /* A signal was successfully delivered, and the saved sigmask was stored on the signal frame, and will be restored by sigreturn. So we can simply clear the restore sigmask flag. */ clear_restore_sigmask(); sigorsets(&blocked, &current->blocked, &ka->sa.sa_mask); if (!(ka->sa.sa_flags & SA_NODEFER)) sigaddset(&blocked, sig); set_current_blocked(&blocked); tracehook_signal_handler(sig, info, ka, regs, stepping); }
void signal_delivered(int sig, siginfo_t *info, struct k_sigaction *ka, struct pt_regs *regs, int stepping) { sigset_t blocked; /* A signal was successfully delivered, and the saved sigmask was stored on the signal frame, and will be restored by sigreturn. So we can simply clear the restore sigmask flag. */ clear_restore_sigmask(); sigorsets(&blocked, &current->blocked, &ka->sa.sa_mask); if (!(ka->sa.sa_flags & SA_NODEFER)) sigaddset(&blocked, sig); set_current_blocked(&blocked); tracehook_signal_handler(sig, info, ka, regs, stepping); }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/acae973ac6297404fe3c9b389b69bf3c7e62cd19
acae973ac6297404fe3c9b389b69bf3c7e62cd19
2009-07-24 Jian Li <[email protected]> Reviewed by Eric Seidel. [V8] More V8 bindings changes to use ErrorEvent. https://bugs.webkit.org/show_bug.cgi?id=27630 * bindings/v8/DOMObjectsInclude.h: * bindings/v8/DerivedSourcesAllInOne.cpp: * bindings/v8/V8DOMWrapper.cpp: (WebCore::V8DOMWrapper::convertEventToV8Object): * bindings/v8/V8Index.cpp: * bindings/v8/V8Index.h: git-svn-id: svn://svn.chromium.org/blink/trunk@46360 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void V8DOMWrapper::setDOMWrapper(v8::Handle<v8::Object> object, int type, void* cptr) { ASSERT(object->InternalFieldCount() >= 2); object->SetPointerInInternalField(V8Custom::kDOMWrapperObjectIndex, cptr); object->SetInternalField(V8Custom::kDOMWrapperTypeIndex, v8::Integer::New(type)); }
void V8DOMWrapper::setDOMWrapper(v8::Handle<v8::Object> object, int type, void* cptr) { ASSERT(object->InternalFieldCount() >= 2); object->SetPointerInInternalField(V8Custom::kDOMWrapperObjectIndex, cptr); object->SetInternalField(V8Custom::kDOMWrapperTypeIndex, v8::Integer::New(type)); }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/51dfe5e3b332bcea02fb4d4c7493ae841106dd9b
51dfe5e3b332bcea02fb4d4c7493ae841106dd9b
Add ALSA support to volume keys If PulseAudio is running, everything should behave as before, otherwise use ALSA API for adjusting volume. The previous PulseAudioMixer was split into AudioMixerBase and audioMixerPusle, then AudioMixerAlsa was added. BUG=chromium-os:10470 TEST=Volume keys should work even if pulseaudio disabled Review URL: http://codereview.chromium.org/5859003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71115 0039d316-1c4b-4281-b951-d872f2087c98
void AudioHandler::AdjustVolumeByPercent(double adjust_by_percent) { if (!VerifyMixerConnection()) return; DVLOG(1) << "Adjusting Volume by " << adjust_by_percent << " percent"; double volume = mixer_->GetVolumeDb(); double pct = VolumeDbToPercent(volume); if (pct < 0) pct = 0; pct = pct + adjust_by_percent; if (pct > 100.0) pct = 100.0; double new_volume; if (pct <= 0.1) new_volume = AudioMixer::kSilenceDb; else new_volume = PercentToVolumeDb(pct); if (new_volume != volume) mixer_->SetVolumeDb(new_volume); }
void AudioHandler::AdjustVolumeByPercent(double adjust_by_percent) { if (!VerifyMixerConnection()) return; DVLOG(1) << "Adjusting Volume by " << adjust_by_percent << " percent"; double volume = mixer_->GetVolumeDb(); double pct = VolumeDbToPercent(volume); if (pct < 0) pct = 0; pct = pct + adjust_by_percent; if (pct > 100.0) pct = 100.0; double new_volume; if (pct <= 0.1) new_volume = kSilenceDb; else new_volume = PercentToVolumeDb(pct); if (new_volume != volume) mixer_->SetVolumeDb(new_volume); }
C
Chrome
1
CVE-2017-5120
https://www.cvedetails.com/cve/CVE-2017-5120/
null
https://github.com/chromium/chromium/commit/b7277af490d28ac7f802c015bb0ff31395768556
b7277af490d28ac7f802c015bb0ff31395768556
bindings: Support "attribute FrozenArray<T>?" Adds a quick hack to support a case of "attribute FrozenArray<T>?". Bug: 1028047 Change-Id: Ib3cecc4beb6bcc0fb0dbc667aca595454cc90c86 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1933866 Reviewed-by: Hitoshi Yoshida <[email protected]> Commit-Queue: Yuki Shiino <[email protected]> Cr-Commit-Position: refs/heads/master@{#718676}
void V8TestObject::ReflectUnsignedShortAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_reflectUnsignedShortAttribute_Getter"); test_object_v8_internal::ReflectUnsignedShortAttributeAttributeGetter(info); }
void V8TestObject::ReflectUnsignedShortAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_reflectUnsignedShortAttribute_Getter"); test_object_v8_internal::ReflectUnsignedShortAttributeAttributeGetter(info); }
C
Chrome
0
CVE-2013-4588
https://www.cvedetails.com/cve/CVE-2013-4588/
CWE-119
https://github.com/torvalds/linux/commit/04bcef2a83f40c6db24222b27a52892cba39dffb
04bcef2a83f40c6db24222b27a52892cba39dffb
ipvs: Add boundary check on ioctl arguments The ipvs code has a nifty system for doing the size of ioctl command copies; it defines an array with values into which it indexes the cmd to find the right length. Unfortunately, the ipvs code forgot to check if the cmd was in the range that the array provides, allowing for an index outside of the array, which then gives a "garbage" result into the length, which then gets used for copying into a stack buffer. Fix this by adding sanity checks on these as well as the copy size. [ [email protected]: adjusted limit to IP_VS_SO_GET_MAX ] Signed-off-by: Arjan van de Ven <[email protected]> Acked-by: Julian Anastasov <[email protected]> Signed-off-by: Simon Horman <[email protected]> Signed-off-by: Patrick McHardy <[email protected]>
static int ip_vs_genl_dump_daemons(struct sk_buff *skb, struct netlink_callback *cb) { mutex_lock(&__ip_vs_mutex); if ((ip_vs_sync_state & IP_VS_STATE_MASTER) && !cb->args[0]) { if (ip_vs_genl_dump_daemon(skb, IP_VS_STATE_MASTER, ip_vs_master_mcast_ifn, ip_vs_master_syncid, cb) < 0) goto nla_put_failure; cb->args[0] = 1; } if ((ip_vs_sync_state & IP_VS_STATE_BACKUP) && !cb->args[1]) { if (ip_vs_genl_dump_daemon(skb, IP_VS_STATE_BACKUP, ip_vs_backup_mcast_ifn, ip_vs_backup_syncid, cb) < 0) goto nla_put_failure; cb->args[1] = 1; } nla_put_failure: mutex_unlock(&__ip_vs_mutex); return skb->len; }
static int ip_vs_genl_dump_daemons(struct sk_buff *skb, struct netlink_callback *cb) { mutex_lock(&__ip_vs_mutex); if ((ip_vs_sync_state & IP_VS_STATE_MASTER) && !cb->args[0]) { if (ip_vs_genl_dump_daemon(skb, IP_VS_STATE_MASTER, ip_vs_master_mcast_ifn, ip_vs_master_syncid, cb) < 0) goto nla_put_failure; cb->args[0] = 1; } if ((ip_vs_sync_state & IP_VS_STATE_BACKUP) && !cb->args[1]) { if (ip_vs_genl_dump_daemon(skb, IP_VS_STATE_BACKUP, ip_vs_backup_mcast_ifn, ip_vs_backup_syncid, cb) < 0) goto nla_put_failure; cb->args[1] = 1; } nla_put_failure: mutex_unlock(&__ip_vs_mutex); return skb->len; }
C
linux
0
CVE-2014-3645
https://www.cvedetails.com/cve/CVE-2014-3645/
CWE-20
https://github.com/torvalds/linux/commit/bfd0a56b90005f8c8a004baf407ad90045c2b11e
bfd0a56b90005f8c8a004baf407ad90045c2b11e
nEPT: Nested INVEPT If we let L1 use EPT, we should probably also support the INVEPT instruction. In our current nested EPT implementation, when L1 changes its EPT table for L2 (i.e., EPT12), L0 modifies the shadow EPT table (EPT02), and in the course of this modification already calls INVEPT. But if last level of shadow page is unsync not all L1's changes to EPT12 are intercepted, which means roots need to be synced when L1 calls INVEPT. Global INVEPT should not be different since roots are synced by kvm_mmu_load() each time EPTP02 changes. Reviewed-by: Xiao Guangrong <[email protected]> Signed-off-by: Nadav Har'El <[email protected]> Signed-off-by: Jun Nakajima <[email protected]> Signed-off-by: Xinhao Xu <[email protected]> Signed-off-by: Yang Zhang <[email protected]> Signed-off-by: Gleb Natapov <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
static int paging64_init_context(struct kvm_vcpu *vcpu, struct kvm_mmu *context) { return paging64_init_context_common(vcpu, context, PT64_ROOT_LEVEL); }
static int paging64_init_context(struct kvm_vcpu *vcpu, struct kvm_mmu *context) { return paging64_init_context_common(vcpu, context, PT64_ROOT_LEVEL); }
C
linux
0
CVE-2017-9310
https://www.cvedetails.com/cve/CVE-2017-9310/
CWE-835
https://git.qemu.org/?p=qemu.git;a=commitdiff;h=4154c7e03fa55b4cf52509a83d50d6c09d743b7
4154c7e03fa55b4cf52509a83d50d6c09d743b77
null
e1000e_process_tx_desc(E1000ECore *core, struct e1000e_tx *tx, struct e1000_tx_desc *dp, int queue_index) { uint32_t txd_lower = le32_to_cpu(dp->lower.data); uint32_t dtype = txd_lower & (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D); unsigned int split_size = txd_lower & 0xffff; uint64_t addr; struct e1000_context_desc *xp = (struct e1000_context_desc *)dp; bool eop = txd_lower & E1000_TXD_CMD_EOP; if (dtype == E1000_TXD_CMD_DEXT) { /* context descriptor */ e1000x_read_tx_ctx_descr(xp, &tx->props); e1000e_process_snap_option(core, le32_to_cpu(xp->cmd_and_length)); return; } else if (dtype == (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D)) { /* data descriptor */ tx->props.sum_needed = le32_to_cpu(dp->upper.data) >> 8; tx->props.cptse = (txd_lower & E1000_TXD_CMD_TSE) ? 1 : 0; e1000e_process_ts_option(core, dp); } else { /* legacy descriptor */ e1000e_process_ts_option(core, dp); tx->props.cptse = 0; } addr = le64_to_cpu(dp->buffer_addr); if (!tx->skip_cp) { if (!net_tx_pkt_add_raw_fragment(tx->tx_pkt, addr, split_size)) { tx->skip_cp = true; } } if (eop) { if (!tx->skip_cp && net_tx_pkt_parse(tx->tx_pkt)) { if (e1000x_vlan_enabled(core->mac) && e1000x_is_vlan_txd(txd_lower)) { net_tx_pkt_setup_vlan_header_ex(tx->tx_pkt, le16_to_cpu(dp->upper.fields.special), core->vet); } if (e1000e_tx_pkt_send(core, tx, queue_index)) { e1000e_on_tx_done_update_stats(core, tx->tx_pkt); } } tx->skip_cp = false; net_tx_pkt_reset(tx->tx_pkt); tx->props.sum_needed = 0; tx->props.cptse = 0; } }
e1000e_process_tx_desc(E1000ECore *core, struct e1000e_tx *tx, struct e1000_tx_desc *dp, int queue_index) { uint32_t txd_lower = le32_to_cpu(dp->lower.data); uint32_t dtype = txd_lower & (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D); unsigned int split_size = txd_lower & 0xffff; uint64_t addr; struct e1000_context_desc *xp = (struct e1000_context_desc *)dp; bool eop = txd_lower & E1000_TXD_CMD_EOP; if (dtype == E1000_TXD_CMD_DEXT) { /* context descriptor */ e1000x_read_tx_ctx_descr(xp, &tx->props); e1000e_process_snap_option(core, le32_to_cpu(xp->cmd_and_length)); return; } else if (dtype == (E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D)) { /* data descriptor */ tx->props.sum_needed = le32_to_cpu(dp->upper.data) >> 8; tx->props.cptse = (txd_lower & E1000_TXD_CMD_TSE) ? 1 : 0; e1000e_process_ts_option(core, dp); } else { /* legacy descriptor */ e1000e_process_ts_option(core, dp); tx->props.cptse = 0; } addr = le64_to_cpu(dp->buffer_addr); if (!tx->skip_cp) { if (!net_tx_pkt_add_raw_fragment(tx->tx_pkt, addr, split_size)) { tx->skip_cp = true; } } if (eop) { if (!tx->skip_cp && net_tx_pkt_parse(tx->tx_pkt)) { if (e1000x_vlan_enabled(core->mac) && e1000x_is_vlan_txd(txd_lower)) { net_tx_pkt_setup_vlan_header_ex(tx->tx_pkt, le16_to_cpu(dp->upper.fields.special), core->vet); } if (e1000e_tx_pkt_send(core, tx, queue_index)) { e1000e_on_tx_done_update_stats(core, tx->tx_pkt); } } tx->skip_cp = false; net_tx_pkt_reset(tx->tx_pkt); tx->props.sum_needed = 0; tx->props.cptse = 0; } }
C
qemu
0
CVE-2011-3055
https://www.cvedetails.com/cve/CVE-2011-3055/
null
https://github.com/chromium/chromium/commit/e9372a1bfd3588a80fcf49aa07321f0971dd6091
e9372a1bfd3588a80fcf49aa07321f0971dd6091
[V8] Pass Isolate to throwNotEnoughArgumentsError() https://bugs.webkit.org/show_bug.cgi?id=86983 Reviewed by Adam Barth. The objective is to pass Isolate around in V8 bindings. This patch passes Isolate to throwNotEnoughArgumentsError(). No tests. No change in behavior. * bindings/scripts/CodeGeneratorV8.pm: (GenerateArgumentsCountCheck): (GenerateEventConstructorCallback): * bindings/scripts/test/V8/V8Float64Array.cpp: (WebCore::Float64ArrayV8Internal::fooCallback): * bindings/scripts/test/V8/V8TestActiveDOMObject.cpp: (WebCore::TestActiveDOMObjectV8Internal::excitingFunctionCallback): (WebCore::TestActiveDOMObjectV8Internal::postMessageCallback): * bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp: (WebCore::TestCustomNamedGetterV8Internal::anotherFunctionCallback): * bindings/scripts/test/V8/V8TestEventConstructor.cpp: (WebCore::V8TestEventConstructor::constructorCallback): * bindings/scripts/test/V8/V8TestEventTarget.cpp: (WebCore::TestEventTargetV8Internal::itemCallback): (WebCore::TestEventTargetV8Internal::dispatchEventCallback): * bindings/scripts/test/V8/V8TestInterface.cpp: (WebCore::TestInterfaceV8Internal::supplementalMethod2Callback): (WebCore::V8TestInterface::constructorCallback): * bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp: (WebCore::TestMediaQueryListListenerV8Internal::methodCallback): * bindings/scripts/test/V8/V8TestNamedConstructor.cpp: (WebCore::V8TestNamedConstructorConstructorCallback): * bindings/scripts/test/V8/V8TestObj.cpp: (WebCore::TestObjV8Internal::voidMethodWithArgsCallback): (WebCore::TestObjV8Internal::intMethodWithArgsCallback): (WebCore::TestObjV8Internal::objMethodWithArgsCallback): (WebCore::TestObjV8Internal::methodWithSequenceArgCallback): (WebCore::TestObjV8Internal::methodReturningSequenceCallback): (WebCore::TestObjV8Internal::methodThatRequiresAllArgsAndThrowsCallback): (WebCore::TestObjV8Internal::serializedValueCallback): (WebCore::TestObjV8Internal::idbKeyCallback): (WebCore::TestObjV8Internal::optionsObjectCallback): (WebCore::TestObjV8Internal::methodWithNonOptionalArgAndOptionalArgCallback): (WebCore::TestObjV8Internal::methodWithNonOptionalArgAndTwoOptionalArgsCallback): (WebCore::TestObjV8Internal::methodWithCallbackArgCallback): (WebCore::TestObjV8Internal::methodWithNonCallbackArgAndCallbackArgCallback): (WebCore::TestObjV8Internal::overloadedMethod1Callback): (WebCore::TestObjV8Internal::overloadedMethod2Callback): (WebCore::TestObjV8Internal::overloadedMethod3Callback): (WebCore::TestObjV8Internal::overloadedMethod4Callback): (WebCore::TestObjV8Internal::overloadedMethod5Callback): (WebCore::TestObjV8Internal::overloadedMethod6Callback): (WebCore::TestObjV8Internal::overloadedMethod7Callback): (WebCore::TestObjV8Internal::overloadedMethod11Callback): (WebCore::TestObjV8Internal::overloadedMethod12Callback): (WebCore::TestObjV8Internal::enabledAtRuntimeMethod1Callback): (WebCore::TestObjV8Internal::enabledAtRuntimeMethod2Callback): (WebCore::TestObjV8Internal::convert1Callback): (WebCore::TestObjV8Internal::convert2Callback): (WebCore::TestObjV8Internal::convert3Callback): (WebCore::TestObjV8Internal::convert4Callback): (WebCore::TestObjV8Internal::convert5Callback): (WebCore::TestObjV8Internal::strictFunctionCallback): (WebCore::V8TestObj::constructorCallback): * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp: (WebCore::TestSerializedScriptValueInterfaceV8Internal::acceptTransferListCallback): (WebCore::V8TestSerializedScriptValueInterface::constructorCallback): * bindings/v8/ScriptController.cpp: (WebCore::setValueAndClosePopupCallback): * bindings/v8/V8Proxy.cpp: (WebCore::V8Proxy::throwNotEnoughArgumentsError): * bindings/v8/V8Proxy.h: (V8Proxy): * bindings/v8/custom/V8AudioContextCustom.cpp: (WebCore::V8AudioContext::constructorCallback): * bindings/v8/custom/V8DataViewCustom.cpp: (WebCore::V8DataView::getInt8Callback): (WebCore::V8DataView::getUint8Callback): (WebCore::V8DataView::setInt8Callback): (WebCore::V8DataView::setUint8Callback): * bindings/v8/custom/V8DirectoryEntryCustom.cpp: (WebCore::V8DirectoryEntry::getDirectoryCallback): (WebCore::V8DirectoryEntry::getFileCallback): * bindings/v8/custom/V8IntentConstructor.cpp: (WebCore::V8Intent::constructorCallback): * bindings/v8/custom/V8SVGLengthCustom.cpp: (WebCore::V8SVGLength::convertToSpecifiedUnitsCallback): * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp: (WebCore::getObjectParameter): (WebCore::V8WebGLRenderingContext::getAttachedShadersCallback): (WebCore::V8WebGLRenderingContext::getExtensionCallback): (WebCore::V8WebGLRenderingContext::getFramebufferAttachmentParameterCallback): (WebCore::V8WebGLRenderingContext::getParameterCallback): (WebCore::V8WebGLRenderingContext::getProgramParameterCallback): (WebCore::V8WebGLRenderingContext::getShaderParameterCallback): (WebCore::V8WebGLRenderingContext::getUniformCallback): (WebCore::vertexAttribAndUniformHelperf): (WebCore::uniformHelperi): (WebCore::uniformMatrixHelper): * bindings/v8/custom/V8WebKitMutationObserverCustom.cpp: (WebCore::V8WebKitMutationObserver::constructorCallback): (WebCore::V8WebKitMutationObserver::observeCallback): * bindings/v8/custom/V8WebSocketCustom.cpp: (WebCore::V8WebSocket::constructorCallback): (WebCore::V8WebSocket::sendCallback): * bindings/v8/custom/V8XMLHttpRequestCustom.cpp: (WebCore::V8XMLHttpRequest::openCallback): git-svn-id: svn://svn.chromium.org/blink/trunk@117736 bbb929c8-8fbe-4397-9dbb-9b2b20218538
static v8::Handle<v8::Value> conditionalAttr2AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.TestObj.conditionalAttr2._get"); TestObj* imp = V8TestObj::toNative(info.Holder()); return v8::Integer::New(imp->conditionalAttr2()); }
static v8::Handle<v8::Value> conditionalAttr2AttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.TestObj.conditionalAttr2._get"); TestObj* imp = V8TestObj::toNative(info.Holder()); return v8::Integer::New(imp->conditionalAttr2()); }
C
Chrome
0
CVE-2018-6121
https://www.cvedetails.com/cve/CVE-2018-6121/
CWE-20
https://github.com/chromium/chromium/commit/7614790c80996d32a28218f4d1605b0908e9ddf6
7614790c80996d32a28218f4d1605b0908e9ddf6
Apply ExtensionNavigationThrottle filesystem/blob checks to all frames. BUG=836858 Change-Id: I34333a72501129fd40b5a9aa6378c9f35f1e7fc2 Reviewed-on: https://chromium-review.googlesource.com/1028511 Reviewed-by: Devlin <[email protected]> Reviewed-by: Alex Moshchuk <[email protected]> Reviewed-by: Nick Carter <[email protected]> Commit-Queue: Charlie Reis <[email protected]> Cr-Commit-Position: refs/heads/master@{#553867}
void RenderFrameHostImpl::OnRenderProcessGone(int status, int exit_code) { if (frame_tree_node_->IsMainFrame()) { render_view_host_->render_view_termination_status_ = static_cast<base::TerminationStatus>(status); } frame_tree_node_->ResetForNewProcess(); SetRenderFrameCreated(false); InvalidateMojoConnection(); document_scoped_interface_provider_binding_.Close(); SetLastCommittedUrl(GURL()); for (auto& iter : ax_tree_snapshot_callbacks_) std::move(iter.second).Run(ui::AXTreeUpdate()); #if defined(OS_ANDROID) for (base::IDMap<std::unique_ptr<ExtractSmartClipDataCallback>>::iterator iter(&smart_clip_callbacks_); !iter.IsAtEnd(); iter.Advance()) { std::move(*iter.GetCurrentValue()).Run(base::string16(), base::string16()); } smart_clip_callbacks_.Clear(); #endif // defined(OS_ANDROID) ax_tree_snapshot_callbacks_.clear(); javascript_callbacks_.clear(); visual_state_callbacks_.clear(); remote_associated_interfaces_.reset(); sudden_termination_disabler_types_enabled_ = 0; if (!is_active()) { OnSwappedOut(); } else { frame_tree_node_->render_manager()->CancelPendingIfNecessary(this); } }
void RenderFrameHostImpl::OnRenderProcessGone(int status, int exit_code) { if (frame_tree_node_->IsMainFrame()) { render_view_host_->render_view_termination_status_ = static_cast<base::TerminationStatus>(status); } frame_tree_node_->ResetForNewProcess(); SetRenderFrameCreated(false); InvalidateMojoConnection(); document_scoped_interface_provider_binding_.Close(); SetLastCommittedUrl(GURL()); for (auto& iter : ax_tree_snapshot_callbacks_) std::move(iter.second).Run(ui::AXTreeUpdate()); #if defined(OS_ANDROID) for (base::IDMap<std::unique_ptr<ExtractSmartClipDataCallback>>::iterator iter(&smart_clip_callbacks_); !iter.IsAtEnd(); iter.Advance()) { std::move(*iter.GetCurrentValue()).Run(base::string16(), base::string16()); } smart_clip_callbacks_.Clear(); #endif // defined(OS_ANDROID) ax_tree_snapshot_callbacks_.clear(); javascript_callbacks_.clear(); visual_state_callbacks_.clear(); remote_associated_interfaces_.reset(); sudden_termination_disabler_types_enabled_ = 0; if (!is_active()) { OnSwappedOut(); } else { frame_tree_node_->render_manager()->CancelPendingIfNecessary(this); } }
C
Chrome
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_METHOD(CURLFile, __wakeup) { zval *_this = getThis(); zend_unset_property(curl_CURLFile_class, _this, "name", sizeof("name")-1 TSRMLS_CC); zend_update_property_string(curl_CURLFile_class, _this, "name", sizeof("name")-1, "" TSRMLS_CC); zend_throw_exception(NULL, "Unserialization of CURLFile instances is not allowed", 0 TSRMLS_CC); }
ZEND_METHOD(CURLFile, __wakeup) { zend_update_property_string(curl_CURLFile_class, getThis(), "name", sizeof("name")-1, "" TSRMLS_CC); zend_throw_exception(NULL, "Unserialization of CURLFile instances is not allowed", 0 TSRMLS_CC); }
C
php
1
CVE-2016-3826
https://www.cvedetails.com/cve/CVE-2016-3826/
CWE-20
https://android.googlesource.com/platform/frameworks/av/+/9cd8c3289c91254b3955bd7347cf605d6fa032c6
9cd8c3289c91254b3955bd7347cf605d6fa032c6
Check effect command reply size in AudioFlinger Bug: 29251553 Change-Id: I1bcc1281f1f0542bb645f6358ce31631f2a8ffbf
size_t AudioFlinger::EffectChain::removeEffect_l(const sp<EffectModule>& effect) { Mutex::Autolock _l(mLock); size_t size = mEffects.size(); uint32_t type = effect->desc().flags & EFFECT_FLAG_TYPE_MASK; for (size_t i = 0; i < size; i++) { if (effect == mEffects[i]) { if (mEffects[i]->state() == EffectModule::ACTIVE || mEffects[i]->state() == EffectModule::STOPPING) { mEffects[i]->stop(); } if (type == EFFECT_FLAG_TYPE_AUXILIARY) { delete[] effect->inBuffer(); } else { if (i == size - 1 && i != 0) { mEffects[i - 1]->setOutBuffer(mOutBuffer); mEffects[i - 1]->configure(); } } mEffects.removeAt(i); ALOGV("removeEffect_l() effect %p, removed from chain %p at rank %d", effect.get(), this, i); break; } } return mEffects.size(); }
size_t AudioFlinger::EffectChain::removeEffect_l(const sp<EffectModule>& effect) { Mutex::Autolock _l(mLock); size_t size = mEffects.size(); uint32_t type = effect->desc().flags & EFFECT_FLAG_TYPE_MASK; for (size_t i = 0; i < size; i++) { if (effect == mEffects[i]) { if (mEffects[i]->state() == EffectModule::ACTIVE || mEffects[i]->state() == EffectModule::STOPPING) { mEffects[i]->stop(); } if (type == EFFECT_FLAG_TYPE_AUXILIARY) { delete[] effect->inBuffer(); } else { if (i == size - 1 && i != 0) { mEffects[i - 1]->setOutBuffer(mOutBuffer); mEffects[i - 1]->configure(); } } mEffects.removeAt(i); ALOGV("removeEffect_l() effect %p, removed from chain %p at rank %d", effect.get(), this, i); break; } } return mEffects.size(); }
C
Android
0
CVE-2013-7271
https://www.cvedetails.com/cve/CVE-2013-7271/
CWE-20
https://github.com/torvalds/linux/commit/f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
net: rework recvmsg handler msg_name and msg_namelen logic This patch now always passes msg->msg_namelen as 0. recvmsg handlers must set msg_namelen to the proper size <= sizeof(struct sockaddr_storage) to return msg_name to the user. This prevents numerous uninitialized memory leaks we had in the recvmsg handlers and makes it harder for new code to accidentally leak uninitialized memory. Optimize for the case recvfrom is called with NULL as address. We don't need to copy the address at all, so set it to NULL before invoking the recvmsg handler. We can do so, because all the recvmsg handlers must cope with the case a plain read() is called on them. read() also sets msg_name to NULL. Also document these changes in include/linux/net.h as suggested by David Miller. Changes since RFC: Set msg->msg_name = NULL if user specified a NULL in msg_name but had a non-null msg_namelen in verify_iovec/verify_compat_iovec. This doesn't affect sendto as it would bail out earlier while trying to copy-in the address. It also more naturally reflects the logic by the callers of verify_iovec. With this change in place I could remove " if (!uaddr || msg_sys->msg_namelen == 0) msg->msg_name = NULL ". This change does not alter the user visible error logic as we ignore msg_namelen as long as msg_name is NULL. Also remove two unnecessary curly brackets in ___sys_recvmsg and change comments to netdev style. Cc: David Miller <[email protected]> Suggested-by: Eric Dumazet <[email protected]> Signed-off-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static struct ipx_interface *ipxitf_auto_create(struct net_device *dev, __be16 dlink_type) { struct ipx_interface *intrfc = NULL; struct datalink_proto *datalink; if (!dev) goto out; /* Check addresses are suitable */ if (dev->addr_len > IPX_NODE_LEN) goto out; switch (ntohs(dlink_type)) { case ETH_P_IPX: datalink = pEII_datalink; break; case ETH_P_802_2: datalink = p8022_datalink; break; case ETH_P_SNAP: datalink = pSNAP_datalink; break; case ETH_P_802_3: datalink = p8023_datalink; break; default: goto out; } intrfc = ipxitf_alloc(dev, 0, dlink_type, datalink, 0, dev->hard_header_len + datalink->header_length); if (intrfc) { memset(intrfc->if_node, 0, IPX_NODE_LEN); memcpy((char *)&(intrfc->if_node[IPX_NODE_LEN-dev->addr_len]), dev->dev_addr, dev->addr_len); spin_lock_init(&intrfc->if_sklist_lock); atomic_set(&intrfc->refcnt, 1); ipxitf_insert(intrfc); dev_hold(dev); } out: return intrfc; }
static struct ipx_interface *ipxitf_auto_create(struct net_device *dev, __be16 dlink_type) { struct ipx_interface *intrfc = NULL; struct datalink_proto *datalink; if (!dev) goto out; /* Check addresses are suitable */ if (dev->addr_len > IPX_NODE_LEN) goto out; switch (ntohs(dlink_type)) { case ETH_P_IPX: datalink = pEII_datalink; break; case ETH_P_802_2: datalink = p8022_datalink; break; case ETH_P_SNAP: datalink = pSNAP_datalink; break; case ETH_P_802_3: datalink = p8023_datalink; break; default: goto out; } intrfc = ipxitf_alloc(dev, 0, dlink_type, datalink, 0, dev->hard_header_len + datalink->header_length); if (intrfc) { memset(intrfc->if_node, 0, IPX_NODE_LEN); memcpy((char *)&(intrfc->if_node[IPX_NODE_LEN-dev->addr_len]), dev->dev_addr, dev->addr_len); spin_lock_init(&intrfc->if_sklist_lock); atomic_set(&intrfc->refcnt, 1); ipxitf_insert(intrfc); dev_hold(dev); } out: return intrfc; }
C
linux
0
CVE-2014-0203
https://www.cvedetails.com/cve/CVE-2014-0203/
CWE-20
https://github.com/torvalds/linux/commit/86acdca1b63e6890540fa19495cfc708beff3d8b
86acdca1b63e6890540fa19495cfc708beff3d8b
fix autofs/afs/etc. magic mountpoint breakage We end up trying to kfree() nd.last.name on open("/mnt/tmp", O_CREAT) if /mnt/tmp is an autofs direct mount. The reason is that nd.last_type is bogus here; we want LAST_BIND for everything of that kind and we get LAST_NORM left over from finding parent directory. So make sure that it *is* set properly; set to LAST_BIND before doing ->follow_link() - for normal symlinks it will be changed by __vfs_follow_link() and everything else needs it set that way. Signed-off-by: Al Viro <[email protected]>
static struct dentry *__lookup_hash(struct qstr *name, struct dentry *base, struct nameidata *nd) { struct dentry *dentry; struct inode *inode; int err; inode = base->d_inode; /* * See if the low-level filesystem might want * to use its own hash.. */ if (base->d_op && base->d_op->d_hash) { err = base->d_op->d_hash(base, name); dentry = ERR_PTR(err); if (err < 0) goto out; } dentry = __d_lookup(base, name); /* lockess __d_lookup may fail due to concurrent d_move() * in some unrelated directory, so try with d_lookup */ if (!dentry) dentry = d_lookup(base, name); if (dentry && dentry->d_op && dentry->d_op->d_revalidate) dentry = do_revalidate(dentry, nd); if (!dentry) { struct dentry *new; /* Don't create child dentry for a dead directory. */ dentry = ERR_PTR(-ENOENT); if (IS_DEADDIR(inode)) goto out; new = d_alloc(base, name); dentry = ERR_PTR(-ENOMEM); if (!new) goto out; dentry = inode->i_op->lookup(inode, new, nd); if (!dentry) dentry = new; else dput(new); } out: return dentry; }
static struct dentry *__lookup_hash(struct qstr *name, struct dentry *base, struct nameidata *nd) { struct dentry *dentry; struct inode *inode; int err; inode = base->d_inode; /* * See if the low-level filesystem might want * to use its own hash.. */ if (base->d_op && base->d_op->d_hash) { err = base->d_op->d_hash(base, name); dentry = ERR_PTR(err); if (err < 0) goto out; } dentry = __d_lookup(base, name); /* lockess __d_lookup may fail due to concurrent d_move() * in some unrelated directory, so try with d_lookup */ if (!dentry) dentry = d_lookup(base, name); if (dentry && dentry->d_op && dentry->d_op->d_revalidate) dentry = do_revalidate(dentry, nd); if (!dentry) { struct dentry *new; /* Don't create child dentry for a dead directory. */ dentry = ERR_PTR(-ENOENT); if (IS_DEADDIR(inode)) goto out; new = d_alloc(base, name); dentry = ERR_PTR(-ENOMEM); if (!new) goto out; dentry = inode->i_op->lookup(inode, new, nd); if (!dentry) dentry = new; else dput(new); } out: return dentry; }
C
linux
0
CVE-2016-3839
https://www.cvedetails.com/cve/CVE-2016-3839/
CWE-284
https://android.googlesource.com/platform/system/bt/+/472271b153c5dc53c28beac55480a8d8434b2d5c
472271b153c5dc53c28beac55480a8d8434b2d5c
DO NOT MERGE Fix potential DoS caused by delivering signal to BT process Bug: 28885210 Change-Id: I63866d894bfca47464d6e42e3fb0357c4f94d360 Conflicts: btif/co/bta_hh_co.c btif/src/btif_core.c Merge conflict resolution of ag/1161415 (referencing ag/1164670) - Directly into mnc-mr2-release
static void uipc_flush_locked(tUIPC_CH_ID ch_id) { if (ch_id >= UIPC_CH_NUM) return; switch(ch_id) { case UIPC_CH_ID_AV_CTRL: uipc_flush_ch_locked(UIPC_CH_ID_AV_CTRL); break; case UIPC_CH_ID_AV_AUDIO: uipc_flush_ch_locked(UIPC_CH_ID_AV_AUDIO); break; } }
static void uipc_flush_locked(tUIPC_CH_ID ch_id) { if (ch_id >= UIPC_CH_NUM) return; switch(ch_id) { case UIPC_CH_ID_AV_CTRL: uipc_flush_ch_locked(UIPC_CH_ID_AV_CTRL); break; case UIPC_CH_ID_AV_AUDIO: uipc_flush_ch_locked(UIPC_CH_ID_AV_AUDIO); break; } }
C
Android
0
CVE-2018-12714
https://www.cvedetails.com/cve/CVE-2018-12714/
CWE-787
https://github.com/torvalds/linux/commit/81f9c4e4177d31ced6f52a89bb70e93bfb77ca03
81f9c4e4177d31ced6f52a89bb70e93bfb77ca03
Merge tag 'trace-v4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace Pull tracing fixes from Steven Rostedt: "This contains a few fixes and a clean up. - a bad merge caused an "endif" to go in the wrong place in scripts/Makefile.build - softirq tracing fix for tracing that corrupts lockdep and causes a false splat - histogram documentation typo fixes - fix a bad memory reference when passing in no filter to the filter code - simplify code by using the swap macro instead of open coding the swap" * tag 'trace-v4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: tracing: Fix SKIP_STACK_VALIDATION=1 build due to bad merge with -mrecord-mcount tracing: Fix some errors in histogram documentation tracing: Use swap macro in update_max_tr softirq: Reorder trace_softirqs_on to prevent lockdep splat tracing: Check for no filter when processing event filters
static void *saved_cmdlines_start(struct seq_file *m, loff_t *pos) { void *v; loff_t l = 0; preempt_disable(); arch_spin_lock(&trace_cmdline_lock); v = &savedcmd->map_cmdline_to_pid[0]; while (l <= *pos) { v = saved_cmdlines_next(m, v, &l); if (!v) return NULL; } return v; }
static void *saved_cmdlines_start(struct seq_file *m, loff_t *pos) { void *v; loff_t l = 0; preempt_disable(); arch_spin_lock(&trace_cmdline_lock); v = &savedcmd->map_cmdline_to_pid[0]; while (l <= *pos) { v = saved_cmdlines_next(m, v, &l); if (!v) return NULL; } return v; }
C
linux
0
CVE-2017-12877
https://www.cvedetails.com/cve/CVE-2017-12877/
CWE-416
https://github.com/ImageMagick/ImageMagick/commit/04178de2247e353fc095846784b9a10fefdbf890
04178de2247e353fc095846784b9a10fefdbf890
https://github.com/ImageMagick/ImageMagick/issues/662
static Image *decompress_block(Image *orig, unsigned int *Size, ImageInfo *clone_info, ExceptionInfo *exception) { Image *image2; void *cache_block, *decompress_block; z_stream zip_info; FILE *mat_file; size_t magick_size; size_t extent; int file; int status; int zip_status; ssize_t TotalSize = 0; if(clone_info==NULL) return NULL; if(clone_info->file) /* Close file opened from previous transaction. */ { fclose(clone_info->file); clone_info->file = NULL; (void) remove_utf8(clone_info->filename); } cache_block = AcquireQuantumMemory((size_t)(*Size < 16384) ? *Size: 16384,sizeof(unsigned char *)); if(cache_block==NULL) return NULL; decompress_block = AcquireQuantumMemory((size_t)(4096),sizeof(unsigned char *)); if(decompress_block==NULL) { RelinquishMagickMemory(cache_block); return NULL; } mat_file=0; file = AcquireUniqueFileResource(clone_info->filename); if (file != -1) mat_file = fdopen(file,"w"); if(!mat_file) { RelinquishMagickMemory(cache_block); RelinquishMagickMemory(decompress_block); (void) LogMagickEvent(CoderEvent,GetMagickModule(),"Cannot create file stream for decompressed image"); return NULL; } zip_info.zalloc=AcquireZIPMemory; zip_info.zfree=RelinquishZIPMemory; zip_info.opaque = (voidpf) NULL; zip_status = inflateInit(&zip_info); if (zip_status != Z_OK) { RelinquishMagickMemory(cache_block); RelinquishMagickMemory(decompress_block); (void) ThrowMagickException(exception,GetMagickModule(),CorruptImageError, "UnableToUncompressImage","`%s'",clone_info->filename); (void) fclose(mat_file); RelinquishUniqueFileResource(clone_info->filename); return NULL; } /* zip_info.next_out = 8*4;*/ zip_info.avail_in = 0; zip_info.total_out = 0; while(*Size>0 && !EOFBlob(orig)) { magick_size = ReadBlob(orig, (*Size < 16384) ? *Size : 16384, (unsigned char *) cache_block); zip_info.next_in = (Bytef *) cache_block; zip_info.avail_in = (uInt) magick_size; while(zip_info.avail_in>0) { zip_info.avail_out = 4096; zip_info.next_out = (Bytef *) decompress_block; zip_status = inflate(&zip_info,Z_NO_FLUSH); if ((zip_status != Z_OK) && (zip_status != Z_STREAM_END)) break; extent=fwrite(decompress_block, 4096-zip_info.avail_out, 1, mat_file); (void) extent; TotalSize += 4096-zip_info.avail_out; if(zip_status == Z_STREAM_END) goto DblBreak; } if ((zip_status != Z_OK) && (zip_status != Z_STREAM_END)) break; *Size -= magick_size; } DblBreak: inflateEnd(&zip_info); (void)fclose(mat_file); RelinquishMagickMemory(cache_block); RelinquishMagickMemory(decompress_block); *Size = TotalSize; if((clone_info->file=fopen(clone_info->filename,"rb"))==NULL) goto UnlinkFile; if( (image2 = AcquireImage(clone_info,exception))==NULL ) goto EraseFile; status = OpenBlob(clone_info,image2,ReadBinaryBlobMode,exception); if (status == MagickFalse) { DeleteImageFromList(&image2); EraseFile: fclose(clone_info->file); clone_info->file = NULL; UnlinkFile: RelinquishUniqueFileResource(clone_info->filename); return NULL; } return image2; }
static Image *decompress_block(Image *orig, unsigned int *Size, ImageInfo *clone_info, ExceptionInfo *exception) { Image *image2; void *cache_block, *decompress_block; z_stream zip_info; FILE *mat_file; size_t magick_size; size_t extent; int file; int status; int zip_status; ssize_t TotalSize = 0; if(clone_info==NULL) return NULL; if(clone_info->file) /* Close file opened from previous transaction. */ { fclose(clone_info->file); clone_info->file = NULL; (void) remove_utf8(clone_info->filename); } cache_block = AcquireQuantumMemory((size_t)(*Size < 16384) ? *Size: 16384,sizeof(unsigned char *)); if(cache_block==NULL) return NULL; decompress_block = AcquireQuantumMemory((size_t)(4096),sizeof(unsigned char *)); if(decompress_block==NULL) { RelinquishMagickMemory(cache_block); return NULL; } mat_file=0; file = AcquireUniqueFileResource(clone_info->filename); if (file != -1) mat_file = fdopen(file,"w"); if(!mat_file) { RelinquishMagickMemory(cache_block); RelinquishMagickMemory(decompress_block); (void) LogMagickEvent(CoderEvent,GetMagickModule(),"Cannot create file stream for decompressed image"); return NULL; } zip_info.zalloc=AcquireZIPMemory; zip_info.zfree=RelinquishZIPMemory; zip_info.opaque = (voidpf) NULL; zip_status = inflateInit(&zip_info); if (zip_status != Z_OK) { RelinquishMagickMemory(cache_block); RelinquishMagickMemory(decompress_block); (void) ThrowMagickException(exception,GetMagickModule(),CorruptImageError, "UnableToUncompressImage","`%s'",clone_info->filename); (void) fclose(mat_file); RelinquishUniqueFileResource(clone_info->filename); return NULL; } /* zip_info.next_out = 8*4;*/ zip_info.avail_in = 0; zip_info.total_out = 0; while(*Size>0 && !EOFBlob(orig)) { magick_size = ReadBlob(orig, (*Size < 16384) ? *Size : 16384, (unsigned char *) cache_block); zip_info.next_in = (Bytef *) cache_block; zip_info.avail_in = (uInt) magick_size; while(zip_info.avail_in>0) { zip_info.avail_out = 4096; zip_info.next_out = (Bytef *) decompress_block; zip_status = inflate(&zip_info,Z_NO_FLUSH); if ((zip_status != Z_OK) && (zip_status != Z_STREAM_END)) break; extent=fwrite(decompress_block, 4096-zip_info.avail_out, 1, mat_file); (void) extent; TotalSize += 4096-zip_info.avail_out; if(zip_status == Z_STREAM_END) goto DblBreak; } if ((zip_status != Z_OK) && (zip_status != Z_STREAM_END)) break; *Size -= magick_size; } DblBreak: inflateEnd(&zip_info); (void)fclose(mat_file); RelinquishMagickMemory(cache_block); RelinquishMagickMemory(decompress_block); *Size = TotalSize; if((clone_info->file=fopen(clone_info->filename,"rb"))==NULL) goto UnlinkFile; if( (image2 = AcquireImage(clone_info,exception))==NULL ) goto EraseFile; status = OpenBlob(clone_info,image2,ReadBinaryBlobMode,exception); if (status == MagickFalse) { DeleteImageFromList(&image2); EraseFile: fclose(clone_info->file); clone_info->file = NULL; UnlinkFile: RelinquishUniqueFileResource(clone_info->filename); return NULL; } return image2; }
C
ImageMagick
0
CVE-2014-6269
https://www.cvedetails.com/cve/CVE-2014-6269/
CWE-189
https://git.haproxy.org/?p=haproxy-1.5.git;a=commitdiff;h=b4d05093bc89f71377230228007e69a1434c1a0c
b4d05093bc89f71377230228007e69a1434c1a0c
null
int apply_filter_to_req_line(struct session *s, struct channel *req, struct hdr_exp *exp) { char *cur_ptr, *cur_end; int done; struct http_txn *txn = &s->txn; int delta; if (unlikely(txn->flags & (TX_CLDENY | TX_CLTARPIT))) return 1; else if (unlikely(txn->flags & TX_CLALLOW) && (exp->action == ACT_ALLOW || exp->action == ACT_DENY || exp->action == ACT_TARPIT)) return 0; else if (exp->action == ACT_REMOVE) return 0; done = 0; cur_ptr = req->buf->p; cur_end = cur_ptr + txn->req.sl.rq.l; /* Now we have the request line between cur_ptr and cur_end */ if (regex_exec_match2(exp->preg, cur_ptr, cur_end-cur_ptr, MAX_MATCH, pmatch)) { switch (exp->action) { case ACT_SETBE: /* It is not possible to jump a second time. * FIXME: should we return an HTTP/500 here so that * the admin knows there's a problem ? */ if (s->be != s->fe) break; /* Swithing Proxy */ session_set_backend(s, (struct proxy *)exp->replace); done = 1; break; case ACT_ALLOW: txn->flags |= TX_CLALLOW; done = 1; break; case ACT_DENY: txn->flags |= TX_CLDENY; done = 1; break; case ACT_TARPIT: txn->flags |= TX_CLTARPIT; done = 1; break; case ACT_REPLACE: trash.len = exp_replace(trash.str, trash.size, cur_ptr, exp->replace, pmatch); if (trash.len < 0) return -1; delta = buffer_replace2(req->buf, cur_ptr, cur_end, trash.str, trash.len); /* FIXME: if the user adds a newline in the replacement, the * index will not be recalculated for now, and the new line * will not be counted as a new header. */ http_msg_move_end(&txn->req, delta); cur_end += delta; cur_end = (char *)http_parse_reqline(&txn->req, HTTP_MSG_RQMETH, cur_ptr, cur_end + 1, NULL, NULL); if (unlikely(!cur_end)) return -1; /* we have a full request and we know that we have either a CR * or an LF at <ptr>. */ txn->meth = find_http_meth(cur_ptr, txn->req.sl.rq.m_l); hdr_idx_set_start(&txn->hdr_idx, txn->req.sl.rq.l, *cur_end == '\r'); /* there is no point trying this regex on headers */ return 1; } } return done; }
int apply_filter_to_req_line(struct session *s, struct channel *req, struct hdr_exp *exp) { char *cur_ptr, *cur_end; int done; struct http_txn *txn = &s->txn; int delta; if (unlikely(txn->flags & (TX_CLDENY | TX_CLTARPIT))) return 1; else if (unlikely(txn->flags & TX_CLALLOW) && (exp->action == ACT_ALLOW || exp->action == ACT_DENY || exp->action == ACT_TARPIT)) return 0; else if (exp->action == ACT_REMOVE) return 0; done = 0; cur_ptr = req->buf->p; cur_end = cur_ptr + txn->req.sl.rq.l; /* Now we have the request line between cur_ptr and cur_end */ if (regex_exec_match2(exp->preg, cur_ptr, cur_end-cur_ptr, MAX_MATCH, pmatch)) { switch (exp->action) { case ACT_SETBE: /* It is not possible to jump a second time. * FIXME: should we return an HTTP/500 here so that * the admin knows there's a problem ? */ if (s->be != s->fe) break; /* Swithing Proxy */ session_set_backend(s, (struct proxy *)exp->replace); done = 1; break; case ACT_ALLOW: txn->flags |= TX_CLALLOW; done = 1; break; case ACT_DENY: txn->flags |= TX_CLDENY; done = 1; break; case ACT_TARPIT: txn->flags |= TX_CLTARPIT; done = 1; break; case ACT_REPLACE: trash.len = exp_replace(trash.str, trash.size, cur_ptr, exp->replace, pmatch); if (trash.len < 0) return -1; delta = buffer_replace2(req->buf, cur_ptr, cur_end, trash.str, trash.len); /* FIXME: if the user adds a newline in the replacement, the * index will not be recalculated for now, and the new line * will not be counted as a new header. */ http_msg_move_end(&txn->req, delta); cur_end += delta; cur_end = (char *)http_parse_reqline(&txn->req, HTTP_MSG_RQMETH, cur_ptr, cur_end + 1, NULL, NULL); if (unlikely(!cur_end)) return -1; /* we have a full request and we know that we have either a CR * or an LF at <ptr>. */ txn->meth = find_http_meth(cur_ptr, txn->req.sl.rq.m_l); hdr_idx_set_start(&txn->hdr_idx, txn->req.sl.rq.l, *cur_end == '\r'); /* there is no point trying this regex on headers */ return 1; } } return done; }
C
haproxy
0
CVE-2018-0494
https://www.cvedetails.com/cve/CVE-2018-0494/
CWE-20
https://git.savannah.gnu.org/cgit/wget.git/commit/?id=1fc9c95ec144499e69dc8ec76dbe07799d7d82cd
1fc9c95ec144499e69dc8ec76dbe07799d7d82cd
null
digest_authentication_encode (const char *au, const char *user, const char *passwd, const char *method, const char *path, uerr_t *auth_err) { static char *realm, *opaque, *nonce, *qop, *algorithm; static struct { const char *name; char **variable; } options[] = { { "realm", &realm }, { "opaque", &opaque }, { "nonce", &nonce }, { "qop", &qop }, { "algorithm", &algorithm } }; char cnonce[16] = ""; char *res = NULL; int res_len; size_t res_size; param_token name, value; realm = opaque = nonce = algorithm = qop = NULL; au += 6; /* skip over `Digest' */ while (extract_param (&au, &name, &value, ',', NULL)) { size_t i; size_t namelen = name.e - name.b; for (i = 0; i < countof (options); i++) if (namelen == strlen (options[i].name) && 0 == strncmp (name.b, options[i].name, namelen)) { *options[i].variable = strdupdelim (value.b, value.e); break; } } if (qop && strcmp (qop, "auth")) { logprintf (LOG_NOTQUIET, _("Unsupported quality of protection '%s'.\n"), qop); xfree (qop); /* force freeing mem and continue */ } else if (algorithm && strcmp (algorithm,"MD5") && strcmp (algorithm,"MD5-sess")) { logprintf (LOG_NOTQUIET, _("Unsupported algorithm '%s'.\n"), algorithm); xfree (algorithm); /* force freeing mem and continue */ } if (!realm || !nonce || !user || !passwd || !path || !method) { *auth_err = ATTRMISSING; goto cleanup; } /* Calculate the digest value. */ { struct md5_ctx ctx; unsigned char hash[MD5_DIGEST_SIZE]; char a1buf[MD5_DIGEST_SIZE * 2 + 1], a2buf[MD5_DIGEST_SIZE * 2 + 1]; char response_digest[MD5_DIGEST_SIZE * 2 + 1]; /* A1BUF = H(user ":" realm ":" password) */ md5_init_ctx (&ctx); md5_process_bytes ((unsigned char *)user, strlen (user), &ctx); md5_process_bytes ((unsigned char *)":", 1, &ctx); md5_process_bytes ((unsigned char *)realm, strlen (realm), &ctx); md5_process_bytes ((unsigned char *)":", 1, &ctx); md5_process_bytes ((unsigned char *)passwd, strlen (passwd), &ctx); md5_finish_ctx (&ctx, hash); dump_hash (a1buf, hash); if (algorithm && !strcmp (algorithm, "MD5-sess")) { /* A1BUF = H( H(user ":" realm ":" password) ":" nonce ":" cnonce ) */ snprintf (cnonce, sizeof (cnonce), "%08x", (unsigned) random_number (INT_MAX)); md5_init_ctx (&ctx); /* md5_process_bytes (hash, MD5_DIGEST_SIZE, &ctx); */ md5_process_bytes (a1buf, MD5_DIGEST_SIZE * 2, &ctx); md5_process_bytes ((unsigned char *)":", 1, &ctx); md5_process_bytes ((unsigned char *)nonce, strlen (nonce), &ctx); md5_process_bytes ((unsigned char *)":", 1, &ctx); md5_process_bytes ((unsigned char *)cnonce, strlen (cnonce), &ctx); md5_finish_ctx (&ctx, hash); dump_hash (a1buf, hash); } /* A2BUF = H(method ":" path) */ md5_init_ctx (&ctx); md5_process_bytes ((unsigned char *)method, strlen (method), &ctx); md5_process_bytes ((unsigned char *)":", 1, &ctx); md5_process_bytes ((unsigned char *)path, strlen (path), &ctx); md5_finish_ctx (&ctx, hash); dump_hash (a2buf, hash); if (qop && !strcmp (qop, "auth")) { /* RFC 2617 Digest Access Authentication */ /* generate random hex string */ if (!*cnonce) snprintf (cnonce, sizeof (cnonce), "%08x", (unsigned) random_number (INT_MAX)); /* RESPONSE_DIGEST = H(A1BUF ":" nonce ":" noncecount ":" clientnonce ":" qop ": " A2BUF) */ md5_init_ctx (&ctx); md5_process_bytes ((unsigned char *)a1buf, MD5_DIGEST_SIZE * 2, &ctx); md5_process_bytes ((unsigned char *)":", 1, &ctx); md5_process_bytes ((unsigned char *)nonce, strlen (nonce), &ctx); md5_process_bytes ((unsigned char *)":", 1, &ctx); md5_process_bytes ((unsigned char *)"00000001", 8, &ctx); /* TODO: keep track of server nonce values */ md5_process_bytes ((unsigned char *)":", 1, &ctx); md5_process_bytes ((unsigned char *)cnonce, strlen (cnonce), &ctx); md5_process_bytes ((unsigned char *)":", 1, &ctx); md5_process_bytes ((unsigned char *)qop, strlen (qop), &ctx); md5_process_bytes ((unsigned char *)":", 1, &ctx); md5_process_bytes ((unsigned char *)a2buf, MD5_DIGEST_SIZE * 2, &ctx); md5_finish_ctx (&ctx, hash); } else { /* RFC 2069 Digest Access Authentication */ /* RESPONSE_DIGEST = H(A1BUF ":" nonce ":" A2BUF) */ md5_init_ctx (&ctx); md5_process_bytes ((unsigned char *)a1buf, MD5_DIGEST_SIZE * 2, &ctx); md5_process_bytes ((unsigned char *)":", 1, &ctx); md5_process_bytes ((unsigned char *)nonce, strlen (nonce), &ctx); md5_process_bytes ((unsigned char *)":", 1, &ctx); md5_process_bytes ((unsigned char *)a2buf, MD5_DIGEST_SIZE * 2, &ctx); md5_finish_ctx (&ctx, hash); } dump_hash (response_digest, hash); res_size = strlen (user) + strlen (realm) + strlen (nonce) + strlen (path) + 2 * MD5_DIGEST_SIZE /*strlen (response_digest)*/ + (opaque ? strlen (opaque) : 0) + (algorithm ? strlen (algorithm) : 0) + (qop ? 128: 0) + strlen (cnonce) + 128; res = xmalloc (res_size); if (qop && !strcmp (qop, "auth")) { res_len = snprintf (res, res_size, "Digest "\ "username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", response=\"%s\""\ ", qop=auth, nc=00000001, cnonce=\"%s\"", user, realm, nonce, path, response_digest, cnonce); } else { res_len = snprintf (res, res_size, "Digest "\ "username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", response=\"%s\"", user, realm, nonce, path, response_digest); } if (opaque) { res_len += snprintf (res + res_len, res_size - res_len, ", opaque=\"%s\"", opaque); } if (algorithm) { snprintf (res + res_len, res_size - res_len, ", algorithm=\"%s\"", algorithm); } } cleanup: xfree (realm); xfree (opaque); xfree (nonce); xfree (qop); xfree (algorithm); return res; }
digest_authentication_encode (const char *au, const char *user, const char *passwd, const char *method, const char *path, uerr_t *auth_err) { static char *realm, *opaque, *nonce, *qop, *algorithm; static struct { const char *name; char **variable; } options[] = { { "realm", &realm }, { "opaque", &opaque }, { "nonce", &nonce }, { "qop", &qop }, { "algorithm", &algorithm } }; char cnonce[16] = ""; char *res = NULL; int res_len; size_t res_size; param_token name, value; realm = opaque = nonce = algorithm = qop = NULL; au += 6; /* skip over `Digest' */ while (extract_param (&au, &name, &value, ',', NULL)) { size_t i; size_t namelen = name.e - name.b; for (i = 0; i < countof (options); i++) if (namelen == strlen (options[i].name) && 0 == strncmp (name.b, options[i].name, namelen)) { *options[i].variable = strdupdelim (value.b, value.e); break; } } if (qop && strcmp (qop, "auth")) { logprintf (LOG_NOTQUIET, _("Unsupported quality of protection '%s'.\n"), qop); xfree (qop); /* force freeing mem and continue */ } else if (algorithm && strcmp (algorithm,"MD5") && strcmp (algorithm,"MD5-sess")) { logprintf (LOG_NOTQUIET, _("Unsupported algorithm '%s'.\n"), algorithm); xfree (algorithm); /* force freeing mem and continue */ } if (!realm || !nonce || !user || !passwd || !path || !method) { *auth_err = ATTRMISSING; goto cleanup; } /* Calculate the digest value. */ { struct md5_ctx ctx; unsigned char hash[MD5_DIGEST_SIZE]; char a1buf[MD5_DIGEST_SIZE * 2 + 1], a2buf[MD5_DIGEST_SIZE * 2 + 1]; char response_digest[MD5_DIGEST_SIZE * 2 + 1]; /* A1BUF = H(user ":" realm ":" password) */ md5_init_ctx (&ctx); md5_process_bytes ((unsigned char *)user, strlen (user), &ctx); md5_process_bytes ((unsigned char *)":", 1, &ctx); md5_process_bytes ((unsigned char *)realm, strlen (realm), &ctx); md5_process_bytes ((unsigned char *)":", 1, &ctx); md5_process_bytes ((unsigned char *)passwd, strlen (passwd), &ctx); md5_finish_ctx (&ctx, hash); dump_hash (a1buf, hash); if (algorithm && !strcmp (algorithm, "MD5-sess")) { /* A1BUF = H( H(user ":" realm ":" password) ":" nonce ":" cnonce ) */ snprintf (cnonce, sizeof (cnonce), "%08x", (unsigned) random_number (INT_MAX)); md5_init_ctx (&ctx); /* md5_process_bytes (hash, MD5_DIGEST_SIZE, &ctx); */ md5_process_bytes (a1buf, MD5_DIGEST_SIZE * 2, &ctx); md5_process_bytes ((unsigned char *)":", 1, &ctx); md5_process_bytes ((unsigned char *)nonce, strlen (nonce), &ctx); md5_process_bytes ((unsigned char *)":", 1, &ctx); md5_process_bytes ((unsigned char *)cnonce, strlen (cnonce), &ctx); md5_finish_ctx (&ctx, hash); dump_hash (a1buf, hash); } /* A2BUF = H(method ":" path) */ md5_init_ctx (&ctx); md5_process_bytes ((unsigned char *)method, strlen (method), &ctx); md5_process_bytes ((unsigned char *)":", 1, &ctx); md5_process_bytes ((unsigned char *)path, strlen (path), &ctx); md5_finish_ctx (&ctx, hash); dump_hash (a2buf, hash); if (qop && !strcmp (qop, "auth")) { /* RFC 2617 Digest Access Authentication */ /* generate random hex string */ if (!*cnonce) snprintf (cnonce, sizeof (cnonce), "%08x", (unsigned) random_number (INT_MAX)); /* RESPONSE_DIGEST = H(A1BUF ":" nonce ":" noncecount ":" clientnonce ":" qop ": " A2BUF) */ md5_init_ctx (&ctx); md5_process_bytes ((unsigned char *)a1buf, MD5_DIGEST_SIZE * 2, &ctx); md5_process_bytes ((unsigned char *)":", 1, &ctx); md5_process_bytes ((unsigned char *)nonce, strlen (nonce), &ctx); md5_process_bytes ((unsigned char *)":", 1, &ctx); md5_process_bytes ((unsigned char *)"00000001", 8, &ctx); /* TODO: keep track of server nonce values */ md5_process_bytes ((unsigned char *)":", 1, &ctx); md5_process_bytes ((unsigned char *)cnonce, strlen (cnonce), &ctx); md5_process_bytes ((unsigned char *)":", 1, &ctx); md5_process_bytes ((unsigned char *)qop, strlen (qop), &ctx); md5_process_bytes ((unsigned char *)":", 1, &ctx); md5_process_bytes ((unsigned char *)a2buf, MD5_DIGEST_SIZE * 2, &ctx); md5_finish_ctx (&ctx, hash); } else { /* RFC 2069 Digest Access Authentication */ /* RESPONSE_DIGEST = H(A1BUF ":" nonce ":" A2BUF) */ md5_init_ctx (&ctx); md5_process_bytes ((unsigned char *)a1buf, MD5_DIGEST_SIZE * 2, &ctx); md5_process_bytes ((unsigned char *)":", 1, &ctx); md5_process_bytes ((unsigned char *)nonce, strlen (nonce), &ctx); md5_process_bytes ((unsigned char *)":", 1, &ctx); md5_process_bytes ((unsigned char *)a2buf, MD5_DIGEST_SIZE * 2, &ctx); md5_finish_ctx (&ctx, hash); } dump_hash (response_digest, hash); res_size = strlen (user) + strlen (realm) + strlen (nonce) + strlen (path) + 2 * MD5_DIGEST_SIZE /*strlen (response_digest)*/ + (opaque ? strlen (opaque) : 0) + (algorithm ? strlen (algorithm) : 0) + (qop ? 128: 0) + strlen (cnonce) + 128; res = xmalloc (res_size); if (qop && !strcmp (qop, "auth")) { res_len = snprintf (res, res_size, "Digest "\ "username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", response=\"%s\""\ ", qop=auth, nc=00000001, cnonce=\"%s\"", user, realm, nonce, path, response_digest, cnonce); } else { res_len = snprintf (res, res_size, "Digest "\ "username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", response=\"%s\"", user, realm, nonce, path, response_digest); } if (opaque) { res_len += snprintf (res + res_len, res_size - res_len, ", opaque=\"%s\"", opaque); } if (algorithm) { snprintf (res + res_len, res_size - res_len, ", algorithm=\"%s\"", algorithm); } } cleanup: xfree (realm); xfree (opaque); xfree (nonce); xfree (qop); xfree (algorithm); return res; }
C
savannah
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}
void WebsiteSettingsPopupAndroid::SetSelectedTab( WebsiteSettingsUI::TabId tab_id) { NOTIMPLEMENTED(); }
void WebsiteSettingsPopupAndroid::SetSelectedTab( WebsiteSettingsUI::TabId tab_id) { NOTIMPLEMENTED(); }
C
Chrome
0
CVE-2016-5219
https://www.cvedetails.com/cve/CVE-2016-5219/
CWE-416
https://github.com/chromium/chromium/commit/a4150b688a754d3d10d2ca385155b1c95d77d6ae
a4150b688a754d3d10d2ca385155b1c95d77d6ae
Add GL_PROGRAM_COMPLETION_QUERY_CHROMIUM This makes the query of GL_COMPLETION_STATUS_KHR to programs much cheaper by minimizing the round-trip to the GPU thread. Bug: 881152, 957001 Change-Id: Iadfa798af29225e752c710ca5c25f50b3dd3101a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1586630 Commit-Queue: Kenneth Russell <[email protected]> Reviewed-by: Kentaro Hara <[email protected]> Reviewed-by: Geoff Lang <[email protected]> Reviewed-by: Kenneth Russell <[email protected]> Cr-Commit-Position: refs/heads/master@{#657568}
void GLES2DecoderImpl::ClearFramebufferForWorkaround(GLbitfield mask) { ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::ClearWorkaround", error_state_.get()); clear_framebuffer_blit_->ClearFramebuffer( this, gfx::Size(viewport_max_width_, viewport_max_height_), mask, state_.color_clear_red, state_.color_clear_green, state_.color_clear_blue, state_.color_clear_alpha, state_.depth_clear, state_.stencil_clear); }
void GLES2DecoderImpl::ClearFramebufferForWorkaround(GLbitfield mask) { ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::ClearWorkaround", error_state_.get()); clear_framebuffer_blit_->ClearFramebuffer( this, gfx::Size(viewport_max_width_, viewport_max_height_), mask, state_.color_clear_red, state_.color_clear_green, state_.color_clear_blue, state_.color_clear_alpha, state_.depth_clear, state_.stencil_clear); }
C
Chrome
0
CVE-2010-2519
https://www.cvedetails.com/cve/CVE-2010-2519/
CWE-119
https://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=b2ea64bcc6c385a8e8318f9c759450a07df58b6d
b2ea64bcc6c385a8e8318f9c759450a07df58b6d
null
ft_lookup_glyph_renderer( FT_GlyphSlot slot ) { FT_Face face = slot->face; FT_Library library = FT_FACE_LIBRARY( face ); FT_Renderer result = library->cur_renderer; if ( !result || result->glyph_format != slot->format ) result = FT_Lookup_Renderer( library, slot->format, 0 ); return result; }
ft_lookup_glyph_renderer( FT_GlyphSlot slot ) { FT_Face face = slot->face; FT_Library library = FT_FACE_LIBRARY( face ); FT_Renderer result = library->cur_renderer; if ( !result || result->glyph_format != slot->format ) result = FT_Lookup_Renderer( library, slot->format, 0 ); return result; }
C
savannah
0
CVE-2017-5067
https://www.cvedetails.com/cve/CVE-2017-5067/
CWE-20
https://github.com/chromium/chromium/commit/83588d6ed473f923a46484958d440da0b8a51b1b
83588d6ed473f923a46484958d440da0b8a51b1b
media/gpu/test: ImageProcessorClient: Use bytes for width and height in libyuv::CopyPlane() |width| is in bytes in libyuv::CopyPlane(). We formerly pass width in pixels. This should matter when a pixel format is used whose pixel is composed of more than one bytes. Bug: None Test: image_processor_test Change-Id: I98e90be70c8d0128319172d4d19f3a8017b65d78 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1553129 Commit-Queue: Hirokazu Honda <[email protected]> Reviewed-by: Alexandre Courbot <[email protected]> Cr-Commit-Position: refs/heads/master@{#648117}
bool ImageProcessorClient::CreateImageProcessor( const ImageProcessor::PortConfig& input_config, const ImageProcessor::PortConfig& output_config, size_t num_buffers) { DCHECK_CALLED_ON_VALID_THREAD(test_main_thread_checker_); base::WaitableEvent done(base::WaitableEvent::ResetPolicy::AUTOMATIC, base::WaitableEvent::InitialState::NOT_SIGNALED); image_processor_client_thread_.task_runner()->PostTask( FROM_HERE, base::BindOnce(&ImageProcessorClient::CreateImageProcessorTask, base::Unretained(this), std::cref(input_config), std::cref(output_config), num_buffers, &done)); done.Wait(); if (!image_processor_) { LOG(ERROR) << "Failed to create ImageProcessor"; return false; } return true; }
bool ImageProcessorClient::CreateImageProcessor( const ImageProcessor::PortConfig& input_config, const ImageProcessor::PortConfig& output_config, size_t num_buffers) { DCHECK_CALLED_ON_VALID_THREAD(test_main_thread_checker_); base::WaitableEvent done(base::WaitableEvent::ResetPolicy::AUTOMATIC, base::WaitableEvent::InitialState::NOT_SIGNALED); image_processor_client_thread_.task_runner()->PostTask( FROM_HERE, base::BindOnce(&ImageProcessorClient::CreateImageProcessorTask, base::Unretained(this), std::cref(input_config), std::cref(output_config), num_buffers, &done)); done.Wait(); if (!image_processor_) { LOG(ERROR) << "Failed to create ImageProcessor"; return false; } return true; }
C
Chrome
0
CVE-2018-15857
https://www.cvedetails.com/cve/CVE-2018-15857/
CWE-416
https://github.com/xkbcommon/libxkbcommon/commit/c1e5ac16e77a21f87bdf3bc4dea61b037a17dddb
c1e5ac16e77a21f87bdf3bc4dea61b037a17dddb
xkbcomp: fix pointer value for FreeStmt Signed-off-by: Peter Hutterer <[email protected]>
ExprCreateArrayRef(xkb_atom_t element, xkb_atom_t field, ExprDef *entry) { EXPR_CREATE(ExprArrayRef, expr, EXPR_ARRAY_REF, EXPR_TYPE_UNKNOWN); expr->array_ref.element = element; expr->array_ref.field = field; expr->array_ref.entry = entry; return expr; }
ExprCreateArrayRef(xkb_atom_t element, xkb_atom_t field, ExprDef *entry) { EXPR_CREATE(ExprArrayRef, expr, EXPR_ARRAY_REF, EXPR_TYPE_UNKNOWN); expr->array_ref.element = element; expr->array_ref.field = field; expr->array_ref.entry = entry; return expr; }
C
libxkbcommon
0
CVE-2012-5148
https://www.cvedetails.com/cve/CVE-2012-5148/
CWE-20
https://github.com/chromium/chromium/commit/e89cfcb9090e8c98129ae9160c513f504db74599
e89cfcb9090e8c98129ae9160c513f504db74599
Remove TabContents from TabStripModelObserver::TabDetachedAt. BUG=107201 TEST=no visible change Review URL: https://chromiumcodereview.appspot.com/11293205 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167122 0039d316-1c4b-4281-b951-d872f2087c98
void BrowserWindowGtk::UpdateDevToolsForContents(WebContents* contents) { TRACE_EVENT0("ui::gtk", "BrowserWindowGtk::UpdateDevToolsForContents"); DevToolsWindow* new_devtools_window = contents ? DevToolsWindow::GetDockedInstanceForInspectedTab(contents) : NULL; if (devtools_window_ == new_devtools_window && (!new_devtools_window || new_devtools_window->dock_side() == devtools_dock_side_)) return; if (devtools_window_ != new_devtools_window) { if (devtools_window_) { devtools_container_->DetachTab( devtools_window_->tab_contents()->web_contents()); } devtools_container_->SetTab( new_devtools_window ? new_devtools_window->tab_contents() : NULL); if (new_devtools_window) { new_devtools_window->tab_contents()->web_contents()->WasShown(); } } if (devtools_window_) { GtkAllocation contents_rect; gtk_widget_get_allocation(contents_vsplit_, &contents_rect); if (devtools_dock_side_ == DEVTOOLS_DOCK_SIDE_RIGHT) { devtools_window_->SetWidth( contents_rect.width - gtk_paned_get_position(GTK_PANED(contents_hsplit_))); } else { devtools_window_->SetHeight( contents_rect.height - gtk_paned_get_position(GTK_PANED(contents_vsplit_))); } } bool should_hide = devtools_window_ && (!new_devtools_window || devtools_dock_side_ != new_devtools_window->dock_side()); bool should_show = new_devtools_window && (!devtools_window_ || should_hide); if (should_hide) HideDevToolsContainer(); devtools_window_ = new_devtools_window; if (should_show) { devtools_dock_side_ = new_devtools_window->dock_side(); ShowDevToolsContainer(); } else if (new_devtools_window) { UpdateDevToolsSplitPosition(); } }
void BrowserWindowGtk::UpdateDevToolsForContents(WebContents* contents) { TRACE_EVENT0("ui::gtk", "BrowserWindowGtk::UpdateDevToolsForContents"); DevToolsWindow* new_devtools_window = contents ? DevToolsWindow::GetDockedInstanceForInspectedTab(contents) : NULL; if (devtools_window_ == new_devtools_window && (!new_devtools_window || new_devtools_window->dock_side() == devtools_dock_side_)) return; if (devtools_window_ != new_devtools_window) { if (devtools_window_) devtools_container_->DetachTab(devtools_window_->tab_contents()); devtools_container_->SetTab( new_devtools_window ? new_devtools_window->tab_contents() : NULL); if (new_devtools_window) { new_devtools_window->tab_contents()->web_contents()->WasShown(); } } if (devtools_window_) { GtkAllocation contents_rect; gtk_widget_get_allocation(contents_vsplit_, &contents_rect); if (devtools_dock_side_ == DEVTOOLS_DOCK_SIDE_RIGHT) { devtools_window_->SetWidth( contents_rect.width - gtk_paned_get_position(GTK_PANED(contents_hsplit_))); } else { devtools_window_->SetHeight( contents_rect.height - gtk_paned_get_position(GTK_PANED(contents_vsplit_))); } } bool should_hide = devtools_window_ && (!new_devtools_window || devtools_dock_side_ != new_devtools_window->dock_side()); bool should_show = new_devtools_window && (!devtools_window_ || should_hide); if (should_hide) HideDevToolsContainer(); devtools_window_ = new_devtools_window; if (should_show) { devtools_dock_side_ = new_devtools_window->dock_side(); ShowDevToolsContainer(); } else if (new_devtools_window) { UpdateDevToolsSplitPosition(); } }
C
Chrome
1
CVE-2018-6080
https://www.cvedetails.com/cve/CVE-2018-6080/
CWE-269
https://github.com/chromium/chromium/commit/b44e68087804e6543a99c87076ab7648d11d9b07
b44e68087804e6543a99c87076ab7648d11d9b07
memory-infra: split up memory-infra coordinator service into two This allows for heap profiler to use its own service with correct capabilities and all other instances to use the existing coordinator service. Bug: 792028 Change-Id: I84e4ec71f5f1d00991c0516b1424ce7334bcd3cd Reviewed-on: https://chromium-review.googlesource.com/836896 Commit-Queue: Lalit Maganti <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Reviewed-by: oysteine <[email protected]> Reviewed-by: Albert J. Wong <[email protected]> Reviewed-by: Hector Dearman <[email protected]> Cr-Commit-Position: refs/heads/master@{#529059}
MATCHER(IsBackgroundDump, "") { return arg.level_of_detail == MemoryDumpLevelOfDetail::BACKGROUND; }
MATCHER(IsBackgroundDump, "") { return arg.level_of_detail == MemoryDumpLevelOfDetail::BACKGROUND; }
C
Chrome
0
CVE-2019-9923
https://www.cvedetails.com/cve/CVE-2019-9923/
CWE-476
https://git.savannah.gnu.org/cgit/tar.git/commit/?id=cb07844454d8cc9fb21f53ace75975f91185a120
cb07844454d8cc9fb21f53ace75975f91185a120
null
decode_num (uintmax_t *num, char const *arg, uintmax_t maxval) { uintmax_t u; char *arg_lim; if (!ISDIGIT (*arg)) return false; errno = 0; u = strtoumax (arg, &arg_lim, 10); if (! (u <= maxval && errno != ERANGE) || *arg_lim) return false; *num = u; return true; }
decode_num (uintmax_t *num, char const *arg, uintmax_t maxval) { uintmax_t u; char *arg_lim; if (!ISDIGIT (*arg)) return false; errno = 0; u = strtoumax (arg, &arg_lim, 10); if (! (u <= maxval && errno != ERANGE) || *arg_lim) return false; *num = u; return true; }
C
savannah
0
CVE-2018-18955
https://www.cvedetails.com/cve/CVE-2018-18955/
CWE-20
https://github.com/torvalds/linux/commit/d2f007dbe7e4c9583eea6eb04d60001e85c6f1bd
d2f007dbe7e4c9583eea6eb04d60001e85c6f1bd
userns: also map extents in the reverse map to kernel IDs The current logic first clones the extent array and sorts both copies, then maps the lower IDs of the forward mapping into the lower namespace, but doesn't map the lower IDs of the reverse mapping. This means that code in a nested user namespace with >5 extents will see incorrect IDs. It also breaks some access checks, like inode_owner_or_capable() and privileged_wrt_inode_uidgid(), so a process can incorrectly appear to be capable relative to an inode. To fix it, we have to make sure that the "lower_first" members of extents in both arrays are translated; and we have to make sure that the reverse map is sorted *after* the translation (since otherwise the translation can break the sorting). This is CVE-2018-18955. Fixes: 6397fac4915a ("userns: bump idmap limits to 340") Cc: [email protected] Signed-off-by: Jann Horn <[email protected]> Tested-by: Eric W. Biederman <[email protected]> Reviewed-by: Eric W. Biederman <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
void __put_user_ns(struct user_namespace *ns) { schedule_work(&ns->work); }
void __put_user_ns(struct user_namespace *ns) { schedule_work(&ns->work); }
C
linux
0
CVE-2016-10046
https://www.cvedetails.com/cve/CVE-2016-10046/
CWE-119
https://github.com/ImageMagick/ImageMagick/commit/989f9f88ea6db09b99d25586e912c921c0da8d3f
989f9f88ea6db09b99d25586e912c921c0da8d3f
Prevent buffer overflow (bug report from Max Thrane)
static PrimitiveInfo *TraceStrokePolygon(const DrawInfo *draw_info, const PrimitiveInfo *primitive_info) { typedef struct _LineSegment { double p, q; } LineSegment; double delta_theta, dot_product, mid, miterlimit; LineSegment dx, dy, inverse_slope, slope, theta; MagickBooleanType closed_path; PointInfo box_p[5], box_q[5], center, offset, *path_p, *path_q; PrimitiveInfo *polygon_primitive, *stroke_polygon; register ssize_t i; size_t arc_segments, max_strokes, number_vertices; ssize_t j, n, p, q; /* Allocate paths. */ number_vertices=primitive_info->coordinates; max_strokes=2*number_vertices+6*BezierQuantum+360; path_p=(PointInfo *) AcquireQuantumMemory((size_t) max_strokes, sizeof(*path_p)); path_q=(PointInfo *) AcquireQuantumMemory((size_t) max_strokes, sizeof(*path_q)); polygon_primitive=(PrimitiveInfo *) AcquireQuantumMemory((size_t) number_vertices+2UL,sizeof(*polygon_primitive)); if ((path_p == (PointInfo *) NULL) || (path_q == (PointInfo *) NULL) || (polygon_primitive == (PrimitiveInfo *) NULL)) return((PrimitiveInfo *) NULL); (void) CopyMagickMemory(polygon_primitive,primitive_info,(size_t) number_vertices*sizeof(*polygon_primitive)); closed_path= (fabs(primitive_info[number_vertices-1].point.x-primitive_info[0].point.x) < DrawEpsilon) && (fabs(primitive_info[number_vertices-1].point.y-primitive_info[0].point.y) < DrawEpsilon) ? MagickTrue : MagickFalse; if ((draw_info->linejoin == RoundJoin) || ((draw_info->linejoin == MiterJoin) && (closed_path != MagickFalse))) { polygon_primitive[number_vertices]=primitive_info[1]; number_vertices++; } polygon_primitive[number_vertices].primitive=UndefinedPrimitive; /* Compute the slope for the first line segment, p. */ dx.p=0.0; dy.p=0.0; for (n=1; n < (ssize_t) number_vertices; n++) { dx.p=polygon_primitive[n].point.x-polygon_primitive[0].point.x; dy.p=polygon_primitive[n].point.y-polygon_primitive[0].point.y; if ((fabs(dx.p) >= DrawEpsilon) || (fabs(dy.p) >= DrawEpsilon)) break; } if (n == (ssize_t) number_vertices) n=(ssize_t) number_vertices-1L; slope.p=0.0; inverse_slope.p=0.0; if (fabs(dx.p) < DrawEpsilon) { if (dx.p >= 0.0) slope.p=dy.p < 0.0 ? -1.0/DrawEpsilon : 1.0/DrawEpsilon; else slope.p=dy.p < 0.0 ? 1.0/DrawEpsilon : -1.0/DrawEpsilon; } else if (fabs(dy.p) < DrawEpsilon) { if (dy.p >= 0.0) inverse_slope.p=dx.p < 0.0 ? -1.0/DrawEpsilon : 1.0/DrawEpsilon; else inverse_slope.p=dx.p < 0.0 ? 1.0/DrawEpsilon : -1.0/DrawEpsilon; } else { slope.p=dy.p/dx.p; inverse_slope.p=(-1.0/slope.p); } mid=ExpandAffine(&draw_info->affine)*draw_info->stroke_width/2.0; miterlimit=(double) (draw_info->miterlimit*draw_info->miterlimit*mid*mid); if ((draw_info->linecap == SquareCap) && (closed_path == MagickFalse)) TraceSquareLinecap(polygon_primitive,number_vertices,mid); offset.x=sqrt((double) (mid*mid/(inverse_slope.p*inverse_slope.p+1.0))); offset.y=(double) (offset.x*inverse_slope.p); if ((dy.p*offset.x-dx.p*offset.y) > 0.0) { box_p[0].x=polygon_primitive[0].point.x-offset.x; box_p[0].y=polygon_primitive[0].point.y-offset.x*inverse_slope.p; box_p[1].x=polygon_primitive[n].point.x-offset.x; box_p[1].y=polygon_primitive[n].point.y-offset.x*inverse_slope.p; box_q[0].x=polygon_primitive[0].point.x+offset.x; box_q[0].y=polygon_primitive[0].point.y+offset.x*inverse_slope.p; box_q[1].x=polygon_primitive[n].point.x+offset.x; box_q[1].y=polygon_primitive[n].point.y+offset.x*inverse_slope.p; } else { box_p[0].x=polygon_primitive[0].point.x+offset.x; box_p[0].y=polygon_primitive[0].point.y+offset.y; box_p[1].x=polygon_primitive[n].point.x+offset.x; box_p[1].y=polygon_primitive[n].point.y+offset.y; box_q[0].x=polygon_primitive[0].point.x-offset.x; box_q[0].y=polygon_primitive[0].point.y-offset.y; box_q[1].x=polygon_primitive[n].point.x-offset.x; box_q[1].y=polygon_primitive[n].point.y-offset.y; } /* Create strokes for the line join attribute: bevel, miter, round. */ p=0; q=0; path_q[p++]=box_q[0]; path_p[q++]=box_p[0]; for (i=(ssize_t) n+1; i < (ssize_t) number_vertices; i++) { /* Compute the slope for this line segment, q. */ dx.q=polygon_primitive[i].point.x-polygon_primitive[n].point.x; dy.q=polygon_primitive[i].point.y-polygon_primitive[n].point.y; dot_product=dx.q*dx.q+dy.q*dy.q; if (dot_product < 0.25) continue; slope.q=0.0; inverse_slope.q=0.0; if (fabs(dx.q) < DrawEpsilon) { if (dx.q >= 0.0) slope.q=dy.q < 0.0 ? -1.0/DrawEpsilon : 1.0/DrawEpsilon; else slope.q=dy.q < 0.0 ? 1.0/DrawEpsilon : -1.0/DrawEpsilon; } else if (fabs(dy.q) < DrawEpsilon) { if (dy.q >= 0.0) inverse_slope.q=dx.q < 0.0 ? -1.0/DrawEpsilon : 1.0/DrawEpsilon; else inverse_slope.q=dx.q < 0.0 ? 1.0/DrawEpsilon : -1.0/DrawEpsilon; } else { slope.q=dy.q/dx.q; inverse_slope.q=(-1.0/slope.q); } offset.x=sqrt((double) (mid*mid/(inverse_slope.q*inverse_slope.q+1.0))); offset.y=(double) (offset.x*inverse_slope.q); dot_product=dy.q*offset.x-dx.q*offset.y; if (dot_product > 0.0) { box_p[2].x=polygon_primitive[n].point.x-offset.x; box_p[2].y=polygon_primitive[n].point.y-offset.y; box_p[3].x=polygon_primitive[i].point.x-offset.x; box_p[3].y=polygon_primitive[i].point.y-offset.y; box_q[2].x=polygon_primitive[n].point.x+offset.x; box_q[2].y=polygon_primitive[n].point.y+offset.y; box_q[3].x=polygon_primitive[i].point.x+offset.x; box_q[3].y=polygon_primitive[i].point.y+offset.y; } else { box_p[2].x=polygon_primitive[n].point.x+offset.x; box_p[2].y=polygon_primitive[n].point.y+offset.y; box_p[3].x=polygon_primitive[i].point.x+offset.x; box_p[3].y=polygon_primitive[i].point.y+offset.y; box_q[2].x=polygon_primitive[n].point.x-offset.x; box_q[2].y=polygon_primitive[n].point.y-offset.y; box_q[3].x=polygon_primitive[i].point.x-offset.x; box_q[3].y=polygon_primitive[i].point.y-offset.y; } if (fabs((double) (slope.p-slope.q)) < DrawEpsilon) { box_p[4]=box_p[1]; box_q[4]=box_q[1]; } else { box_p[4].x=(double) ((slope.p*box_p[0].x-box_p[0].y-slope.q*box_p[3].x+ box_p[3].y)/(slope.p-slope.q)); box_p[4].y=(double) (slope.p*(box_p[4].x-box_p[0].x)+box_p[0].y); box_q[4].x=(double) ((slope.p*box_q[0].x-box_q[0].y-slope.q*box_q[3].x+ box_q[3].y)/(slope.p-slope.q)); box_q[4].y=(double) (slope.p*(box_q[4].x-box_q[0].x)+box_q[0].y); } if (q >= (ssize_t) (max_strokes-6*BezierQuantum-360)) { if (~max_strokes < (6*BezierQuantum+360)) { path_p=(PointInfo *) RelinquishMagickMemory(path_p); path_q=(PointInfo *) RelinquishMagickMemory(path_q); } else { max_strokes+=6*BezierQuantum+360; path_p=(PointInfo *) ResizeQuantumMemory(path_p,max_strokes, sizeof(*path_p)); path_q=(PointInfo *) ResizeQuantumMemory(path_q,max_strokes, sizeof(*path_q)); } if ((path_p == (PointInfo *) NULL) || (path_q == (PointInfo *) NULL)) { if (path_p != (PointInfo *) NULL) path_p=(PointInfo *) RelinquishMagickMemory(path_p); if (path_q != (PointInfo *) NULL) path_q=(PointInfo *) RelinquishMagickMemory(path_q); polygon_primitive=(PrimitiveInfo *) RelinquishMagickMemory(polygon_primitive); return((PrimitiveInfo *) NULL); } } dot_product=dx.q*dy.p-dx.p*dy.q; if (dot_product <= 0.0) switch (draw_info->linejoin) { case BevelJoin: { path_q[q++]=box_q[1]; path_q[q++]=box_q[2]; dot_product=(box_q[4].x-box_p[4].x)*(box_q[4].x-box_p[4].x)+ (box_q[4].y-box_p[4].y)*(box_q[4].y-box_p[4].y); if (dot_product <= miterlimit) path_p[p++]=box_p[4]; else { path_p[p++]=box_p[1]; path_p[p++]=box_p[2]; } break; } case MiterJoin: { dot_product=(box_q[4].x-box_p[4].x)*(box_q[4].x-box_p[4].x)+ (box_q[4].y-box_p[4].y)*(box_q[4].y-box_p[4].y); if (dot_product <= miterlimit) { path_q[q++]=box_q[4]; path_p[p++]=box_p[4]; } else { path_q[q++]=box_q[1]; path_q[q++]=box_q[2]; path_p[p++]=box_p[1]; path_p[p++]=box_p[2]; } break; } case RoundJoin: { dot_product=(box_q[4].x-box_p[4].x)*(box_q[4].x-box_p[4].x)+ (box_q[4].y-box_p[4].y)*(box_q[4].y-box_p[4].y); if (dot_product <= miterlimit) path_p[p++]=box_p[4]; else { path_p[p++]=box_p[1]; path_p[p++]=box_p[2]; } center=polygon_primitive[n].point; theta.p=atan2(box_q[1].y-center.y,box_q[1].x-center.x); theta.q=atan2(box_q[2].y-center.y,box_q[2].x-center.x); if (theta.q < theta.p) theta.q+=2.0*MagickPI; arc_segments=(size_t) ceil((double) ((theta.q-theta.p)/ (2.0*sqrt((double) (1.0/mid))))); path_q[q].x=box_q[1].x; path_q[q].y=box_q[1].y; q++; for (j=1; j < (ssize_t) arc_segments; j++) { delta_theta=(double) (j*(theta.q-theta.p)/arc_segments); path_q[q].x=(double) (center.x+mid*cos(fmod((double) (theta.p+delta_theta),DegreesToRadians(360.0)))); path_q[q].y=(double) (center.y+mid*sin(fmod((double) (theta.p+delta_theta),DegreesToRadians(360.0)))); q++; } path_q[q++]=box_q[2]; break; } default: break; } else switch (draw_info->linejoin) { case BevelJoin: { path_p[p++]=box_p[1]; path_p[p++]=box_p[2]; dot_product=(box_q[4].x-box_p[4].x)*(box_q[4].x-box_p[4].x)+ (box_q[4].y-box_p[4].y)*(box_q[4].y-box_p[4].y); if (dot_product <= miterlimit) path_q[q++]=box_q[4]; else { path_q[q++]=box_q[1]; path_q[q++]=box_q[2]; } break; } case MiterJoin: { dot_product=(box_q[4].x-box_p[4].x)*(box_q[4].x-box_p[4].x)+ (box_q[4].y-box_p[4].y)*(box_q[4].y-box_p[4].y); if (dot_product <= miterlimit) { path_q[q++]=box_q[4]; path_p[p++]=box_p[4]; } else { path_q[q++]=box_q[1]; path_q[q++]=box_q[2]; path_p[p++]=box_p[1]; path_p[p++]=box_p[2]; } break; } case RoundJoin: { dot_product=(box_q[4].x-box_p[4].x)*(box_q[4].x-box_p[4].x)+ (box_q[4].y-box_p[4].y)*(box_q[4].y-box_p[4].y); if (dot_product <= miterlimit) path_q[q++]=box_q[4]; else { path_q[q++]=box_q[1]; path_q[q++]=box_q[2]; } center=polygon_primitive[n].point; theta.p=atan2(box_p[1].y-center.y,box_p[1].x-center.x); theta.q=atan2(box_p[2].y-center.y,box_p[2].x-center.x); if (theta.p < theta.q) theta.p+=2.0*MagickPI; arc_segments=(size_t) ceil((double) ((theta.p-theta.q)/ (2.0*sqrt((double) (1.0/mid))))); path_p[p++]=box_p[1]; for (j=1; j < (ssize_t) arc_segments; j++) { delta_theta=(double) (j*(theta.q-theta.p)/arc_segments); path_p[p].x=(double) (center.x+mid*cos(fmod((double) (theta.p+delta_theta),DegreesToRadians(360.0)))); path_p[p].y=(double) (center.y+mid*sin(fmod((double) (theta.p+delta_theta),DegreesToRadians(360.0)))); p++; } path_p[p++]=box_p[2]; break; } default: break; } slope.p=slope.q; inverse_slope.p=inverse_slope.q; box_p[0]=box_p[2]; box_p[1]=box_p[3]; box_q[0]=box_q[2]; box_q[1]=box_q[3]; dx.p=dx.q; dy.p=dy.q; n=i; } path_p[p++]=box_p[1]; path_q[q++]=box_q[1]; /* Trace stroked polygon. */ stroke_polygon=(PrimitiveInfo *) AcquireQuantumMemory((size_t) (p+q+2UL*closed_path+2UL),sizeof(*stroke_polygon)); if (stroke_polygon != (PrimitiveInfo *) NULL) { for (i=0; i < (ssize_t) p; i++) { stroke_polygon[i]=polygon_primitive[0]; stroke_polygon[i].point=path_p[i]; } if (closed_path != MagickFalse) { stroke_polygon[i]=polygon_primitive[0]; stroke_polygon[i].point=stroke_polygon[0].point; i++; } for ( ; i < (ssize_t) (p+q+closed_path); i++) { stroke_polygon[i]=polygon_primitive[0]; stroke_polygon[i].point=path_q[p+q+closed_path-(i+1)]; } if (closed_path != MagickFalse) { stroke_polygon[i]=polygon_primitive[0]; stroke_polygon[i].point=stroke_polygon[p+closed_path].point; i++; } stroke_polygon[i]=polygon_primitive[0]; stroke_polygon[i].point=stroke_polygon[0].point; i++; stroke_polygon[i].primitive=UndefinedPrimitive; stroke_polygon[0].coordinates=(size_t) (p+q+2*closed_path+1); } path_p=(PointInfo *) RelinquishMagickMemory(path_p); path_q=(PointInfo *) RelinquishMagickMemory(path_q); polygon_primitive=(PrimitiveInfo *) RelinquishMagickMemory(polygon_primitive); return(stroke_polygon); }
static PrimitiveInfo *TraceStrokePolygon(const DrawInfo *draw_info, const PrimitiveInfo *primitive_info) { typedef struct _LineSegment { double p, q; } LineSegment; double delta_theta, dot_product, mid, miterlimit; LineSegment dx, dy, inverse_slope, slope, theta; MagickBooleanType closed_path; PointInfo box_p[5], box_q[5], center, offset, *path_p, *path_q; PrimitiveInfo *polygon_primitive, *stroke_polygon; register ssize_t i; size_t arc_segments, max_strokes, number_vertices; ssize_t j, n, p, q; /* Allocate paths. */ number_vertices=primitive_info->coordinates; max_strokes=2*number_vertices+6*BezierQuantum+360; path_p=(PointInfo *) AcquireQuantumMemory((size_t) max_strokes, sizeof(*path_p)); path_q=(PointInfo *) AcquireQuantumMemory((size_t) max_strokes, sizeof(*path_q)); polygon_primitive=(PrimitiveInfo *) AcquireQuantumMemory((size_t) number_vertices+2UL,sizeof(*polygon_primitive)); if ((path_p == (PointInfo *) NULL) || (path_q == (PointInfo *) NULL) || (polygon_primitive == (PrimitiveInfo *) NULL)) return((PrimitiveInfo *) NULL); (void) CopyMagickMemory(polygon_primitive,primitive_info,(size_t) number_vertices*sizeof(*polygon_primitive)); closed_path= (fabs(primitive_info[number_vertices-1].point.x-primitive_info[0].point.x) < DrawEpsilon) && (fabs(primitive_info[number_vertices-1].point.y-primitive_info[0].point.y) < DrawEpsilon) ? MagickTrue : MagickFalse; if ((draw_info->linejoin == RoundJoin) || ((draw_info->linejoin == MiterJoin) && (closed_path != MagickFalse))) { polygon_primitive[number_vertices]=primitive_info[1]; number_vertices++; } polygon_primitive[number_vertices].primitive=UndefinedPrimitive; /* Compute the slope for the first line segment, p. */ dx.p=0.0; dy.p=0.0; for (n=1; n < (ssize_t) number_vertices; n++) { dx.p=polygon_primitive[n].point.x-polygon_primitive[0].point.x; dy.p=polygon_primitive[n].point.y-polygon_primitive[0].point.y; if ((fabs(dx.p) >= DrawEpsilon) || (fabs(dy.p) >= DrawEpsilon)) break; } if (n == (ssize_t) number_vertices) n=(ssize_t) number_vertices-1L; slope.p=0.0; inverse_slope.p=0.0; if (fabs(dx.p) < DrawEpsilon) { if (dx.p >= 0.0) slope.p=dy.p < 0.0 ? -1.0/DrawEpsilon : 1.0/DrawEpsilon; else slope.p=dy.p < 0.0 ? 1.0/DrawEpsilon : -1.0/DrawEpsilon; } else if (fabs(dy.p) < DrawEpsilon) { if (dy.p >= 0.0) inverse_slope.p=dx.p < 0.0 ? -1.0/DrawEpsilon : 1.0/DrawEpsilon; else inverse_slope.p=dx.p < 0.0 ? 1.0/DrawEpsilon : -1.0/DrawEpsilon; } else { slope.p=dy.p/dx.p; inverse_slope.p=(-1.0/slope.p); } mid=ExpandAffine(&draw_info->affine)*draw_info->stroke_width/2.0; miterlimit=(double) (draw_info->miterlimit*draw_info->miterlimit*mid*mid); if ((draw_info->linecap == SquareCap) && (closed_path == MagickFalse)) TraceSquareLinecap(polygon_primitive,number_vertices,mid); offset.x=sqrt((double) (mid*mid/(inverse_slope.p*inverse_slope.p+1.0))); offset.y=(double) (offset.x*inverse_slope.p); if ((dy.p*offset.x-dx.p*offset.y) > 0.0) { box_p[0].x=polygon_primitive[0].point.x-offset.x; box_p[0].y=polygon_primitive[0].point.y-offset.x*inverse_slope.p; box_p[1].x=polygon_primitive[n].point.x-offset.x; box_p[1].y=polygon_primitive[n].point.y-offset.x*inverse_slope.p; box_q[0].x=polygon_primitive[0].point.x+offset.x; box_q[0].y=polygon_primitive[0].point.y+offset.x*inverse_slope.p; box_q[1].x=polygon_primitive[n].point.x+offset.x; box_q[1].y=polygon_primitive[n].point.y+offset.x*inverse_slope.p; } else { box_p[0].x=polygon_primitive[0].point.x+offset.x; box_p[0].y=polygon_primitive[0].point.y+offset.y; box_p[1].x=polygon_primitive[n].point.x+offset.x; box_p[1].y=polygon_primitive[n].point.y+offset.y; box_q[0].x=polygon_primitive[0].point.x-offset.x; box_q[0].y=polygon_primitive[0].point.y-offset.y; box_q[1].x=polygon_primitive[n].point.x-offset.x; box_q[1].y=polygon_primitive[n].point.y-offset.y; } /* Create strokes for the line join attribute: bevel, miter, round. */ p=0; q=0; path_q[p++]=box_q[0]; path_p[q++]=box_p[0]; for (i=(ssize_t) n+1; i < (ssize_t) number_vertices; i++) { /* Compute the slope for this line segment, q. */ dx.q=polygon_primitive[i].point.x-polygon_primitive[n].point.x; dy.q=polygon_primitive[i].point.y-polygon_primitive[n].point.y; dot_product=dx.q*dx.q+dy.q*dy.q; if (dot_product < 0.25) continue; slope.q=0.0; inverse_slope.q=0.0; if (fabs(dx.q) < DrawEpsilon) { if (dx.q >= 0.0) slope.q=dy.q < 0.0 ? -1.0/DrawEpsilon : 1.0/DrawEpsilon; else slope.q=dy.q < 0.0 ? 1.0/DrawEpsilon : -1.0/DrawEpsilon; } else if (fabs(dy.q) < DrawEpsilon) { if (dy.q >= 0.0) inverse_slope.q=dx.q < 0.0 ? -1.0/DrawEpsilon : 1.0/DrawEpsilon; else inverse_slope.q=dx.q < 0.0 ? 1.0/DrawEpsilon : -1.0/DrawEpsilon; } else { slope.q=dy.q/dx.q; inverse_slope.q=(-1.0/slope.q); } offset.x=sqrt((double) (mid*mid/(inverse_slope.q*inverse_slope.q+1.0))); offset.y=(double) (offset.x*inverse_slope.q); dot_product=dy.q*offset.x-dx.q*offset.y; if (dot_product > 0.0) { box_p[2].x=polygon_primitive[n].point.x-offset.x; box_p[2].y=polygon_primitive[n].point.y-offset.y; box_p[3].x=polygon_primitive[i].point.x-offset.x; box_p[3].y=polygon_primitive[i].point.y-offset.y; box_q[2].x=polygon_primitive[n].point.x+offset.x; box_q[2].y=polygon_primitive[n].point.y+offset.y; box_q[3].x=polygon_primitive[i].point.x+offset.x; box_q[3].y=polygon_primitive[i].point.y+offset.y; } else { box_p[2].x=polygon_primitive[n].point.x+offset.x; box_p[2].y=polygon_primitive[n].point.y+offset.y; box_p[3].x=polygon_primitive[i].point.x+offset.x; box_p[3].y=polygon_primitive[i].point.y+offset.y; box_q[2].x=polygon_primitive[n].point.x-offset.x; box_q[2].y=polygon_primitive[n].point.y-offset.y; box_q[3].x=polygon_primitive[i].point.x-offset.x; box_q[3].y=polygon_primitive[i].point.y-offset.y; } if (fabs((double) (slope.p-slope.q)) < DrawEpsilon) { box_p[4]=box_p[1]; box_q[4]=box_q[1]; } else { box_p[4].x=(double) ((slope.p*box_p[0].x-box_p[0].y-slope.q*box_p[3].x+ box_p[3].y)/(slope.p-slope.q)); box_p[4].y=(double) (slope.p*(box_p[4].x-box_p[0].x)+box_p[0].y); box_q[4].x=(double) ((slope.p*box_q[0].x-box_q[0].y-slope.q*box_q[3].x+ box_q[3].y)/(slope.p-slope.q)); box_q[4].y=(double) (slope.p*(box_q[4].x-box_q[0].x)+box_q[0].y); } if (q >= (ssize_t) (max_strokes-6*BezierQuantum-360)) { if (~max_strokes < (6*BezierQuantum+360)) { path_p=(PointInfo *) RelinquishMagickMemory(path_p); path_q=(PointInfo *) RelinquishMagickMemory(path_q); } else { max_strokes+=6*BezierQuantum+360; path_p=(PointInfo *) ResizeQuantumMemory(path_p,max_strokes, sizeof(*path_p)); path_q=(PointInfo *) ResizeQuantumMemory(path_q,max_strokes, sizeof(*path_q)); } if ((path_p == (PointInfo *) NULL) || (path_q == (PointInfo *) NULL)) { if (path_p != (PointInfo *) NULL) path_p=(PointInfo *) RelinquishMagickMemory(path_p); if (path_q != (PointInfo *) NULL) path_q=(PointInfo *) RelinquishMagickMemory(path_q); polygon_primitive=(PrimitiveInfo *) RelinquishMagickMemory(polygon_primitive); return((PrimitiveInfo *) NULL); } } dot_product=dx.q*dy.p-dx.p*dy.q; if (dot_product <= 0.0) switch (draw_info->linejoin) { case BevelJoin: { path_q[q++]=box_q[1]; path_q[q++]=box_q[2]; dot_product=(box_q[4].x-box_p[4].x)*(box_q[4].x-box_p[4].x)+ (box_q[4].y-box_p[4].y)*(box_q[4].y-box_p[4].y); if (dot_product <= miterlimit) path_p[p++]=box_p[4]; else { path_p[p++]=box_p[1]; path_p[p++]=box_p[2]; } break; } case MiterJoin: { dot_product=(box_q[4].x-box_p[4].x)*(box_q[4].x-box_p[4].x)+ (box_q[4].y-box_p[4].y)*(box_q[4].y-box_p[4].y); if (dot_product <= miterlimit) { path_q[q++]=box_q[4]; path_p[p++]=box_p[4]; } else { path_q[q++]=box_q[1]; path_q[q++]=box_q[2]; path_p[p++]=box_p[1]; path_p[p++]=box_p[2]; } break; } case RoundJoin: { dot_product=(box_q[4].x-box_p[4].x)*(box_q[4].x-box_p[4].x)+ (box_q[4].y-box_p[4].y)*(box_q[4].y-box_p[4].y); if (dot_product <= miterlimit) path_p[p++]=box_p[4]; else { path_p[p++]=box_p[1]; path_p[p++]=box_p[2]; } center=polygon_primitive[n].point; theta.p=atan2(box_q[1].y-center.y,box_q[1].x-center.x); theta.q=atan2(box_q[2].y-center.y,box_q[2].x-center.x); if (theta.q < theta.p) theta.q+=2.0*MagickPI; arc_segments=(size_t) ceil((double) ((theta.q-theta.p)/ (2.0*sqrt((double) (1.0/mid))))); path_q[q].x=box_q[1].x; path_q[q].y=box_q[1].y; q++; for (j=1; j < (ssize_t) arc_segments; j++) { delta_theta=(double) (j*(theta.q-theta.p)/arc_segments); path_q[q].x=(double) (center.x+mid*cos(fmod((double) (theta.p+delta_theta),DegreesToRadians(360.0)))); path_q[q].y=(double) (center.y+mid*sin(fmod((double) (theta.p+delta_theta),DegreesToRadians(360.0)))); q++; } path_q[q++]=box_q[2]; break; } default: break; } else switch (draw_info->linejoin) { case BevelJoin: { path_p[p++]=box_p[1]; path_p[p++]=box_p[2]; dot_product=(box_q[4].x-box_p[4].x)*(box_q[4].x-box_p[4].x)+ (box_q[4].y-box_p[4].y)*(box_q[4].y-box_p[4].y); if (dot_product <= miterlimit) path_q[q++]=box_q[4]; else { path_q[q++]=box_q[1]; path_q[q++]=box_q[2]; } break; } case MiterJoin: { dot_product=(box_q[4].x-box_p[4].x)*(box_q[4].x-box_p[4].x)+ (box_q[4].y-box_p[4].y)*(box_q[4].y-box_p[4].y); if (dot_product <= miterlimit) { path_q[q++]=box_q[4]; path_p[p++]=box_p[4]; } else { path_q[q++]=box_q[1]; path_q[q++]=box_q[2]; path_p[p++]=box_p[1]; path_p[p++]=box_p[2]; } break; } case RoundJoin: { dot_product=(box_q[4].x-box_p[4].x)*(box_q[4].x-box_p[4].x)+ (box_q[4].y-box_p[4].y)*(box_q[4].y-box_p[4].y); if (dot_product <= miterlimit) path_q[q++]=box_q[4]; else { path_q[q++]=box_q[1]; path_q[q++]=box_q[2]; } center=polygon_primitive[n].point; theta.p=atan2(box_p[1].y-center.y,box_p[1].x-center.x); theta.q=atan2(box_p[2].y-center.y,box_p[2].x-center.x); if (theta.p < theta.q) theta.p+=2.0*MagickPI; arc_segments=(size_t) ceil((double) ((theta.p-theta.q)/ (2.0*sqrt((double) (1.0/mid))))); path_p[p++]=box_p[1]; for (j=1; j < (ssize_t) arc_segments; j++) { delta_theta=(double) (j*(theta.q-theta.p)/arc_segments); path_p[p].x=(double) (center.x+mid*cos(fmod((double) (theta.p+delta_theta),DegreesToRadians(360.0)))); path_p[p].y=(double) (center.y+mid*sin(fmod((double) (theta.p+delta_theta),DegreesToRadians(360.0)))); p++; } path_p[p++]=box_p[2]; break; } default: break; } slope.p=slope.q; inverse_slope.p=inverse_slope.q; box_p[0]=box_p[2]; box_p[1]=box_p[3]; box_q[0]=box_q[2]; box_q[1]=box_q[3]; dx.p=dx.q; dy.p=dy.q; n=i; } path_p[p++]=box_p[1]; path_q[q++]=box_q[1]; /* Trace stroked polygon. */ stroke_polygon=(PrimitiveInfo *) AcquireQuantumMemory((size_t) (p+q+2UL*closed_path+2UL),sizeof(*stroke_polygon)); if (stroke_polygon != (PrimitiveInfo *) NULL) { for (i=0; i < (ssize_t) p; i++) { stroke_polygon[i]=polygon_primitive[0]; stroke_polygon[i].point=path_p[i]; } if (closed_path != MagickFalse) { stroke_polygon[i]=polygon_primitive[0]; stroke_polygon[i].point=stroke_polygon[0].point; i++; } for ( ; i < (ssize_t) (p+q+closed_path); i++) { stroke_polygon[i]=polygon_primitive[0]; stroke_polygon[i].point=path_q[p+q+closed_path-(i+1)]; } if (closed_path != MagickFalse) { stroke_polygon[i]=polygon_primitive[0]; stroke_polygon[i].point=stroke_polygon[p+closed_path].point; i++; } stroke_polygon[i]=polygon_primitive[0]; stroke_polygon[i].point=stroke_polygon[0].point; i++; stroke_polygon[i].primitive=UndefinedPrimitive; stroke_polygon[0].coordinates=(size_t) (p+q+2*closed_path+1); } path_p=(PointInfo *) RelinquishMagickMemory(path_p); path_q=(PointInfo *) RelinquishMagickMemory(path_q); polygon_primitive=(PrimitiveInfo *) RelinquishMagickMemory(polygon_primitive); return(stroke_polygon); }
C
ImageMagick
0
CVE-2013-1789
https://www.cvedetails.com/cve/CVE-2013-1789/
null
https://cgit.freedesktop.org/poppler/poppler/commit/?h=poppler-0.22&id=a9b8ab4657dec65b8b86c225d12c533ad7e984e2
a9b8ab4657dec65b8b86c225d12c533ad7e984e2
null
Splash::Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA, SplashScreenParams *screenParams) { int i; bitmap = bitmapA; vectorAntialias = vectorAntialiasA; inShading = gFalse; state = new SplashState(bitmap->width, bitmap->height, vectorAntialias, screenParams); if (vectorAntialias) { aaBuf = new SplashBitmap(splashAASize * bitmap->width, splashAASize, 1, splashModeMono1, gFalse); for (i = 0; i <= splashAASize * splashAASize; ++i) { aaGamma[i] = (Guchar)splashRound( splashPow((SplashCoord)i / (SplashCoord)(splashAASize * splashAASize), splashAAGamma) * 255); } } else { aaBuf = NULL; } minLineWidth = 0; clearModRegion(); debugMode = gFalse; }
Splash::Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA, SplashScreenParams *screenParams) { int i; bitmap = bitmapA; vectorAntialias = vectorAntialiasA; inShading = gFalse; state = new SplashState(bitmap->width, bitmap->height, vectorAntialias, screenParams); if (vectorAntialias) { aaBuf = new SplashBitmap(splashAASize * bitmap->width, splashAASize, 1, splashModeMono1, gFalse); for (i = 0; i <= splashAASize * splashAASize; ++i) { aaGamma[i] = (Guchar)splashRound( splashPow((SplashCoord)i / (SplashCoord)(splashAASize * splashAASize), splashAAGamma) * 255); } } else { aaBuf = NULL; } minLineWidth = 0; clearModRegion(); debugMode = gFalse; }
CPP
poppler
0
CVE-2016-3839
https://www.cvedetails.com/cve/CVE-2016-3839/
CWE-284
https://android.googlesource.com/platform/system/bt/+/472271b153c5dc53c28beac55480a8d8434b2d5c
472271b153c5dc53c28beac55480a8d8434b2d5c
DO NOT MERGE Fix potential DoS caused by delivering signal to BT process Bug: 28885210 Change-Id: I63866d894bfca47464d6e42e3fb0357c4f94d360 Conflicts: btif/co/bta_hh_co.c btif/src/btif_core.c Merge conflict resolution of ag/1161415 (referencing ag/1164670) - Directly into mnc-mr2-release
static char packet_put_head_l(l2cap_socket *sock, const void *data, uint32_t len) { struct packet *p = packet_alloc((const uint8_t*)data, len); /* * We do not check size limits here since this is used to undo "getting" a * packet that the user read incompletely. That is to say the packet was * already in the queue. We do check thos elimits in packet_put_tail_l() since * that function is used to put new data into the queue. */ if (!p) return FALSE; p->prev = NULL; p->next = sock->first_packet; sock->first_packet = p; if (p->next) p->next->prev = p; else sock->last_packet = p; sock->bytes_buffered += len; return TRUE; }
static char packet_put_head_l(l2cap_socket *sock, const void *data, uint32_t len) { struct packet *p = packet_alloc((const uint8_t*)data, len); /* * We do not check size limits here since this is used to undo "getting" a * packet that the user read incompletely. That is to say the packet was * already in the queue. We do check thos elimits in packet_put_tail_l() since * that function is used to put new data into the queue. */ if (!p) return FALSE; p->prev = NULL; p->next = sock->first_packet; sock->first_packet = p; if (p->next) p->next->prev = p; else sock->last_packet = p; sock->bytes_buffered += len; return TRUE; }
C
Android
0
CVE-2013-2867
https://www.cvedetails.com/cve/CVE-2013-2867/
null
https://github.com/chromium/chromium/commit/d358f57009b85fb7440208afa5ba87636b491889
d358f57009b85fb7440208afa5ba87636b491889
Refactor to support default Bluetooth pairing delegate In order to support a default pairing delegate we need to move the agent service provider delegate implementation from BluetoothDevice to BluetoothAdapter while retaining the existing API. BUG=338492 TEST=device_unittests, unit_tests, browser_tests Review URL: https://codereview.chromium.org/148293003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252216 0039d316-1c4b-4281-b951-d872f2087c98
void BluetoothAdapterChromeOS::SetAdapter(const dbus::ObjectPath& object_path) { DCHECK(!IsPresent()); object_path_ = object_path; VLOG(1) << object_path_.value() << ": using adapter."; SetDefaultAdapterName(); BluetoothAdapterClient::Properties* properties = DBusThreadManager::Get()->GetBluetoothAdapterClient()-> GetProperties(object_path_); PresentChanged(true); if (properties->powered.value()) PoweredChanged(true); if (properties->discoverable.value()) DiscoverableChanged(true); if (properties->discovering.value()) DiscoveringChanged(true); std::vector<dbus::ObjectPath> device_paths = DBusThreadManager::Get()->GetBluetoothDeviceClient()-> GetDevicesForAdapter(object_path_); for (std::vector<dbus::ObjectPath>::iterator iter = device_paths.begin(); iter != device_paths.end(); ++iter) { BluetoothDeviceChromeOS* device_chromeos = new BluetoothDeviceChromeOS(this, *iter); devices_[device_chromeos->GetAddress()] = device_chromeos; FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, DeviceAdded(this, device_chromeos)); } }
void BluetoothAdapterChromeOS::SetAdapter(const dbus::ObjectPath& object_path) { DCHECK(!IsPresent()); object_path_ = object_path; VLOG(1) << object_path_.value() << ": using adapter."; SetDefaultAdapterName(); BluetoothAdapterClient::Properties* properties = DBusThreadManager::Get()->GetBluetoothAdapterClient()-> GetProperties(object_path_); PresentChanged(true); if (properties->powered.value()) PoweredChanged(true); if (properties->discoverable.value()) DiscoverableChanged(true); if (properties->discovering.value()) DiscoveringChanged(true); std::vector<dbus::ObjectPath> device_paths = DBusThreadManager::Get()->GetBluetoothDeviceClient()-> GetDevicesForAdapter(object_path_); for (std::vector<dbus::ObjectPath>::iterator iter = device_paths.begin(); iter != device_paths.end(); ++iter) { BluetoothDeviceChromeOS* device_chromeos = new BluetoothDeviceChromeOS(this, *iter); devices_[device_chromeos->GetAddress()] = device_chromeos; FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_, DeviceAdded(this, device_chromeos)); } }
C
Chrome
0
CVE-2014-3690
https://www.cvedetails.com/cve/CVE-2014-3690/
CWE-399
https://github.com/torvalds/linux/commit/d974baa398f34393db76be45f7d4d04fbdbb4a0a
d974baa398f34393db76be45f7d4d04fbdbb4a0a
x86,kvm,vmx: Preserve CR4 across VM entry CR4 isn't constant; at least the TSD and PCE bits can vary. TBH, treating CR0 and CR3 as constant scares me a bit, too, but it looks like it's correct. This adds a branch and a read from cr4 to each vm entry. Because it is extremely likely that consecutive entries into the same vcpu will have the same host cr4 value, this fixes up the vmcs instead of restoring cr4 after the fact. A subsequent patch will add a kernel-wide cr4 shadow, reducing the overhead in the common case to just two memory reads and a branch. Signed-off-by: Andy Lutomirski <[email protected]> Acked-by: Paolo Bonzini <[email protected]> Cc: [email protected] Cc: Petr Matousek <[email protected]> Cc: Gleb Natapov <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
static void loaded_vmcs_clear(struct loaded_vmcs *loaded_vmcs) { int cpu = loaded_vmcs->cpu; if (cpu != -1) smp_call_function_single(cpu, __loaded_vmcs_clear, loaded_vmcs, 1); }
static void loaded_vmcs_clear(struct loaded_vmcs *loaded_vmcs) { int cpu = loaded_vmcs->cpu; if (cpu != -1) smp_call_function_single(cpu, __loaded_vmcs_clear, loaded_vmcs, 1); }
C
linux
0
CVE-2013-4282
https://www.cvedetails.com/cve/CVE-2013-4282/
CWE-119
https://cgit.freedesktop.org/spice/spice/commit/?id=8af619009660b24e0b41ad26b30289eea288fcc2
8af619009660b24e0b41ad26b30289eea288fcc2
null
static void openssl_init(RedLinkInfo *link) { unsigned long f4 = RSA_F4; link->tiTicketing.bn = BN_new(); if (!link->tiTicketing.bn) { spice_error("OpenSSL BIGNUMS alloc failed"); } BN_set_word(link->tiTicketing.bn, f4); }
static void openssl_init(RedLinkInfo *link) { unsigned long f4 = RSA_F4; link->tiTicketing.bn = BN_new(); if (!link->tiTicketing.bn) { spice_error("OpenSSL BIGNUMS alloc failed"); } BN_set_word(link->tiTicketing.bn, f4); }
C
spice
0
CVE-2017-15386
https://www.cvedetails.com/cve/CVE-2017-15386/
CWE-20
https://github.com/chromium/chromium/commit/ba3b1b344017bbf36283464b51014fad15c2f3f4
ba3b1b344017bbf36283464b51014fad15c2f3f4
If a page shows a popup, end fullscreen. This was implemented in Blink r159834, but it is susceptible to a popup/fullscreen race. This CL reverts that implementation and re-implements it in WebContents. BUG=752003 TEST=WebContentsImplBrowserTest.PopupsFromJavaScriptEndFullscreen Change-Id: Ia345cdeda273693c3231ad8f486bebfc3d83927f Reviewed-on: https://chromium-review.googlesource.com/606987 Commit-Queue: Avi Drissman <[email protected]> Reviewed-by: Charlie Reis <[email protected]> Reviewed-by: Philip Jägenstedt <[email protected]> Cr-Commit-Position: refs/heads/master@{#498171}
void WebContentsImpl::DidStartLoading(FrameTreeNode* frame_tree_node, bool to_different_document) { LoadingStateChanged(frame_tree_node->IsMainFrame() && to_different_document, false, nullptr); BrowserAccessibilityManager* manager = frame_tree_node->current_frame_host()->browser_accessibility_manager(); if (manager) manager->UserIsNavigatingAway(); }
void WebContentsImpl::DidStartLoading(FrameTreeNode* frame_tree_node, bool to_different_document) { LoadingStateChanged(frame_tree_node->IsMainFrame() && to_different_document, false, nullptr); BrowserAccessibilityManager* manager = frame_tree_node->current_frame_host()->browser_accessibility_manager(); if (manager) manager->UserIsNavigatingAway(); }
C
Chrome
0
CVE-2016-6304
https://www.cvedetails.com/cve/CVE-2016-6304/
CWE-399
https://git.openssl.org/?p=openssl.git;a=commit;h=2c0d295e26306e15a92eb23a84a1802005c1c137
2c0d295e26306e15a92eb23a84a1802005c1c137
null
int tls1_process_heartbeat(SSL *s) { unsigned char *p = &s->s3->rrec.data[0], *pl; unsigned short hbtype; unsigned int payload; unsigned int padding = 16; /* Use minimum padding */ if (s->msg_callback) s->msg_callback(0, s->version, TLS1_RT_HEARTBEAT, &s->s3->rrec.data[0], s->s3->rrec.length, s, s->msg_callback_arg); /* Read type and payload length first */ if (1 + 2 + 16 > s->s3->rrec.length) return 0; /* silently discard */ hbtype = *p++; n2s(p, payload); if (1 + 2 + payload + 16 > s->s3->rrec.length) return 0; /* silently discard per RFC 6520 sec. 4 */ pl = p; if (hbtype == TLS1_HB_REQUEST) { unsigned char *buffer, *bp; int r; /* * Allocate memory for the response, size is 1 bytes message type, * plus 2 bytes payload length, plus payload, plus padding */ buffer = OPENSSL_malloc(1 + 2 + payload + padding); if (buffer == NULL) return -1; bp = buffer; /* Enter response type, length and copy payload */ *bp++ = TLS1_HB_RESPONSE; s2n(payload, bp); memcpy(bp, pl, payload); bp += payload; /* Random padding */ if (RAND_bytes(bp, padding) <= 0) { OPENSSL_free(buffer); return -1; } r = ssl3_write_bytes(s, TLS1_RT_HEARTBEAT, buffer, 3 + payload + padding); if (r >= 0 && s->msg_callback) s->msg_callback(1, s->version, TLS1_RT_HEARTBEAT, buffer, 3 + payload + padding, s, s->msg_callback_arg); OPENSSL_free(buffer); if (r < 0) return r; } else if (hbtype == TLS1_HB_RESPONSE) { unsigned int seq; /* * We only send sequence numbers (2 bytes unsigned int), and 16 * random bytes, so we just try to read the sequence number */ n2s(pl, seq); if (payload == 18 && seq == s->tlsext_hb_seq) { s->tlsext_hb_seq++; s->tlsext_hb_pending = 0; } } return 0; }
int tls1_process_heartbeat(SSL *s) { unsigned char *p = &s->s3->rrec.data[0], *pl; unsigned short hbtype; unsigned int payload; unsigned int padding = 16; /* Use minimum padding */ if (s->msg_callback) s->msg_callback(0, s->version, TLS1_RT_HEARTBEAT, &s->s3->rrec.data[0], s->s3->rrec.length, s, s->msg_callback_arg); /* Read type and payload length first */ if (1 + 2 + 16 > s->s3->rrec.length) return 0; /* silently discard */ hbtype = *p++; n2s(p, payload); if (1 + 2 + payload + 16 > s->s3->rrec.length) return 0; /* silently discard per RFC 6520 sec. 4 */ pl = p; if (hbtype == TLS1_HB_REQUEST) { unsigned char *buffer, *bp; int r; /* * Allocate memory for the response, size is 1 bytes message type, * plus 2 bytes payload length, plus payload, plus padding */ buffer = OPENSSL_malloc(1 + 2 + payload + padding); if (buffer == NULL) return -1; bp = buffer; /* Enter response type, length and copy payload */ *bp++ = TLS1_HB_RESPONSE; s2n(payload, bp); memcpy(bp, pl, payload); bp += payload; /* Random padding */ if (RAND_bytes(bp, padding) <= 0) { OPENSSL_free(buffer); return -1; } r = ssl3_write_bytes(s, TLS1_RT_HEARTBEAT, buffer, 3 + payload + padding); if (r >= 0 && s->msg_callback) s->msg_callback(1, s->version, TLS1_RT_HEARTBEAT, buffer, 3 + payload + padding, s, s->msg_callback_arg); OPENSSL_free(buffer); if (r < 0) return r; } else if (hbtype == TLS1_HB_RESPONSE) { unsigned int seq; /* * We only send sequence numbers (2 bytes unsigned int), and 16 * random bytes, so we just try to read the sequence number */ n2s(pl, seq); if (payload == 18 && seq == s->tlsext_hb_seq) { s->tlsext_hb_seq++; s->tlsext_hb_pending = 0; } } return 0; }
C
openssl
0
CVE-2013-0839
https://www.cvedetails.com/cve/CVE-2013-0839/
CWE-399
https://github.com/chromium/chromium/commit/dd3b6fe574edad231c01c78e4647a74c38dc4178
dd3b6fe574edad231c01c78e4647a74c38dc4178
Remove parent* arg from GDataEntry ctor. * Remove static FromDocumentEntry from GDataEntry, GDataFile, GDataDirectory. Replace with InitFromDocumentEntry. * Move common code from GDataFile::InitFromDocumentEntry and GDataDirectory::InitFromDocumentEntry to GDataEntry::InitFromDocumentEntry. * Add GDataDirectoryService::FromDocumentEntry and use this everywhere. * Make ctors of GDataFile, GDataDirectory private, so these must be created by GDataDirectoryService's CreateGDataFile and CreateGDataDirectory. Make GDataEntry ctor protected. BUG=141494 TEST=unit tests. Review URL: https://chromiumcodereview.appspot.com/10854083 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151008 0039d316-1c4b-4281-b951-d872f2087c98
void VerifyDirectoryService(GDataDirectoryService* directory_service) { ASSERT_TRUE(directory_service->root()); GDataDirectory* dir1 = FindDirectory(directory_service, "drive/dir1"); ASSERT_TRUE(dir1); GDataDirectory* dir2 = FindDirectory(directory_service, "drive/dir2"); ASSERT_TRUE(dir2); GDataDirectory* dir3 = FindDirectory(directory_service, "drive/dir1/dir3"); ASSERT_TRUE(dir3); GDataFile* file4 = FindFile(directory_service, "drive/dir1/file4"); ASSERT_TRUE(file4); EXPECT_EQ(file4->parent(), dir1); GDataFile* file5 = FindFile(directory_service, "drive/dir1/file5"); ASSERT_TRUE(file5); EXPECT_EQ(file5->parent(), dir1); GDataFile* file6 = FindFile(directory_service, "drive/dir2/file6"); ASSERT_TRUE(file6); EXPECT_EQ(file6->parent(), dir2); GDataFile* file7 = FindFile(directory_service, "drive/dir2/file7"); ASSERT_TRUE(file7); EXPECT_EQ(file7->parent(), dir2); GDataFile* file8 = FindFile(directory_service, "drive/dir2/file8"); ASSERT_TRUE(file8); EXPECT_EQ(file8->parent(), dir2); GDataFile* file9 = FindFile(directory_service, "drive/dir1/dir3/file9"); ASSERT_TRUE(file9); EXPECT_EQ(file9->parent(), dir3); GDataFile* file10 = FindFile(directory_service, "drive/dir1/dir3/file10"); ASSERT_TRUE(file10); EXPECT_EQ(file10->parent(), dir3); EXPECT_EQ(dir1, directory_service->GetEntryByResourceId( "dir_resource_id:dir1")); EXPECT_EQ(dir2, directory_service->GetEntryByResourceId( "dir_resource_id:dir2")); EXPECT_EQ(dir3, directory_service->GetEntryByResourceId( "dir_resource_id:dir3")); EXPECT_EQ(file4, directory_service->GetEntryByResourceId( "file_resource_id:file4")); EXPECT_EQ(file5, directory_service->GetEntryByResourceId( "file_resource_id:file5")); EXPECT_EQ(file6, directory_service->GetEntryByResourceId( "file_resource_id:file6")); EXPECT_EQ(file7, directory_service->GetEntryByResourceId( "file_resource_id:file7")); EXPECT_EQ(file8, directory_service->GetEntryByResourceId( "file_resource_id:file8")); EXPECT_EQ(file9, directory_service->GetEntryByResourceId( "file_resource_id:file9")); EXPECT_EQ(file10, directory_service->GetEntryByResourceId( "file_resource_id:file10")); }
void VerifyDirectoryService(GDataDirectoryService* directory_service) { ASSERT_TRUE(directory_service->root()); GDataDirectory* dir1 = FindDirectory(directory_service, "drive/dir1"); ASSERT_TRUE(dir1); GDataDirectory* dir2 = FindDirectory(directory_service, "drive/dir2"); ASSERT_TRUE(dir2); GDataDirectory* dir3 = FindDirectory(directory_service, "drive/dir1/dir3"); ASSERT_TRUE(dir3); GDataFile* file4 = FindFile(directory_service, "drive/dir1/file4"); ASSERT_TRUE(file4); EXPECT_EQ(file4->parent(), dir1); GDataFile* file5 = FindFile(directory_service, "drive/dir1/file5"); ASSERT_TRUE(file5); EXPECT_EQ(file5->parent(), dir1); GDataFile* file6 = FindFile(directory_service, "drive/dir2/file6"); ASSERT_TRUE(file6); EXPECT_EQ(file6->parent(), dir2); GDataFile* file7 = FindFile(directory_service, "drive/dir2/file7"); ASSERT_TRUE(file7); EXPECT_EQ(file7->parent(), dir2); GDataFile* file8 = FindFile(directory_service, "drive/dir2/file8"); ASSERT_TRUE(file8); EXPECT_EQ(file8->parent(), dir2); GDataFile* file9 = FindFile(directory_service, "drive/dir1/dir3/file9"); ASSERT_TRUE(file9); EXPECT_EQ(file9->parent(), dir3); GDataFile* file10 = FindFile(directory_service, "drive/dir1/dir3/file10"); ASSERT_TRUE(file10); EXPECT_EQ(file10->parent(), dir3); EXPECT_EQ(dir1, directory_service->GetEntryByResourceId( "dir_resource_id:dir1")); EXPECT_EQ(dir2, directory_service->GetEntryByResourceId( "dir_resource_id:dir2")); EXPECT_EQ(dir3, directory_service->GetEntryByResourceId( "dir_resource_id:dir3")); EXPECT_EQ(file4, directory_service->GetEntryByResourceId( "file_resource_id:file4")); EXPECT_EQ(file5, directory_service->GetEntryByResourceId( "file_resource_id:file5")); EXPECT_EQ(file6, directory_service->GetEntryByResourceId( "file_resource_id:file6")); EXPECT_EQ(file7, directory_service->GetEntryByResourceId( "file_resource_id:file7")); EXPECT_EQ(file8, directory_service->GetEntryByResourceId( "file_resource_id:file8")); EXPECT_EQ(file9, directory_service->GetEntryByResourceId( "file_resource_id:file9")); EXPECT_EQ(file10, directory_service->GetEntryByResourceId( "file_resource_id:file10")); }
C
Chrome
0
CVE-2011-2803
https://www.cvedetails.com/cve/CVE-2011-2803/
CWE-119
https://github.com/chromium/chromium/commit/48f2ec5c24570c9b96bb2798a9ffe956117c5066
48f2ec5c24570c9b96bb2798a9ffe956117c5066
Add OVERRIDE to ui::TreeModelObserver overridden methods. BUG=None TEST=None [email protected] Review URL: http://codereview.chromium.org/7046093 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88827 0039d316-1c4b-4281-b951-d872f2087c98
TreeModelNode* TreeView::GetNodeForTreeItem(HTREEITEM tree_item) { NodeDetails* details = GetNodeDetailsByTreeItem(tree_item); return details ? details->node : NULL; }
TreeModelNode* TreeView::GetNodeForTreeItem(HTREEITEM tree_item) { NodeDetails* details = GetNodeDetailsByTreeItem(tree_item); return details ? details->node : NULL; }
C
Chrome
0
CVE-2017-9330
https://www.cvedetails.com/cve/CVE-2017-9330/
CWE-835
https://git.qemu.org/?p=qemu.git;a=commit;h=26f670a244982335cc08943fb1ec099a2c81e42d
26f670a244982335cc08943fb1ec099a2c81e42d
null
static inline int ohci_read_iso_td(OHCIState *ohci, dma_addr_t addr, struct ohci_iso_td *td) { return get_dwords(ohci, addr, (uint32_t *)td, 4) || get_words(ohci, addr + 16, td->offset, 8); }
static inline int ohci_read_iso_td(OHCIState *ohci, dma_addr_t addr, struct ohci_iso_td *td) { return get_dwords(ohci, addr, (uint32_t *)td, 4) || get_words(ohci, addr + 16, td->offset, 8); }
C
qemu
0
CVE-2016-5219
https://www.cvedetails.com/cve/CVE-2016-5219/
CWE-416
https://github.com/chromium/chromium/commit/a4150b688a754d3d10d2ca385155b1c95d77d6ae
a4150b688a754d3d10d2ca385155b1c95d77d6ae
Add GL_PROGRAM_COMPLETION_QUERY_CHROMIUM This makes the query of GL_COMPLETION_STATUS_KHR to programs much cheaper by minimizing the round-trip to the GPU thread. Bug: 881152, 957001 Change-Id: Iadfa798af29225e752c710ca5c25f50b3dd3101a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1586630 Commit-Queue: Kenneth Russell <[email protected]> Reviewed-by: Kentaro Hara <[email protected]> Reviewed-by: Geoff Lang <[email protected]> Reviewed-by: Kenneth Russell <[email protected]> Cr-Commit-Position: refs/heads/master@{#657568}
void GLES2DecoderImpl::DoUniform2uiv(GLint fake_location, GLsizei count, const volatile GLuint* value) { GLenum type = 0; GLint real_location = -1; if (!PrepForSetUniformByLocation(fake_location, "glUniform2uiv", Program::kUniform2ui, &real_location, &type, &count)) { return; } api()->glUniform2uivFn(real_location, count, const_cast<const GLuint*>(value)); }
void GLES2DecoderImpl::DoUniform2uiv(GLint fake_location, GLsizei count, const volatile GLuint* value) { GLenum type = 0; GLint real_location = -1; if (!PrepForSetUniformByLocation(fake_location, "glUniform2uiv", Program::kUniform2ui, &real_location, &type, &count)) { return; } api()->glUniform2uivFn(real_location, count, const_cast<const GLuint*>(value)); }
C
Chrome
0
CVE-2017-7586
https://www.cvedetails.com/cve/CVE-2017-7586/
CWE-119
https://github.com/erikd/libsndfile/commit/708e996c87c5fae77b104ccfeb8f6db784c32074
708e996c87c5fae77b104ccfeb8f6db784c32074
src/ : Move to a variable length header buffer Previously, the `psf->header` buffer was a fixed length specified by `SF_HEADER_LEN` which was set to `12292`. This was problematic for two reasons; this value was un-necessarily large for the majority of files and too small for some others. Now the size of the header buffer starts at 256 bytes and grows as necessary up to a maximum of 100k.
psf_sanitize_string (char * cptr, int len) { do { len -- ; cptr [len] = psf_isprint (cptr [len]) ? cptr [len] : '.' ; } while (len > 0) ; } /* psf_sanitize_string */
psf_sanitize_string (char * cptr, int len) { do { len -- ; cptr [len] = psf_isprint (cptr [len]) ? cptr [len] : '.' ; } while (len > 0) ; } /* psf_sanitize_string */
C
libsndfile
0
CVE-2017-5019
https://www.cvedetails.com/cve/CVE-2017-5019/
CWE-416
https://github.com/chromium/chromium/commit/f03ea5a5c2ff26e239dfd23e263b15da2d9cee93
f03ea5a5c2ff26e239dfd23e263b15da2d9cee93
Convert FrameHostMsg_DidAddMessageToConsole to Mojo. Note: Since this required changing the test RenderViewImplTest.DispatchBeforeUnloadCanDetachFrame, I manually re-introduced https://crbug.com/666714 locally (the bug the test was added for), and reran the test to confirm that it still covers the bug. Bug: 786836 Change-Id: I110668fa6f0f261fd2ac36bb91a8d8b31c99f4f1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1526270 Commit-Queue: Lowell Manners <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Reviewed-by: Camille Lamy <[email protected]> Cr-Commit-Position: refs/heads/master@{#653137}
ServiceWorkerContextCore::ServiceWorkerContextCore( const base::FilePath& user_data_directory, scoped_refptr<base::SequencedTaskRunner> database_task_runner, storage::QuotaManagerProxy* quota_manager_proxy, storage::SpecialStoragePolicy* special_storage_policy, URLLoaderFactoryGetter* url_loader_factory_getter, base::ObserverListThreadSafe<ServiceWorkerContextCoreObserver>* observer_list, ServiceWorkerContextWrapper* wrapper) : wrapper_(wrapper), providers_(std::make_unique<ProviderByIdMap>()), provider_by_uuid_(std::make_unique<ProviderByClientUUIDMap>()), loader_factory_getter_(url_loader_factory_getter), force_update_on_page_load_(false), was_service_worker_registered_(false), observer_list_(observer_list), weak_factory_(this) { DCHECK(observer_list_); storage_ = ServiceWorkerStorage::Create( user_data_directory, AsWeakPtr(), std::move(database_task_runner), quota_manager_proxy, special_storage_policy); job_coordinator_ = std::make_unique<ServiceWorkerJobCoordinator>(AsWeakPtr()); }
ServiceWorkerContextCore::ServiceWorkerContextCore( const base::FilePath& user_data_directory, scoped_refptr<base::SequencedTaskRunner> database_task_runner, storage::QuotaManagerProxy* quota_manager_proxy, storage::SpecialStoragePolicy* special_storage_policy, URLLoaderFactoryGetter* url_loader_factory_getter, base::ObserverListThreadSafe<ServiceWorkerContextCoreObserver>* observer_list, ServiceWorkerContextWrapper* wrapper) : wrapper_(wrapper), providers_(std::make_unique<ProviderByIdMap>()), provider_by_uuid_(std::make_unique<ProviderByClientUUIDMap>()), loader_factory_getter_(url_loader_factory_getter), force_update_on_page_load_(false), was_service_worker_registered_(false), observer_list_(observer_list), weak_factory_(this) { DCHECK(observer_list_); storage_ = ServiceWorkerStorage::Create( user_data_directory, AsWeakPtr(), std::move(database_task_runner), quota_manager_proxy, special_storage_policy); job_coordinator_ = std::make_unique<ServiceWorkerJobCoordinator>(AsWeakPtr()); }
C
Chrome
0
CVE-2012-2895
https://www.cvedetails.com/cve/CVE-2012-2895/
CWE-119
https://github.com/chromium/chromium/commit/baef1ffd73db183ca50c854e1779ed7f6e5100a8
baef1ffd73db183ca50c854e1779ed7f6e5100a8
Revert 144993 - gdata: Remove invalid files in the cache directories Broke linux_chromeos_valgrind: http://build.chromium.org/p/chromium.memory.fyi/builders/Chromium%20OS%20%28valgrind%29%285%29/builds/8628/steps/memory%20test%3A%20unit/logs/stdio In theory, we shouldn't have any invalid files left in the cache directories, but things can go wrong and invalid files may be left if the device shuts down unexpectedly, for instance. Besides, it's good to be defensive. BUG=134862 TEST=added unit tests Review URL: https://chromiumcodereview.appspot.com/10693020 [email protected] git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145029 0039d316-1c4b-4281-b951-d872f2087c98
void GDataCache::DestroyOnUIThread() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); ui_weak_ptr_factory_.InvalidateWeakPtrs(); pool_->GetSequencedTaskRunner(sequence_token_)->PostTask( FROM_HERE, base::Bind(&GDataCache::Destroy, base::Unretained(this))); }
void GDataCache::DestroyOnUIThread() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); ui_weak_ptr_factory_.InvalidateWeakPtrs(); pool_->GetSequencedTaskRunner(sequence_token_)->PostTask( FROM_HERE, base::Bind(&GDataCache::Destroy, base::Unretained(this))); }
C
Chrome
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::changeLocation(const KURL& url, const String& referrer, bool lockHistory, bool lockBackForwardList, bool userGesture, bool refresh) { RefPtr<Frame> protect(m_frame); ResourceRequest request(url, referrer, refresh ? ReloadIgnoringCacheData : UseProtocolCachePolicy); if (m_frame->script()->executeIfJavaScriptURL(request.url(), userGesture)) return; urlSelected(request, "_self", 0, lockHistory, lockBackForwardList, userGesture, SendReferrer); }
void FrameLoader::changeLocation(const KURL& url, const String& referrer, bool lockHistory, bool lockBackForwardList, bool userGesture, bool refresh) { RefPtr<Frame> protect(m_frame); ResourceRequest request(url, referrer, refresh ? ReloadIgnoringCacheData : UseProtocolCachePolicy); if (m_frame->script()->executeIfJavaScriptURL(request.url(), userGesture)) return; urlSelected(request, "_self", 0, lockHistory, lockBackForwardList, userGesture, SendReferrer); }
C
Chrome
0
CVE-2014-2739
https://www.cvedetails.com/cve/CVE-2014-2739/
CWE-20
https://github.com/torvalds/linux/commit/b2853fd6c2d0f383dbdf7427e263eb576a633867
b2853fd6c2d0f383dbdf7427e263eb576a633867
IB/core: Don't resolve passive side RoCE L2 address in CMA REQ handler The code that resolves the passive side source MAC within the rdma_cm connection request handler was both redundant and buggy, so remove it. It was redundant since later, when an RC QP is modified to RTR state, the resolution will take place in the ib_core module. It was buggy because this callback also deals with UD SIDR exchange, for which we incorrectly looked at the REQ member of the CM event and dereferenced a random value. Fixes: dd5f03beb4f7 ("IB/core: Ethernet L2 attributes in verbs/cm structures") Signed-off-by: Moni Shoua <[email protected]> Signed-off-by: Or Gerlitz <[email protected]> Signed-off-by: Roland Dreier <[email protected]>
static int cma_join_ib_multicast(struct rdma_id_private *id_priv, struct cma_multicast *mc) { struct ib_sa_mcmember_rec rec; struct rdma_dev_addr *dev_addr = &id_priv->id.route.addr.dev_addr; ib_sa_comp_mask comp_mask; int ret; ib_addr_get_mgid(dev_addr, &rec.mgid); ret = ib_sa_get_mcmember_rec(id_priv->id.device, id_priv->id.port_num, &rec.mgid, &rec); if (ret) return ret; ret = cma_set_qkey(id_priv, 0); if (ret) return ret; cma_set_mgid(id_priv, (struct sockaddr *) &mc->addr, &rec.mgid); rec.qkey = cpu_to_be32(id_priv->qkey); rdma_addr_get_sgid(dev_addr, &rec.port_gid); rec.pkey = cpu_to_be16(ib_addr_get_pkey(dev_addr)); rec.join_state = 1; comp_mask = IB_SA_MCMEMBER_REC_MGID | IB_SA_MCMEMBER_REC_PORT_GID | IB_SA_MCMEMBER_REC_PKEY | IB_SA_MCMEMBER_REC_JOIN_STATE | IB_SA_MCMEMBER_REC_QKEY | IB_SA_MCMEMBER_REC_SL | IB_SA_MCMEMBER_REC_FLOW_LABEL | IB_SA_MCMEMBER_REC_TRAFFIC_CLASS; if (id_priv->id.ps == RDMA_PS_IPOIB) comp_mask |= IB_SA_MCMEMBER_REC_RATE | IB_SA_MCMEMBER_REC_RATE_SELECTOR | IB_SA_MCMEMBER_REC_MTU_SELECTOR | IB_SA_MCMEMBER_REC_MTU | IB_SA_MCMEMBER_REC_HOP_LIMIT; mc->multicast.ib = ib_sa_join_multicast(&sa_client, id_priv->id.device, id_priv->id.port_num, &rec, comp_mask, GFP_KERNEL, cma_ib_mc_handler, mc); return PTR_ERR_OR_ZERO(mc->multicast.ib); }
static int cma_join_ib_multicast(struct rdma_id_private *id_priv, struct cma_multicast *mc) { struct ib_sa_mcmember_rec rec; struct rdma_dev_addr *dev_addr = &id_priv->id.route.addr.dev_addr; ib_sa_comp_mask comp_mask; int ret; ib_addr_get_mgid(dev_addr, &rec.mgid); ret = ib_sa_get_mcmember_rec(id_priv->id.device, id_priv->id.port_num, &rec.mgid, &rec); if (ret) return ret; ret = cma_set_qkey(id_priv, 0); if (ret) return ret; cma_set_mgid(id_priv, (struct sockaddr *) &mc->addr, &rec.mgid); rec.qkey = cpu_to_be32(id_priv->qkey); rdma_addr_get_sgid(dev_addr, &rec.port_gid); rec.pkey = cpu_to_be16(ib_addr_get_pkey(dev_addr)); rec.join_state = 1; comp_mask = IB_SA_MCMEMBER_REC_MGID | IB_SA_MCMEMBER_REC_PORT_GID | IB_SA_MCMEMBER_REC_PKEY | IB_SA_MCMEMBER_REC_JOIN_STATE | IB_SA_MCMEMBER_REC_QKEY | IB_SA_MCMEMBER_REC_SL | IB_SA_MCMEMBER_REC_FLOW_LABEL | IB_SA_MCMEMBER_REC_TRAFFIC_CLASS; if (id_priv->id.ps == RDMA_PS_IPOIB) comp_mask |= IB_SA_MCMEMBER_REC_RATE | IB_SA_MCMEMBER_REC_RATE_SELECTOR | IB_SA_MCMEMBER_REC_MTU_SELECTOR | IB_SA_MCMEMBER_REC_MTU | IB_SA_MCMEMBER_REC_HOP_LIMIT; mc->multicast.ib = ib_sa_join_multicast(&sa_client, id_priv->id.device, id_priv->id.port_num, &rec, comp_mask, GFP_KERNEL, cma_ib_mc_handler, mc); return PTR_ERR_OR_ZERO(mc->multicast.ib); }
C
linux
0
CVE-2018-7998
https://www.cvedetails.com/cve/CVE-2018-7998/
CWE-362
https://github.com/jcupitt/libvips/commit/20d840e6da15c1574b3ed998bc92f91d1e36c2a5
20d840e6da15c1574b3ed998bc92f91d1e36c2a5
fix a crash with delayed load If a delayed load failed, it could leave the pipeline only half-set up. Sebsequent threads could then segv. Set a load-has-failed flag and test before generate. See https://github.com/jcupitt/libvips/issues/893
vips_foreign_load_generate( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop ) { VipsRegion *ir = (VipsRegion *) seq; VipsRect *r = &or->valid; /* Ask for input we need. */ if( vips_region_prepare( ir, r ) ) return( -1 ); /* Attach output region to that. */ if( vips_region_region( or, ir, r, r->left, r->top ) ) return( -1 ); return( 0 ); }
vips_foreign_load_generate( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop ) { VipsRegion *ir = (VipsRegion *) seq; VipsRect *r = &or->valid; /* Ask for input we need. */ if( vips_region_prepare( ir, r ) ) return( -1 ); /* Attach output region to that. */ if( vips_region_region( or, ir, r, r->left, r->top ) ) return( -1 ); return( 0 ); }
C
libvips
0
CVE-2012-5156
https://www.cvedetails.com/cve/CVE-2012-5156/
CWE-399
https://github.com/chromium/chromium/commit/b15c87071f906301bccc824ce013966ca93998c7
b15c87071f906301bccc824ce013966ca93998c7
Validate and report peer's PID to WorkerProcessIpcDelegate so it will be able to duplicate handles to and from the worker process. As a side effect WorkerProcessLauncher::Delegate is now responsible for retrieving the client's PID and deciding whether a launch failed due to a permanent error condition. BUG=134694 Review URL: https://chromiumcodereview.appspot.com/11143025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162778 0039d316-1c4b-4281-b951-d872f2087c98
bool DesktopSessionWin::OnMessageReceived(const IPC::Message& message) { DCHECK(main_task_runner_->BelongsToCurrentThread()); return false; }
bool DesktopSessionWin::OnMessageReceived(const IPC::Message& message) { DCHECK(main_task_runner_->BelongsToCurrentThread()); return false; }
C
Chrome
0
CVE-2013-2906
https://www.cvedetails.com/cve/CVE-2013-2906/
CWE-362
https://github.com/chromium/chromium/commit/c4a4dfb26615b5ef5e9dcc730ef43f70ce9202e2
c4a4dfb26615b5ef5e9dcc730ef43f70ce9202e2
Suspend shared timers while blockingly closing databases BUG=388771 [email protected] Review URL: https://codereview.chromium.org/409863002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284785 0039d316-1c4b-4281-b951-d872f2087c98
GpuChannelHost* RenderThreadImpl::GetGpuChannel() { if (!gpu_channel_.get()) return NULL; if (gpu_channel_->IsLost()) return NULL; return gpu_channel_.get(); }
GpuChannelHost* RenderThreadImpl::GetGpuChannel() { if (!gpu_channel_.get()) return NULL; if (gpu_channel_->IsLost()) return NULL; return gpu_channel_.get(); }
C
Chrome
0
CVE-2017-16534
https://www.cvedetails.com/cve/CVE-2017-16534/
CWE-119
https://github.com/torvalds/linux/commit/2e1c42391ff2556387b3cb6308b24f6f65619feb
2e1c42391ff2556387b3cb6308b24f6f65619feb
USB: core: harden cdc_parse_cdc_header Andrey Konovalov reported a possible out-of-bounds problem for the cdc_parse_cdc_header function. He writes: It looks like cdc_parse_cdc_header() doesn't validate buflen before accessing buffer[1], buffer[2] and so on. The only check present is while (buflen > 0). So fix this issue up by properly validating the buffer length matches what the descriptor says it is. Reported-by: Andrey Konovalov <[email protected]> Tested-by: Andrey Konovalov <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
static void __usb_queue_reset_device(struct work_struct *ws) { int rc; struct usb_interface *iface = container_of(ws, struct usb_interface, reset_ws); struct usb_device *udev = interface_to_usbdev(iface); rc = usb_lock_device_for_reset(udev, iface); if (rc >= 0) { usb_reset_device(udev); usb_unlock_device(udev); } usb_put_intf(iface); /* Undo _get_ in usb_queue_reset_device() */ }
static void __usb_queue_reset_device(struct work_struct *ws) { int rc; struct usb_interface *iface = container_of(ws, struct usb_interface, reset_ws); struct usb_device *udev = interface_to_usbdev(iface); rc = usb_lock_device_for_reset(udev, iface); if (rc >= 0) { usb_reset_device(udev); usb_unlock_device(udev); } usb_put_intf(iface); /* Undo _get_ in usb_queue_reset_device() */ }
C
linux
0
CVE-2016-3951
https://www.cvedetails.com/cve/CVE-2016-3951/
null
https://github.com/torvalds/linux/commit/1666984c8625b3db19a9abc298931d35ab7bc64b
1666984c8625b3db19a9abc298931d35ab7bc64b
usbnet: cleanup after bind() in probe() In case bind() works, but a later error forces bailing in probe() in error cases work and a timer may be scheduled. They must be killed. This fixes an error case related to the double free reported in http://www.spinics.net/lists/netdev/msg367669.html and needs to go on top of Linus' fix to cdc-ncm. Signed-off-by: Oliver Neukum <[email protected]> Signed-off-by: David S. Miller <[email protected]>
int usbnet_suspend (struct usb_interface *intf, pm_message_t message) { struct usbnet *dev = usb_get_intfdata(intf); if (!dev->suspend_count++) { spin_lock_irq(&dev->txq.lock); /* don't autosuspend while transmitting */ if (dev->txq.qlen && PMSG_IS_AUTO(message)) { dev->suspend_count--; spin_unlock_irq(&dev->txq.lock); return -EBUSY; } else { set_bit(EVENT_DEV_ASLEEP, &dev->flags); spin_unlock_irq(&dev->txq.lock); } /* * accelerate emptying of the rx and queues, to avoid * having everything error out. */ netif_device_detach (dev->net); usbnet_terminate_urbs(dev); __usbnet_status_stop_force(dev); /* * reattach so runtime management can use and * wake the device */ netif_device_attach (dev->net); } return 0; }
int usbnet_suspend (struct usb_interface *intf, pm_message_t message) { struct usbnet *dev = usb_get_intfdata(intf); if (!dev->suspend_count++) { spin_lock_irq(&dev->txq.lock); /* don't autosuspend while transmitting */ if (dev->txq.qlen && PMSG_IS_AUTO(message)) { dev->suspend_count--; spin_unlock_irq(&dev->txq.lock); return -EBUSY; } else { set_bit(EVENT_DEV_ASLEEP, &dev->flags); spin_unlock_irq(&dev->txq.lock); } /* * accelerate emptying of the rx and queues, to avoid * having everything error out. */ netif_device_detach (dev->net); usbnet_terminate_urbs(dev); __usbnet_status_stop_force(dev); /* * reattach so runtime management can use and * wake the device */ netif_device_attach (dev->net); } return 0; }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/4afa45dfbf11e9334e63aef002cd854ec86f6d44
4afa45dfbf11e9334e63aef002cd854ec86f6d44
Revert 37061 because it caused ui_tests to not finish. TBR=estade TEST=none BUG=none Review URL: http://codereview.chromium.org/549155 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37075 0039d316-1c4b-4281-b951-d872f2087c98
bool BrowserActionButton::IsPopup() { return browser_action_->has_popup(); }
bool BrowserActionButton::IsPopup() { return browser_action_->has_popup(); }
C
Chrome
0
CVE-2019-11412
https://www.cvedetails.com/cve/CVE-2019-11412/
CWE-119
https://github.com/ccxvii/mujs/commit/1e5479084bc9852854feb1ba9bf68b52cd127e02
1e5479084bc9852854feb1ba9bf68b52cd127e02
Bug 700947: Add missing ENDTRY opcode in try/catch/finally byte code. In one of the code branches in handling exceptions in the catch block we forgot to call the ENDTRY opcode to pop the inner hidden try. This leads to an unbalanced exception stack which can cause a crash due to us jumping to a stack frame that has already been exited.
static void cvarinit(JF, js_Ast *list) { while (list) { js_Ast *var = list->a; if (var->b) { cexp(J, F, var->b); emitline(J, F, var); emitlocal(J, F, OP_SETLOCAL, OP_SETVAR, var->a); emit(J, F, OP_POP); } list = list->b; } }
static void cvarinit(JF, js_Ast *list) { while (list) { js_Ast *var = list->a; if (var->b) { cexp(J, F, var->b); emitline(J, F, var); emitlocal(J, F, OP_SETLOCAL, OP_SETVAR, var->a); emit(J, F, OP_POP); } list = list->b; } }
C
mujs
0