+ range check enumeration array indicies, range checking is after all a safety mean

git-svn-id: trunk@47652 -
This commit is contained in:
florian 2020-11-30 22:08:04 +00:00
parent 792b629aa6
commit 7f07c9f94d

View File

@ -1016,7 +1016,13 @@ implementation
(right.resultdef.typ=enumdef) and
(tenumdef(htype).basedef=tenumdef(right.resultdef).basedef) and
((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.}
inserttypeconv(right,cenumdef.create_subrange(tenumdef(right.resultdef),
asizeint(Tarraydef(left.resultdef).lowrange),