[virt-tools-list] [PATCH virt-viewer v4 2/3] session-spice: Set fullscreen displays according to monitor-mapping

Jonathon Jongsma jjongsma at redhat.com
Mon May 4 16:48:16 UTC 2015


On Mon, 2015-05-04 at 17:20 +0200, Pavel Grunt wrote:
> It is necessary to follow the monitor mapping, otherwise a display
> can get dimensions which belongs to other than desired monitor.
> 
> Related: rhbz#1212802
> ---
>  src/virt-viewer-session-spice.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
> index b69faa6..c1333dd 100644
> --- a/src/virt-viewer-session-spice.c
> +++ b/src/virt-viewer-session-spice.c
> @@ -866,7 +866,7 @@ virt_viewer_session_spice_fullscreen_auto_conf(VirtViewerSessionSpice *self)
>      displays = g_new0(GdkRectangle, ndisplays);
>  
>      for (i = 0, l = initial_displays; l != NULL; l = l->next, i++) {
> -        GdkRectangle* rect = &displays[i];
> +        GdkRectangle* rect = &displays[GPOINTER_TO_INT(l->data)];
>          gint j = virt_viewer_app_get_initial_monitor_for_display(app, GPOINTER_TO_INT(l->data));
>          if (j == -1)
>              continue;

I feel that this is a little bit risky because we're not validating that
GPOINTER_TO_INT(l->data) is less than ndisplays. It's true that you did
guarantee that on your previous commit, but that's in a totally
different section of code. In the future, somebody might change that
behavior without realizing that it could create an illegal array access
in this location. So I think we should validate our assumptions in this
location as well.




More information about the virt-tools-list mailing list