Skip to content
  • Peter Lieven's avatar
    6360ab27
    qemu-img: avoid overflow of min_sparse parameter · 6360ab27
    Peter Lieven authored
    
    
    the min_sparse convert parameter can overflow (e.g. -S 1024G)
    in the conversion from int64_t to int resulting in a negative
    min_sparse parameter. Avoid this by limiting the valid parameters
    to sane values. In fact anything exceeding the convert buffer size
    is also pointless. While at it also forbid values that are non
    multiple of 512 to avoid undesired behaviour. For instance, values
    between 1 and 511 were legal, but resulted in full allocation.
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: default avatarPeter Lieven <pl@kamp.de>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    6360ab27
    qemu-img: avoid overflow of min_sparse parameter
    Peter Lieven authored
    
    
    the min_sparse convert parameter can overflow (e.g. -S 1024G)
    in the conversion from int64_t to int resulting in a negative
    min_sparse parameter. Avoid this by limiting the valid parameters
    to sane values. In fact anything exceeding the convert buffer size
    is also pointless. While at it also forbid values that are non
    multiple of 512 to avoid undesired behaviour. For instance, values
    between 1 and 511 were legal, but resulted in full allocation.
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: default avatarPeter Lieven <pl@kamp.de>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
Loading