Commit 5e259919 authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

[ozone/wayland] Fix zaura_shell versioning check

This CL ensures that the WL client (Chromium/Wayland, Lacros) tells
the WL server (Exo) the higher Aura Shell protocol version it
supports, instead of the lower.

With this in place, code is safe against similar crashes observed in
bugs 1145642 and 1145695, where the Client (Lacros) was telling the
server (Exo) it supports a version higher than it actually does.

BUG=1145642, 1145695

Change-Id: Ia471748f0f3066eea901c189c06da3c1137c1cdf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2518443
Auto-Submit: Antonio Gomes <tonikitoo@igalia.com>
Reviewed-by: default avatarNick Yamane <nickdiego@igalia.com>
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Cr-Commit-Position: refs/heads/master@{#824556}
parent 6d02b47a
......@@ -53,6 +53,7 @@
namespace ui {
namespace {
constexpr uint32_t kMaxAuraShellVersion = 11;
constexpr uint32_t kMaxCompositorVersion = 4;
constexpr uint32_t kMaxCursorShapesVersion = 1;
constexpr uint32_t kMaxGtkPrimarySelectionDeviceManagerVersion = 1;
......@@ -66,7 +67,6 @@ constexpr uint32_t kMaxWpPresentationVersion = 1;
constexpr uint32_t kMaxWpViewporterVersion = 1;
constexpr uint32_t kMaxTextInputManagerVersion = 1;
constexpr uint32_t kMaxExplicitSyncVersion = 2;
constexpr uint32_t kMinAuraShellVersion = 11;
constexpr uint32_t kMinWlDrmVersion = 2;
constexpr uint32_t kMinWlOutputVersion = 2;
constexpr uint32_t kMaxXdgDecorationVersion = 1;
......@@ -435,9 +435,9 @@ void WaylandConnection::Global(void* data,
connection->drm_ =
std::make_unique<WaylandDrm>(wayland_drm.release(), connection);
} else if (!connection->zaura_shell_ &&
(strcmp(interface, "zaura_shell") == 0) &&
version >= kMinAuraShellVersion) {
auto zaura_shell = wl::Bind<struct zaura_shell>(registry, name, version);
(strcmp(interface, "zaura_shell") == 0)) {
auto zaura_shell = wl::Bind<struct zaura_shell>(
registry, name, std::min(version, kMaxAuraShellVersion));
if (!zaura_shell) {
LOG(ERROR) << "Failed to bind zaura_shell";
return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment