From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NO_DNS_FOR_FROM,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from localhost.localdomain (unknown [180.246.144.41]) by gnuweeb.org (Postfix) with ESMTPSA id CE97F809BB; Wed, 17 Aug 2022 13:35:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1660743338; bh=eeHAqmGzNbRhA8VeObVz8eCokp14uB4ThkveElnndBU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jwk2wXQtCJbh/Vz/UC/F2okDIO7DHPV6dTLI7nw6RDxlN4QWGanytAdcpPJskEEIO m+qyjWNYBrQLkusjTz3d7SWPrhRCGT3dSVemtR8+WZcNpIxoMdijFmw62FjNQxB+pk TajlRzNgZWYlHB1B2Fo9NJLY6cdCnTdMp4s/mVEZ7oaVZarV3a/3s9aaheFM+ziq0v ghAefeVXpa3vK0crqoVoEouqCxamj52Io7fBK5MwceHtvfHUSOEdNLJ2z0W/ZMLg4g VRTz8Hx+ENuwd+UpJwzX7svj38Zl8U5ceDL+TDMMFlpYIruElSJSgfgAJb5MfKA+3y Iy8mU7QMjL5Cw== From: Ammar Faizi To: Alviro Iskandar Setiawan Cc: Ammar Faizi , GNU/Weeb Mailing List Subject: [PATCH ncns v1 1/2] chnet: Initialize `read_ret_` to zero Date: Wed, 17 Aug 2022 20:35:21 +0700 Message-Id: <20220817133522.1339809-2-ammarfaizi2@gnuweeb.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220817133522.1339809-1-ammarfaizi2@gnuweeb.org> References: <20220817133522.1339809-1-ammarfaizi2@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We can't rely on read_ret_ value being random at initialization. This caused a real crash where @ret value being random (83382480 in this case): ret = 83382480 [0817/093957.227555:FATAL:scoped_refptr.h(272)] Check failed: ptr_. #0 0x7fa9a8a6b62c #1 0x7fa9a87cb30a #2 0x7fa9a87cb2c5 #3 0x7fa9a881c799 #4 0x7fa9a881cfa9 #5 0x7fa9a878537b #6 0x7fa9a93866b6 #7 0x7fa9a93121fa #8 0x7fa9a931debd #9 0x000000b0deed #10 0x000000d972d0 #11 0x000000d9880f #12 0x0000016dabb9 Signed-off-by: Ammar Faizi --- chnet/chnet.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/chnet/chnet.cc b/chnet/chnet.cc index 37c0b03..c870e05 100644 --- a/chnet/chnet.cc +++ b/chnet/chnet.cc @@ -43,6 +43,7 @@ CHNetDelegate::CHNetDelegate(void): { base::Thread::Options options(base::MessagePumpType::IO, 0); CHECK(thread_.StartWithOptions(std::move(options))); + read_ret_.store(0, std::memory_order_relaxed); } static void CHNetDelegateDestruct(std::unique_ptr *url_req, -- Ammar Faizi