Welcome to the Builder Academy

Question Crashing on close_socket()

More
05 Apr 2025 04:55 - 08 Apr 2025 04:25 #10647 by Salty
Greetings,

This is the gdb of my crash:
Code:
Reading symbols from bin/circle... [New LWP 211177] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Core was generated by `circle -C3 9000'. Program terminated with signal SIGSEGV, Segmentation fault. Download failed: Invalid argument.  Continuing without source file ./malloc/./malloc/malloc.c. #0  0x00007c0e884add55 in __GI___libc_free (mem=0x18fffb02f50003)     at ./malloc/malloc.c:3375 warning: 3375   ./malloc/malloc.c: No such file or directory (gdb) bt #0  0x00007c0e884add55 in __GI___libc_free (mem=0x18fffb02f50003)     at ./malloc/malloc.c:3375 #1  0x0000601067bbe2ae in close_socket (d=d@entry=0x601080aa18a0)     at comm.c:2368 #2  0x0000601067bbfdef in game_loop (local_mother_desc=3) at comm.c:983 #3  0x0000601067b5d282 in init_game (local_port=<optimized out>) at comm.c:567 #4  main (argc=<optimized out>, argv=<optimized out>) at comm.c:364 (gdb) q

Line #2368 of comm.c is here:
Code:
  /* Clear the command history. */   if (d->history)   {     int cnt;     for (cnt = 0; cnt < HISTORY_SIZE; cnt++)       if (d->history[cnt])         free(d->history[cnt]);  // this is #2368     free(d->history);   }


Are we having problems calling free() without malloc as comm.c doesn't include stdlib.h ?
 
Thanks!
Last edit: 08 Apr 2025 04:25 by Salty.

Please Log in or Create an account to join the conversation.

More
08 Apr 2025 04:24 #10651 by Salty
Replied by Salty on topic Any help?
Looking for some insight. Please help if able.

Please Log in or Create an account to join the conversation.

More
08 Apr 2025 05:36 - 08 Apr 2025 05:46 #10652 by ironfist
Replied by ironfist on topic Any help?
Not sure really, but It is like it got freed or never got set, so it is trying to free something that isn't supposed to be freed.  Did you change anything recently that lead to this?  If the code in general doesn't set a pointer to NULL after it is freed then the if statement won't really stop you from doing a bad free (as far as I know). 

If this is modified tba, I'd compare anything involving history to a default comm.c.

EDIT: btw, the "malloc thing with the source file" means is just that it doesnt have debugging symbols because it is precompiled without them for malloc itself but that really isn't the problem, just that the debugger can't look at its code.

You could have a buffer overflow somewhere too nearby that messes up the memory there.
Last edit: 08 Apr 2025 05:46 by ironfist.

Please Log in or Create an account to join the conversation.

More
08 Apr 2025 21:04 #10655 by thomas
Replied by thomas on topic Crashing on close_socket()
This is actually a rather common place for the mud to crash; I can recall seeing it several places in the forums.
Cunning seems to have a fix here: tbamud.com/forums/2-general/5488-crash-bug-client-app#10104

Apparently, this can happen in some cases when the port is crawled by a web spider.
The following user(s) said Thank You: Salty

Please Log in or Create an account to join the conversation.

Time to create page: 0.505 seconds