任务单 #38557

read_blocks may return fewer bytes on eof

开放日期: 2018-08-29 20:27 最后更新: 2018-08-29 20:27

报告人:
属主:
类型:
状态:
开启 [Owner assigned]
组件:
(无)
里程碑:
(无)
优先:
5 - Medium
严重性:
5 - Medium
处理结果:
文件:

Details

arbitrary_positional_facade.hpp line 325 may result in res less than n at end of file. Specifically this code at lines 330 and 331:

					count_ = block_size_ - n;
					total += n;
leaves count_ with residual bytes when there are none such that a subsequent call to read will return data when no data is available. I believe these should be something along the lines of:
					if (res > n)
					{
						count_ = res - n;
						total += n;
					}
					else
					{
						count_ = 0;
						total += res;
					}
Thus if block size is say 3 and only 2 bytes are read at the end of file there will not be a residual of 1 byte for the next call to read. Rather, the next call will return the expected 0 bytes indicating end of file.

任务单历史 (1/1 Histories)

2018-08-29 20:27 Updated by: nivekkagicom
  • New Ticket "read_blocks may return fewer bytes on eof" created

Attachment File List

No attachments

编辑

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » 登录名