On Fri 03 Nov 2017 05:27:59 PM CET, Max Reitz wrote:
>> + if (new_cluster == 0) {
>> + qcow2_signal_corruption(bs, true, -1, -1, "Preventing
>> invalid "
>> + "allocation of compressed cluster "
>> + "at offset 0");
>> + return -EIO;
>> + }
>> +
>> if (!offset || ROUND_UP(offset, s->cluster_size) !=
>> new_cluster) {
>> offset = new_cluster;
>> free_in_cluster = s->cluster_size;
>> @@ -1090,7 +1097,6 @@ int64_t qcow2_alloc_bytes(BlockDriverState *bs, int
>> size)
>> }
>> }
>>
>> - assert(offset);
>
> I don't think this assert() was meant as a protection against offset
> being 0. :-)
After the new check offset is now guaranteed to be 0, so what's the
point of keeping the assert() ?
Berto