mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
TWP: Fix argument cannot be negative in squirrel.
Coverity CID 1540600
This commit is contained in:
1 parent
ef07070954
commit
ed5da2b101
1 file changed
+4
@@ -334,7 +334,11 @@ static SQInteger _string_startswith(HSQUIRRELVM v)
|
||||
sq_getstring(v,2,&str);
|
||||
sq_getstring(v,3,&cmp);
|
||||
SQInteger len = sq_getsize(v,2);
|
||||
if(len < 0)
|
||||
len = 0;
|
||||
SQInteger cmplen = sq_getsize(v,3);
|
||||
if(cmplen < 0)
|
||||
len = 0;
|
||||
SQBool ret = SQFalse;
|
||||
if((len >=0) && (cmplen >=0) && (cmplen <= len)) {
|
||||
ret = memcmp(str,cmp,sq_rsl(cmplen)) == 0 ? SQTrue : SQFalse;
|
||||
|
||||
Reference in new issue
Block a user