EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Range Errors under FPC/Lazarus

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
#29721
Posted: 06/08/2014 23:05:51
by Erich Kuba (Standard support level)
Joined: 05/16/2013
Posts: 38

Hi there,

I'm getting RangeCheck errors when starting my application;

SBB 11 VCL Edition;
FreePascal 2.6.4
Lazarus 1.2.2
OS Ubuntu Linux 64bit;

I can't run any program compiled in Lazarus that includes SBB code with the $DEBUG compiler directive defined; I get Run Error (201) and then an ERangeError in SBSHA2.pas at line 219; This does not happen for code compiled under Delphi.

I posted a simple sample project below that causes the error; Please note that this error only occurs when $DEBUG is defined in compiler options (i.e. Project -> Project Options -> Compiler Options -> Other -> Defines -> DEBUG)

Code
unit fmMain;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, SBUtils;

type
  TForm1 = class(TForm)
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

end.      


Any advice would be appreciated;

Kind regards

Erich
#29723
Posted: 06/09/2014 01:17:59
by Eugene Mayevski (EldoS Corp.)

Range checks must be disabled - the code won't work otherwise (we have a bunch of casts in the code that would cause range error). So the checks are disabled in secbbox.inc for VCL edition.

If FPC doesn't respect the setting for whatever reason, please contact FPC support.


Sincerely yours
Eugene Mayevski
#29724
Posted: 06/09/2014 01:31:36
by Eugene Mayevski (EldoS Corp.)

Ok, wrote first, thought second ... The options in secbbox.inc are not set in case of FPC, hence the problem.

You need to add {$R-} to the end of secbbox.inc or disable range checks globally in your application.


Sincerely yours
Eugene Mayevski
#29725
Posted: 06/09/2014 02:27:19
by Erich Kuba (Standard support level)
Joined: 05/16/2013
Posts: 38

Thanks Eugene ... that worked;

Can you guys please update secbbox.inc with this change;

Kind regards

Erich
#29726
Posted: 06/09/2014 02:29:28
by Eugene Mayevski (EldoS Corp.)

Of course, if we recommend some change, we also make one in our code.


Sincerely yours
Eugene Mayevski
#29727
Posted: 06/09/2014 03:04:30
by Erich Kuba (Standard support level)
Joined: 05/16/2013
Posts: 38

Thanks Eugene,

I've just compiled under Linux32 as well, and it needs a {$Q-} in secbbox.inc

Kind regards

Erich
Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages

Reply

Statistics

Topic viewed 985 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!