vrend: reject capset id 0

0 is never an invalid capset id.

For an invalid capset id, we have to assume caps points to a buffer of
size 0 (what vrend_renderer_get_cap_set reports).  We can't set
caps->max_version.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gert Wollny <gert.wollny@collabra.com>
macos/master
Chia-I Wu 4 years ago
parent 0e272c3fe3
commit 922435f279
  1. 14
      src/vrend_renderer.c

@ -10145,18 +10145,18 @@ void vrend_renderer_fill_caps(uint32_t set, UNUSED uint32_t version,
if (!caps)
return;
if (set > 2) {
caps->max_version = 0;
return;
}
if (set == 1) {
switch (set) {
case VIRGL_RENDERER_CAPSET_VIRGL:
memset(caps, 0, sizeof(struct virgl_caps_v1));
caps->max_version = 1;
} else if (set == 2) {
break;
case VIRGL_RENDERER_CAPSET_VIRGL2:
memset(caps, 0, sizeof(*caps));
caps->max_version = 2;
fill_capset2 = true;
break;
default:
return;
}
/* We don't want to deal with stale error states that the caller might not

Loading…
Cancel
Save