View Issue Details

IDProjectCategoryView StatusLast Update
0028747LazarusLCLpublic2015-09-29 22:35
ReporterwpAssigned ToJesus Reyes 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.5 (SVN)Product Build 
Target Version1.4.4Fixed in Version1.5 (SVN) 
Summary0028747: Range check error when pasting a selection with empty cells in a string grid
DescriptionTStringGrid supports copy&paste of cell blocks. However, if the selection contains empty cells then the paste operation fails with error 201 (range check). Range checking is normally off, but nothing prevents to user to turn it on. The provided patch fixes this error even with range-checking on.
Steps To Reproduce* Run attached demo.
* Select the range between the two cells such that "12" is the upper/left and "34" is the lower/right cell of the selection. In this selection the first cell of the second row is empty.
* Press CTRL+C to copy the range to the clipboard
* Select another cell somewhere.
* Press CTRL+V to paste the range back into the grid
* Run-time error 201 is reported.

NOTE: the LCL has to be compiled with range-checking on to see this bug.
TagsNo tags attached.
Fixed in Revision49896
LazTarget1.6
Widgetset
Attached Files
  • Grid_PasteError201.zip (1,873 bytes)
  • grids.pas.patch (542 bytes)
    Index: lcl/grids.pas
    ===================================================================
    --- lcl/grids.pas	(revision 49892)
    +++ lcl/grids.pas	(working copy)
    @@ -10664,8 +10664,12 @@
             ini := P;
             while (P^<>#0) and (P^<>#9) do
               Inc(P);
    -        SetLength(St, P-Ini);
    -        Move(Ini^,St[1],P-Ini);
    +        if P = Ini then
    +          St := ''
    +        else begin
    +          SetLength(St, P-Ini);
    +          Move(Ini^,St[1],P-Ini);
    +        end;
             SubL.Add(St);
             if P^<>#0 then
               Inc(P);
    
    grids.pas.patch (542 bytes)

Activities

wp

2015-09-29 11:51

developer  

Grid_PasteError201.zip (1,873 bytes)

wp

2015-09-29 11:52

developer  

grids.pas.patch (542 bytes)
Index: lcl/grids.pas
===================================================================
--- lcl/grids.pas	(revision 49892)
+++ lcl/grids.pas	(working copy)
@@ -10664,8 +10664,12 @@
         ini := P;
         while (P^<>#0) and (P^<>#9) do
           Inc(P);
-        SetLength(St, P-Ini);
-        Move(Ini^,St[1],P-Ini);
+        if P = Ini then
+          St := ''
+        else begin
+          SetLength(St, P-Ini);
+          Move(Ini^,St[1],P-Ini);
+        end;
         SubL.Add(St);
         if P^<>#0 then
           Inc(P);
grids.pas.patch (542 bytes)

Jesus Reyes

2015-09-29 20:46

developer   ~0086167

Applied, thanks.

wp

2015-09-29 22:35

developer   ~0086171

Thank you.

Issue History

Date Modified Username Field Change
2015-09-29 11:51 wp New Issue
2015-09-29 11:51 wp Status new => assigned
2015-09-29 11:51 wp Assigned To => Jesus Reyes
2015-09-29 11:51 wp File Added: Grid_PasteError201.zip
2015-09-29 11:52 wp File Added: grids.pas.patch
2015-09-29 20:46 Jesus Reyes Fixed in Revision => 49896
2015-09-29 20:46 Jesus Reyes LazTarget - => 1.6
2015-09-29 20:46 Jesus Reyes Note Added: 0086167
2015-09-29 20:46 Jesus Reyes Status assigned => resolved
2015-09-29 20:46 Jesus Reyes Fixed in Version => 1.5 (SVN)
2015-09-29 20:46 Jesus Reyes Resolution open => fixed
2015-09-29 20:46 Jesus Reyes Target Version => 1.6
2015-09-29 22:35 wp Note Added: 0086171
2015-09-29 22:35 wp Status resolved => closed
2015-09-29 22:35 wp Target Version 1.6 => 1.4.4