diff options
author | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2008-08-04 15:39:54 +0000 |
---|---|---|
committer | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2008-08-04 15:39:54 +0000 |
commit | ed557ff06d1933dfa1f5cee5d82d2ee54ec72e40 (patch) | |
tree | 0d622ea7a6fd3050cb9b2655ce27dce2978e762b | |
parent | 136cfab4c5f22061327135e43239dde36c47c08d (diff) |
fixed bug where negative list-lengths would not be
handled specially, resulting in possible segfaults
svn path=/trunk/externals/zexy/; revision=10233
-rw-r--r-- | src/list2lists.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/list2lists.c b/src/list2lists.c index d181bf8..9f858d4 100644 --- a/src/list2lists.c +++ b/src/list2lists.c @@ -66,7 +66,12 @@ static void list2lists_list2(t_list2lists*x,t_symbol*s, int argc, t_atom*argv) x->x_lcount=argc; x->x_length=(t_int*)getbytes((x->x_lcount)*sizeof(t_int)); for(i=0; i<argc; i++) { - x->x_length[i]=atom_getint(argv+i); + int index=atom_getint(argv+i); + if(index<0) { + pd_error(x, "[list2lists]: clamped negative index=%d to 0!", index); + index=0; + } + x->x_length[i]=index; } } |