Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup function causes crashes #1

Closed
TylersGit opened this issue Apr 24, 2024 · 1 comment
Closed

Cleanup function causes crashes #1

TylersGit opened this issue Apr 24, 2024 · 1 comment
Assignees

Comments

@TylersGit
Copy link
Owner

(gdb) run
Starting program: /root/exercise26/./ex26
String: /var/log/messages

String: /var/log/messages.1

String: /var/log/messages.2

*** Error in `/root/exercise26/./ex26': corrupted size vs. prev_size: 0x0000000000602240 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x7f474)[0x7ffff7a8c474]
/lib64/libc.so.6(+0x8156b)[0x7ffff7a8e56b]
/root/exercise26/./ex26[0x400870]
/root/exercise26/./ex26[0x400a69]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7ffff7a2f555]
/root/exercise26/./ex26[0x4006f9]
======= Memory map: ========
00400000-00401000 r-xp 00000000 fd:00 23006 /root/exercise26/ex26
00600000-00601000 r--p 00000000 fd:00 23006 /root/exercise26/ex26
00601000-00602000 rw-p 00001000 fd:00 23006 /root/exercise26/ex26
00602000-00623000 rw-p 00000000 00:00 0 [heap]
7ffff0000000-7ffff0021000 rw-p 00000000 00:00 0
7ffff0021000-7ffff4000000 ---p 00000000 00:00 0
7ffff77f7000-7ffff780c000 r-xp 00000000 fd:00 34397554 /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7ffff780c000-7ffff7a0b000 ---p 00015000 fd:00 34397554 /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7ffff7a0b000-7ffff7a0c000 r--p 00014000 fd:00 34397554 /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7ffff7a0c000-7ffff7a0d000 rw-p 00015000 fd:00 34397554 /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7ffff7a0d000-7ffff7bd1000 r-xp 00000000 fd:00 33589089 /usr/lib64/libc-2.17.so
7ffff7bd1000-7ffff7dd0000 ---p 001c4000 fd:00 33589089 /usr/lib64/libc-2.17.so
7ffff7dd0000-7ffff7dd4000 r--p 001c3000 fd:00 33589089 /usr/lib64/libc-2.17.so
7ffff7dd4000-7ffff7dd6000 rw-p 001c7000 fd:00 33589089 /usr/lib64/libc-2.17.so
7ffff7dd6000-7ffff7ddb000 rw-p 00000000 00:00 0
7ffff7ddb000-7ffff7dfd000 r-xp 00000000 fd:00 33589081 /usr/lib64/ld-2.17.so
7ffff7fef000-7ffff7ff2000 rw-p 00000000 00:00 0
7ffff7ff6000-7ffff7ffa000 rw-p 00000000 00:00 0
7ffff7ffa000-7ffff7ffc000 r-xp 00000000 00:00 0 [vdso]
7ffff7ffc000-7ffff7ffd000 r--p 00021000 fd:00 33589081 /usr/lib64/ld-2.17.so
7ffff7ffd000-7ffff7ffe000 rw-p 00022000 fd:00 33589081 /usr/lib64/ld-2.17.so
7ffff7ffe000-7ffff7fff000 rw-p 00000000 00:00 0
7ffffffde000-7ffffffff000 rw-p 00000000 00:00 0 [stack]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]

Program received signal SIGABRT, Aborted.
0x00007ffff7a43387 in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install glibc-2.17-325.el7_9.x86_64 libgcc-4.8.5-44.el7.x86_64
(gdb) bt
#0 0x00007ffff7a43387 in raise () from /lib64/libc.so.6
#1 0x00007ffff7a44a78 in abort () from /lib64/libc.so.6
#2 0x00007ffff7a85f67 in __libc_message () from /lib64/libc.so.6
#3 0x00007ffff7a8c474 in malloc_printerr () from /lib64/libc.so.6
#4 0x00007ffff7a8e56b in _int_free () from /lib64/libc.so.6
#5 0x0000000000400870 in cleanup (logfind_dot_file=0x602010, file_list=0x602250) at ex26.c:39
#6 0x0000000000400a69 in main (argc=1, argv=0x7fffffffe088) at ex26.c:66
(gdb)

@TylersGit TylersGit self-assigned this Apr 24, 2024
@TylersGit
Copy link
Owner Author

Solved in side branch by fixing the invalid writes in the read function, and improving the cleanup function overall.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant