diff options
author | Filip Sandborg <filipsandborg@gmail.com> | 2020-03-15 18:41:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-15 18:41:12 +0100 |
commit | 5ee52a3ab9a12adb157738dc3fba72137c3c6879 (patch) | |
tree | 758d392ea2fb279abfb05bf647ef7c6bee7c5ca9 /backend | |
parent | 1282c3b12fc2c0dacf0c5df9b261dfc45046e7c6 (diff) |
Fix uint32 overflow in fill_empty_gamma_table on Icelake platform
Closes: https://github.com/swaywm/sway/issues/4826
Diffstat (limited to 'backend')
-rw-r--r-- | backend/drm/drm.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c index fe989e38..b62de849 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -501,8 +501,9 @@ static bool drm_connector_commit(struct wlr_output *output) { static void fill_empty_gamma_table(size_t size, uint16_t *r, uint16_t *g, uint16_t *b) { + assert(0xFFFF < UINT64_MAX / (size - 1)); for (uint32_t i = 0; i < size; ++i) { - uint16_t val = (uint32_t)0xffff * i / (size - 1); + uint16_t val = (uint64_t)0xffff * i / (size - 1); r[i] = g[i] = b[i] = val; } } |