Browse Source

--- Merging r19875 into '.':
U packages/gdbint/src/gdbint.pp
--- Merging r20228 into '.':
U packages/fcl-web/src/base/custfcgi.pp
--- Merging r20229 into '.':
G packages/fcl-web/src/base/custfcgi.pp
--- Merging r20265 into '.':
U rtl/objpas/classes/stringl.inc

# revisions: 19875,20228,20229,20265
------------------------------------------------------------------------
r19875 | pierre | 2011-12-19 14:01:49 +0100 (Mon, 19 Dec 2011) | 3 lines
Changed paths:
M /trunk/packages/gdbint/src/gdbint.pp

* Use xvasprintf instead od xstrvprintf as the later only appeared in GDB 6.2
* Also auto-reply to 'Discard symbol table' query if reset_command is true.

------------------------------------------------------------------------
------------------------------------------------------------------------
r20228 | michael | 2012-02-03 10:00:07 +0100 (Fri, 03 Feb 2012) | 1 line
Changed paths:
M /trunk/packages/fcl-web/src/base/custfcgi.pp

* Fix for bug #21211, suggested by Dmitry Ukolov
------------------------------------------------------------------------
------------------------------------------------------------------------
r20229 | michael | 2012-02-03 10:07:20 +0100 (Fri, 03 Feb 2012) | 1 line
Changed paths:
M /trunk/packages/fcl-web/src/base/custfcgi.pp

* Disable range checks
------------------------------------------------------------------------
------------------------------------------------------------------------
r20265 | michael | 2012-02-05 20:55:21 +0100 (Sun, 05 Feb 2012) | 1 line
Changed paths:
M /trunk/rtl/objpas/classes/stringl.inc

* Correctly free objects when destroying stringlist instance
------------------------------------------------------------------------

git-svn-id: branches/fixes_2_6@20309 -

marco 13 years ago
parent
commit
7534765431

+ 9 - 1
packages/fcl-web/src/base/custfcgi.pp

@@ -16,6 +16,11 @@
 {$mode objfpc}
 {$H+}
 
+{ Disable rangechecks. 
+  Buffers of unknown size are received and handled with a dummy array type }
+
+{$RANGECHECKS OFF}
+
 unit custfcgi;
 
 Interface
@@ -302,8 +307,11 @@ var
 
   function GetString(ALength : integer) : string;
   begin
+    if (ALength<0) then
+      ALength:=0;
     SetLength(Result,ALength);
-    move(ARecord^.ContentData[i],Result[1],ALength);
+    if (ALength>0) then
+      move(ARecord^.ContentData[i],Result[1],ALength);
     inc(i,ALength);
   end;
 

+ 10 - 3
packages/gdbint/src/gdbint.pp

@@ -1523,7 +1523,10 @@ var
 { used for gdb_stdout and gdb_stderr }
 function  xmalloc(size : longint) : pointer;cdecl;external;
 { used for QueryHook }
-function xstrvprintf(msg : pchar) : pchar; varargs; cdecl; external;
+{ xvasprintf is present at least from GDB 5.3
+  while xstrvprintf only appears in version 6.2,
+  so only use xvasprintf function }
+function xvasprintf(ret : ppchar; msg : pchar) : pchar; varargs; cdecl; external;
 procedure xfree(p : pointer); cdecl; external;
 function  find_pc_line(i:CORE_ADDR;l:longint):symtab_and_line;cdecl;external;
 function  find_pc_function(i:CORE_ADDR):psymbol;cdecl;external;
@@ -2406,11 +2409,15 @@ begin
     QueryHook:=0
   else
     begin
-      if curr_gdb^.reset_command and (pos('Kill',question)>0) then
+      if curr_gdb^.reset_command and ((pos('Kill',question)>0) or
+         (pos('Discard symbol table',question)>0)) then
         QueryHook:=1
       else if pos('%',question)>0 then
         begin
-          local:=xstrvprintf(question,arg);
+          xvasprintf(@local,question,arg);
+          { xvasprintf can failed, in that case local is set to nil }
+          if not assigned(local) then
+            local:=question;
           QueryHook:=curr_gdb^.Query(local, nil);
           xfree(local);
         end

+ 1 - 4
rtl/objpas/classes/stringl.inc

@@ -1133,10 +1133,7 @@ Var I : Longint;
 begin
   FOnChange:=Nil;
   FOnChanging:=Nil;
-  // This will force a dereference. Can be done better...
-  For I:=0 to FCount-1 do
-    FList^[I].FString:='';
-  FCount:=0;
+  Clear;
   SetCapacity(0);
   Inherited destroy;
 end;