[File] [SECURITY] Integer Overflow in ascmagic.c UTF-8 Buffer Allocation (file-5.17, 32-bit)

Christos Zoulas christos at zoulas.com
Fri Apr 17 10:47:55 EDT 2026


Added the check, thanks. 

christos

> On Apr 1, 2026, at 11:19 AM, Kerwin <kerwinxia66001 at gmail.com> wrote:
> 
> Hi maintainers,
> 
> I am reporting an integer overflow vulnerability in libmagic (file-5.17) where the calculation `mlen = ulen * 6` in `file_ascmagic_with_encoding()` (ascmagic.c:141-142) overflows on 32-bit platforms, causing an undersized `malloc`. The heap corruption is mitigated by bounds checking in `encode_utf8()`, but the overflow results in a logic error / denial of service.
> 
> Please find the detailed vulnerability report and proof-of-concept files attached.
> 
> Best regards
> 
> <POC.tar>-- 
> File mailing list
> File at astron.com
> https://mailman.astron.com/mailman/listinfo/file
> <sanitizer.log>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.astron.com/pipermail/file/attachments/20260417/f585e0e2/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <http://mailman.astron.com/pipermail/file/attachments/20260417/f585e0e2/attachment.asc>


More information about the File mailing list