From 72fd58d62e2a58f8d24187da8ac29a4936b1d21e Mon Sep 17 00:00:00 2001 From: paul Date: Wed, 8 May 2013 06:00:44 +0000 Subject: [PATCH] rtl: fix possible division by zero git-svn-id: trunk@24472 - --- rtl/inc/rtti.inc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rtl/inc/rtti.inc b/rtl/inc/rtti.inc index c50726784e..f56fc2cfa8 100644 --- a/rtl/inc/rtti.inc +++ b/rtl/inc/rtti.inc @@ -115,6 +115,9 @@ var begin typeInfo:=aligntoptr(typeInfo+2+PByte(typeInfo)[1]); Count:=PArrayInfo(typeInfo)^.ElCount; + { no elements to process => exit } + if Count = 0 then + Exit; ElSize:=PArrayInfo(typeInfo)^.Size div Count; Info:=PArrayInfo(typeInfo)^.ElInfo; { Process elements } @@ -262,6 +265,9 @@ begin {$else} Result:=PArrayInfo(Temp)^.Size; Count:=PArrayInfo(Temp)^.ElCount; + { no elements to process => exit } + if Count = 0 then + Exit; Info:=PArrayInfo(Temp)^.ElInfo; copiedsize:=Result div Count; Offset:=0;