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
0006436 [JEDI VCL] JclGraphics crash always 2015-09-08 09:47 2016-08-03 20:23
Reporter CubicDesign View Status public  
Assigned To AHUser
Priority normal Resolution fixed  
Status resolved   Product Version Version 2.5 (Subversion repository/Daily zips)
Summary 0006436: Crash in JvPaintFX.pas
Description The person that added JanFX library to JEDI removed a {$R-} directive without really understanding what it is doing.
Without this directive the code crashes.
Additional Information The problem is

class procedure TJvPaintFX.Stretch(Src, Dst: TBitmap; Filter: TFilterProc; AWidth: Single);
begin
...
    GetMem(Contrib, DstWidth * SizeOf(TCList));
    // Horizontal sub-sampling
    // Scales from bigger to smaller Width
    {$R-} <------------------ THIS WAS REMOVED!!!!!
    if (xscale < 1.0) then
...
end;


This will explain why that range check should be disabled:
http://stackoverflow.com/questions/628965/delphi-accessing-data-from-dynamic-array-that-is-populated-from-an-untyped-poi [^]
Tags bug, janfx, JvPaintFX, resampler, stretch
Attached Files

- Relationships
duplicate of 0006241resolvedAHUser Range check error in JvPaintFX.pas 

-  Notes
(0021206)
CubicDesign (reporter)
2015-09-14 21:21

To reproduce it, simply call TJvPaintFX.Stretch.
It is amazing that nobody reported this until now.
(0021307)
AHUser (developer)
2016-08-02 19:23

All JVCL files are compiled with $R- (first compiler directive in jvcl.inc). So I don't see how that code could be compiled with $R+ unless you copy that part into your own unit.
(0021309)
CubicDesign (reporter)
2016-08-02 20:00

> are compiled with $R-
That is BAAAAD! During debugging and testing Range Checking should ALWAYS be on.


> unless you copy that part into your own unit
Yes. This is what I do (and I know for sure at least 3 friends that are doing the same). I don't like having the whole Jedi installed because it is too big, so I only use what I need from it.
Any person that will use ONLY that piece of code will have the same problem.


If in the future Jedi will (hopefully) change the R- to R+ that code will fail also in Jedi. So, why deleting that single line of code if it does NO harm when it is there and LOT of harm when is removed?
(0021316)
AHUser (developer)
2016-08-03 17:23

My guess it that the person who integrated TJvPaintFX thought that due to the global $R- that it isn't necessary.


I found some more "array[0..0] of T" type declaration in the JCL/JVCL. The Delphi RTL changed them years ago to "array[0..MaxInt div SizeOf(T) - 1] of T". That's what I'm going to do to fix this.



BTW: Why is TJvPaintFX a component anyway, it should be moved to the JCL and made an abstract class. But I guess it is a bit too late for that, especially with nobody actively working on the JCL/JVCL.
(0021317)
AHUser (developer)
2016-08-03 20:23

Fixed in master branch.

I also moved the JvResample.pas to \archive because all its code is a copy of JvPaintFX (with some style guide changes).

- Issue History
Date Modified Username Field Change
2015-09-08 09:47 CubicDesign New Issue
2015-09-08 09:47 CubicDesign IDE version => Delphi/C++Builder XE3
2015-09-11 16:28 CubicDesign Tag Attached: janfx
2015-09-11 16:28 CubicDesign Tag Attached: resampler
2015-09-11 16:29 CubicDesign Tag Attached: bug
2015-09-11 16:29 CubicDesign Tag Attached: JvPaintFX
2015-09-11 16:29 CubicDesign Tag Attached: stretch
2015-09-14 21:21 CubicDesign Note Added: 0021206
2016-08-02 19:17 AHUser Project JEDI Code Library => JEDI VCL
2016-08-02 19:23 AHUser Note Added: 0021307
2016-08-02 19:23 AHUser Status new => feedback
2016-08-02 20:00 CubicDesign Note Added: 0021309
2016-08-03 17:23 AHUser Note Added: 0021316
2016-08-03 20:23 AHUser Note Added: 0021317
2016-08-03 20:23 AHUser Status feedback => resolved
2016-08-03 20:23 AHUser Fixed in Version => Daily / GIT
2016-08-03 20:23 AHUser Resolution open => fixed
2016-08-03 20:23 AHUser Assigned To => AHUser
2016-08-04 21:17 AHUser Relationship added duplicate of 0006241


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