mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-22 18:09:49 +01:00
backend/drm: prevent out-of-bounds array access on unknown subpixel
If the kernel adds new enum entries for subpixel, don't read past the end of the subpixel_map array.
This commit is contained in:
parent
bde68b1df7
commit
c675380c56
1 changed files with 5 additions and 1 deletions
|
@ -1245,7 +1245,11 @@ static void connect_drm_connector(struct wlr_drm_connector *wlr_conn,
|
|||
wlr_conn->output.phys_height = drm_conn->mmHeight;
|
||||
wlr_log(WLR_INFO, "Physical size: %"PRId32"x%"PRId32,
|
||||
wlr_conn->output.phys_width, wlr_conn->output.phys_height);
|
||||
wlr_conn->output.subpixel = subpixel_map[drm_conn->subpixel];
|
||||
if (drm_conn->subpixel < sizeof(subpixel_map) / sizeof(subpixel_map[0])) {
|
||||
wlr_conn->output.subpixel = subpixel_map[drm_conn->subpixel];
|
||||
} else {
|
||||
wlr_log(WLR_ERROR, "Unknown subpixel value: %d", (int)drm_conn->subpixel);
|
||||
}
|
||||
|
||||
get_drm_connector_props(drm->fd, wlr_conn->id, &wlr_conn->props);
|
||||
|
||||
|
|
Loading…
Reference in a new issue