summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scilab/modules/ast/src/cpp/types/arrayof.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/scilab/modules/ast/src/cpp/types/arrayof.cpp b/scilab/modules/ast/src/cpp/types/arrayof.cpp
index ebe8e98..ba6a2f5 100644
--- a/scilab/modules/ast/src/cpp/types/arrayof.cpp
+++ b/scilab/modules/ast/src/cpp/types/arrayof.cpp
@@ -999,11 +999,6 @@ GenericType* ArrayOf<T>::extract(typed_list* _pArgs)
999 //index are ":" 999 //index are ":"
1000 bool isForceColVector = il.size() == 4; 1000 bool isForceColVector = il.size() == 4;
1001 1001
1002 if (start < 1 || end < 1)
1003 {
1004 return NULL;
1005 }
1006
1007 //std::cout << start << ":" << step << ":" << end << std::endl; 1002 //std::cout << start << ":" << step << ":" << end << std::endl;
1008 int size = static_cast<int>((end - start) / step + 1); 1003 int size = static_cast<int>((end - start) / step + 1);
1009 1004
@@ -1012,8 +1007,9 @@ GenericType* ArrayOf<T>::extract(typed_list* _pArgs)
1012 return createEmpty(); 1007 return createEmpty();
1013 } 1008 }
1014 1009
1015 if (step > 0 && (size - 1) * step + start > m_iSize || 1010 //check bounds
1016 step < 0 && start > m_iSize) 1011 if (step > 0 && ((size - 1) * step + start > m_iSize || start < 1) ||
1012 (step < 0 && (start > m_iSize || end < 1)))
1017 { 1013 {
1018 return NULL; 1014 return NULL;
1019 } 1015 }