#64 ncea crashes on netcdf files with no record dimension

closed-fixed
None
5
2013-01-14
2013-01-14
Martin Otte
No

Ncea crashes with a seg-fault when operating on netcdf files without a record dimension. I am using nco version 4.2.3. The crashes occur at 2 places in ncra.c, near line 791 and near line 1032, because the lmt_rec structure is being accessed even though it is not available when operating on files without a record dimension. I fixed the crash for my use by enclosing the offending code in a if(rec_dmn_id != NCO_REC_DMN_UNDEFINED) block so that lmt_rec is never accessed if there is no record dimension. I have attached the patch I used to fix the problem.

Discussion

  • Martin Otte
    Martin Otte
    2013-01-14

    Patch to fix ncea seg-fault

     
    Attachments
  • Charlie Zender
    Charlie Zender
    2013-01-14

    Thank you for this bug report. I have reproduced the problem you describe and I will try to fix with your patch. Unfortunately we never tested ncea on files without a record variable. This is good timing for the report as we are getting ready to release 4.2.4 which will contain a fix for this problem. Happy NCOing.
    cz

     
  • Charlie Zender
    Charlie Zender
    2013-01-14

    • assigned_to: nobody --> zender
    • status: open --> open-fixed
     
  • Charlie Zender
    Charlie Zender
    2013-01-14

    A patch very similar to yours has been applied to fix the problem. Thanks again. Will be in 4.2.4.
    For future reference, a simple regression test for this is:
    ncks -O -v one ~/nco/data/in.nc ~/foo.nc
    ncea -O -p ~ foo.nc foo.nc foo2.nc
    cz

     
  • Charlie Zender
    Charlie Zender
    2013-01-14

    • status: open-fixed --> closed-fixed