GNU bug report logs - #45595
recvfrom! optional start and end parameter invalid

Previous Next

Package: guile;

Reported by: d4ryus <d4ryus <at> mailbox.org>

Date: Fri, 1 Jan 2021 14:59:02 UTC

Severity: normal

Done: lloda <lloda <at> sarc.name>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 45595 in the body.
You can then email your comments to 45595 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#45595; Package guile. (Fri, 01 Jan 2021 14:59:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to d4ryus <d4ryus <at> mailbox.org>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Fri, 01 Jan 2021 14:59:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: d4ryus <d4ryus <at> mailbox.org>
To: bug-guile <at> gnu.org
Subject: recvfrom! optional start and end parameter invalid
Date: Fri, 1 Jan 2021 12:34:57 +0100
[Message part 1 (text/plain, inline)]
hi,

the parameter validation for the optional "start" and "end" arguments to
"recvfrom!" are off by one if "end" is passed. From libguile/socket.c
(master commit 64c89458e6):

  ...
  if (SCM_UNBNDP (end))
    cend = SCM_BYTEVECTOR_LENGTH (buf);
  else
    {
      cend = scm_to_size_t (end);
      if (SCM_UNLIKELY (cend >= SCM_BYTEVECTOR_LENGTH (buf)
                        || cend < offset))
        scm_out_of_range (FUNC_NAME, end);
    }
  ...

"end" is the optional end argument, "offset" is 0 or "start" if start
was given. The check must be:

  cend > SCM_BYTEVECTOR_LENGTH (buf) || cend <= offset

to allow filling the last byte in the buffer and verify that start is
not equal to end. A workaround to skip the validation is to not pass
end. But i think a better way would be to always validate start (and
end), if one (or both) of them are passed. A potentional fix is
attached.

If you need any additional information, please let me know.

Thank you for your great work!

-  d4ryus
[recvfrom-fix.patch (text/plain, attachment)]

Reply sent to lloda <lloda <at> sarc.name>:
You have taken responsibility. (Wed, 03 Nov 2021 18:30:02 GMT) Full text and rfc822 format available.

Notification sent to d4ryus <d4ryus <at> mailbox.org>:
bug acknowledged by developer. (Wed, 03 Nov 2021 18:30:03 GMT) Full text and rfc822 format available.

Message #10 received at 45595-done <at> debbugs.gnu.org (full text, mbox):

From: lloda <lloda <at> sarc.name>
To: 45595-done <at> debbugs.gnu.org
Subject: Re: recvfrom! optional start and end parameter invalid
Date: Wed, 3 Nov 2021 19:29:03 +0100
Hi,

Your patch didn't allow for start == end, which is valid as far as I can tell.

With that amended, applied in 1a8294f495cb202f8fcd0f260627c58e7a4c4d10. Thanks!






bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 02 Dec 2021 12:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 139 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.