X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 84DF23897A21
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1671131096;
	bh=PQvyHk25dxI9Vj98HUtr52HhyyGamTXCq8C1qZlBHqQ=;
	h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post:
	 List-Help:List-Subscribe:From:Reply-To:From;
	b=cIQJ/P2G1XitS25wqybDce7yrWdevS0WSftLSjRA+oHrGNxWNSjn0Xdm7vuUylalk
	 K9Xvav0hEpwtmaMEqx92f2L/IcMjH6tsejea3QZylfOPJ5ZmQza2q9uVzMBevbUocT
	 pNGy40N2mz5gbOd/cwj+Y5Vo2RVFvaRzceXuGRcc=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DA8CA389719A
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=to:subject:message-id:date:from:mime-version:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=C3kBGG/YaFPMnc9INRdqWN7CL9RvUaEcDkyMcRN/RCY=;
 b=Q8Biy52FHt2k04M20JMyThVE+KPyOOK9kveb5sd2LSq2/JgPMidSprWt1mG+VOG6QY
 wWD0PYQGfDsn0TPDn67BFFn9krodUU4xRU8JUTRNEcpD2facrI1ldlaUQQ167UPhK899
 MRyruoseeUkD9hUYkeFlLUByFAWITpo2rREl58Iu9WY4UsNUatdBerxt5S2RA7dc/RbI
 PatNRExzTmCgnLHTiQiH5uwby1ZejjH7eqZ9GDfFNE6zaCwcX/2iLDmuIJwa/4Fy+3CH
 MxtUQrhU5BEKFfZ4qLD3cE3UqJz+EeEGLxNsOUFq1D44oLz7Xe6+mnThCFMDOr0L46BG
 eWHg==
X-Gm-Message-State: ANoB5pkfUGl7XWI3gSI3EYzTU5m5wWdjTLumNmo6E7KBQpPbfFvbQKJO
 ScXqq80xAEIQ9rV2qP24xZKYpQOOn55ifkmfA0xF/iIUimVY+g==
X-Google-Smtp-Source: AA0mqf7EgVhJQLokcRV6NVVI6cwtuSvy4Y6nGLBaoeCFWuvjPy+2YEwnrMvr10QnEjobh0+MXp1Pv15rfobZb3X69R4=
X-Received: by 2002:a05:6000:a03:b0:242:67cf:a572 with SMTP id
 co3-20020a0560000a0300b0024267cfa572mr9805018wrb.124.1671131060009; Thu, 15
 Dec 2022 11:04:20 -0800 (PST)
MIME-Version: 1.0
Date: Thu, 15 Dec 2022 20:04:06 +0100
Message-ID: <CAE6_+Udw=1dK20fsF34PagXRXV9uhqU_d82mOn68oQR5a9duWQ@mail.gmail.com>
Subject: wmemset() regression with 3.4.2
To: cygwin@cygwin.com
X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, DKIM_SIGNED,
 DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_NUMSUBJECT,
 RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS,
 TXREP autolearn=no autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
 server2.sourceware.org
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Christoph Reiter via Cygwin <cygwin@cygwin.com>
Reply-To: Christoph Reiter <reiter.christoph@gmail.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>

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

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
