[NeXus-code-tickets] [NeXusCode] #143: rank not set properly by analyzeDim

NeXus Data Format Library and Applications noreply at nexusformat.org
Sun Dec 14 21:08:52 GMT 2008


#143: rank not set properly by analyzeDim
-----------------------------+----------------------------------------------
 Reporter:  Freddie Akeroyd  |       Owner:  Freddie Akeroyd  
     Type:  defect           |      Status:  new              
 Priority:  major            |   Milestone:  NeXus 4.2 Release
Component:  napi             |     Version:  4.2rc2           
 Keywords:                   |  
-----------------------------+----------------------------------------------
 From http://lists.nexusformat.org/pipermail/nexus/2008/000310.html

 I just upgraded some of my software to use NAPI 4.1.0.  I wanted to try
 and convert some of my HDF4 files to XML to see if XML is viable now.  I
 ran into a problem.

 I read in an old HDF4 file that was generated with NAPI.  When I try and
 write the same file out with XML, the program crashes.  The program
 crashes at the line:

 555>           memcpy(pPtr,data,dim[0]);

 becuase dim[0] is some random huge number.  It appears that the previous
 call to NXXgetinfo which should have returned the proper dim size for
 the data fails at a subcall to analyzeDim when there is a character data
 field with only 1 character in it.  If the character field has more than
 one character, the typeString passed to analyzeDim looks like
 "NX_CHAR[x>1]" but if there is a single character, the typeString passed
 looks like "NX_CHAR" which causes analyzeDim to enter a switch statement
 based on the variable type--which is undefined in this case.

 I could fix the problem by changing the order of lines 638-641 in
 nxxml.c from

 638>      analyzeDim(attr,rank,dimension,iType);
 639>      *rank = 1;
 640>       *iType = NX_CHAR;

 to

 638>      *rank = 1;
 639>       *iType = NX_CHAR;
 640>      analyzeDim(attr,rank,dimension,iType);

 so that type would be appropriately defined in analyzeDim.

 Not sure this is the right thing to do, but it got me past that problem
 and on to another one :)

 Brian

-- 
Ticket URL: <http://trac.nexusformat.org/code/ticket/143>
NeXus Data Format Library and Applications <http://www.nexusformat.org/>
NeXus Data Format Library and Applications



More information about the NeXus-code-tickets mailing list