I don't think overrunning DICT_SIZE  is a problem, though to be honest,
this is stuff I've never looked at before.  I believe the size you refer to
is the size of a list of lists maintained within the dictionary.  Given a
tag for a dictionary entry (a CRC of the key) it looks like it uses the
lowest bits as an index into the list of lists, to find the list that
should contain the item of interest.   The dictionary contains a variable,
mask, that is size-1 - eg. a mask for the index of the list in the list of
lists (if, as Peter pointed out, size is a power of 2 - this will fail
miserably if a dictionary of size NOT a power of 2 is ever created).  You
can see the mask being used to get the index b at line 393 of d.c.

Let me look into this a bit, see if I can replicate it on our less than
up-to-date SGI box.

Greg

"Alan Ferrenberg" <[EMAIL PROTECTED]>@opendx.watson.ibm.com on 02/22/2000
11:39:21 AM

Please respond to [email protected]

Sent by:  [EMAIL PROTECTED]


To:   <[email protected]>
cc:
Subject:  [opendx-dev] Dictionary overruns




Hi all,

  I think I've found the source of the memory  problems I'm having with the
dictionary routines running on IRIX!  I'm not  sure about how to fix it so
I'm letting the experts know before I spend too much  time trying to fix
it.

The problem seems to be that when elements are  added to a dictionary (in
_dxf_ExDictionaryInsert, src/exec/dpexec/d.c) there's  no check if the
number of items in the dictionary is greater than the  size.  I was writing
out a lot of debugging information and noticed along  the way that a
dictionary of size 64 (created in graph.c) had 82 items in it at  the time
of the crash.  (To clarify:  I wrote out the number of items  and the size
each time something was inserted into any dictionary and watched  the items
variable go past 64.)  This dictionary overrun managed to corrupt  data in
a different dictionary which caused a null string to get passed into
strcmp resulting in the segmentation violation.

I don't know if the solution is as simple as  increasing the DICT_SIZE from
64 to something bigger (probably not a good idea)  or will require checks
in _dxf_ExDictionaryInsert and changes elsewhere.   I'll continue to muddle
around in the code, but any suggestions are very, very  welcome.

*********************************************************************
Alan  M. Ferrenberg ([EMAIL PROTECTED])
Manager, Research  and Computational Science Support
UGA Computing and Networking  Services

Get the latest information from UCNS!   Subscribe to our weekly e-mail
publication "UCNS Weekly News".  For more  information, check out:

http://www.uga.edu/ucns/consult/casnews/

*********************************************************************


Reply via email to