summaryrefslogtreecommitdiffstats
path: root/generator.py
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2011-06-03 13:53:26 -0600
committerEric Blake <eblake@redhat.com>2011-06-08 05:28:20 -0600
commite360d2ef588b4f57a4c7e74aa1c9177f15445a92 (patch)
tree7ca1f1b8adbf033ea7a43f7e093a73b0864db2e8 /generator.py
parentd4bd086156663a972fcafc3b0aca857dddae1194 (diff)
downloadlibvirt-python-v6-e360d2ef588b4f57a4c7e74aa1c9177f15445a92.tar.gz
libvirt-python-v6-e360d2ef588b4f57a4c7e74aa1c9177f15445a92.tar.xz
libvirt-python-v6-e360d2ef588b4f57a4c7e74aa1c9177f15445a92.zip
python: avoid unlikely sign extension bug
Detected by Coverity. cpumap was allocated with a value of (unsigned short)*(int), which is an int computation, and then promotes to size_t. On a 64-bit platform, this fails if bit 32 of the product is set (because of sign extension giving a HUGE value to malloc), even though a naive programmer would assume that since the first value is unsigned, the product is also unsigned and at most 4GB would be allocated. Won't bite in practice (the product should never be that large), but worth using the right types to begin with, so that we are now computing (unsigned short)*(size_t). * python/libvirt-override.c (libvirt_virDomainGetVcpus): Use correct type.
Diffstat (limited to 'generator.py')
0 files changed, 0 insertions, 0 deletions