[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] util: storage: Fix qcow(2) header parser according to docs



On 09/15/2014 04:22 PM, Peter Krempa wrote:
> The backing store string location offset 0 determines that the file
> isn't present. The string size shouldn't be then checked:
> 
> from qemu.git/docs/specs/qcow2.txt
> 
> == Header ==
> 
> The first cluster of a qcow2 image contains the file header:
> 
> Byte  0 -  3:   magic
>                 QCOW magic string ("QFI\xfb")
> 
>       4 -  7:   version
>                 Version number (valid values are 2 and 3)
> 
>       8 - 15:   backing_file_offset
>                 Offset into the image file at which the backing file name
>                 is stored (NB: The string is not null terminated). 0 if the
>                 image doesn't have a backing file.
> 
>      16 - 19:   backing_file_size
>                 Length of the backing file name in bytes. Must not be
>                 longer than 1023 bytes. Undefined if the image doesn't have
>                 a backing file.         ^^^^^^^^^
> 
> This patch intentionally leaves the backing file string size check in
> place in case a malformatted file would be presented to libvirt. Also
> according to the docs the string size is maximum 1023 bytes, thus this
> patch adds a check to verify that.
> 
> I was also able to verify that the check was done the same way in the
> legacy qcow fromat (in qemu's code).
> ---
>  src/util/virstoragefile.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)

ACK

Jan

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]