From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by sourceware.org (Postfix) with ESMTPS id 1BBB03858D39 for ; Mon, 1 May 2023 07:06:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1BBB03858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-63b5465fb99so1697829b3a.1 for ; Mon, 01 May 2023 00:06:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682924790; x=1685516790; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=PljgB4gBBUH6YSfmHcHCVNFtX5huzNOMNtvso8Rryhc=; b=VMtXSlMg86LEgimp8zeGsab+fcDXa8hDn+Q0oJDa2cyDbyBUZJ9AS9+JzbHD9G+ZIU do47KgJcrjflBaMnxBhKrlYKLdddoDsXsfwzDCN11cvsuJzA2ZR8DZYRcIZxKSMfmK68 f4f7UVnF51m9/7AT6XSfFUg5IPDQxSV6lxtG/VI5D4jwDsC2E1+5HkBITywICrITsryh wqjNnaZksi78WxrwosfDPpt+FEuC4YzVXmrGgnqvrlPukz0SDhwr23LjWatiL0a56/4P txWTikzBZBxj8rnKDjj903gqJw2CVji7OoRwWsxR58B1Bii3DYRjujVjptvvgPm4pz89 jF6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682924790; x=1685516790; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=PljgB4gBBUH6YSfmHcHCVNFtX5huzNOMNtvso8Rryhc=; b=EXQCjYfANGVq6TwHzfvwgqXcBLAaAr1nCzSM/K1QQUXmyCLcAd7Xfa0QYXgcY3YgaA C//rw4TFf5Zd/g9tdLoRYBfzvHW6cNKAw6c54jnUWDmJpOZy79+szxeuuWf+KSQFXdAw oJDdvzmEXOHgu24dhXbY8ZLtnmKYcUfqImN/qZ7I1QXXyG+NoP4vr9I9BjRUWvDhzrlU qCt7dEbbxGCkCB3pI2+M2PpjekpPjzjxvmyZdghTisbZg0zehmWO486fvgfuiryk1oir tsMD17xWsAqXkhYw9FzMEYyxd5Uq52mARQjbD2EqzgUQn/sRvUPtFIUl8kcoVCw9PKVm dgSw== X-Gm-Message-State: AC+VfDwdU26CVRs7fZ2BkrtJWqiTMM6ybjtt5n2ZBjEuPa1w64rFu0ov BYMVtpdbVFO/YQMA04bygSgMAQ1UxigjoQ== X-Google-Smtp-Source: ACHHUZ69mcJFug0WgHLPGeeYnXJKNfBjvKlxZ+byvQv0EVWpVolVjW37oFn/JHdkf9sj+UiQGX1ncg== X-Received: by 2002:a05:6a00:1746:b0:63d:6825:d843 with SMTP id j6-20020a056a00174600b0063d6825d843mr19081272pfc.23.1682924790219; Mon, 01 May 2023 00:06:30 -0700 (PDT) Received: from localhost.localdomain ([101.93.160.94]) by smtp.gmail.com with ESMTPSA id o21-20020a056a0015d500b0063b87f47062sm15966659pfu.127.2023.05.01.00.06.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 00:06:29 -0700 (PDT) From: Kefu Chai To: libstdc++@gcc.gnu.org Cc: Kefu Chai Subject: [PATCH v1 0/1] Set _M_string_length before calling _M_dispose() Date: Mon, 1 May 2023 15:06:21 +0800 Message-Id: <20230501070622.847749-1-tchaikov@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_ABUSEAT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This patch fixes the false alarm when performing the check introduced by bf78b43873b0b7e8f9a430df38749b8b61f9c9b8 . A minimal reproducer can be found at https://godbolt.org/z/7q4nG68xn I am pasting the reproducer here just in case: #include #include #include int main() { unsigned char buf[sizeof(std::string)] ; std::memset(buf, 0xff, sizeof(buf)); const char s[] = "1234567890abcdefg"; std::istringstream in{s}; std::istreambuf_iterator it{in}, end; auto* p = new (buf) std::string(it, end); return 0; } Tested on x86_64-pc-linux-gnu, with "make check-target-libstdc++-v3". Would be great if this change can be included in thunk, 13.2 and 12 branches. Kefu Chai (1): libstdc++: Set _M_string_length before calling _M_dispose() libstdc++-v3/include/bits/basic_string.tcc | 1 + 1 file changed, 1 insertion(+) -- 2.40.1