[Customdrawn] Rangecheck error

Michael Schnell mschnell at lumino.de
Tue Aug 28 11:46:45 CEST 2012


Hi Custom Drawers.

I deleted and re-downloaded the Lazarus trunk and after this I can't 
even run an empty form any more. It generates the said Rangecheck 
errors, so nothing seems to have been improved on that behalf since March.

.-Michael




On 07/03/2012 12:00 PM, Michael Schnell wrote:
> On 07/03/2012 10:48 AM, Felipe Monteiro de Carvalho wrote:
>> Could you send me a patch? 
> trying to remember which file(s) I modified ..... :-(
> I'll try to look this up. (I'm not yet up to speed with svn but trying 
> :-) ) ...
>
> OK. See below. Not sure which changes in fact did the trick for the 
> form and which were done trying to debug and to get e.g TLable 
> running. And which might be shown due to me not merging and the 
> repository getting changes.
>
> I do remember the Get_Long / Get_ULong issue. Here I definitely found 
> that the types Long and ULong were used in a sloppy way, resulting in 
> a range check condition when an ULong value > $7FFFFFFF is assigned to 
> a signed Long.
>
> Similar with PtrInt vs THandle.
>
> Maybe you want to take a look at my old posts on this in the this 
> forum.....
>
> -Michael
>
>> TTInterp Line 481:
>>     exc.opcode := exc.Code^[exc.IP];
>> In which unit?
> (*******************************************************************
>  *
>  *  TTInterp.pas                                              2.0
>  *
>  *  TrueType bytecode intepreter.
>  *
>
> IFAIR, all these range check problems are due to glitches in these 
> Font related functions that seem to be implemented in a way that 
> relies on range check beeing off. I don't think this is a good idea 
> and I think that these issues should be fixed by using the correct 
> types and/or explicit typecasts when appropriate.
>
> -Michael
>
> svn diff:
> ------------------------------------------------------------------------
> --- components/lazutils/ttload.pas      (revision 37854)
> +++ components/lazutils/ttload.pas      (working copy)
> @@ -56,6 +56,8 @@
>
>  implementation
>
> +{$R-}
> +
>  uses TTError, TTMemory, TTFile;
>
>    (* Composite glyph decoding flags *)
> @@ -248,25 +250,27 @@
>        exit;
>      end;
>
> -    with face^ do
> -    begin
> +//    with face^ do
> +//    begin
>
> -      numTables := tableDir.numTables;
> +      face^.numTables := tableDir.numTables;
>
> -      if Alloc( dirTables, numTables * sizeof( TTableDirEntry ) ) or
> -         TT_Access_Frame( 16 * numTables ) then exit;
> +      if Alloc( face^.dirTables, face^.numTables * sizeof( 
> TTableDirEntry ) ) or
> +         TT_Access_Frame( 16 * face^.numTables ) then exit;
>
> -      for n := 0 to numTables-1 do with dirTables^[n] do
> +      for n := 0 to face^.numTables-1 do
>        begin
> -        Tag        := GET_ULong;
> -        Checksum   := GET_ULong;
> -        Offset     := GET_Long;
> -        Length     := Get_Long;
> +        face^.dirTables^[n].Tag        := GET_ULong;
> +        face^.dirTables^[n].Checksum   := GET_ULong;
> +//        face^.dirTables^[n].Tag        := GET_Long;
> +//        face^.dirTables^[n].Checksum   := GET_Long;
> +        face^.dirTables^[n].Offset     := GET_Long;
> +        face^.dirTables^[n].Length     := Get_Long;
>        end;
>
>        TT_Forget_Frame;
>
> -   end;
> +//   end;
>
>     {$IFDEF FREETYPE_DEBUG} Writeln('loaded'); {$ENDIF}
>
> Index: components/lazutils/lazfreetype.pas
> ===================================================================
> --- components/lazutils/lazfreetype.pas (revision 37854)
> +++ components/lazutils/lazfreetype.pas (working copy)
> @@ -464,6 +464,8 @@
>    TTGLoad,
>    TTRaster;
>
> +{$R-}
> +
> (*****************************************************************)
> (* *)
> (* *)
> Index: components/lazutils/ttobjs.pas
> ===================================================================
> --- components/lazutils/ttobjs.pas      (revision 37854)
> +++ components/lazutils/ttobjs.pas      (working copy)
> @@ -796,6 +796,8 @@
>
>
>
> +{$R-}
> +
>  const
>    objs_face_class     : TCache_Class
>                        = (object_size: sizeof(TFace);
> Index: components/lazutils/ttmemory.pas
> ===================================================================
> --- components/lazutils/ttmemory.pas    (revision 37854)
> +++ components/lazutils/ttmemory.pas    (working copy)
> @@ -64,6 +64,7 @@
>
>  uses TTTypes;
>
> +{$R-}
>  {$I TTCONFIG.INC}
>
>  type
> Index: components/lazutils/ttfile.pas
> ===================================================================
> --- components/lazutils/ttfile.pas      (revision 37854)
> +++ components/lazutils/ttfile.pas      (working copy)
> @@ -48,6 +48,8 @@
>
>  {$I TTCONFIG.INC}
>
> +{$R-}
> +
>  uses TTTypes,
>       TTError;
>
> Index: lcl/interfaces/customdrawn/customdrawndefines.inc
> ===================================================================
> --- lcl/interfaces/customdrawn/customdrawndefines.inc (revision 37854)
> +++ lcl/interfaces/customdrawn/customdrawndefines.inc   (working copy)
> @@ -3,6 +3,12 @@
>  {$modeswitch objectivec1}{$H+}// modeswitch seams to deactivate H+
>  {$endif}
>
> +
> +
> +{$define CD_Debug_TTF}
> +
> +
> +
>  // For now default to Android for arm-linux,
>  // because LCL-CustomDrawn is our main Android widgetset.
>  // Remove this when Android gets it's own target
> Index: lcl/interfaces/fpgui/fpguiobject.inc
> ===================================================================
> --- lcl/interfaces/fpgui/fpguiobject.inc        (revision 37854)
> +++ lcl/interfaces/fpgui/fpguiobject.inc        (working copy)
> @@ -150,7 +150,7 @@
>  begin
>    Timer := TFPGUITimer.Create(Interval, TimerFunc);
>
> -  Result := PtrInt(Timer);
> +  Result := THandle(Timer);
>  end;
>
>  {------------------------------------------------------------------------------
>
>
>
> _______________________________________________
> Customdrawn mailing list
> Customdrawn at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/customdrawn

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/customdrawn/attachments/20120828/a8ff3d3a/attachment-0002.html>


More information about the Customdrawn mailing list