From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: d4ryus via "Bug reports for GUILE, GNU's Ubiquitous Extension Language" Newsgroups: gmane.lisp.guile.bugs Subject: bug#45816: (ice-9 suspendable-ports):get-bytevector-some! is broken Date: Tue, 12 Jan 2021 15:19:05 +0100 Message-ID: Reply-To: d4ryus Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="4zG0w5A58Fq5uK3u" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31499"; mail-complaints-to="usenet@ciao.gmane.io" To: 45816@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Tue Jan 12 16:10:48 2021 Return-path: Envelope-to: guile-bugs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kzLJn-000857-RY for guile-bugs@m.gmane-mx.org; Tue, 12 Jan 2021 16:10:47 +0100 Original-Received: from localhost ([::1]:38170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzLJm-0006Ku-SS for guile-bugs@m.gmane-mx.org; Tue, 12 Jan 2021 10:10:46 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58176) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzLDG-000824-HG for bug-guile@gnu.org; Tue, 12 Jan 2021 10:04:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49500) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzLDG-0007Jd-8B for bug-guile@gnu.org; Tue, 12 Jan 2021 10:04:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kzLDG-0003yZ-4D for bug-guile@gnu.org; Tue, 12 Jan 2021 10:04:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: d4ryus Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 12 Jan 2021 15:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 45816 X-GNU-PR-Package: guile X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.161046378715215 (code B ref -1); Tue, 12 Jan 2021 15:04:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 12 Jan 2021 15:03:07 +0000 Original-Received: from localhost ([127.0.0.1]:32813 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kzLCL-0003xK-W8 for submit@debbugs.gnu.org; Tue, 12 Jan 2021 10:03:07 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:53012) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kzKVx-0002Wi-1g for submit@debbugs.gnu.org; Tue, 12 Jan 2021 09:19:18 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47928) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzKVw-0008D2-OX for bug-guile@gnu.org; Tue, 12 Jan 2021 09:19:16 -0500 Original-Received: from mout-p-202.mailbox.org ([80.241.56.172]:52872) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1kzKVu-0000Ut-14 for bug-guile@gnu.org; Tue, 12 Jan 2021 09:19:16 -0500 Original-Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4DFXkj39CQzQlmf for ; Tue, 12 Jan 2021 15:19:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mailbox.org; h= content-disposition:content-type:content-type:mime-version :message-id:subject:subject:from:from:date:date:received; s= mail20150812; t=1610461146; bh=gadcbqjtUlPiREemwkdHTii9Q8jQapsYD c9yNbygmss=; b=ca8aXRo87cvNZRc+6RX9U7tuxzFYSytVzt0raCK5M0i7RP1Ee Y3worCW9JrtTJrOGH6Z9JrR5mEhwV4uPy6vN4aokcvKriDx2xDgGw3k2IBLY7XTL vWNOgNAyddDJbxmZnlo1oqqgyYUaA7RVfhKQK05DL6tgUmcWnAP5bKiKfkRYJzh1 R0BFLR9Fsig2AYDZaSjGqC8f7uQJ8hQrcpZSyl1JpIC/02EcXxmuaDkCwPpTgtxN os7GWnNsQNdVWar+aQG82nT8ZCJeOnX64TY5Uc6VpGwxsTK7xghTBYlDhcDENKed J+vWSe3NGkJ4rcOMFOEqyIQQbHG5mYwihIPUg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1610461147; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=qIXpcQEAvpiUAUve2sPWr8P/hJRSBDvmLOf//zunl50=; b=k3MdtUl0BGjZsSrchk3y22MmGdRHclznkS1imA233gq3lrAJcSaWW8bWv7kOC0ex7QW69I NzGAvB0FPjIPhz+V6Aaia3SSZ3fD44bHr6Ittfnhgy7LMj10ACIA72a+Rdn4xAmMYzY2PU ZEQouqcoF4ib57hXKQ4mZsTnUIvet4rKAbNSFixdGep7+vS2Mw0KxPCer+LE4tqOk9hpQA OtrCQUKCwLw2umpG1MNOkRTZFCqotU7KHYagcxHVf77ayXvvD0TVVkmNjG+E6HHQJnQEvN Pzxx7CoFy5qJlZtde2sAtzIf8KzH2vBLzMRFeSWhRluqlYK7tfBsNemXU2ouyg== X-Virus-Scanned: amavisd-new at heinlein-support.de Original-Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter02.heinlein-hosting.de (spamfilter02.heinlein-hosting.de [80.241.56.116]) (amavisd-new, port 10030) with ESMTP id 2MaPmUkmpHl3 for ; Tue, 12 Jan 2021 15:19:06 +0100 (CET) Content-Disposition: inline X-Rspamd-Score: -2.58 / 15.00 / 15.00 X-Rspamd-Queue-Id: 77C2E185F X-Rspamd-UID: 3d7b7c Received-SPF: pass client-ip=80.241.56.172; envelope-from=d4ryus@mailbox.org; helo=mout-p-202.mailbox.org X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 12 Jan 2021 10:03:04 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.io gmane.lisp.guile.bugs:9947 Archived-At: --4zG0w5A58Fq5uK3u Content-Type: text/plain; charset=us-ascii Content-Disposition: inline hi, (ice-9 suspendable-ports):get-bytevector-some! calls bytevector-copy! with transfer-size (which is a number) as third argument: ... (define (get-bytevector-some! port bv start count) (if (zero? count) 0 (call-with-values (lambda () (fill-input port 1 'binary)) (lambda (buf cur buffered) (if (zero? buffered) (begin (set-port-buffer-has-eof?! buf #f) the-eof-object) (let ((transfer-size (min count buffered))) (bytevector-copy! (port-buffer-bytevector buf) cur transfer-size start buffered) (set-port-buffer-cur! buf (+ cur transfer-size)) transfer-size)))))) ... The third argument to bytevector-copy! must be the target bytevector, from the doc: Scheme Procedure: bytevector-copy! source source-start target target-start len Copy len bytes from source into target, starting reading from source-start (a positive index within source) and start writing at target-start. It is permitted for the source and target regions to overlap. I think the correct call is: (bytevector-copy! (port-buffer-bytevector buf) cur bv start transfer-size) A potentional fix is attached. If you need any additional information, please let me know. - d4ryus --4zG0w5A58Fq5uK3u Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="suspendable-get-bytevector-some-fix.patch" diff --git a/module/ice-9/suspendable-ports.scm b/module/ice-9/suspendable-ports.scm index f5f005cca..a823f1d37 100644 --- a/module/ice-9/suspendable-ports.scm +++ b/module/ice-9/suspendable-ports.scm @@ -338,7 +338,7 @@ the-eof-object) (let ((transfer-size (min count buffered))) (bytevector-copy! (port-buffer-bytevector buf) cur - transfer-size start buffered) + bv start transfer-size) (set-port-buffer-cur! buf (+ cur transfer-size)) transfer-size)))))) --4zG0w5A58Fq5uK3u--