1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
From f06015040e7ffb3be21bb7622f9f8291b749aaf9 Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Sun, 4 Apr 2021 17:46:17 +0000
Subject: [PATCH] Fix regression after unsigned/signed printing changes by
making types unsigned (Richard W.M. Jones)
---
magic/Magdir/filesystems | 54 +++++++++++++++++++--------------------
magic/Magdir/linux | 30 +++++++++++-----------
tests/Makefile.am | 1 +
tests/ext4.result | 1 +
tests/ext4.testfile | Bin 0 -> 2048 bytes
5 files changed, 44 insertions(+), 42 deletions(-)
create mode 100644 tests/ext4.result
create mode 100644 tests/ext4.testfile
diff --git a/magic/Magdir/filesystems b/magic/Magdir/filesystems
index 0cb45cbfe..81966d6cc 100644
--- a/magic/Magdir/filesystems
+++ b/magic/Magdir/filesystems
@@ -1,5 +1,5 @@
#------------------------------------------------------------------------------
-# $File: filesystems,v 1.140 2021/02/23 00:51:10 christos Exp $
+# $File: filesystems,v 1.141 2021/04/04 17:46:17 christos Exp $
# filesystems: file(1) magic for different filesystems
#
0 name partid
@@ -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@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@debian.org>
@@ -2296,20 +2296,20 @@
>>0x10060 string >\0 lockproto %s)
# Russell Coker <russell@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@gmail.com>
diff --git a/magic/Magdir/linux b/magic/Magdir/linux
index 693cef6f5..f25243e20 100644
--- a/magic/Magdir/linux
+++ b/magic/Magdir/linux
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
-# $File: linux,v 1.77 2021/02/24 23:05:02 christos Exp $
+# $File: linux,v 1.78 2021/04/04 17:46:17 christos Exp $
# linux: file(1) magic for Linux files
#
# Values for Linux/i386 binaries, from Daniel Quinlan <quinlan@yggdrasil.com>
@@ -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/Makefile.am b/tests/Makefile.am
index b38a25b3d..a63c2f65a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -7,6 +7,7 @@ regex-eol.magic \
CVE-2014-1943.testfile \
JW07022A.mp3.testfile \
escapevel.testfile \
+ext4.testfile \
fit-map-data.testfile \
gedcom.testfile \
hddrawcopytool.testfile \
|