Re: [Qemu-block] [PATCH v2 2/3] qcow2: Don't allow overflow during cluster allocation

2018-02-22 Thread Eric Blake
On 02/22/2018 04:29 AM, Alberto Garcia wrote: On Thu 22 Feb 2018 12:39:52 AM CET, Eric Blake wrote: free_in_cluster = s->cluster_size - offset_into_cluster(s, offset); do { if (!offset || free_in_cluster < size) { -int64_t new_cluster = alloc_clusters_noref(bs,

Re: [Qemu-block] [PATCH v2 2/3] qcow2: Don't allow overflow during cluster allocation

2018-02-22 Thread Alberto Garcia
On Thu 22 Feb 2018 12:39:52 AM CET, Eric Blake wrote: > free_in_cluster = s->cluster_size - offset_into_cluster(s, offset); > do { > if (!offset || free_in_cluster < size) { > -int64_t new_cluster = alloc_clusters_noref(bs, s->cluster_size); > +int64_t

[Qemu-block] [PATCH v2 2/3] qcow2: Don't allow overflow during cluster allocation

2018-02-21 Thread Eric Blake
Our code was already checking that we did not attempt to allocate more clusters than what would fit in an INT64 (the physical maximimum if we can access a full off_t's worth of data). But this does not catch smaller limits enforced by various spots in the qcow2 image description: L1 and normal