darlinghq / darling-dmg

FUSE module for .dmg files (containing an HFS+ filesystem)
http://www.darlinghq.org
GNU General Public License v3.0
273 stars 45 forks source link

DMGPartition::readRun new logic is incorrect #78

Closed tomkoen closed 6 years ago

tomkoen commented 6 years ago

The new logic introduced in this commit by @jief666 throws an exception whilst the older code works fine mounting the same dmg image.

Exception is thrown here:

if (dec < count)
   throw io_error("Error decompressing stream");

Image to reproduce

jief666 commented 6 years ago

I probably put that check a bit quick. It might be possible that the compressed buffer is bigger than the uncompressed one, so dec would be < count. Usually, read method returns what they could read even if it's less than count. So that should be ok to remove that check. But DMGPartition::read should be modified too, to be able to return less than count. (maybe it was handled and I removed it :-). In my memory, I put that because I had infinite loop in DMGPartition::read Did you try just removing the throw ? I'll talk about that to my old friend the live debugger !