12 Apr, 2009, Lancsta wrote in the 1st comment:
Votes: 0
(gdb) bt
#0 fwrite_obj (ch=0x15634f4, obj=0x156626c, fp=0x18808bc, iNest=0) at pfile.c:761
#1 0x000a7d4c in fwrite_obj (ch=0x15634f4, obj=0x1566318, fp=0x18808bc, iNest=0) at pfile.c:637
#2 0x000a7d4c in fwrite_obj (ch=0x15634f4, obj=0x15663c4, fp=0x18808bc, iNest=0) at pfile.c:637
#3 0x000a7d4c in fwrite_obj (ch=0x15634f4, obj=0x1566470, fp=0x18808bc, iNest=0) at pfile.c:637
#4 0x000a7d4c in fwrite_obj (ch=0x15634f4, obj=0x156651c, fp=0x18808bc, iNest=0) at pfile.c:637
#5 0x000a7d4c in fwrite_obj (ch=0x15634f4, obj=0x15665c8, fp=0x18808bc, iNest=0) at pfile.c:637
#6 0x000a7d4c in fwrite_obj (ch=0x15634f4, obj=0x1566674, fp=0x18808bc, iNest=0) at pfile.c:637
#7 0x000a7d4c in fwrite_obj (ch=0x15634f4, obj=0x1566720, fp=0x18808bc, iNest=0) at pfile.c:637
#8 0x000a7d4c in fwrite_obj (ch=0x15634f4, obj=0x15667cc, fp=0x18808bc, iNest=0) at pfile.c:637
#9 0x000a7d4c in fwrite_obj (ch=0x15634f4, obj=0x1566878, fp=0x18808bc, iNest=0) at pfile.c:637
#10 0x000a7d4c in fwrite_obj (ch=0x15634f4, obj=0x1566924, fp=0x18808bc, iNest=0) at pfile.c:637
#11 0x000a7d4c in fwrite_obj (ch=0x15634f4, obj=0x15669d0, fp=0x18808bc, iNest=0) at pfile.c:637
#12 0x000a7d4c in fwrite_obj (ch=0x15634f4, obj=0x1566a7c, fp=0x18808bc, iNest=0) at pfile.c:637
#13 0x000a7d4c in fwrite_obj (ch=0x15634f4, obj=0x1566b28, fp=0x18808bc, iNest=0) at pfile.c:637
#14 0x000a7d4c in fwrite_obj (ch=0x15634f4, obj=0x1566bd4, fp=0x18808bc, iNest=0) at pfile.c:637
#15 0x000a7d4c in fwrite_obj (ch=0x15634f4, obj=0x1566c80, fp=0x18808bc, iNest=0) at pfile.c:637
#16 0x000a7d4c in fwrite_obj (ch=0x15634f4, obj=0x1566d2c, fp=0x18808bc, iNest=0) at pfile.c:637
#17 0x000a7d4c in fwrite_obj (ch=0x15634f4, obj=0x1566dd8, fp=0x18808bc, iNest=0) at pfile.c:637
#18 0x000a7d4c in fwrite_obj (ch=0x15634f4, obj=0x15685d0, fp=0x18808bc, iNest=0) at pfile.c:637
#19 0x000a7d4c in fwrite_obj (ch=0x15634f4, obj=0x15686ac, fp=0x18808bc, iNest=0) at pfile.c:637
#20 0x000a9cf8 in save_char_obj (ch=0x15634f4) at pfile.c:120
#21 0x000d6790 in char_update () at update.c:1461
#22 0x000d75a8 in update_handler () at update.c:2045
#23 0x00048560 in game_loop_unix (mud_desc=5) at comm.c:538
#24 0x00048a64 in main (argc=1280016, argv=0x240ca0) at comm.c:295

(gdb) print iNest
$7 = 0
(gdb) print *iNest
Cannot access memory at address 0x0
(gdb) print *obj
$8 = {
next = 0x15661c0,
next_content = 0x15661c0,
contains = 0x0,
in_obj = 0x0,
on = 0x0,
carried_by = 0x15634f4,
reset = 0x0,
extra_descr = 0x800,
affected = 0x0,
pIndexData = 0x12072f8,
in_room = 0x0,
oprog_target = 0x0,
oprog_delay = 0,
enchanted = 0 '\0',
owner = 0x0,
killer = 0x0,
name = 0x21e30c0 "golden garnet hoops",
short_descr = 0x21e30dc "{ya pair of {Ygo{yl{Yden {rga{Rr{rnet {Yho{yo{Yps{x",
description = 0x23da9cc "ARE TO MEET DEATH $n!{x\n\rmob cast 'plague' $n\n\rBreak\n\rElse\n\rsay {YPREPARE TO MEET DEATH $n!{x\n\rmob cast 'confusion' $n\n\rEndif\n\rEndif\n\rEndif\n\rEndif\n\r",
serialnum = 256,
item_type = 17177,
extra_flags = 268583361,
restrict_flags = 0,
wear_flags = 262145,
vflags = 4,
wear_loc = 21,
weight = 1,
cost = 2525,
level = 101,
condition = 100,
material = 4,
size = 1,
timer = 0,
value = {23, 23, 23, 20, 0},
valueorig = {23, 23, 23, 20, 0},
origin = 0x0,
exp = 0,
plevel = 0,
xp_tolevel = 0
}

