[Met_help] possible error in METv1.1

John Halley Gotway johnhg at rap.ucar.edu
Wed Aug 20 11:46:40 MDT 2008


Matt,

I'd like to find out more info about your system.  In particular, what's the size of a "char".  I've attached a simple test program that will dump out the sizes and alignments of basic types.  Please
do the following:

(1) Compile the attached test program with a C++ compiler:
g++ test_program.cc -o test_program

(2) Run the test program and send the output to a file:
./test_program > test.out

(3) Send me a copy of the "test.out" file.

I've been talking to another engineer here about this, and hopefully this info will help us figure out what's going on.

Thanks,
John

mclark at face.aero.org wrote:
>> Matt,
>>
>> I looked through the vx_met_util library and added a print statement to
>> the "get_column_format()" to dump the length of the "fmt_str".  The length
>> of the "fmt_str" variable varies depending on the
>> line type, but here are the values I found: 35, 41, 47, 53, 65, 365, 371,
>> 437
>>
>> And all of them are under 512 (max_str_len).  Perhaps something else is
>> going on here.  I notice that 730 is exactly 2 * 365, which is one of the
>> sting lengths I encountered.
>>
>> Can you tell me what OS you're running MET on?
>>
>> Thanks,
>> John Halley-Gotway
>> johnhg at ucar.edu
>>
>> J Matt Clark wrote:
>>> Sirs:
>>>
>>> I have installed and run METv1.1, and discovered a possible error in the
>>> grid_stat function,
>>> Reference ./lib/vx_met_util:
>>>
>>> In vsdb_columns.cc,  fimction get_column_format is called to build
>>> fmt_str, which is defined
>>>
>>> char fmt_str[max_str_len];
>>>
>>> and max_str_len is defined in constants.h:
>>>
>>> static const int max_str_len  = 512;
>>>
>>> However, get_column_format appears to pack 730 or so characters into
>>> char_fmt_str - which overflows and
>>> eventually causes a seg fault.
>>>
>>> Tnx,
>>>
>>> Matt
>>> _______________________________________________
>>> Met_help mailing list
>>> Met_help at mailman.ucar.edu
>>> http://mailman.ucar.edu/mailman/listinfo/met_help
>>
> John,
> 
> Looking further into the problem, it appears that grid_stat is getting its
> Segfault at line 1067 of vsdb_columns.cc - possibly because the space
> allocated for fmt_str and/or str is too small.  I (arbitrarily) increased
> max_str_len to 4096 - and got a bit further - grid_stat code now segfaults
> at line 1534.
> 
> This is for the case GRID_STAT using Grib forecast and netCDF observation
> 
> And of course I'm using a pretty odd system - gfortran and g++ on a Mac
> cluster.
> 
> Tnx,
> Matt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_program.cc
Type: text/x-c++src
Size: 5526 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/met_help/attachments/20080820/2431344c/test_program.bin


More information about the Met_help mailing list