[fpc-devel] Overflow in TMemoryStream?

Michael Van Canneyt michael at freepascal.org
Mon Sep 12 10:44:38 CEST 2016



On Mon, 12 Sep 2016, Michael Van Canneyt wrote:

>
> So it looks like a 32 vs. 64 bit issue.
>
> from the method Realloc :
>
>        NewCapacity := (5*FCapacity) div 4;  // 5*FCapacity can cause 
> overflow
>
> Changing this to
>   NewCapacity:=FCapacity + (FCapacity div 4)
>
> Will probably fix the issue.

I have committed a patch. Please test and report if it is fixed.
I don't have a 32-bit system available to test on...

Michael.



More information about the fpc-devel mailing list