Closed cldhms closed 1 year ago
The expectation of the modelling tool is not clear for me. I've taken a look here https://reference.opcfoundation.org/Core/Part6/v105/docs/5.3#_Ref131702289 but couldn't find any hint. I would vote to set the value to NULL to fix the segfault.
I haven't found any clear hint on how to handle it either. I'm not familiar with the parser part of the nodesetloader. Do you mean that you would set the value to NULL there if the value tag is empty or would it be better to move the allocation to where the tag is found to where the content is handled instead? In that case we would get the same behavior for no tag and empty tag.
Btw, I tried to import the same xml in nodeset_compiler.py included in open62541 and it crashed as well.
The modelling tool that I have been using sometimes produces empty value tags for variable nodes. When this nodeset file is loaded using the nodesetloader the program crashes at Value.c:365 (open62541 backend) since the value pointer isn't allocated (data member of NL_Value struct). This happens as pctx->val is allocated at NodesetLoader.c:216 but the data member is never allocated which is supposed to happen at NodesetLoader.c:263 but doesn't as the value tag is empty. I was about to implement a fix but I'm not sure how empty value tags should be treated.
Do you have any input on this?