[fpc-devel] Memory Streams unable to handle reads past 2GB

Jeppe Græsdal Johansen jjohan07 at student.aau.dk
Wed Nov 7 00:43:39 CET 2012


Den 07-11-2012 00:12, Andrew skrev:
> On 12-11-06 05:07 PM, Michael Van Canneyt wrote:
>
> Please re-open the issue and I will post an updated program that fails 
> EVERY TIME.
>
> Or just use the attached Widen.lpr... :-)
Try this
FSize:=int64(1024*1024*1024)*Factor;

1024*1024*1024 is handled as a longint on a 32bit machine. Multiplied by 
a byte will still give a longint, which will overflow if multiplied by 2.

It also generates a hint about that:
widen.lpr(44,12) Hint: Converting the operands to "Int64" before doing 
the multiply could prevent overflow errors.



More information about the fpc-devel mailing list