Skip to content

v0.3.1: rebuild with zlib 1.4

Choose a tag to compare

@kenshaw kenshaw released this 11 Nov 21:18
· 42 commits to main since this release

Do not use this release on Windows or macOS. It does not link with MinGW gcc (undefined reference to strndup), and its macOS archives call pipe2, which older macOS does not have. v0.4.0 fixes both.

This release rebuilds all archives with zlib 1.4. The Go code and the API do not change.

What changed

  • zlib is now 1.4. It fixes two CVEs: a buffer overflow in a non-blocking gzwrite(), and an out-of-bounds pointer in contrib/infback9. libmagic reads compressed files through zlib. We did not check whether either code path is reachable through libmagic.
  • Every target module has the new version v5.48.1, such as libmagic/linux_amd64/v5.48.1. The version of file stays 5.48, so the patch number grows, as D18 in docs/PLAN.md says. The root tag is v0.3.1.
  • The archives were built with zig 0.17.1. The archives of v0.3.0 came from zig 0.16, so all five libraries differ in bytes.
  • The Windows targets pass -Wno-incompatible-pointer-types. file 5.48 passes a long * where it wants a const time_t *, and the sizes differ on Windows. zig 0.16 warned about this and zig 0.17 stops with an error. The flag builds the same code as before and does not fix the mismatch.

To update, run go get github.com/xo/magic@v0.3.1.

How this release was tested

GitHub Actions was down when this release was made, so no CI run exists for it. The tests ran on the build host:

  • The package tests passed on linux/amd64, on linux/arm and linux/arm64 under qemu, and on windows/amd64 under wine.
  • windows/arm64 and freebsd/amd64 link into a program, and nothing ran them. The darwin archives compiled and were not linked.
  • A program in an empty module ran go get for v0.3.1 and printed the version and a MIME type.

No Go file changed since v0.3.0, which passed CI on all runnable jobs, including windows/arm64 with llvm-mingw.

Known fault, not new

A program that links the Linux archives with glibc gets a wrong description for Netpbm files (.pbm, .pgm, .ppm) on linux/amd64. The archives are built for musl. A program that links them with musl gives the same output as file. The MIME types and the tests are not affected. v0.2.1 and v0.3.0 have the same fault. The README and docs/BACKLOG.md describe it, and open question 9 in docs/PLAN.md asks how to fix it. The release notes of v0.3.0 said that the archives work under both libcs. That was true for linking and for MIME types only.

Versions

  • libmagic 5.48 (file 5.48)
  • zlib 1.4, bzip2 1.0.8, xz 5.8.4, zstd 1.5.7
  • libgnurx 2.5.1 on Windows, which is under LGPL 2.1