> 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...
Tested on win32: the overflow is fixed, 500M gets incremented by 125M.
I think the RunError is caused by the way ReallocMem works: growing from 869M to
1086M seems to be done
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
On Sun, 11 Sep 2016, Martok wrote:
Hi,
yes, I can confirm this as an overflow, but on its own, it should be safe. Above
430MB, the stream doesn't grow by a quarter but just by however much was
requested, luckily the branch fails before the wrong capacity could be set.
Test:
type
TMS2 =
Hi,
yes, I can confirm this as an overflow, but on its own, it should be safe. Above
430MB, the stream doesn't grow by a quarter but just by however much was
requested, luckily the branch fails before the wrong capacity could be set.
Test:
type
TMS2 = class(TMemoryStream) end;
var
ms: TMS2;
Hi,
While working on the MSEgui fork of classes unit I saw a suspect piece of code
in streams.inc:
"
function TMemoryStream.Realloc(var NewCapacity: PtrInt): Pointer;
begin
If NewCapacity<0 Then
NewCapacity:=0
else
begin
// if growing, grow at least a quarter
if