From 7d7f66c626bc44d4f472291e9da17bb7b0dcb62e Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Tue, 31 Jul 2007 21:58:34 +0000 Subject: [PATCH] Fixed a bug in the array indexing that was causing heap corruption --- tock_support_cppcsp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tock_support_cppcsp.h b/tock_support_cppcsp.h index c8e2fb9..470bbf2 100644 --- a/tock_support_cppcsp.h +++ b/tock_support_cppcsp.h @@ -233,7 +233,7 @@ public: inline tockArrayView operator[] (const unsigned index) const { - return tockArrayView(realArray + (totalSubDim * index),dims,totalSubDim / dims[0]); + return tockArrayView(realArray + (totalSubDim * index),dims,DIMS <= 1 ? 1 : (totalSubDim / dims[1])); } inline tockArrayView sliceFor(const unsigned amount) const