Skip to content

respect length of BuiltStream - #38

Merged
LordMike merged 1 commit into
DiscUtils:masterfrom
ahdde:streams
Jul 10, 2017
Merged

respect length of BuiltStream#38
LordMike merged 1 commit into
DiscUtils:masterfrom
ahdde:streams

Conversation

@zivillian

Copy link
Copy Markdown
Contributor

Currently it is possible to read data after the end of a BuiltStream, if the size of all extents is larger than the length of the BuiltStream.
This can be reproduced by calling Read() with a count larger than number of remaining bytes.
I've also added an unit test, which validates the fix.

@LordMike

Copy link
Copy Markdown
Member

Defensive coding would set the new count to whatevers biggest between 0 and the value calculated. But it shouldn't happen, that the resulting count is negative, so it looks fine. :P

@LordMike
LordMike merged commit 60b4a57 into DiscUtils:master Jul 10, 2017
@zivillian

Copy link
Copy Markdown
Contributor Author

Even if count gets negative this wouldn't be problem since totalRead is initialized with 0 and the first comparison is totalRead < count which would then be false

@zivillian
zivillian deleted the streams branch July 11, 2017 19:19
LordMike added a commit that referenced this pull request Aug 16, 2017
Includes PRs:
#17, #18, #21, #22, #23, #27, #30, #31, #33, #34, #35, #36, #38, #39, #40, #41, #48, #51, #52, #55, #60
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants