]> git.ipfire.org Git - thirdparty/openwrt.git/commit
apk: handle edge case when parsing .apk files 22001/head
authorMatt Merhar <mattmerhar@protonmail.com>
Wed, 11 Feb 2026 22:30:53 +0000 (17:30 -0500)
committerHauke Mehrtens <hauke@hauke-m.de>
Thu, 12 Feb 2026 23:12:35 +0000 (00:12 +0100)
commit324e157b4bf2fea54bd2608ab2af05066936e12f
tree94b561ece8d16dda0849900b5cbac5ba56256f4f
parentac7c25ee92d808910a04231cf33660c754396556
apk: handle edge case when parsing .apk files

This was a regression introduced in the recent alignment changes and led
to failures when reading (i.e. 'mkndx') certain packages like follows:

ERROR: python3-botocore-1.31.7-r1.apk: unexpected end of file

It affected packages with a header size greater than the read buffer
size of 128KB but less than 160KB (128KB + (128KB / 4)).

In those cases, we'd attempt a 0 byte read, leading to APKE_EOF.

Based on some tests of files across multiple archs and feeds, it seems
the only packages meeting those criteria were python3-botocore and
golang-github-jedisct1-dnscrypt-proxy2-dev.

Fixes: 64ec08eee1 ("apk: backport upstream fixes for unaligned access")
Signed-off-by: Matt Merhar <mattmerhar@protonmail.com>
Link: https://github.com/openwrt/openwrt/pull/21992
Signed-off-by: Robert Marko <robimarko@gmail.com>
(cherry picked from commit 8c6ed4e927373282b654420ad3962a6a0ea110c3)
Link: https://github.com/openwrt/openwrt/pull/22001
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
package/system/apk/Makefile
package/system/apk/patches/0034-io-handle-edge-case-when-refilling-read-buffer.patch [new file with mode: 0644]