git-localedef-check-magic
authorGNU Libc Maintainers <debian-glibc@lists.debian.org>
Tue, 15 Feb 2022 11:21:20 +0000 (11:21 +0000)
committerAurelien Jarno <aurel32@debian.org>
Tue, 15 Feb 2022 11:21:20 +0000 (11:21 +0000)
commit1ff9f4a8207e98e4e9b62a3e51e4f3e5cdfe4696
treefaedc3b0e15da1228d0c6a50bd2d5c7b34545954
parentd40c55cc86ca6f515509956faec7eee57aa2e6cb
git-localedef-check-magic

commit 56ea4bed7369f32e3c7c935f9e33ee38e9f78143
Author: Aurelien Jarno <aurelien@aurel32.net>
Date:   Sun Dec 5 11:51:17 2021 +0100

    localedef: check magic value on archive load [BZ #28650]

    localedef currently blindly trust the archive header. When passed an
    archive file with the wrong endianess, this leads to a segmentation
    fault:

      $ localedef --big-endian --list-archive /usr/lib/locale/locale-archive
      Segmentation fault (core dumped)

    When passed non-archive files, asserts are reported on the best case,
    but sometimes it can lead to a segmentation fault:

      $ localedef --list-archive /bin/true
      localedef: programs/locarchive.c:1643: show_archive_content: Assertion `used < GET (head->namehash_used)' failed.
      Aborted (core dumped)

      $ localedef --list-archive /usr/lib/locale/C.utf8/LC_COLLATE
      Segmentation fault (core dumped)

    This patch improves the user experience by looking at the magic value,
    which is always written, but never checked. It should still be possible
    to trigger a segmentation fault with crafted files, but this already
    catch many cases.

Gbp-Pq: Topic any
Gbp-Pq: Name git-localedef-check-magic.patch
locale/programs/locarchive.c