Skip to content
  • Peter Wu's avatar
    c6d34865
    block/dmg: fix sector data offset calculation · c6d34865
    Peter Wu authored
    
    
    This patch addresses two issues:
    
     - The data fork offset was not taken into account, resulting in failure
       to read an InstallESD.dmg file (5164763151 bytes) which had a
       non-zero DataForkOffset field.
     - The offset of the previous block ("partition") was unconditionally
       added to the current block because older files would start the input
       offset of a new block at zero. Newer files (including vlc-2.1.5.dmg,
       tuxpaint-0.9.15-macosx.dmg and OS X Yosemite [MAS].dmg) failed in
       reads because these files have chunk offsets, relative to the begin
       of a data fork.
    
    Now the data offset of the mish is taken into account. While we could
    check that the data_offset is within the data fork, let's not do that
    here as it would only result in parse failures on invalid files (rather
    than gracefully handling such bad files). dmg_read will error out if
    the offset is incorrect.
    
    Signed-off-by: default avatarPeter Wu <peter@lekensteyn.nl>
    Reviewed-by: default avatarJohn Snow <jsnow@redhat.com>
    Message-id: 1420566495-13284-9-git-send-email-peter@lekensteyn.nl
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    c6d34865
    block/dmg: fix sector data offset calculation
    Peter Wu authored
    
    
    This patch addresses two issues:
    
     - The data fork offset was not taken into account, resulting in failure
       to read an InstallESD.dmg file (5164763151 bytes) which had a
       non-zero DataForkOffset field.
     - The offset of the previous block ("partition") was unconditionally
       added to the current block because older files would start the input
       offset of a new block at zero. Newer files (including vlc-2.1.5.dmg,
       tuxpaint-0.9.15-macosx.dmg and OS X Yosemite [MAS].dmg) failed in
       reads because these files have chunk offsets, relative to the begin
       of a data fork.
    
    Now the data offset of the mish is taken into account. While we could
    check that the data_offset is within the data fork, let's not do that
    here as it would only result in parse failures on invalid files (rather
    than gracefully handling such bad files). dmg_read will error out if
    the offset is incorrect.
    
    Signed-off-by: default avatarPeter Wu <peter@lekensteyn.nl>
    Reviewed-by: default avatarJohn Snow <jsnow@redhat.com>
    Message-id: 1420566495-13284-9-git-send-email-peter@lekensteyn.nl
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
Loading