Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0006595 [JEDI VCL] 00 JVCL Components block random 2017-09-08 13:28 2018-10-28 17:26
Reporter vaniusrb View Status public  
Assigned To
Priority normal Resolution open  
Status feedback   Product Version Daily / GIT
Summary 0006595: TJvTFDays testing wrong integer object typecast test
Description Function TJvTFApptMap.HasAppt was testing if FData has object with ">0"
instead "<> 0". Object with integer typecast can returns negative values
(it happened with Delphi 10.2 Tokyo build, causing infinity loop)

This line
      if Test > 0 then

must be
      if Test <> 0 then
Additional Information
Tags No tags attached.
Attached Files

- Relationships

-  Notes
obones (administrator)
2018-07-18 16:00

Could you check if the issue is still present in the latest GIT content? If yes, please provide the zipped sources of an application showing this.
mh (reporter)
2018-10-28 17:26

That code line is still there and Test is a NativeInt var so it could get negative:

function TJvTFApptMap.HasAppt(Appt: TJvTFAppt): Boolean;
  MapRow, MapCol, StartRow, EndRow, ApptsExamined: Integer;
  Test: NativeInt;
  ApptGrid: TJvTFDays;
  FGridCol.CalcStartEndRows(Appt, StartRow, EndRow);

  StartRow := Greater(StartRow, 0);

  ApptGrid := FGridCol.ColCollection.ApptGrid;
  if Assigned(ApptGrid) then
    EndRow := Lesser(EndRow, ApptGrid.RowCount - 1)
    EndRow := Lesser(EndRow, FGridCol.ColCollection.Printer.RowCount - 1);

  MapRow := 0;
  Result := False;
  while (MapRow <= EndRow) and not Result do
    MapCol := 1;
    ApptsExamined := 0;
    while (ApptsExamined < FData[MapRow, -1]) and not Result do
      Test := FData[MapRow, MapCol];
      if Test > 0 then
        if Test = NativeInt(Appt) then
          Result := True;



The FData var is a sparse mag which contains NativeInt values so they could get negative. I don't know this component, but I guess the author of this report is right about changing the comparison as otherwise the while loop could really become an endless loop!

- Issue History
Date Modified Username Field Change
2017-09-08 13:28 vaniusrb New Issue
2018-07-18 16:00 obones Note Added: 0021538
2018-07-18 16:00 obones Status new => feedback
2018-10-28 17:26 mh Note Added: 0021585

Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker