[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] Better .dmg autodetection
From: |
Alex Beregszaszi |
Subject: |
[Qemu-devel] [PATCH] Better .dmg autodetection |
Date: |
Tue, 12 Apr 2005 19:28:41 +0200 |
Hi,
There are quiet lot fake dmg files floating around. These are just raw
images containing the Apple partition map and HFS partitions.
I hardened the autodetection of dmg files with more sanity checks. Real
dmg files are likely to be zlib compressed, and the header is placed at
the end. So the first sector of the file is used to be zlib data.
There are 3 parts of the detection:
* first look if the first byte means zlib data (CFM byte, compression
and format flags, the compression is ought to be 8, while the flags
should be less then 8), also if it validates, look if the filename ends
in .dmg
* check wether it is Apple partition map, the magic bytes are ER
* last check if the filename ends in .dmg
--
Alex Beregszaszi e-mail: address@hidden
Free Software Network cell: +36 70 3144424
block-dmg.detection.diff
Description: Text Data
- [Qemu-devel] [PATCH] Better .dmg autodetection,
Alex Beregszaszi <=