RE: Win32lib

new topic     » topic index » view thread      » older message » newer message

Jess Harpur wrote:

> Line 1620 contains an error which results in SIZEOF_MSG being two bytes 
> too few. Consequently acquire_mem(0, SIZEOF_MSG) grabs less memory than 
> required and calls to GetMessage write past the end of the allocated 
> memory with unpredictable results. If this has been fixed in a later 
> version of the library then "good on yer" ;)

Oooh, that's spooky.  I just found this one myself yesterday, although 
two attempts to post a message about it have dissappeared, so I'm 
posting this from the web.  Here's what I had to say:

-----Original Message-----
From: Matthew Lewis 

I think I've finally figured out what's wrong in EuCOM.  I've found 
several bugs in EuCOM (again, improperly declared structures), and fixed 
them.  I *think* that's what the problem has been--BoundsChecker says no 
more memory problems (well, there are a few leaks, but that's a 
different issue).  However, I also found a bug in Win32Lib, that looks 
like it goes back to v.41.

The MSG structure is defined incorrectly.  The second member, msg, was 
declared as an Integer, which to Win32Lib is the same as a Word, or 
16-bits.  In fact, msg should be a UINT, a 32-bit number.  This could 
account for some crashes occuring when a Win32Lib app closes.

It seems that dlls and such can sometimes write past the bounds of 
memory allocated by Eu without problem, until that memory is freed--then 
it all crashes and burns.  Or something like that.

I tracked this down by writing a DLL in VC++ that wrapped malloc and 
free, and compiled in debug mode.  It caught several things that might 
have gone unnoticed.  Thanks also go to Euman for his help, and Thomas, 
as well.

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu