From 1ac02db6a98749c9618500888fd42acfcca76ffd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Fri, 24 Jun 2022 16:20:55 +0200 Subject: [PATCH] spa: audioconvert: ensure that noise::intesity is not too big Shifting by 64 or more would not fit into `uint64_t`. --- spa/plugins/audioconvert/noise-ops.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spa/plugins/audioconvert/noise-ops.c b/spa/plugins/audioconvert/noise-ops.c index 1c934792e..1fd4081e4 100644 --- a/spa/plugins/audioconvert/noise-ops.c +++ b/spa/plugins/audioconvert/noise-ops.c @@ -71,6 +71,9 @@ int noise_init(struct noise *ns) if (info == NULL) return -ENOTSUP; + if (ns->intensity >= 64) + return -EINVAL; + for (i = 0; i < SPA_N_ELEMENTS(ns->tab); i++) ns->tab[i] = (drand48() - 0.5) / (UINT64_C(1) << ns->intensity);