mirror of
https://github.com/byteworksinc/ORCA-Pascal.git
synced 2024-09-27 13:57:19 +00:00
Avoid overflow in computation of whether a case statement is sparse.
If the difference between the minimum and maximum values in a case statement was greater than 32767, then the subtraction in this computation would overflow. That would cause the case statement to be treated as non-sparse, so a jump table would be generated for it, but that jump table would be very large, so it would overflow the object buffer and cause an error.
This commit is contained in:
parent
d660acc061
commit
e42be0deeb
@ -3737,7 +3737,7 @@ end; {DoConstant}
|
|||||||
Gen1(dc_lab, lcix);
|
Gen1(dc_lab, lcix);
|
||||||
if fstptr <> nil then begin {if there are labels...}
|
if fstptr <> nil then begin {if there are labels...}
|
||||||
lmin := fstptr^.cslab;
|
lmin := fstptr^.cslab;
|
||||||
if (lmax - lmin) div lcount > sparse then begin
|
if (ord4(lmax) - lmin) div lcount > sparse then begin
|
||||||
|
|
||||||
{use if-else for sparse case statements}
|
{use if-else for sparse case statements}
|
||||||
while fstptr <> nil do begin
|
while fstptr <> nil do begin
|
||||||
|
Loading…
Reference in New Issue
Block a user