mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-04 06:00:15 +00:00
(svn r23870) -Fix [FS#5004]: scripts with a bad comparator could lock up OpenTTD
This commit is contained in:
parent
399186526a
commit
a90ad57763
4
src/3rdparty/squirrel/squirrel/sqbaselib.cpp
vendored
4
src/3rdparty/squirrel/squirrel/sqbaselib.cpp
vendored
@ -538,6 +538,10 @@ bool _hsort_sift_down(HSQUIRRELVM v,SQArray *arr, SQInteger root, SQInteger bott
|
||||
if(!_sort_compare(v,arr->_values[root],arr->_values[maxChild],func,ret))
|
||||
return false;
|
||||
if (ret < 0) {
|
||||
if (root == maxChild) {
|
||||
v->Raise_Error(_SC("inconsistent compare function"));
|
||||
return false; // We'd be swapping ourselve. The compare function is incorrect
|
||||
}
|
||||
_Swap(arr->_values[root],arr->_values[maxChild]);
|
||||
root = maxChild;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user