From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 27 07:59:59 2021 Received: (at 46796) by debbugs.gnu.org; 27 Feb 2021 12:59:59 +0000 Received: from localhost ([127.0.0.1]:43370 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lFzCR-0007um-9V for submit@debbugs.gnu.org; Sat, 27 Feb 2021 07:59:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50530) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lFzCQ-0007uZ-7Q for 46796@debbugs.gnu.org; Sat, 27 Feb 2021 07:59:58 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:58963) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lFzCK-00082q-Ud; Sat, 27 Feb 2021 07:59:52 -0500 Received: from [2a01:e0a:19b:d9a0:98e:5d4:fa52:995a] (port=45062 helo=cervin) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lFzCK-00044Q-86; Sat, 27 Feb 2021 07:59:52 -0500 From: Mathieu Othacehe To: zimoun Subject: Re: bug#46796: Cuirass & pointer finalization. References: <8735xihq60.fsf@gnu.org> <86im6e1tbr.fsf@gmail.com> Date: Sat, 27 Feb 2021 13:59:50 +0100 In-Reply-To: <86im6e1tbr.fsf@gmail.com> (zimoun's message of "Fri, 26 Feb 2021 21:12:56 +0100") Message-ID: <87blc5vf7d.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 46796 Cc: 46796@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hello zimoun, > and why is =E2=80=99zmq-message-content=E2=80=99 used for? Since =E2=80= =99message=E2=80=99 is > initialized with zero, I guess. Well, I am confused by: > > (let ((content-ptr (zmq_msg_data (message->pointer message))) > [...] > (pointer->bytevector content-ptr size)))) > > =E2=80=A6 > > (let ((msg (pointer->message! msg-pointer))) > (when content-bv > (let ((target (zmq-message-content msg))) > (bytevector-copy! content-bv 0 target 0 len))) > msg)))) > > Is =E2=80=99target=E2=80=99 at the same address than =E2=80=99msg=E2=80= =99? Maybe =E2=80=99target=E2=80=99 creates > somehow a dangling pointer. No 'target' is not at the same address than 'msg', it's just a field of 'msg' that is allocated internally when "zmq_msg_init_size" is called. Allocating a message with "zmq_msg_init_size" and filling its content by memcpy'ing data to the memory region pointed by "zmq_msg_data" is the example given in "Man 3 zmq_msg_send", to I hope this is a valid use-case :). Thanks, Mathieu