musl: workaround a segfault in dcngettext().

Close #12042
This commit is contained in:
Juan RP 2019-06-26 10:11:20 +02:00
parent 7b2b4dc55e
commit 5322f964c8
No known key found for this signature in database
GPG key ID: AF19F6CB482F9368
2 changed files with 20 additions and 1 deletions

View file

@ -0,0 +1,19 @@
Do not crash with a NULL pointer dereference when dcngettext()
is called with NULL msgid[12] arguments.
Fix for https://github.com/void-linux/void-packages/issues/12042
and probably others.
--xtraeme
--- src/locale/__mo_lookup.c.orig 2019-06-26 09:55:36.843012674 +0200
+++ src/locale/__mo_lookup.c 2019-06-26 09:56:11.529443955 +0200
@@ -13,7 +13,7 @@ const char *__mo_lookup(const void *p, s
uint32_t b = 0, n = swapc(mo[2], sw);
uint32_t o = swapc(mo[3], sw);
uint32_t t = swapc(mo[4], sw);
- if (n>=size/4 || o>=size-4*n || t>=size-4*n || ((o|t)%4))
+ if (!s || n>=size/4 || o>=size-4*n || t>=size-4*n || ((o|t)%4))
return 0;
o/=4;
t/=4;

View file

@ -1,7 +1,7 @@
# Template file for 'musl'.
pkgname=musl
version=1.1.22
revision=3
revision=4
archs="*-musl"
build_style=gnu-configure
configure_args="--prefix=/usr --disable-gcc-wrapper"