[fpc-devel] SYSUTILS UTF8String Memory Bug

mark diener rpzrpzrpz at gmail.com
Sun Aug 10 22:17:53 CEST 2014


Jonas:

I am working on the heaptrc and DrMemory analysis today.

Switching to range checks (-CRr) begins a new round of code changing to
handle compile errors as shown by example below.

How would you begin to clean up the code so that range checks

Your response appreciated,

Marco


************************************

For example:

Compile Error Message:

C:\pdev\rpzlib\rpzopsyswin32.pas(46,37) Error: range check error while
evaluating constants

Offending code:

nres := ioctlsocket(socket,FIONBIO, at nblock) ;

So my FIONBIO constant is triggering a compile time error.

>From winsock2.pas:

const
  FIONBIO      = ULONG(IOC_IN or { set/clear non-blocking i/o }
    ((Longint(SizeOf(Longint)) and IOCPARM_MASK) shl 16) or
    (Longint(Byte('f')) shl 8) or 126);

function ioctlsocket( const s: TSocket; cmd: Longint; argp: pu_long ):
Longint; stdcall;external WINSOCK2_DLL name 'ioctlsocket';






On Sat, Aug 9, 2014 at 3:34 PM, Jonas Maebe <jonas.maebe at elis.ugent.be>
wrote:

> On 09/08/14 20:06, mark diener wrote:
>
>> So with the memory manager changed out, the exception now occurs in the
>> GUI main thread instead of the TThread and clearly the
>> fpc_ansistr_decr_ref function is failing.
>>
>> The lines in question in .\include\application.inc:1079 are as follows:
>>
>>        // call event
>>        Event(Data);
>>
>> This Event variable is a pointer to a function with a single pointer to
>> integer argument.
>>
>> Anybody got some ideas about this?
>>
>
> Your program probably contains a memory corruption bug that messes up the
> heap state. To find it, you can try enabling range and class type checking
> (-CRr) and enabling heaptrc (-gh), or using the C memory manager and
> running the program through Dr Memory (http://www.drmemory.org )
>
>
> Jonas
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20140810/3558ad70/attachment.html>


More information about the fpc-devel mailing list