unaligned access bug in winspool on sparc
Eric Pouech
pouech-eric at wanadoo.fr
Sat Oct 23 01:40:16 CDT 2004
Juan Lang a écrit :
>>I just ran across an evil little bug in the
>>WINSPOOL_GetPrinter_2 function. It looks like this
>>type of bug could be hiding in other API functions
>>too. It causes a segmentation fault because of an
>>unaligned access on Solaris (sparc).
>
>
> Yikes. That's a bad one. The trouble is MS loves
> this sort of return value. Even if the dll itself
> doesn't dereference an unaligned pointer, the caller
> might depending on how things are layed out. The
> trouble is i386 allows unaligned memory access, so we
> don't see this sort of thing.
>
> If you happen to know how MS handles alignment on
> platforms that require it, we might be able to fix it.
> Otherwise it'll have to be case-by-case I'm afraid.
MSVC supports __unaligned as pointer attribute. So declaring
*(__unaligned long*)ptr will force the compiler (on CPUs/OSes which
requires it) to generate the relevant code for this.
It doesn't seem however that gcc supports such keyword.
A+
More information about the wine-devel
mailing list