Explorar el Código

* fix division by zero in alignment code, should resolve #20265 an #20240

git-svn-id: trunk@19338 -
florian hace 14 años
padre
commit
7bb1c642dd
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  1. 2 1
      compiler/ncgld.pas

+ 2 - 1
compiler/ncgld.pas

@@ -780,7 +780,8 @@ implementation
                             len:=left.resultdef.size;
 
                             { data smaller than an aint has less alignment requirements }
-                            alignmentrequirement:=min(len,sizeof(aint));
+                            { max(1,...) avoids div by zero in case of an empty record  }
+                            alignmentrequirement:=min(max(1,len),sizeof(aint));
 
                             if (right.location.reference.offset mod alignmentrequirement<>0) or
                               (left.location.reference.offset mod alignmentrequirement<>0) or