Re: string-desc: Fix undefined behaviour

2024-09-09 Thread Bruno Haible
Jeffrey Walton wrote: > >if (needle._nbytes == 0) > > return 0; > > + if (haystack._nbytes == 0) > > +return -1; > >void *found = > > memmem (haystack._data, haystack._nbytes, needle._data, > > needle._nbytes); > >if (found != NULL) > > Clang is complaining haystack._da

Re: string-desc: Fix undefined behaviour

2024-09-09 Thread Jeffrey Walton
On Mon, Sep 9, 2024 at 8:08 PM Bruno Haible wrote: > > Running some gnulib tests with clang's UBSAN, I get this error in the file > test-string-desc.sh.log: > > string-desc-contains.c:39:13: runtime error: null pointer passed as > argument 1, which is declared to never be null > /usr/include/