NOAA-EMC / NCEPLIBS-g2c

This library contains C decoder/encoder routines for GRIB edition 2.
Other
18 stars 11 forks source link

Is this a bug in g2c_compare.c? #515

Closed DusanJovic-NOAA closed 3 weeks ago

DusanJovic-NOAA commented 2 months ago

In this section in g2c_compare.c:

 69     /* Open the two files. */
 70     g2c_set_log_level(10);
 71     if ((ret = g2c_open(path[0], G2C_NOWRITE, &g2cid0)))
 72         return ret;
 73     if ((ret = g2c_open(path[0], G2C_NOWRITE, &g2cid1)))
 74         return ret;

shouldn't the second file use path[1] instead of path[0]?

DusanJovic-NOAA commented 2 months ago
$ ../NCEPLIBS-g2c/install/bin/g2c_compare
Segmentation fault (core dumped)

Running the program with no command line arguments should not segfault, it should print some kind of help/usage info.

edwardhartnett commented 1 month ago

Uggg! What a dumb bug.

I've fixed it in #530

Thanks @DusanJovic-NOAA for catching this!