summaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2011-09-02 20:16:41 +0000
committermichi_cc <michi_cc@openttd.org>2011-09-02 20:16:41 +0000
commit65637d89411e96dee5ee9fc2e8a7b3805c4162a2 (patch)
tree79fdfb3cefba4457d3b81760173c5ca68e359a81 /src/script
parent6c7cbb1d46d266d33e49bd42a52e483296313882 (diff)
downloadopenttd-65637d89411e96dee5ee9fc2e8a7b3805c4162a2.tar.xz
(svn r22874) -Fix [FS#4747]: Check size of various buffers before allocation. (monoid)
Diffstat (limited to 'src/script')
-rw-r--r--src/script/squirrel_helper.hpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/script/squirrel_helper.hpp b/src/script/squirrel_helper.hpp
index a7d0bf7ba..babdf74b3 100644
--- a/src/script/squirrel_helper.hpp
+++ b/src/script/squirrel_helper.hpp
@@ -118,6 +118,9 @@ namespace SQConvert {
template <> inline Array *GetParam(ForceType<Array *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr)
{
+ /* Sanity check of the size. */
+ if (sq_getsize(vm, index) > UINT16_MAX) throw sq_throwerror(vm, _SC("an array used as parameter to a function is too large"));
+
SQObject obj;
sq_getstackobj(vm, index, &obj);
sq_pushobject(vm, obj);