aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-12-04 18:19:55 -0500
committerGitHub <noreply@github.com>2018-12-04 18:19:55 -0500
commit4fadde362fbda2558c9d92944966825c99949e84 (patch)
tree06b570100634801a254d105e8fda02437b108b87 /backend
parent3efc6bc363b4200d9cd73e76a7e95778595f5049 (diff)
parent491f1dbf75d07f6a940d9792eb74ff871606e7b0 (diff)
Merge pull request #1412 from emersion/drm-vla-overflow
backend/drm: fix VLA overflow
Diffstat (limited to 'backend')
-rw-r--r--backend/drm/drm.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index c2186932..97028dc7 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -428,6 +428,19 @@ bool enable_drm_connector(struct wlr_output *output, bool enable) {
return true;
}
+static ssize_t connector_index_from_crtc(struct wlr_drm_backend *drm,
+ struct wlr_drm_crtc *crtc) {
+ size_t i = 0;
+ struct wlr_drm_connector *conn;
+ wl_list_for_each(conn, &drm->outputs, link) {
+ if (conn->crtc == crtc) {
+ return i;
+ }
+ ++i;
+ }
+ return -1;
+}
+
static void realloc_planes(struct wlr_drm_backend *drm, const uint32_t *crtc_in,
bool *changed_outputs) {
wlr_log(WLR_DEBUG, "Reallocating planes");
@@ -477,7 +490,10 @@ static void realloc_planes(struct wlr_drm_backend *drm, const uint32_t *crtc_in,
type,
c->id);
- changed_outputs[crtc_res[i]] = true;
+ ssize_t conn_idx = connector_index_from_crtc(drm, c);
+ if (conn_idx >= 0) {
+ changed_outputs[conn_idx] = true;
+ }
if (*old) {
finish_drm_surface(&(*old)->surf);
}