public inbox for [email protected]
 help / color / mirror / Atom feed
From: Ammar Faizi <[email protected]>
To: Alviro Iskandar Setiawan <[email protected]>
Cc: Ammar Faizi <[email protected]>,
	GNU/Weeb Mailing List <[email protected]>
Subject: [PATCH ncns v1 1/2] chnet: Initialize `read_ret_` to zero
Date: Wed, 17 Aug 2022 20:35:21 +0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

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 <unknown>
  #1 0x7fa9a87cb30a <unknown>
  #2 0x7fa9a87cb2c5 <unknown>
  #3 0x7fa9a881c799 <unknown>
  #4 0x7fa9a881cfa9 <unknown>
  #5 0x7fa9a878537b <unknown>
  #6 0x7fa9a93866b6 <unknown>
  #7 0x7fa9a93121fa <unknown>
  #8 0x7fa9a931debd <unknown>
  #9 0x000000b0deed <unknown>
  #10 0x000000d972d0 <unknown>
  #11 0x000000d9880f <unknown>
  #12 0x0000016dabb9 <unknown>

Signed-off-by: Ammar Faizi <[email protected]>
---
 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<URLRequest> *url_req,
-- 
Ammar Faizi


  reply	other threads:[~2022-08-17 13:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-17 13:35 [PATCH ncns v1 0/2] ncns fixes Ammar Faizi
2022-08-17 13:35 ` Ammar Faizi [this message]
2022-08-17 13:40   ` [PATCH ncns v1 1/2] chnet: Initialize `read_ret_` to zero Alviro Iskandar Setiawan
2022-08-17 13:35 ` [PATCH ncns v1 2/2] chnet: Set error string when the Chromium hits net error Ammar Faizi
2022-08-17 13:41 ` [PATCH ncns v1 0/2] ncns fixes Alviro Iskandar Setiawan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox