mfunyu / malloc

Find out the workings behind optimum memory management and recode it, as well as free and realloc.
2 stars 0 forks source link

[segfault] heap infinit loop with wrong chunk size #25

Closed mfunyu closed 8 months ago

mfunyu commented 8 months ago
$> make correction FILENAME="test11.c" 
$> MallocShowAbbr=1 LD_PRELOAD=./libft_malloc.so LD_LIBRARY_PATH=. ./correction 10000 2> f
~~~
<< 1901 >>
free : 0x7feca2c573e8
free : 35
free : 0x7feca38b3780
free : 36
<< 1902 >>
free : 0x7feca2408eb8
free : 35
[1]    63904 segmentation fault (core dumped)  LD_PRELOAD=./libft_malloc.so LD_LIBRARY_PATH=. ./correction 10000
==================++==========================+
 0x7f11fc9f1ab8   ||     1008 (    0x3f8) |A|P| size
------------------++--------------------------+
 0x7f11fc9f1ac0   ||                          | mem
==================++==========================+
 0x7f11fc9f1eb0   ||     1944 (    0x7a0) |A|P| size
------------------++--------------------------+
 0x7f11fc9f1eb8   || ���                   | mem
==================++==========================+
 0x7f11fc9f2648   ||                    0x7a0 | prev_size
------------------++--------------------------+
 0x7f11fc9f2650   ||       -8 (      0x0) |-|-| size
------------------++--------------------------+
 0x7f11fc9f2658   ||                    0x7b0 | fd
------------------++--------------------------+
 0x7f11fc9f2660   ||                    0x3a8 | bk
==================++==========================+
 0x7f11fc9f2648   ||                    0x7a0 | prev_size
------------------++--------------------------+
 0x7f11fc9f2650   ||       -8 (      0x0) |-|-| size
------------------++--------------------------+
 0x7f11fc9f2658   ||                    0x7b0 | fd
------------------++--------------------------+
 0x7f11fc9f2660   ||                    0x3a8 | bk
==================++==========================+
 0x7f11fc9f2648   ||                    0x7a0 | prev_size
------------------++--------------------------+
 0x7f11fc9f2650   ||       -8 (      0x0) |-|-| size
------------------++--------------------------+
 0x7f11fc9f2658   ||                    0x7b0 | fd
------------------++--------------------------+
 0x7f11fc9f2660   ||                    0x3a8 | bk