Bug in XE8/8.1 [Edit]

There's a fatal bug somewhere either in the compiler or RTL.
Below is code to reproduce this bug, which results in "Exception EInvalid Pointer in module xxxx.exe at yyyy. Invalid pointer operation."

{code}
program test;
uses
  System.SysUtils, Generics.Collections;

procedure Xe8Bug;
var
  list: TList<AnsiString>;
  s: AnsiString;
  i: integer;
begin
  list := TList<AnsiString>.Create;

  for i := 0 to 20 do
  begin
    s := AnsiString('num = ') + AnsiString(IntToStr(i));
    list.Insert(0, s);
  end;

  list.Clear;
  list.Free;
end;

begin
  Xe8Bug;
end.
{code}


I used EurekaLog to locate the bug, and got the info:
Application made attempt to free the same memory block twice: $02F43A88 DATA [?] 20 bytes.

The error occurs at System._LStrArrayClr

Anyone can help fire a bug report to Embarcadero? Thank you.

Code updated to use AnsiString instead of RawByteString.
0
Simon
7/4/2015 4:36:32 PM
embarcadero.delphi.non-tech 5933 articles. 1 followers. Follow

5 Replies
727 Views

Similar Articles

[PageSpeed] 58

Am 04.07.2015 um 18:36 schrieb Simon Lau:
> There's a fatal bug somewhere either in the compiler or RTL.
> Below is code to reproduce this bug, which results in "Exception EInvalid Pointer in module xxxx.exe at yyyy. Invalid pointer operation."
> 
> {code}
> program test;
> uses
>   System.SysUtils, Generics.Collections;
> 
> procedure Xe8Bug;
> var
>   list: TList<AnsiString>;
>   s: AnsiString;
>   i: integer;
> begin
>   list := TList<AnsiString>.Create;
> 
>   for i := 0 to 20 do
>   begin
>     s := AnsiString('num = ') + AnsiString(IntToStr(i));
>     list.Insert(0, s);
>   end;
> 
>   list.Clear;
>   list.Free;
> end;
> 
> begin
>   Xe8Bug;
> end.
> {code}
> 
> 
> I used EurekaLog to locate the bug, and got the info:
> Application made attempt to free the same memory block twice: $02F43A88 DATA [?] 20 bytes.
> 
> The error occurs at System._LStrArrayClr
> 
> Anyone can help fire a bug report to Embarcadero? Thank you.
> 
> Code updated to use AnsiString instead of RawByteString.
> 

Hello,

which line of your sample project results in the exception?
Did you already file a quality portal report at quality.embarcadero.com?
If yes, which report number is this?

Since you're using TList, does it also happen if you use say integers
for your list?

Greetings

Markus
0
Markus
7/5/2015 7:08:38 AM
No.

<Arnaud Bouchez> schrieb im Newsbeitrag 
news:727773@forums.embarcadero.com...
> Hasn't it been fixed by update 1 of XE8?
0
Ralf
7/5/2015 3:19:43 PM
I have a hard time accessing embarcadero's website.
Anyone can help fire a bug report to them?

It seems a fatal bug in the memory manager or compiler.
An improved version of the sample project follows:

{code}
program test;
{$APPTYPE CONSOLE}
uses
  System.SysUtils, Generics.Collections;

procedure Xe8Bug;
var
  list: TList<AnsiString>;
  s: AnsiString;
  i: integer;
begin
  list := TList<AnsiString>.Create;

  WriteLn('------ to insert ------');
  for i := 0 to 10 do
  begin
    s := AnsiString('num = ') + AnsiString(IntToStr(i));
    WriteLn(Format('[%d] str len=%d, str=[%s]', [i, length(s), s]));
    list.Insert(0, s);
  end;

  WriteLn('------ results ------');
  for i := 0 to list.Count-1 do
    WriteLn(Format('[%d] str len=%d, str=[%s]', [i, length(list[i]), list[i]]));

  list.Clear;
  list.Free;
end;

begin
  Xe8Bug;
end.
{code}


Runing this code will output:

------ to insert ------
[0] str len=7, str=[num = 0]
[1] str len=7, str=[num = 1]
[2] str len=7, str=[num = 2]
[3] str len=7, str=[num = 3]
[4] str len=7, str=[num = 4]
[5] str len=7, str=[num = 5]
[6] str len=7, str=[num = 6]
[7] str len=7, str=[num = 7]
[8] str len=7, str=[num = 8]
[9] str len=7, str=[num = 9]
[10] str len=8, str=[num = 10]
------ results ------
[0] str len=8, str=[num = 10]
[1] str len=1, str=[]
[2] str len=1, str=[
]
[3] str len=1, str=[
]
[4] str len=1, str=[
]
[5] str len=1, str=[
]
[6] str len=1, str=[
]
[7] str len=1, str=[
]
[8] str len=1, str=[
]
[9] str len=1, str=[
]
[10] str len=1, str=[
]


Only the last insert was preserved; all previous inserts were destroyed/corrupted.




> {quote:title=Markus Humm wrote:}{quote}
> Am 04.07.2015 um 18:36 schrieb Simon Lau:
> > There's a fatal bug somewhere either in the compiler or RTL.
> > Below is code to reproduce this bug, which results in "Exception EInvalid Pointer in module xxxx.exe at yyyy. Invalid pointer operation."
> > 
> > {code}
> > program test;
> > uses
> >   System.SysUtils, Generics.Collections;
> > 
> > procedure Xe8Bug;
> > var
> >   list: TList<AnsiString>;
> >   s: AnsiString;
> >   i: integer;
> > begin
> >   list := TList<AnsiString>.Create;
> > 
> >   for i := 0 to 20 do
> >   begin
> >     s := AnsiString('num = ') + AnsiString(IntToStr(i));
> >     list.Insert(0, s);
> >   end;
> > 
> >   list.Clear;
> >   list.Free;
> > end;
> > 
> > begin
> >   Xe8Bug;
> > end.
> > {code}
> > 
> > 
> > I used EurekaLog to locate the bug, and got the info:
> > Application made attempt to free the same memory block twice: $02F43A88 DATA [?] 20 bytes.
> > 
> > The error occurs at System._LStrArrayClr
> > 
> > Anyone can help fire a bug report to Embarcadero? Thank you.
> > 
> > Code updated to use AnsiString instead of RawByteString.
> > 
> 
> Hello,
> 
> which line of your sample project results in the exception?
> Did you already file a quality portal report at quality.embarcadero.com?
> If yes, which report number is this?
> 
> Since you're using TList, does it also happen if you use say integers
> for your list?
> 
> Greetings
> 
> Markus
0
Simon
7/6/2015 3:01:13 AM
I found the cause of bug, which affects these two usages of TList:  TList<AnsiString> and TList<WideString>

Bugfix Steps:

1. Open System.Generics.Collections.pas
2. Locate the line:
{code}
procedure TListHelper.DoInsertAnsiString(AIndex: Integer; const Value);
{code}

   Add the following line immediately after the Move statement:
{code}   
PPointer(FItems^)[AIndex] := nil;
{code}

3. Repeat the above step for 
{code}
procedure TListHelper.DoInsertWideString(AIndex: Integer; const Value);
{code}

4. Compile System.Generics.Collections.pas, and replace the old System.Generics.Collections.dcu versions with the new .dcu files (32-bit, 64-bit)




> {quote:title=Simon Lau wrote:}{quote}
> There's a fatal bug somewhere either in the compiler or RTL.
> Below is code to reproduce this bug, which results in "Exception EInvalid Pointer in module xxxx.exe at yyyy. Invalid pointer operation."
> 
> {code}
> program test;
> uses
>   System.SysUtils, Generics.Collections;
> 
> procedure Xe8Bug;
> var
>   list: TList<AnsiString>;
>   s: AnsiString;
>   i: integer;
> begin
>   list := TList<AnsiString>.Create;
> 
>   for i := 0 to 20 do
>   begin
>     s := AnsiString('num = ') + AnsiString(IntToStr(i));
>     list.Insert(0, s);
>   end;
> 
>   list.Clear;
>   list.Free;
> end;
> 
> begin
>   Xe8Bug;
> end.
> {code}
> 
> 
> I used EurekaLog to locate the bug, and got the info:
> Application made attempt to free the same memory block twice: $02F43A88 DATA [?] 20 bytes.
> 
> The error occurs at System._LStrArrayClr
> 
> Anyone can help fire a bug report to Embarcadero? Thank you.
> 
> Code updated to use AnsiString instead of RawByteString.
0
Simon
7/6/2015 4:37:15 AM
Am 06.07.2015 um 06:37 schrieb Simon Lau:
> I found the cause of bug, which affects these two usages of TList:  TList<AnsiString> and TList<WideString>
> 
> Bugfix Steps:
> 
> 1. Open System.Generics.Collections.pas
> 2. Locate the line:
> {code}
> procedure TListHelper.DoInsertAnsiString(AIndex: Integer; const Value);
> {code}
> 
>    Add the following line immediately after the Move statement:
> {code}   
> PPointer(FItems^)[AIndex] := nil;
> {code}
> 
> 3. Repeat the above step for 
> {code}
> procedure TListHelper.DoInsertWideString(AIndex: Integer; const Value);
> {code}
> 
> 4. Compile System.Generics.Collections.pas, and replace the old System.Generics.Collections.dcu versions with the new .dcu files (32-bit, 64-bit)
> 

So it only affects generic lists with strings as lisgt elements?
And which troubles do you have with the quality.embarcadero.com website
that you're asking us to file the report?

Greetings

Markus
0
Markus
7/6/2015 6:45:22 PM
Reply:

Similar Artilces:

superreview granted: [Bug 362139] bump SeaMonkey versions to 1.0.7/1.1 on 1.8.0/1.8 branches, localeVersion to 1.8.1 on 1.8 branch : [Attachment 246922] 1.8 patch: SeaMonkey version -> 1.1, localeVers
neil@parkwaycc.co.uk <neil@httl.net> has granted Robert Kaiser <kairo@kairo.at>'s request for superreview: Bug 362139: bump SeaMonkey versions to 1.0.7/1.1 on 1.8.0/1.8 branches, localeVersion to 1.8.1 on 1.8 branch https://bugzilla.mozilla.org/show_bug.cgi?id=362139 Attachment 246922: 1.8 patch: SeaMonkey version -> 1.1, localeVersion -> 1.8.1 https://bugzilla.mozilla.org/attachment.cgi?id=246922&action=edit ...

superreview requested: [Bug 362139] bump SeaMonkey versions to 1.0.7/1.1 on 1.8.0/1.8 branches, localeVersion to 1.8.1 on 1.8 branch : [Attachment 246922] 1.8 patch: SeaMonkey version -> 1.1, localeVe
Robert Kaiser <kairo@kairo.at> has asked neil@parkwaycc.co.uk <neil@httl.net> for superreview: Bug 362139: bump SeaMonkey versions to 1.0.7/1.1 on 1.8.0/1.8 branches, localeVersion to 1.8.1 on 1.8 branch https://bugzilla.mozilla.org/show_bug.cgi?id=362139 Attachment 246922: 1.8 patch: SeaMonkey version -> 1.1, localeVersion -> 1.8.1 https://bugzilla.mozilla.org/attachment.cgi?id=246922&action=edit ------- Additional Comments from Robert Kaiser <kairo@kairo.at> ...and here's the 1.8 branch patch, setting SeaMonkey version to 1.1 for final, and locale...

superreview granted: [Bug 362139] bump SeaMonkey versions to 1.0.7/1.1 on 1.8.0/1.8 branches, localeVersion to 1.8.1 on 1.8 branch : [Attachment 246921] 1.8.0 patch: SeaMonkey version -> 1.0.7
neil@parkwaycc.co.uk <neil@httl.net> has granted Robert Kaiser <kairo@kairo.at>'s request for superreview: Bug 362139: bump SeaMonkey versions to 1.0.7/1.1 on 1.8.0/1.8 branches, localeVersion to 1.8.1 on 1.8 branch https://bugzilla.mozilla.org/show_bug.cgi?id=362139 Attachment 246921: 1.8.0 patch: SeaMonkey version -> 1.0.7 https://bugzilla.mozilla.org/attachment.cgi?id=246921&action=edit ...

superreview requested: [Bug 362139] bump SeaMonkey versions to 1.0.7/1.1 on 1.8.0/1.8 branches, localeVersion to 1.8.1 on 1.8 branch : [Attachment 246921] 1.8.0 patch: SeaMonkey version -> 1.0.7
Robert Kaiser <kairo@kairo.at> has asked neil@parkwaycc.co.uk <neil@httl.net> for superreview: Bug 362139: bump SeaMonkey versions to 1.0.7/1.1 on 1.8.0/1.8 branches, localeVersion to 1.8.1 on 1.8 branch https://bugzilla.mozilla.org/show_bug.cgi?id=362139 Attachment 246921: 1.8.0 patch: SeaMonkey version -> 1.0.7 https://bugzilla.mozilla.org/attachment.cgi?id=246921&action=edit ------- Additional Comments from Robert Kaiser <kairo@kairo.at> This is the 1.8.0 branch patch for bumping SeaMonkey version to 1.0.7 ...

