Fix DataReader.findNewLine with multiple lone EOL character#9362
Conversation
|
What is this trying to fix? There is no issue attached. The So please provide an explanation/issue why this is a good solution and a general one. Thanks! |
The fix was created before the issue, that's unusual !
The documented contract is With the current code If a buffer contains I will update the issue with more explanations. |
7659bce to
c9ddb37
Compare
spericas
left a comment
There was a problem hiding this comment.
LGTM. As I mentioned offline, it may be worth renaming some variables to distinguish between node and stream indexes. Should help understand the calculations better.
When there is multiple lone CR within a buffer, the virtual index is accumulated each time with the node index. The virtual index may be incorrectly seen as >= max, which ignores CRLN within max. - Fix virtual index accumulation - Re-use the branch that changes the buffer - Renamed indexWithinNode -> fromIndexNode - Renamed crIndex -> crIndexNode - Renamed lfIndex -> lfIndexNode - Add unit tests
c9ddb37 to
360349b
Compare
…io#9362) When there is multiple lone CR within a buffer, the virtual index is accumulated each time with the node index. The virtual index may be incorrectly seen as >= max, which ignores CRLN within max. - Fix virtual index accumulation - Re-use the branch that changes the buffer - Renamed indexWithinNode -> fromIndexNode - Renamed crIndex -> crIndexNode - Renamed lfIndex -> lfIndexNode - Add unit tests
…9391) When there is multiple lone CR within a buffer, the virtual index is accumulated each time with the node index. The virtual index may be incorrectly seen as >= max, which ignores CRLN within max. - Fix virtual index accumulation - Re-use the branch that changes the buffer - Renamed indexWithinNode -> fromIndexNode - Renamed crIndex -> crIndexNode - Renamed lfIndex -> lfIndexNode - Add unit tests Co-authored-by: Romain Grecourt <romain.grecourt@oracle.com>
…io#9362) When there is multiple lone CR within a buffer, the virtual index is accumulated each time with the node index. The virtual index may be incorrectly seen as >= max, which ignores CRLN within max. - Fix virtual index accumulation - Re-use the branch that changes the buffer - Renamed indexWithinNode -> fromIndexNode - Renamed crIndex -> crIndexNode - Renamed lfIndex -> lfIndexNode - Add unit tests
Description
DataReader.findNewLinereturns max instead of new line index when there are multiple lone CR characters in the same buffer.E.g.
\r\r\r\nThe virtual index is incorrectly accumulated each time with the relative index, its value may exceed max which will skip any valid CRLN within max.
Fixes #9365
Documentation
None.