D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 13893 - "rawRead must take a non-empty buffer"
Summary: "rawRead must take a non-empty buffer"
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P1 enhancement
Assignee: No Owner
URL:
Keywords: bootcamp, pull
Depends on:
Blocks:
 
Reported: 2014-12-25 15:31 UTC by Vladimir Panteleev
Modified: 2022-07-24 10:42 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Vladimir Panteleev 2014-12-25 15:31:38 UTC
If an empty buffer is passed to rawRead, it throws.

This is a somewhat arbitrary limitation, and, in the generic case that the buffer a program may want to read would happen to have a length of 0, a needless corner case the programmer must be aware of. (I've had a long-running program crash half-way through because of this.)

Empty buffers are OK with the following:
- File.rawWrite
- fread
- Socket.send
- Socket.receive (although maybe this one shouldn't be, as its return value is then ambiguous).
Comment 1 Dlang Bot 2022-07-23 13:54:24 UTC
@vali0901 created dlang/phobos pull request #8517 "Fix Issue 13893 - rawRead must take a non-empty buffer" fixing this issue:

- Fix Issue 13893 - rawRead must take a non-empty buffer

https://github.com/dlang/phobos/pull/8517
Comment 2 Dlang Bot 2022-07-24 10:42:40 UTC
dlang/phobos pull request #8517 "Fix Issue 13893 - rawRead must take a non-empty buffer" was merged into master:

- 85b47bc401ce227db53922c9123cb5f3671524fa by vali0901:
  Fix Issue 13893 - rawRead must take a non-empty buffer

- 1d1621398014390734186d30be08bd1e63f3de51 by vali0901:
  Fix Issue 13893 - rawRead must take a non-empty buffer

https://github.com/dlang/phobos/pull/8517