diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2020-08-13 23:48:25 +0400 |
---|---|---|
committer | Frediano Ziglio <freddy77@gmail.com> | 2020-09-14 14:35:12 +0100 |
commit | 828c881bd0a8d73a5c2038bdf22cb8ae7c793428 (patch) | |
tree | df78c9b93720ae810285f09320e3bbe829e556ca | |
parent | 5223aeed322c9e30da919796233f203af5a19e37 (diff) |
agent/qxl: add monitors physical dimensions handling
Requires
https://gitlab.freedesktop.org/spice/spice-protocol/-/merge_requests/24
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | meson.build | 2 | ||||
-rw-r--r-- | server/reds.cpp | 12 |
3 files changed, 12 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac index 63699122..035bab51 100644 --- a/configure.ac +++ b/configure.ac @@ -164,7 +164,7 @@ AM_CONDITIONAL(HAVE_SASL, test "x$have_sasl" = "xyes") dnl ========================================================================= dnl Check deps -m4_define([SPICE_PROTOCOL_MIN_VER],[0.14.0]) +m4_define([SPICE_PROTOCOL_MIN_VER],[0.14.3]) m4_include([subprojects/spice-common/m4/common.m4]) AC_CHECK_LIBM diff --git a/meson.build b/meson.build index 8aab78a5..b7d6e8b3 100644 --- a/meson.build +++ b/meson.build @@ -50,7 +50,7 @@ spice_server_include = [include_directories('.')] spice_server_deps = [dependency('threads')] spice_server_link_args = [] spice_server_requires = '' -spice_protocol_version='0.14.0' +spice_protocol_version='0.14.3' # # Spice common subproject diff --git a/server/reds.cpp b/server/reds.cpp index edbd09de..bfe525bf 100644 --- a/server/reds.cpp +++ b/server/reds.cpp @@ -1111,10 +1111,12 @@ static void reds_on_main_agent_monitors_config(RedsState *reds, { const unsigned int MAX_NUM_MONITORS = 256; const unsigned int MAX_MONITOR_CONFIG_SIZE = - sizeof(VDAgentMonitorsConfig) + MAX_NUM_MONITORS * sizeof(VDAgentMonConfig); + sizeof(VDAgentMonitorsConfig) + + MAX_NUM_MONITORS * (sizeof(VDAgentMonConfig) + sizeof(VDAgentMonitorMM)); VDAgentMessage *msg_header; VDAgentMonitorsConfig *monitors_config; + size_t monitor_size = sizeof(VDAgentMonConfig); SpiceBuffer *cmc = &reds->client_monitors_config; uint32_t max_monitors; @@ -1140,9 +1142,15 @@ static void reds_on_main_agent_monitors_config(RedsState *reds, goto overflow; } monitors_config = (VDAgentMonitorsConfig *)(cmc->buffer + sizeof(*msg_header)); + /* filter out not known flags */ + monitors_config->flags &= ~(VD_AGENT_CONFIG_MONITORS_FLAG_USE_POS | + VD_AGENT_CONFIG_MONITORS_FLAG_PHYSICAL_SIZE); + if ((monitors_config->flags & VD_AGENT_CONFIG_MONITORS_FLAG_PHYSICAL_SIZE) != 0) { + monitor_size += sizeof(VDAgentMonitorMM); + } // limit the monitor number to avoid buffer overflows max_monitors = (msg_header->size - sizeof(VDAgentMonitorsConfig)) / - sizeof(VDAgentMonConfig); + monitor_size; if (monitors_config->num_of_monitors > max_monitors) { goto overflow; } |