You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For anyone stumbling here, a similar problem was reported upstream here (requires creating an account).
Date Submitted: 2026-03-04 12:58
Last Update: 2026-04-01 08:54
They seem to be on the right track. I spent some time digging tonight, I had identified a commit that messed with offset calculations in file_buffer(). I intended to report it, but I found that issue, and based on the latest comments from today, they found the same commit and code paths I was looking at.
In the meantime:
Using magic.from_file() or magic.from_descriptor() works fine.
If you really want to use buffers (e.g. to avoid reading huge files), save the buffer to a temporary file and use magic.from_file() on that.
Or pin your file package ≤ 5.46, until further news.
UPDATE: The bug is reported as patched by one of the maintainers, as of 2026-04-12 22:15 (UTC). All we need now is to wait for a 5.48 release. Which unfortunately might take a while: 5.47 landed Feb 26, 2026, 5.46 landed Nov 27, 2024. Let's hope we won't have to wait 1 more year. 😅
Reacted by Wesley Moore, ddelange, pfcodes and RafayAK
Activity
ddelange commentedon Mar 21, 2026
I can confirm this issue, just tried bumping to file-5.47 in #294 and the smoke test starts failing:
Successfully installed python-magic-0.4.28 + /bin/sh -c 'python -c "import magic; assert magic.Magic(mime=True).from_buffer(b'"'"'\x00\x00\x00\x1cftypiso5\x00\x00\x00\x01isomiso5hlsf\x00\x00'"'"') == '"'"'video/mp4'"'"'"' Traceback (most recent call last): File "<string>", line 1, in <module> AssertionErrorSounds like an upstream issue because this library is just a CDLL wrapper.
Revert "Bump to file-5.47" because of ahupp#362
bvergnaud commentedon Apr 1, 2026
Hiya,
For anyone stumbling here, a similar problem was reported upstream here (requires creating an account).
Date Submitted: 2026-03-04 12:58
Last Update: 2026-04-01 08:54
They seem to be on the right track. I spent some time digging tonight, I had identified a commit that messed with offset calculations in
file_buffer(). I intended to report it, but I found that issue, and based on the latest comments from today, they found the same commit and code paths I was looking at.In the meantime:
magic.from_file()ormagic.from_descriptor()works fine.magic.from_file()on that.UPDATE: The bug is reported as patched by one of the maintainers, as of 2026-04-12 22:15 (UTC). All we need now is to wait for a 5.48 release. Which unfortunately might take a while: 5.47 landed Feb 26, 2026, 5.46 landed Nov 27, 2024. Let's hope we won't have to wait 1 more year. 😅
fix: use magic from file
doronbehar commentedon May 4, 2026
Did anyone manage to figure out what upstream commit fixed the issue? I didn't find a clear candidate here:
I'd like to patch it for my distribution...
bvergnaud commentedon May 4, 2026
Here you go:
file/file@c546057
RafayAK commentedon May 18, 2026
Just faced this issue, for somereason
audio/oggis getting picked up asapplication/octet-stream