mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 08:19:22 +02:00
+ range check enumeration array indicies, range checking is after all a safety mean
git-svn-id: trunk@47652 -
This commit is contained in:
parent
792b629aa6
commit
7f07c9f94d
@ -1016,7 +1016,13 @@ implementation
|
|||||||
(right.resultdef.typ=enumdef) and
|
(right.resultdef.typ=enumdef) and
|
||||||
(tenumdef(htype).basedef=tenumdef(right.resultdef).basedef) and
|
(tenumdef(htype).basedef=tenumdef(right.resultdef).basedef) and
|
||||||
((tarraydef(left.resultdef).lowrange<>tenumdef(htype).min) or
|
((tarraydef(left.resultdef).lowrange<>tenumdef(htype).min) or
|
||||||
(tarraydef(left.resultdef).highrange<>tenumdef(htype).max)) then
|
(tarraydef(left.resultdef).highrange<>tenumdef(htype).max) or
|
||||||
|
{ while we could assume that the value might not be out of range,
|
||||||
|
memory corruption could have resulted in an illegal value,
|
||||||
|
so do not skip the type conversion in case of range checking
|
||||||
|
|
||||||
|
After all, range checking is a safety mean }
|
||||||
|
(cs_check_range in current_settings.localswitches)) then
|
||||||
{Convert array indexes to low_bound..high_bound.}
|
{Convert array indexes to low_bound..high_bound.}
|
||||||
inserttypeconv(right,cenumdef.create_subrange(tenumdef(right.resultdef),
|
inserttypeconv(right,cenumdef.create_subrange(tenumdef(right.resultdef),
|
||||||
asizeint(Tarraydef(left.resultdef).lowrange),
|
asizeint(Tarraydef(left.resultdef).lowrange),
|
||||||
|
Loading…
Reference in New Issue
Block a user