summaryrefslogtreecommitdiffstats
path: root/lib/starc_lower.c
diff options
context:
space:
mode:
authorEthan Werner <mail@ethanwerner.com>2026-08-09 15:02:21 +0400
committerEthan Werner <mail@ethanwerner.com>2026-08-09 15:02:21 +0400
commit3d92926a902017e7cf1f5738e99ff62da596ce12 (patch)
tree2b55422c26a48759d56fa91f06df24449e9dfa88 /lib/starc_lower.c
parent07e18043145f3d91c8ea7ec3ad41b3c905585277 (diff)
Diffstat (limited to 'lib/starc_lower.c')
-rw-r--r--lib/starc_lower.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/starc_lower.c b/lib/starc_lower.c
index 97ac02f..16c5084 100644
--- a/lib/starc_lower.c
+++ b/lib/starc_lower.c
@@ -24,7 +24,7 @@ ts_parameter_t const ts_starc_lower_p = { .n_inputs = 4, .n_outputs = 1, .n_cons
uint_t ts_starc_lower_offset( ts_constant_t const *c )
{
( void )c;
- return ( c ? ((ts_starc_lower_params_t *)c)->k > 0 ? ((ts_starc_lower_params_t *)c)->k - 1 : 0 : 0 );
+ return ( c ? ((ts_starc_lower_params_t const *)c)->k > 0 ? ((ts_starc_lower_params_t const *)c)->k - 1 : 0 : 0 );
}
int ts_starc_lower(
@@ -35,9 +35,11 @@ int ts_starc_lower(
{
TS_PROLOGUE( ts_starc_lower_p );
if ( !c ) return -1;
- uint_t k = ((ts_starc_lower_params_t *)c)->k;
+ TS_CHECK_INPUT(x, x_n, n);
+ uint_t k = ((ts_starc_lower_params_t const *)c)->k;
if( k == 0 ) return -1;
- fp_t mult = ((ts_starc_lower_params_t *)c)->mult;
+ fp_t mult = ((ts_starc_lower_params_t const *)c)->mult;
+ if (mult < 0 || isnan(mult) || isinf(mult)) return -1;
uint_t half_k = k / 2;
if (n <= half_k) return -1;