Review Request: Fix KPixmapCache crash (probably because of pointer aliasing in unions)

Michael Pyne mpyne at purinchu.net
Fri May 29 02:04:19 BST 2009


On Monday 25 May 2009 03:55:37 Johannes Sixt wrote:
> No, don't ship it. The new code is just as wrong as the old code was.
>
> The new code uses the idiom
>     *(some_type*)foo
> where foo is of some_other_type. This breaks aliasing rules.

I have a patch (attached) for the issue, which eliminates the union entirely.  
The portions of code needing a char* pointer to the beginning of mmap'ed 
memory get one using a reinterpret_cast, and the DataHeader alias was unneeded 
anyways from what I can tell.

I plan to commit to 4.3 and 4.2 branches tonight after I do some testing here.

Regards,
 - Michael Pyne
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kpixmapcache-alignment.patch
Type: text/x-patch
Size: 2761 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090528/ab02cee6/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090528/ab02cee6/attachment.sig>


More information about the kde-core-devel mailing list