Writes to TMemoryStream should fail
Original Reporter info from Mantis: mftq75
-
Reporter name: C Western
Original Reporter info from Mantis: mftq75
- Reporter name: C Western
Description:
If the position in a TMemoryStream is explicitly set negative, then writes should fail. The current implementation writes to memory that does not belong to the stream. Following some discussion on the fpc-devel list I am submitting the patch below to fix this. It follows Delphi in that writes to negative locations fail silently. I would prefer to add the additional check enclosed in {$IFDEF DEBUG} in the patch, to raise an exeception if the position is set before the start of the stream, as this is usually a programming error.
Mantis conversion info:
- Mantis ID: 13318
- OS: Fedora
- Platform: i386
- Version: 2.2.3
- Fixed in version: 2.4.0
- Fixed in revision: 12955 (#6f4637b3)