]> xenbits.xensource.com Git - libvirt.git/commit
storage: avoid mishandling backing store > 2GB
authorEric Blake <eblake@redhat.com>
Thu, 2 Jun 2011 23:52:16 +0000 (17:52 -0600)
committerEric Blake <eblake@redhat.com>
Wed, 8 Jun 2011 11:18:46 +0000 (05:18 -0600)
commit54456cc0fd3590ae9d1d4a74161eb9aa76d66710
treeb25f83ac640dd992b1f44126ae5a0ebcc81804ba
parent28ea3bf31c5fb03d7e51ba49cfaf8f1b2ec6fc57
storage: avoid mishandling backing store > 2GB

Detected by Coverity.  The code was doing math on shifted unsigned
char (which promotes to int), then promoting that to unsigned long
during assignment to size.  On 64-bit platforms, this risks sign
extending values of size > 2GiB.  Bug present since commit
489fd3 (v0.6.0).

I'm not sure if a specially-crafted bogus qcow2 image could
exploit this, although it's probably not possible, since we
were already checking for the computed results being within
range of our fixed-size buffer.

* src/util/storage_file.c (qcowXGetBackingStore): Avoid sign
extension.
src/util/storage_file.c