diff options
author | Tor Lillqvist <tml@collabora.com> | 2015-01-16 14:56:17 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-01-26 09:52:50 +0000 |
commit | d134941fd914aa70567c5856d2d5acb8cba1114a (patch) | |
tree | eb1f94a7d1627e429b4fcb6c7f0912de2afe9e73 | |
parent | f6fb7359657425acfb045a6daeaad20ca70a6cb8 (diff) |
fdo#88444: Guard against out-of-bound access
libreoffice-4-2-milestone-7-2
Change-Id: Id918934eed1e5221a40e3a04604640fa2b158fe4
-rw-r--r-- | sc/source/core/opencl/opbase.cxx | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sc/source/core/opencl/opbase.cxx b/sc/source/core/opencl/opbase.cxx index 7589de9a813e..fd6cdfbed5ad 100644 --- a/sc/source/core/opencl/opbase.cxx +++ b/sc/source/core/opencl/opbase.cxx @@ -190,13 +190,20 @@ void CheckVariables::CheckSubArgumentIsNan2( std::stringstream & ss, ss<< " tmp"; ss<< i; ss<< "= fsum("; - vSubArguments[i]->GenDeclRef(ss); if(vSubArguments[i]->GetFormulaToken()->GetType() == formula::svDoubleVectorRef) + { + vSubArguments[i]->GenDeclRef(ss); ss<<"["<< p.c_str()<< "]"; + } else if(vSubArguments[i]->GetFormulaToken()->GetType() == formula::svSingleVectorRef) - ss<<"[get_group_id(1)]"; + { + formula::SingleVectorRefToken *pSVR = dynamic_cast<formula::SingleVectorRefToken*>(vSubArguments[i]->GetFormulaToken()); + ss<<"(get_group_id(1)<" << pSVR->GetArrayLength() << "?"; + vSubArguments[i]->GenDeclRef(ss); + ss<<"[get_group_id(1)]:0)"; + } ss<<", 0);\n"; #else ss <<" tmp"; |