View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0006595 | JEDI VCL | 00 JVCL Components | public | 2017-09-08 13:28 | 2019-03-11 17:02 |
Reporter | vaniusrb | Assigned To | obones | ||
Priority | normal | Severity | block | Reproducibility | random |
Status | resolved | Resolution | fixed | ||
Product Version | Daily / GIT | ||||
Target Version | Fixed in 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 | ||||
Tags | No tags attached. | ||||
|
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. |
|
That code line is still there and Test is a NativeInt var so it could get negative: function TJvTFApptMap.HasAppt(Appt: TJvTFAppt): Boolean; var MapRow, MapCol, StartRow, EndRow, ApptsExamined: Integer; Test: NativeInt; ApptGrid: TJvTFDays; begin FGridCol.CalcStartEndRows(Appt, StartRow, EndRow); StartRow := Greater(StartRow, 0); ApptGrid := FGridCol.ColCollection.ApptGrid; if Assigned(ApptGrid) then EndRow := Lesser(EndRow, ApptGrid.RowCount - 1) else EndRow := Lesser(EndRow, FGridCol.ColCollection.Printer.RowCount - 1); MapRow := 0; Result := False; while (MapRow <= EndRow) and not Result do begin MapCol := 1; ApptsExamined := 0; while (ApptsExamined < FData[MapRow, -1]) and not Result do begin Test := FData[MapRow, MapCol]; if Test > 0 then begin Inc(ApptsExamined); if Test = NativeInt(Appt) then Result := True; end; Inc(MapCol); end; Inc(MapRow); end; end; 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! |
|
I made your small change from if Test > 0 then to if Test <> 0 then in a branch and created this pull request for it: https://github.com/project-jedi/jvcl/pull/60 Hopefully it will get included soon. |
|
Replaced the pull request with this one, as my old one contained unrelated modifications as well (Git is still new for me): https://github.com/project-jedi/jvcl/pull/66 |
|
Thanks, this is now merged in GIT |
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 | |
2019-03-07 21:16 | mh | Note Added: 0021617 | |
2019-03-10 10:42 | mh | Note Added: 0021629 | |
2019-03-11 17:02 | obones | Note Added: 0021631 | |
2019-03-11 17:02 | obones | Status | feedback => resolved |
2019-03-11 17:02 | obones | Fixed in Version | => Daily / GIT |
2019-03-11 17:02 | obones | Resolution | open => fixed |
2019-03-11 17:02 | obones | Assigned To | => obones |