Providing an empty string for the backing file parameter like so:
qemu-img create -f qcow2 -b '' /tmp/foo
allows the flow of control to reach and subsequently fail an assert
statement because passing an empty string to
bdrv_get_full_backing_filename_from_filename()
simply results in NULL being returned without an error being raised.
To fix this, let's check for an empty string when getting the value from
the opts list.
Reported-by: Attila Fazekas <afazekas@redhat.com>
Fixes: https://bugzilla.redhat.com/1809553
Signed-off-by: Connor Kuehl <ckuehl@redhat.com>
---
v3:
- Moved test case into 049 instead of taking up
298.
v2:
- Removed 4 spaces to resolve pylint warning
- Updated format to be 'iotests.imgfmt' instead
of hardcoding 'qcow2'
- Use temporary file instead of '/tmp/foo'
- Give a size parameter to qemu-img
- Run test for qcow2, qcow, qed and *not* raw