#565910 Critical error when using hpmount in package hfsplus

Package:
hfsplus
Source:
hfsplus
Description:
Tools to access HFS+ formatted volumes
Submitter:
Ruan Beihong
Date:
2010-01-19 16:03:08 UTC
Severity:
normal
#565910#5
Date:
2010-01-19 16:01:49 UTC
From:
To:
Package: hfsplus
Version: 1.0.4-12

When I use hpmount to mount an hfs+ disk, it CAN‘T mount it, even worse, it
destroy the file system on disk.
And I don't have an idea about how to rescure the disk ( which saves my
friend's 5 years personal data and that damage make me very embarrassing).
And I tested it on some newly formatted hfs+ system, it easily reproduced
the bug:

ruan@debian:~$ dd if=/dev/zero of=test.dmg bs=4k count=4k
4096+0 records in
4096+0 records out
16777216 bytes (17 MB) copied, 0.214315 s, 78.3 MB/s

ruan@debian:~$ sudo mkfs.hfsplus test.dmg
Initialized test.dmg as a 16 MB HFS Plus volume

ruan@debian:~$ hpmount test.dmg
*** Warning: You are about to open '/home/ruan/test.dmg' for writing ***
*** Do you really want to do that ? (y/n) ***
y
hpmount: /home/ruan/test.dmg: This is not a HFS+ volume (Unknown error
18446744073709551615)

sudo hpfsck test.dmg
*** Checking Volume Header:
Volume was last Mounted by unknnown implemenatation:
0.01
Invalid total blocks 1000, expected
0                                           Done ***
*** Checking Backup Volume Header:
Unexpected Volume signature '  ' expected 'H+'

And then I use hexedit to see what is changed:
the OLD:
000003F4   00 00 00 00  00 00 00 00  00 00 00 00  48 2B 00 04  00 00 01 00
31 30 2E 30  00 00 00 00  C7 7B EF 83  C7 7B 7F 03  00 00 00 00  C7 7B 7F
03  ............H+......10.0.....{...{.......{..
00000420   00 00 00 00  00 00 00 00  00 00 10 00  00 00 10 00  00 00 0F BD
00 00 01 82  00 01 00 00  00 01 00 00  00 00 00 10  00 00 00 00  00 00 00
00  ............................................
0000044C   00 00 00 01  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 10
00  ............................................
00000478   00 00 10 00  00 00 00 01  00 00 00 01  00 00 00 01  00 00 00 00
00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00
00  ............................................
000004A4   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
00 00 00 00  00 00 00 00  00 00 00 00  00 02 00 00  00 02 00 00  00 00 00
20  ...........................................
000004D0   00 00 00 02  00 00 00 20  00 00 00 00  00 00 00 00  00 00 00 00
00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00
00  ....... ....................................
000004FC   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
00 00 00 00  00 02 00 00  00 02 00 00  00 00 00 20  00 00 00 22  00 00 00
20  ................................... ..."...
00000528   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00
00  ............................................
00000554   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00
00  ............................................
00000580   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00
00  ............................................
000005AC   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00
00  ............................................
000005D8   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00
00  ............................................

After hpmount:
000003F4   00 00 00 00  00 00 00 00  00 00 00 00  48 2B 00 04  00 00 01 00
31 30 2E 30  00 00 00 00  C7 7B EF 83  C7 7B 7F 03  00 00 00 00  C7 7B 7F
03  ............H+......10.0.....{...{.......{..
00000420   00 00 00 00  00 00 00 00  00 00 10 00  00 00 10 00  00 00 0F BD
00 00 01 82  00 01 00 00  00 01 00 00  00 00 00 10  00 00 00 00  00 00 00
00  ............................................
0000044C   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 10 00  00 00 00
01  ............................................
00000478   00 00 00 01  00 00 00 01  00 00 00 00  00 00 00 00  00 00 00 00
00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00
00  ............................................
000004A4   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
00 00 00 00  00 02 00 00  00 00 00 20  00 00 00 02  00 00 00 20  00 00 00
00  ............................... ....... ....
000004D0   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00
00  ............................................
000004FC   00 00 00 00  00 00 00 00  00 00 00 00  00 02 00 00  00 00 00 20
00 00 00 22  00 00 00 20  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00
00  ................... ..."... ................
00000528   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00
00  ............................................
00000554   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00
00  ............................................
00000580   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00
00  ............................................
000005AC   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00
00  ............................................
000005D8   00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  90 48 26 58
FF 7F 00 00  90 75 26 58  FF 7F 00 00  F0 A6 4A 06  6E 7F 00 00  00 00 00
00  .................H&X.....u&X......J.n.......


the mkfs.hfsplus comes from hfsutils in version 3.2.6-11