TMemoryStream size limits 2GB caused by use of LongInt in Read/Write procedure
Original Reporter info from Mantis: jackshencn
-
Reporter name:
Original Reporter info from Mantis: jackshencn
- Reporter name:
Description:
I tried to use TMemoryStream to load a huge file (8GB) into memory. The Loadfromfile is called and memory allocation were correct (TMemoryStream.Size equal to filesize). But program proceed to next step without IO actually taking place. Calling readbyte/readword will raise access violation exception. If file size smaller than 2GiB it will be OK.
Traced the routine into classesh.inc the ReadBuffer procedure use LongInt instead of INT64.
Additional information:
Line 858 in classesh.inc
procedure ReadBuffer(var Buffer; Count: Longint);
procedure WriteBuffer(const Buffer; Count: Longint);
Line 854
function Read(var Buffer; Count: Longint): Longint; virtual;
Mantis conversion info:
- Mantis ID: 25671
- OS: MacOS and Linux
- Build: 2013/02/16
- Platform: x86_64
- Version: 2.6.2
- Monitored by: » Vincent (Vincent Snijders)