#15035 closed defect (fixed)

wxGrid infinite loop

Reported by: hackish Owned by: vadz
Priority: critical Milestone:
Component: wxGrid Version: stable-latest
Keywords: Cc:
Blocked By: Blocking:
Patch: no

Description

Sorry I don't have the tools here to make a patch...

In grid.cpp line 6694
You have a loop like so:

do
{

line = oper.GetLineBefore(this, line);

}
while ( line >= 0 && oper.GetLineSize(this, line) == 0 );

When line becomes 0 you have an infinite loop.

The fix is simple:

while ( line > 0 && oper.GetLineSize(this, line) == 0 );

Change History (2)

comment:1 Changed 14 months ago by vadz

  • Owner set to vadz
  • Status changed from new to accepted

I was sure that I modified GetLineBefore(0) to return -1 but somehow I forgot to do this :-( Will do, thanks for noticing.

comment:2 Changed 14 months ago by VZ

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [73487]) Fix infinite loop in wxGrid::PosToEdgeOfLine().

Return -1 from wxGridRowOperations::GetLineBefore(0) to ensure that we exit
the loop in wxGrid::PosToEdgeOfLine(). Doing this is the logical thing to do
as wxGridColumnOperations::GetLineBefore() already behaved like this and this
was is more expected than returning 0, as the function previously did for some
reason.

Closes #15035.

Note: See TracTickets for help on using tickets.