embedded mySQL SAFEMALLOC

embedded mySQL SAFEMALLOC

am 18.06.2002 13:21:19 von Yuri Alexandrov

Hi,
Just found problem within mySQL embedded library.

How-To-Repeat: Latest 4.0.1 sources, compiled under Win2K, VS 6.0, SP
5 + Processor Pack installed. Sources built on Debug configuration.

As far as I could see from source code, safe malloc's functions
reserve first 18 bytes for internal information and returns pointer to
allocated memory + 18 bytes. But, at some functions, it still
uses normal free(ptr) system call instead of overloaded which takes this
address directly so the software crashes, because no block with this
address is allocated in HEAP...

Solution for this (at least what I found),
either remove SAFEMALLOC define from project and rebuild DEBUGor use
just release version, which not always a good solution because of
mixed runtime.

Best regards,
Yuri Alexandrov
yura@csd.ru


------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail bugs-thread12121@lists.mysql.com
To unsubscribe, e-mail

embedded mySQL SAFEMALLOC

am 19.06.2002 11:43:31 von Michael Widenius

hi!

>>>>> "Yuri" == Yuri Alexandrov writes:

Yuri> Hi,
Yuri> Just found problem within mySQL embedded library.

Yuri> How-To-Repeat: Latest 4.0.1 sources, compiled under Win2K, VS 6.0, SP
Yuri> 5 + Processor Pack installed. Sources built on Debug configuration.

Yuri> As far as I could see from source code, safe malloc's functions
Yuri> reserve first 18 bytes for internal information and returns pointer to
Yuri> allocated memory + 18 bytes. But, at some functions, it still
Yuri> uses normal free(ptr) system call instead of overloaded which takes this
Yuri> address directly so the software crashes, because no block with this
Yuri> address is allocated in HEAP...

There should be no instances where free() is called for memory
allocated by safe_malloc(). If this happens there is a bug in the
free call and has to be fixed.

Can you please tell us where this happens ?

It's rather strange that this happens as I am sure I tested this
compiled with safemalloc before doing the 4.0.1 release.
(But of course, our test suite is not yet perfect and I may have
missed something).

Regards,
Monty

------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail bugs-thread12124@lists.mysql.com
To unsubscribe, e-mail

Re: embedded mySQL SAFEMALLOC

am 21.06.2002 09:23:09 von Holyfoot

Hello.

>How-To-Repeat: Latest 4.0.1 sources, compiled under Win2K, VS 6.0, SP
>5 + Processor Pack installed. Sources built on Debug configuration.

>Solution for this (at least what I found),
>either remove SAFEMALLOC define from project and rebuild DEBUGor use
>just release version, which not always a good solution because of
>mixed runtime.

Better solution would be to add SAFEMALLOC define to the libmysqld project
for Debug mode.
I think we just miss this define.

Thanks for reporting.
A.



------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail bugs-thread12126@lists.mysql.com
To unsubscribe, e-mail