superreview granted: [Bug 350409] flip localeVersion to 1.8.1(rc?) for SeaMonkey 1.1 Beta : [Attachment 241582] change to 1.8.1rc
neil@parkwaycc.co.uk <neil@httl.net> has granted Robert Kaiser <kairo@kairo.at>'s request for superreview: Bug 350409: flip localeVersion to 1.8.1(rc?) for SeaMonkey 1.1 Beta https://bugzilla.mozilla.org/show_bug.cgi?id=350409 Attachment 241582: change to 1.8.1rc https://bugzilla.mozilla.org/attachment.cgi?id=241582&action=edit ...

superreview requested: [Bug 350409] flip localeVersion to 1.8.1(rc?) for SeaMonkey 1.1 Beta : [Attachment 241582] change to 1.8.1rc
Robert Kaiser <kairo@kairo.at> has asked neil@parkwaycc.co.uk <neil@httl.net> for superreview: Bug 350409: flip localeVersion to 1.8.1(rc?) for SeaMonkey 1.1 Beta https://bugzilla.mozilla.org/show_bug.cgi?id=350409 Attachment 241582: change to 1.8.1rc https://bugzilla.mozilla.org/attachment.cgi?id=241582&action=edit ------- Additional Comments from Robert Kaiser <kairo@kairo.at> OK, I think we should go for 1.8.1rc and then do another change for final, so possible last-minute string fixes after the string freeze can't break any langpack that can be instal...

Bug in XE8/8.1
There's a fatal bug somewhere either in the compiler or RTL. Below is code to reproduce this bug, which results in "Exception EInvalid Pointer in module xxxx.exe at yyyy. Invalid pointer operation." {code} program test; uses System.SysUtils, Generics.Collections; procedure Xe8Bug; var list: TList<RawByteString>; s: RawByteString; i: integer; begin list := TList<RawByteString>.Create; for i := 0 to 20 do begin s := RawByteString('num = ') + RawByteString(IntToStr(i)); list.Insert(0, s); end; list.Clear; lis...

superreview requested: [Bug 344300] Crash [@ nsFrameItems::AddChild ] on 1. 8.0.5 and 1.8.1 branch
Mats Palmgren <mats.palmgren@bredband.net> has asked Boris Zbarsky <bzbarsky@mit.edu> for superreview: Bug 344300: Crash [@ nsFrameItems::AddChild ] on 1.8.0.5 and 1.8.1 branch https://bugzilla.mozilla.org/show_bug.cgi?id=344300 Attachment 263844: Patch rev. 1 https://bugzilla.mozilla.org/attachment.cgi?id=263844&action=edit ...

superreview granted: [Bug 344300] Crash [@ nsFrameItems::AddChild ] on 1.8. 0.5 and 1.8.1 branch
Boris Zbarsky <bzbarsky@mit.edu> has granted superreview: Bug 344300: Crash [@ nsFrameItems::AddChild ] on 1.8.0.5 and 1.8.1 branch https://bugzilla.mozilla.org/show_bug.cgi?id=3D344300 Attachment 263844: Patch rev. 1 https://bugzilla.mozilla.org/attachment.cgi?id=3D263844&action=3Dedit ------- Additional Comments from Boris Zbarsky <bzbarsky@mit.edu> Sure, I guess. I hate the branch. ;)= ...

superreview granted: [Bug 330276] Drop support for pre-Win2k platforms (Win9x/Me/NT4). : [Attachment 220066] subset of rv2.1 to fix mingw bustage on 1.8/1.8.0 branches
Robert O'Callahan (Novell) <roc@ocallahan.org> has granted cls (zoom zoom) <cls@seawood.org>'s request for superreview: Bug 330276: Drop support for pre-Win2k platforms (Win9x/Me/NT4). https://bugzilla.mozilla.org/show_bug.cgi?id=330276 Attachment 220066: subset of rv2.1 to fix mingw bustage on 1.8/1.8.0 branches https://bugzilla.mozilla.org/attachment.cgi?id=220066&action=edit ...

superreview requested: [Bug 330276] Drop support for pre-Win2k platforms (Win9x/Me/NT4). : [Attachment 220066] subset of rv2.1 to fix mingw bustage on 1.8/1.8.0 branches
cls (zoom zoom) <cls@seawood.org> has asked Robert O'Callahan (Novell) <roc@ocallahan.org> for superreview: Bug 330276: Drop support for pre-Win2k platforms (Win9x/Me/NT4). https://bugzilla.mozilla.org/show_bug.cgi?id=330276 Attachment 220066: subset of rv2.1 to fix mingw bustage on 1.8/1.8.0 branches https://bugzilla.mozilla.org/attachment.cgi?id=220066&action=edit ...

Delphi 7 in Windows 8.1 Pro [Edit]
Hello All I'm aware that Delphi 7 is rather old creature, but... I had Delphi 7 IDE working on my Win 8.1 for quite some time. Since probably some Windows update, Delphi 7 IDE freezes when opening Save/Open dialog, and it is impossible to end taks from Task Manager, because it freezes as well. Hard restart is required. Has anyony encountered something like this. That Win 8.1 instance of my Delphi 7 is the exact copy of my previous installation in Windows 7 - same component even don't recompiled, but installed from copied packages. Funny thing is that app compiled on Win 8.1 th...

Install Delphi 2007 in Windows 8.1 [Edit]
I'm trying to move my development platform from Windows 7 to Windows 8.1 but the Rad Studio 2007 installer fails. It tries to install the .Net 2.0 prerequisite and then stops with the following error: ".NET Framework 2.0 (x64) could not be installed." I neither want nor need this framework so is there any way to disable this? Or get past this error? TIA. The IDE needs .Net. I suggest you try Right Click and Run as Administrator and see if that solves it. Fulvio Castelli wrote: > I'm trying to move my development platform from Windows 7 to Windows 8.1 but the Rad St...

ANN: Pascal Analyzer 8.1
PASCAL ANALYZER 8.1 - Measure and check your Delphi source code Peganza Software has released version 8.1 of Pascal Analyzer, a Windows program that helps Delphi developers measure, check, and document their source code. Pascal Analyzer (or PAL for short) is a development tool that makes software projects of any size easier to understand and enables developers to produce flawless and reliable code. PAL contains numerous optimization, validation, and documentation features, which help in fine-tuning and managing the development process. In addition, it is an extremely easy tool to ...

Web resources about - Bug in XE8/8.1 [Edit] - embarcadero.delphi.non-tech

Edits Quarterly
“Short narratives in film and photography”, by Ian Coyle. Do yourself a favor and view it on a big display in Safari in full-screen mode.

File:Edit-copy purple.svg - Wikipedia, the free encyclopedia
This file contains additional information, probably added from the digital camera or scanner used to create or digitize it.If the file has been ...

Articles with edits awaiting review - Wikipedia, the free encyclopedia
As part of a Request for Comment on pending-changes protection , a third phase considered its use in the short term. In accordance with consensus ...

Facebook Android App Update Includes Privacy Settings Icon, Structured Status Updates, Ability To Edit ...
... Inside Facebook reported that the update also extends the availability of structured status updates , as well as the ability for users to edit ...

Viz Responds Regarding Manga Edits
Edits done with creator's approval

Bazaart now lets you seamlessly edit your photos using Adobe apps
The acclaimed photo-editing app Bazaart has just become much better with its latest update, which most notably introduces inter-app operability ...

Markdown Edit is a distraction-free editor for Windows
Markdown is a lightweight and readable markup language which makes it easy to create rich text documents with a plain text editor. How easy? ...

Politico Edits Ben Carson Hit Piece, Drops Claims of ‘Fabrication’
Politico has rewritten several portions of an article accusing Ben Carson of "fabricating" his personal biography involving West Point.

A powerful tool that lets scientists edit our DNA was discovered mostly by accident
You may have seen the headlines about CRISPR/Cas9, a powerful genetic technique that lets scientists "edit" genes. It's been hailed as a miracle ...

Gallery: The Daily Edit 12.14.15
Charlotte Observer Gallery: The Daily Edit 12.14.15 Charlotte Observer Real Madrid's Karim Benzema, second right, and Cristiano Ronaldo, second ...

Resources last updated: 12/20/2015 12:17:43 PM