Patch. Functions TStrings.GetNextLine and TStrings.GetNextLineBreak does not check parameters
Original Reporter info from Mantis: SergeAnvarov @SergeAnvarov
-
Reporter name: Serge Anvarov
Original Reporter info from Mantis: SergeAnvarov @SergeAnvarov
- Reporter name: Serge Anvarov
Description:
Parameters: (const Value: string; var S: string; var P: Integer): Boolean;
Fail when:
- P < 0
- Value and S are the same variable
The functions are not private, so they can be called with these parameters.
Steps to reproduce:
The test is included (also works for version 3.0.4).
Additional information:
The patch assumes a new version of "System.Pos".
The new implementation not only corrects these errors, but also eliminates conversions to and from PChar, because there is no difference in speed between Data[0] and Data[Index] on modern processors.
The new implementation also eliminates implicit generation of the "try finally" block, which improves performance.
Mantis conversion info:
- Mantis ID: 35331
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 41853 (#27894ebe)
- Target version: 3.2.0