(gdb) print fp
$9 = (FILE *) 0x18808bc
(gdb) print *fp
$10 = {
_p = 0x1802e88 "RPPnts 815\nQuestHit 40\nQuestPnts 380\nQuestErnd 9805\nSec 0\nRecall 2093\nHome\t 2093\nSpeaking common~\nClrank 5\nPlyd 1072292\nBrating -16\nClan Shadows~\nMrate 94499\nPkwin 8\nPkloss 9\nMwin 2439\nMloss 49\nAwin "…,
_r = 0,
_w = 3960,
_flags = 1160,
_file = 126,
_bf = {
_base = 0x1802e00 "dif\n\rEndif\n\rEndif\n\r~\nExtF 268583361\nItyp 17177\nWear 21\nLev 101\nCost 2525\nSerial 256\nCond 100\nVal 23 23 23 20 0\nValOrig 23 23 23 20 0\nRPPnts 815\nQuestHit 40\nQuestPnts 380\nQuestErnd 9805\nSec 0\nRecal"…,
_size = 4096
},
_lbfsize = 0,
_cookie = 0x18808bc,
_close = 0x90015978 <__sclose>,
_read = 0x9001ad80 <__sread>,
_seek = 0x9001a970 <__sseek>,
_write = 0x90015968 <__swrite>,
_ub = {
_base = 0x0,
_size = 0
},
_extra = 0x1880cf4,
_ur = 0,
_ubuf = "\000\000",
_nbuf = "",
_lb = {
_base = 0x0,
_size = 0
},
_blksize = 4096,
_offset = 0
}
636          if (obj->next_content != NULL && ( ch !=NULL || iNest !=0 ) )
637 fwrite_obj (ch, obj->next_content, fp, iNest);

That's the part in fwrite_obj. Before last night, it didn't check for "ch!=NULL" and "iNest !=0"
12 Apr, 2009, Davion wrote in the 2nd comment:
Votes: 0
What's line 761 of pfile.c
12 Apr, 2009, Lancsta wrote in the 3rd comment:
Votes: 0
Davion said:
What's line 761 of pfile.c


for (ed = obj->extra_descr; ed != NULL; ed = ed->next)
{
761 fprintf (fp, "ExDe %s~ %s~\n", ed->keyword, ed->description);
}
12 Apr, 2009, Sharmair wrote in the 4th comment:
Votes: 0
Your gdb print of *obj said:
extra_descr = 0x800,

This seems to be an odd value to have as a pointer to dynamic memory. Not only is
it way out of the range other data is, but it also is a very round (in binary terms)
value of 2048. I would look to see how this value came to be here (is the code
storing something like MAX_STRING_LENGTH or some other int constant instead of
the EXTRA_DESC_DATA pointer?). If this is out of range (and I am very sure it is),
this would cause a crash like you are having on the line you are having it.

Also, though I don't think it is a problem:
Lancsta said:
636          if (obj->next_content != NULL && ( ch !=NULL || iNest !=0 ) )
637 fwrite_obj (ch, obj->next_content, fp, iNest);

That's the part in fwrite_obj. Before last night, it didn't check for "ch!=NULL" and "iNest !=0"

Why would you bother checking ch here? If ch is already used to get the objects carried list
it can't be NULL and though harmless is basically a do nothing check. If it does happen to be
NULL here, you have problems (bad linked lists or program logic) that should be fixed (not
just covered up).
12 Apr, 2009, Lancsta wrote in the 5th comment:
Votes: 0
I didn't think it was right either to have the check in there either. I was browsing through other codebases and comparing, thinking maybe someone else had the same issue. I totally agree with you and try to practice fixing things rather than covering up. And I think that's what I'm finding lately mostly anyhow are "cover ups" gone bad instead of repairs.
As far as pulling 2048 I'm not sure. This is all I have for it.
/sunder2.1/src Tyr$ grep -in "2048" *.h
merc.h:368:# define L 2048
/sunder2.1/src Tyr$ grep -in "2048" *.c
comm.c:1707: nBlock = UMIN( length - iStart, 2048 );
db.c:324: 4, 8, 16, 32, 64, 128, 256, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288 - 64
hunt.c:317: init_hash_table( &x_room, sizeof(int), 2048 );


Thanks for your help. I'll start reading some of these player files that have logged and see what's going on.
0.0/5