mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-30 11:40:21 +02:00
* fix for bug #36722. Assigning result of compare(w)str to shortint risks overflow if length difference>=128.
Add sign() calls to fix this. git-svn-id: trunk@44290 -
This commit is contained in:
parent
7b4ef925f0
commit
f56e971958
@ -1183,10 +1183,10 @@ begin
|
||||
if OpCode in [opCmpEq, opCmpNe] then
|
||||
if Length(WideString(Left)) <> Length(WideString(Right)) then
|
||||
Exit(-1);
|
||||
Result := WideCompareStr(
|
||||
Result := sign(WideCompareStr(
|
||||
WideString(Left),
|
||||
WideString(Right)
|
||||
);
|
||||
));
|
||||
end;
|
||||
|
||||
|
||||
@ -1204,10 +1204,10 @@ begin
|
||||
if OpCode in [opCmpEq, opCmpNe] then
|
||||
if Length(AnsiString(Left)) <> Length(AnsiString(Right)) then
|
||||
Exit(-1);
|
||||
Result := CompareStr(
|
||||
Result := sign(CompareStr(
|
||||
AnsiString(Left),
|
||||
AnsiString(Right)
|
||||
);
|
||||
));
|
||||
end;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user