pacman before 5.2 is vulnerable to arbitrary command injection in lib/libalpm/sync.c in the apply_deltas() function. This can be exploited when unsigned databases are used. To exploit the vulnerability, the user must enable the non-default delta feature and retrieve an attacker-controlled crafted database and delta file.
https://github.com/alpinelinux/alpine-secdb/blob/master/v3.11/community.yaml
https://git.archlinux.org/pacman.git/tree/lib/libalpm/sync.c?h=v5.1.3#n767
https://git.archlinux.org/pacman.git/commit/?id=c0e9be7973be6c81b22fde91516fb8991e7bb07b