[MPlayer-dev-eng] [PATCH] x11_common: XChangeProperty uses long for 32-bits
Nicolas George
nicolas.george at normalesup.org
Fri Aug 19 16:10:28 CEST 2011
Le decadi 30 thermidor, an CCXIX, Alexander Strasser a écrit :
> Of course! Good catch. It is always the simplest things, that can go
> awfully wrong. Thank you for having a close look.
>
> Looking at my comment again, we are not checking if the PID fits into
> 32 bits, I guess this way it might happen that the X server receives a
> partial PID. Could we use a bitwise AND operation to only assign bits
> 0 to 31, so that we do the early return when pid contains a value that
> doesn't fit into 32 bits? That approach might fail on sign extension
> of a negative value of a signed 32-bit pid_t into a signed 64 bit long
> type in some cases. But I would like to think that is more hypothetical.
A process ID is positive, while pid_t is signed: using a binary AND to mask
only bits 0 to 30 (and not 31) should be safe.
In the meantime, I could test the code on an UltraSparc in the GCC Compile
Farm: the current code dies with a SIGBUS, the modified code works and sets
_NET_WM_PID correctly. Here is the updated patch.
If there is no further remarks, I can push any time.
Regards,
--
Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-x11_common-XChangeProperty-uses-long-for-32-bits.patch
Type: text/x-diff
Size: 1235 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20110819/84921637/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20110819/84921637/attachment.asc>
More information about the MPlayer-dev-eng
mailing list