[fpc-devel]PowerPC, TypInfo
Mattias Gaertner
nc-gaertnma at netcologne.de
Sun Aug 15 12:38:05 CEST 2004
On Sun, 15 Aug 2004 03:18:59 +0200 Mattias Gaertner
<nc-gaertnma at netcologne.de> wrote:
> On Sat, 14 Aug 2004 23:59:55 +0200 Jonas Maebe <jonas at zeus.ugent.be>
> wrote:
>
> >
> > On 14 aug 2004, at 21:07, Mattias Gaertner wrote:
> >
> > >> The GetOrdProp is used to read boolean values. It reads a longint and
> > >> applies "and $ff" to get only the lowest byte. Under PowerPC the
> > >> boolean
> > >> value is stored just like under i386 in the first byte. Reading the
> > >> longint under i386 works, but of course it does not under powerpc.
> > >[...]
> > > I just found out, that this is also the case for ShortInt, SmallInt,
> > > Word
> > > and Byte, but not for enums.
> >
> > To me, the fact that it always reads a longint regardless of the size
> > of the property seems to be inherently wrong. What if the last field of
> > a class is a byte? Then you can read past the end of the class,
> > possibly into unallocated memory causing a crash, no?
>
> Good point.
> Looking at SetOrdProp, I see, that it works correct with PByte, PWord,
> PLongInt.
> So GetOrdProp is buggy.
>
> I will send a patch, when I completed the other tests.
Attached patch was tested under i386 and ppc.
Mattias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fcl_objpas_patch.gz
Type: application/x-gzip
Size: 864 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20040815/fa88cd61/attachment.bin>
More information about the fpc-devel
mailing list