openfast icon indicating copy to clipboard operation
openfast copied to clipboard

Incorrect error handling causes seg-fault in MAP with incorrect node keyword

Open andrew-platt opened this issue 2 years ago • 2 comments

Bug description In MAP, the keyword fix in the node list is used to denote an anchor node of a line (the only allowed keywords are fix, connect, and vessel). Any other word should result in an error reported to OpenFAST, not a segmentation fault. This appears to be a bug in the error handling in the set_node_list routine in mapinit.c

To Reproduce

  1. Use any release of OpenFAST (v3.2.0 was used for testing, v3.1.0
  2. Run a regression test that includes MAP (5MW_TLP_DLL_WTurb_WavesIrr_WavesMulti was used in testing), but change the keyword fix in the MAP input file node list section to fixed.
  3. The resulting error occurs (note there is no indication that this is in MAP): Screen Shot 2022-07-19 at 10 12 43 AM

Likely cause (or at least where to start) In the set_node_list subroutine in mapinit.c, an incorrect keyword should be caught by line 1936 and a message passed out to OpenFAST with graceful termination of MAP. It may be that the subroutine is continuing and trying to access a pointer that should have been set in that logic block, but is left unassociated (maybe we need to exit that routine earlier if there is a bad keyword).

OpenFAST Version Looking at the source code history, this bug dates back to at least OpenFAST v2.0.0, if not earlier.

Other info This was discovered when the word fixed is used instead of fixed. This is a very easy mistake to make since MAP and MoorDyn look very similar and MoorDyn uses fixed to denote an anchor point. To help eliminate this potential issue, we should add the word fixed into the keyword checking for the node list section parsing in MAP. This will be remedied in a following PR.

andrew-platt avatar Jul 19 '22 16:07 andrew-platt

@andrew-platt I want to confirm that #1186 does not fix this issue. The issue here is the incorrect error handling in mapinit. Is that right?

rafmudaf avatar Jul 21 '22 15:07 rafmudaf

@rafmudaf, that is correct. #1186 does not resolve the seg-fault.

andrew-platt avatar Jul 21 '22 16:07 andrew-platt