[Libvir] [PATCH] Fixed integer wraparound in python binding

The attached patch fixes a problem with integrate wraparound in the python bindings. THe problem is thus: - the memory & max-memory fields in the virDomainInfo struct are of type 'unsigned long'. - The python bindings, however, then stick this into a python 'Int' which is signed. Now, on 64-bit this is not an issue. For DomU guests on 32-bit it is not an issue either, but for Dom0 XenD sets the max-memory field to be 2^32-1 whcih causes wraparound when converting to python int. This patch simply switches the python binding over to using a python Long which is 64 bits on all platforms. Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|

On Wed, Nov 15, 2006 at 02:41:55AM +0000, Daniel P. Berrange wrote:
The attached patch fixes a problem with integrate wraparound in the python bindings. THe problem is thus:
- the memory & max-memory fields in the virDomainInfo struct are of type 'unsigned long'. - The python bindings, however, then stick this into a python 'Int' which is signed.
Now, on 64-bit this is not an issue. For DomU guests on 32-bit it is not an issue either, but for Dom0 XenD sets the max-memory field to be 2^32-1 whcih causes wraparound when converting to python int.
This patch simply switches the python binding over to using a python Long which is 64 bits on all platforms.
Dohh, sure, please push ! Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
participants (2)
-
Daniel P. Berrange
-
Daniel Veillard