Skip to content

rd_grid_alloc_mapaxes_kw returns inconsistent rd_kw when mapaxes is not used #1117

@eivindjahren

Description

@eivindjahren

Calling rd_grid_alloc_mapaxes_kw will always return a rd_kw_type pointer with size 6, but grid->mapaxes may be null, meaning the data is instantiated to NULL so doing

for (int i = 0; i < rd_kw_get_size(mapaxes_kw);i++)
   printf("%s\n", rd_kw_iget_float(mapaxes_kw, i));

will segfault.

There is a warning printed:

.../resdata/lib/resdata/rd_kw.cpp:726:11: runtime error: null pointer passed as argument 2, which is declared to never be 
null

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions