待辦事項 #38557

read_blocks may return fewer bytes on eof

啟用日期: 2018-08-29 20:27 最後更新: 2018-08-29 20:27

回報者:
負責人:
類型:
狀態:
開啟 [Owner assigned]
元件:
(無)
里程碑:
(無)
優先權:
5 - 中
嚴重程度:
5 - 中
處理結果:
檔案:

細節

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.

Ticket History (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. » 登入