Re: sort --version-sort

2025-02-18 Thread enh
fwiw, one reason i never bothered implementing strverscmp() for Android is that (a) basic testing showed that the gnu documentation didn't match their implementation and (b) no two existing implementations appeared to behave the same. interestingly, i note that freebsd has added a strverscmp() whe

Re: major/minor(3) macros conflict with regular code

2025-02-07 Thread enh
r(dev); return (minor & 0xff) | (major << 8) | ((minor & ~0xff) << 12); } so "move the macros to " might be the least worst option unless you're prepared to deal with a lot of disruption... On Fri, Feb 7, 2025 at 11:13 AM enh wrote: > > yeah, i

Re: major/minor(3) macros conflict with regular code

2025-02-07 Thread enh
yeah, i've seen this in Android a couple of times (and at least one of those was a similar protobuf). fwiw the "linux" libcs have moved this stuff out into where it seems to cause much less trouble (at least now we're past the transition period where source had to be updated to add the new #inclu

Re: regcomp() signedness issues

2024-12-16 Thread enh
thoughts? (i'm probably just addressing christos@ since i think he's Mr Regex :-) ) On Tue, Dec 10, 2024 at 2:06 PM enh wrote: > a trivial fuzzer someone once wrote blew up on this input to regcomp() > [passed directly to regcomp() after adding a trailing '\0

regcomp() signedness issues

2024-12-10 Thread enh
a trivial fuzzer someone once wrote blew up on this input to regcomp() [passed directly to regcomp() after adding a trailing '\0']: xxd ~~/Downloads/clusterfuzz-testcase-minimized-regexec_fuzzer-5459313584832512 : 6a3a 5b5d 6a3a 5b5d 6a3a 5bd9 6a3a 5b5d j:[]j:[]j:[.j:[] here: ==2830==ER

resource leaks in sethostent.c

2023-12-07 Thread enh
the malloc one was reported to Android (as https://android-review.googlesource.com/c/platform/bionic/+/2856549) by wuhaitao3 ; Chris Ferris then spotted the goto nospc one. the other function in the file looks fine. diff --git a/lib/libc/net/sethostent.c b/lib/libc/net/sethostent.c index b5f7ac8f

Re: regex change

2022-11-10 Thread enh
On Thu, Nov 10, 2022 at 7:44 AM Christos Zoulas wrote: > In article < > cajgzzorydwzwyur9wggdplocxebjnxepmkbiouyxsxdu-jk...@mail.gmail.com>, > enh wrote: > >-=-=-=-=-=- > > > >i see (having synced the current NetBSD lib/libc/regex to Android) that > &

regex change

2022-11-09 Thread enh
i see (having synced the current NetBSD lib/libc/regex to Android) that regcomp() no longer allows unescaped `{` and `}`. this is technically correct (since POSIX explicitly calls this undefined behavior), but it's a change from historical NetBSD behavior. specifically (since this was the existing

[PATCH] regex.c: fix assertion

2022-11-04 Thread enh
errbuf is only required to be non-NULL if errbuf_size != 0. diff --git a/lib/libc/regex/regerror.c b/lib/libc/regex/regerror.c index 262144220f3b..fe553a8f3327 100644 --- a/lib/libc/regex/regerror.c +++ b/lib/libc/regex/regerror.c @@ -139,7 +139,7 @@ regerror(int errcode, char convbuf[50];

Re: NetBSD bug/misbehavior in vdprintf

2020-08-29 Thread enh
On Fri, Aug 28, 2020 at 2:50 PM Rob Newberry wrote: > NetBSD's implementation of vdprintf makes a special check -- if the > descriptor is in non-blocking mode, it needs to be a regular file (I think > I read that code correctly). But it apparently doesn't have this check > problem for vfprintf.

__hldtoa broken for ld128

2020-04-10 Thread enh
this was found by fuzzing the LLVM __cxa_demangle on an ld128 Android system using hwasan, but it turns out no to simply be a buffer overflow --- the results are just wrong. (which shows how much anyone uses ld128 in conjunction with %a!) this was the minimized test case: free(__cxa_demangle("1\0

Fwd: Change in aosp/bionic[master]: [fuzzers] Test for ns_parserr() and got a heap-buffer-overflow.

2019-09-03 Thread enh
FYI, https://android-review.googlesource.com/c/platform/bionic/+/1093130 fixes a bug recently found by fuzzing the DNS code we share with NetBSD. -- Forwarded message - Subject: Change in aosp/bionic[master]: [fuzzers] Test for ns_parserr() and got a heap-buffer-overflow. Bruce C

Re: C11 threads patch proposal

2019-04-24 Thread enh
any reason you're using `int` rather than `pthread_key_t` for `tss_t`? (given that the other C11 types are just the pthread types.) for Android, i'm going with all the types being the same, and wondered if i missed something here? On Thu, Apr 18, 2019 at 6:30 PM Kamil Rytarowski wrote: > > I wrot

Re: [PATCH] grep: fix ASan heap-buffer-overflow.

2019-04-01 Thread enh
- bufpos; len += diff; - if (grep_lnbufgrow(len)) - goto error; + grep_lnbufgrow(len + 1); memcpy(lnbuf + off, bufpos, diff); + lnbuf[off + diff] = '\0'; bufrem -= diff; bufpos = p; break; On Fri, Mar 29, 2019 at 10:12 PM enh wrote: > > Like the regular fgetln(), gr

[PATCH] grep: fix ASan heap-buffer-overflow.

2019-03-29 Thread enh
Like the regular fgetln(), grep_fgetln() doesn't NUL-terminate the string, which regexec() doesn't like. ASan just gained the ability to intercept regexec(), which is why we didn't find this previously. Bug: http://b/129089665 Test: adb shell grep -R /system -e "abc" --- toolbox/upstream-netbsd/u

missing regex fixes from FreeBSD/OpenBSD?

2019-02-04 Thread enh
this FreeBSD regex fix seems to apply to the NetBSD copy of the code too? https://github.com/freebsd/freebsd/commit/981dd2aa38f37e4d0dd86225c619e900fc03d82e#diff-d7c26714f9432399b202eefcedb97491 as does this one? https://github.com/freebsd/freebsd/commit/95b1feb22b6da0549367ed0023308f0abfa8086b#