[vbox-dev] vdiRead and vdiWrite asserts question

Klaus Espenlaub klaus.espenlaub at oracle.com
Tue Jun 4 09:11:49 GMT 2013


Hi Ribhi,

On 03.06.2013 23:25, Ribhi Kamal wrote:
> I'm messing around with adding some conversions of raw to/from virtual
> disks to the API and noticed that the functions vdiRead and vdiWrite (in
> VDI.cpp) assert whenever the amount being read/written is not a multiple
> of 512.

Anything wrong with VBoxManage convertfromraw and/or clonehd? The 
functionality should be there already.

> Do these functions break when the byte count is not a multiple of 512 or
> is this just a sanitary check?

The code is meant to implement a block device interface with fixed 
sector size, and thus the parameter sanity checking is consistent with 
this intention. I don't care if the code could theoretically handle such 
cases, it's not meant to get such requests ever.

> Are these asserts valid when dealing with binary image files (they could
> have any size) vs block devices?

I don't understand... raw disk image files should always be a multiple 
of the sector size, and if that's not the case it's a rather clear hint 
that the file was corrupted during transfer.

Klaus

>
> Thanks,
> -- Ribhi




More information about the vbox-dev mailing list