From 3a59756c5ba9d322487714751e3aa6498e6a8fee Mon Sep 17 00:00:00 2001 From: Jonathan Wilkes <jon.w.wilkes@gmail.com> Date: Sun, 18 Jun 2017 16:33:20 -0400 Subject: [PATCH] port from Pd Vanilla: assert table-sizes in tabread4~ tabread4~ needs at least 4 samples to interpolate; this patch adds guards in order to not access out-of-bound indices in the table, in case the table is smaller than 4 samples. commit e667894370ec22bc1d1d844443d90f1a76adc03e --- pd/src/d_array.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pd/src/d_array.c b/pd/src/d_array.c index 838a2ecb2..175704b1d 100644 --- a/pd/src/d_array.c +++ b/pd/src/d_array.c @@ -298,6 +298,7 @@ static t_int *tabread_tilde_perform(t_int *w) int i; maxindex = x->x_npoints - 1; + if (maxindex < 0) goto zero; if (!buf) goto zero; for (i = 0; i < n; i++) @@ -398,6 +399,7 @@ static t_int *tabread4_tilde_perform(t_int *w) int i; maxindex = x->x_npoints - 3; + if (maxindex < 0) goto zero; if (!buf) goto zero; -- GitLab