[File] [PATCH] Use unsigned datatypes for filesystem UUIDs
Thomas Weißschuh
thomas at t-8ch.de
Sun Apr 4 16:02:15 UTC 2021
Fixes a regression introduced in 0478d9251abafd0876cdb3121ef2c07af6c99513
Reported-By: Richard W.M. Jones <rjones at redhat.com>
Reporated-At: https://bugs.astron.com/view.php?id=253
Reporated-At: https://bugzilla.redhat.com/show_bug.cgi?id=1945122
---
magic/Magdir/filesystems | 52 +++++++++++++++++++--------------------
magic/Magdir/linux | 28 ++++++++++-----------
tests/ext4.result | 1 +
tests/ext4.testfile | Bin 0 -> 2048 bytes
4 files changed, 41 insertions(+), 40 deletions(-)
create mode 100644 tests/ext4.result
create mode 100644 tests/ext4.testfile
diff --git a/magic/Magdir/filesystems b/magic/Magdir/filesystems
index 0cb45cbf..14ee70f3 100644
--- a/magic/Magdir/filesystems
+++ b/magic/Magdir/filesystems
@@ -1739,12 +1739,12 @@
>>>0x464 lelong >0x0000007 ext4 filesystem data
# else large INCOMPAT?
>>0x460 lelong >0x000003f ext4 filesystem data
->0x468 belong x \b, UUID=%08x
->0x46c beshort x \b-%04x
->0x46e beshort x \b-%04x
->0x470 beshort x \b-%04x
->0x472 belong x \b-%08x
->0x476 beshort x \b%04x
+>0x468 ubelong x \b, UUID=%08x
+>0x46c ubeshort x \b-%04x
+>0x46e ubeshort x \b-%04x
+>0x470 ubeshort x \b-%04x
+>0x472 ubelong x \b-%08x
+>0x476 ubeshort x \b%04x
>0x478 string >0 \b, volume name "%s"
# General flags for any ext* fs
>0x460 lelong &0x0000004 (needs journal recovery)
@@ -1767,12 +1767,12 @@
# f2fs filesystem - Tuomas Tynkkynen <tuomas.tynkkynen at iki.fi>
0x400 lelong 0xF2F52010 F2FS filesystem
->0x46c belong x \b, UUID=%08x
->0x470 beshort x \b-%04x
->0x472 beshort x \b-%04x
->0x474 beshort x \b-%04x
->0x476 belong x \b-%08x
->0x47a beshort x \b%04x
+>0x46c ubelong x \b, UUID=%08x
+>0x470 ubeshort x \b-%04x
+>0x472 ubeshort x \b-%04x
+>0x474 ubeshort x \b-%04x
+>0x476 ubelong x \b-%08x
+>0x47a ubeshort x \b%04x
>0x147c lestring16 x \b, volume name "%s"
# Minix filesystems - Juan Cespedes <cespedes at debian.org>
@@ -2296,20 +2296,20 @@
>>0x10060 string >\0 lockproto %s)
# Russell Coker <russell at coker.com.au>
-0x10040 string _BHRfS_M BTRFS Filesystem
->0x1012b string >\0 label "%s",
->0x10090 lelong x sectorsize %d,
->0x10094 lelong x nodesize %d,
->0x10098 lelong x leafsize %d,
->0x10020 belong x UUID=%08x-
->0x10024 beshort x \b%04x-
->0x10026 beshort x \b%04x-
->0x10028 beshort x \b%04x-
->0x1002a beshort x \b%04x
->0x1002c belong x \b%08x,
->0x10078 lequad x %lld/
->0x10070 lequad x \b%lld bytes used,
->0x10088 lequad x %lld devices
+0x10040 string _BHRfS_M BTRFS Filesystem
+>0x1012b string >\0 label "%s",
+>0x10090 lelong x sectorsize %d,
+>0x10094 lelong x nodesize %d,
+>0x10098 lelong x leafsize %d,
+>0x10020 ubelong x UUID=%08x-
+>0x10024 ubeshort x \b%04x-
+>0x10026 ubeshort x \b%04x-
+>0x10028 ubeshort x \b%04x-
+>0x1002a ubeshort x \b%04x
+>0x1002c ubelong x \b%08x,
+>0x10078 lequad x %lld/
+>0x10070 lequad x \b%lld bytes used,
+>0x10088 lequad x %lld devices
# dvdisaster's .ecc
# From: "Nelson A. de Oliveira" <naoliv at gmail.com>
diff --git a/magic/Magdir/linux b/magic/Magdir/linux
index 693cef6f..3203fce8 100644
--- a/magic/Magdir/linux
+++ b/magic/Magdir/linux
@@ -83,20 +83,20 @@
# format v1, supported since 1998
0 name linux-swap
->0x400 lelong 1 little endian, version %u,
->>0x404 lelong x size %u pages,
->>0x408 lelong x %u bad pages,
->0x400 belong 1 big endian, version %u,
->>0x404 belong x size %u pages,
->>0x408 belong x %u bad pages,
->0x41c string \0 no label,
->0x41c string >\0 LABEL=%s,
->0x40c belong x UUID=%08x
->0x410 beshort x \b-%04x
->0x412 beshort x \b-%04x
->0x414 beshort x \b-%04x
->0x416 belong x \b-%08x
->0x41a beshort x \b%04x
+>0x400 lelong 1 little endian, version %u,
+>>0x404 lelong x size %u pages,
+>>0x408 lelong x %u bad pages,
+>0x400 belong 1 big endian, version %u,
+>>0x404 belong x size %u pages,
+>>0x408 belong x %u bad pages,
+>0x41c string \0 no label,
+>0x41c string >\0 LABEL=%s,
+>0x40c ubelong x UUID=%08x
+>0x410 ubeshort x \b-%04x
+>0x412 ubeshort x \b-%04x
+>0x414 ubeshort x \b-%04x
+>0x416 ubelong x \b-%08x
+>0x41a ubeshort x \b%04x
0xff6 string SWAPSPACE2 Linux swap file, 4k page size,
>0 use linux-swap
diff --git a/tests/ext4.result b/tests/ext4.result
new file mode 100644
index 00000000..e48ac193
--- /dev/null
+++ b/tests/ext4.result
@@ -0,0 +1 @@
+Linux rev 1.0 ext4 filesystem data, UUID=d32bbb08-3a76-4510-a064-3045f887dbdf (extents) (64bit) (large files) (huge files)
\ No newline at end of file
diff --git a/tests/ext4.testfile b/tests/ext4.testfile
new file mode 100644
index 0000000000000000000000000000000000000000..6add6b92a62f6cdda64f07adaa860d5102963b17
GIT binary patch
literal 2048
zcmZQz7zLvtFd70QH3S4e9_L_SNCQ%Lm>C#YfixpX3<eZ{3?K%p12T25WhO8%{Qn>P
zo)N4L!UswK0Zbn^klg^pHb8uciGd-Tg at NI+_HGWVGFO2GDF&`T+Hc<nO3?uDW0(o_
z8XT;9zbXHrk*Cc>jvYxt=jI(^WOQKQfy#pX!S$J$0q9gX0QpA|h(R>SWMv=*g~JD6
pIGF%xOaKcdgbXZ95F!i=EI>h!S;Gm4AqU)W^4Ku;i*I5x7XVZUAejIF
literal 0
HcmV?d00001
base-commit: 2f62d5544d13ca32dc09504ec70358db581e9e65
--
2.31.1
More information about the File
mailing list