git: e5861dc2ea52 - stable/15 - Merge commit faa5141b9be4 from file git (by Christos Zoulas):
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 11 Jan 2026 19:22:59 UTC
The branch stable/15 has been updated by adrian:
URL: https://cgit.FreeBSD.org/src/commit/?id=e5861dc2ea529527894b9be2df99f359c0d5b6ef
commit e5861dc2ea529527894b9be2df99f359c0d5b6ef
Author: Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2025-12-31 17:14:55 +0000
Commit: Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2026-01-11 19:21:47 +0000
Merge commit faa5141b9be4 from file git (by Christos Zoulas):
PR/656: harry.sintonen: Fix bug in byte swapping that was caused by the change to make flags uint16_t and cont_level uint8_t.
This fixes using a magic.mgc built with a different endianness than
file(1) itself, e.g. when building powerpc64 on amd64.
PR: 292079
Fixes: ae316d1d1cff ("MFV: file 5.46.")
MFC after: 3 days
(cherry picked from commit 39047538cf5d8f26112f7b08b3c56967f70f7f94)
---
contrib/file/src/apprentice.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/contrib/file/src/apprentice.c b/contrib/file/src/apprentice.c
index 5289f8e87267..dde2dd1e0c2d 100644
--- a/contrib/file/src/apprentice.c
+++ b/contrib/file/src/apprentice.c
@@ -3646,15 +3646,14 @@ file_varint2uintmax_t(const unsigned char *us, int t, size_t *l)
file_private void
bs1(struct magic *m)
{
- m->cont_level = swap2(m->cont_level);
+ m->flag = swap2(m->flag);
m->offset = swap4(CAST(uint32_t, m->offset));
m->in_offset = swap4(CAST(uint32_t, m->in_offset));
m->lineno = swap4(CAST(uint32_t, m->lineno));
if (IS_STRING(m->type)) {
m->str_range = swap4(m->str_range);
m->str_flags = swap4(m->str_flags);
- }
- else {
+ } else {
m->value.q = swap8(m->value.q);
m->num_mask = swap8(m->num_mask);
}