[Ecls-list] Segfault for invalid DIMS parameter to MAKE-ARRAY

Mark Cox markcox80 at gmail.com
Mon Sep 6 00:46:05 UTC 2010


Hi,

When evaluating (make-array #(3.5)), ECL currently segfaults. With the attached patch, make-array now produces an error when the DIMS parameter is neither a FIXNUM nor a LIST.

Mark 

===File ~/tmp/array.diff====================================
diff --git a/src/c/array.d b/src/c/array.d
index 66c138a..d698ff6 100644
--- a/src/c/array.d
+++ b/src/c/array.d
@@ -406,6 +406,8 @@ si_make_pure_array(cl_object etype, cl_object dims, cl_object adj,
	cl_object x;
	if (FIXNUMP(dims)) {
		return si_make_vector(etype, dims, adj, fillp, displ, disploff);
+	} else if (ecl_unlikely(!ECL_LISTP(dims))) {
+		FEerror("DIMS is neither a FIXNUM nor a LIST. ~A",1,dims);
	}
	r = ecl_length(dims);
	if (ecl_unlikely(r >= ARANKLIM)) {
============================================================




More information about the ecl-devel mailing list