wmemset() regression with 3.4.2

Christoph Reiter reiter.christoph@gmail.com
Thu Dec 15 19:04:06 GMT 2022


The following example works with 3.3.6, but fails with 3.4.2. It's a
reduced example from pacman which started to produce garbage output in
some places after upgrading to 3.4.2. While I noticed it in MSYS2
first, I have confirmed it with 3.3.6 and 3.4.2 in cygwin.

```
#include <wchar.h>
#include <stdlib.h>
#include <stdio.h>

int main()
{
    char dest[50] = { 0 };
    wchar_t src[] = L"example";
    wmemset(src, L'E', 1);
    if (wcstombs(dest, src, 7) == -1) {
        printf("FAILED\n");
        return 1;
    }
    printf("OK: %s\n", dest);
    return 0;
}
```

thanks


More information about the Cygwin mailing list