Commit 58b818d5 authored by Eduardo Habkost's avatar Eduardo Habkost Committed by Stefan Hajnoczi
Browse files

image-fuzzer: Encode file name and file format to bytes



Callers of create_image() will pass strings as arguments, but the
Image class will expect bytes objects to be provided.  Encode
them inside create_image().

Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
Reviewed-by: default avatarJohn Snow <jsnow@redhat.com>
Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20191016192430.25098-9-ehabkost@redhat.com
Message-Id: <20191016192430.25098-9-ehabkost@redhat.com>
Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
parent ee1fde71
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -602,8 +602,8 @@ class Image(object):
def create_image(test_img_path, backing_file_name=None, backing_file_fmt=None,
                 fields_to_fuzz=None):
    """Create a fuzzed image and write it to the specified file."""
    image = Image(backing_file_name)
    image.set_backing_file_format(backing_file_fmt)
    image = Image(backing_file_name.encode())
    image.set_backing_file_format(backing_file_fmt.encode())
    image.create_feature_name_table()
    image.set_end_of_extension_area()
    image.create_l_structures()