{"action":"created","issue":{"url":"https://api.github.com/repos/open62541/open62541/issues/1842","repository_url":"https://api.github.com/repos/open62541/open62541","labels_url":"https://api.github.com/repos/open62541/open62541/issues/1842/labels{/name}","comments_url":"https://api.github.com/repos/open62541/open62541/issues/1842/comments","events_url":"https://api.github.com/repos/open62541/open62541/issues/1842/events","html_url":"https://github.com/open62541/open62541/issues/1842","id":331480198,"node_id":"MDU6SXNzdWUzMzE0ODAxOTg=","number":1842,"title":"BADDECODINGERROR in namespace0 initialization","user":{"login":"jonasgreen88","id":20221877,"node_id":"MDQ6VXNlcjIwMjIxODc3","avatar_url":"https://avatars1.githubusercontent.com/u/20221877?v=4","gravatar_id":"","url":"https://api.github.com/users/jonasgreen88","html_url":"https://github.com/jonasgreen88","followers_url":"https://api.github.com/users/jonasgreen88/followers","following_url":"https://api.github.com/users/jonasgreen88/following{/other_user}","gists_url":"https://api.github.com/users/jonasgreen88/gists{/gist_id}","starred_url":"https://api.github.com/users/jonasgreen88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonasgreen88/subscriptions","organizations_url":"https://api.github.com/users/jonasgreen88/orgs","repos_url":"https://api.github.com/users/jonasgreen88/repos","events_url":"https://api.github.com/users/jonasgreen88/events{/privacy}","received_events_url":"https://api.github.com/users/jonasgreen88/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-06-12T08:05:29Z","updated_at":"2018-07-07T09:33:11Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Description\r\n===========\r\nI have upgraded to the release candidate of version 0.3 and getting an error in the namespace0 initialization. The namespace0.c have been generated using the default xml file in the cmake process. The error occurs when initializing the OutputArguments node (ns=0,i=11494). The node is intialized in the function function_ua_namespace0_107_begin() and it is the call to UA_Server_addNode_begin() that returns UA_STATUSCODE_BADDECODINGERROR (0x80070000).\r\n\r\nIn function_ua_namespace0_107_begin() the attribute value is intialized by writing to the encoded struct of UA_ExtensionObject variables. I have tracked the error code to be generated in the call chain UA_Server_addNode_begin() -> Operation_addNode_begin() -> AddNode_raw() -> UA_Node_setAttributes() -> copyVariableNodeAttributes() -> copyCommonVariableAttributes() -> UA_decodeBinary() -> decodeBinaryInternal() -> Array_decodeBinary(). The length variable gets the value 536885516 when decoding. https://github.com/open62541/open62541/blob/a5089596dad0225a06e9fe8fef2626f427d51630/src/ua_types_encoding_binary.c#L511\r\n\r\nHave anyone seen a similar issue?\r\n\r\nBelow is the generated function from namespace0.c that encodes the data that fails to be decoded when adding the node:\r\n```\r\n/* OutputArguments - ns=0;i=11494 */\r\n\r\nstatic UA_StatusCode function_ua_namespace0_107_begin(UA_Server *server, UA_UInt16* ns) {\r\n\r\nUA_StatusCode retVal = UA_STATUSCODE_GOOD;\r\nUA_VariableAttributes attr = UA_VariableAttributes_default;\r\nattr.minimumSamplingInterval = 0.000000;\r\nattr.userAccessLevel = 1;\r\nattr.accessLevel = 1;\r\nattr.valueRank = 1;\r\nattr.arrayDimensionsSize = 1;\r\nattr.arrayDimensions = (UA_UInt32 *)UA_Array_new(1, &UA_TYPES[UA_TYPES_UINT32]);\r\nattr.arrayDimensions[0] = 0;\r\nattr.dataType = UA_NODEID_NUMERIC(ns[0], 296);\r\n\r\nstruct {\r\n  UA_String Name;\r\n  UA_NodeId DataType;\r\n  UA_Int32 ValueRank;\r\n  UA_Int32 ArrayDimensionsSize;\r\n  UA_UInt32 *ArrayDimensions;\r\n  UA_LocalizedText Description;\r\n} variablenode_ns_0_i_11494_Argument_0_0_struct;\r\nvariablenode_ns_0_i_11494_Argument_0_0_struct.Name = UA_STRING(\"ServerHandles\");\r\nvariablenode_ns_0_i_11494_Argument_0_0_struct.DataType = UA_NODEID_NUMERIC(ns[0], 7);\r\nvariablenode_ns_0_i_11494_Argument_0_0_struct.ValueRank = (UA_Int32) 1;\r\nvariablenode_ns_0_i_11494_Argument_0_0_struct.ArrayDimensionsSize = 1;\r\nvariablenode_ns_0_i_11494_Argument_0_0_struct.ArrayDimensions = (UA_UInt32*) UA_malloc(sizeof(UA_UInt32));\r\nvariablenode_ns_0_i_11494_Argument_0_0_struct.ArrayDimensions[0]  = (UA_UInt32) 0;\r\nvariablenode_ns_0_i_11494_Argument_0_0_struct.Description = UA_LOCALIZEDTEXT(\"\", \"\");\r\nUA_ExtensionObject *variablenode_ns_0_i_11494_Argument_0_0 =  UA_ExtensionObject_new();\r\nvariablenode_ns_0_i_11494_Argument_0_0->encoding = UA_EXTENSIONOBJECT_ENCODED_BYTESTRING;\r\nvariablenode_ns_0_i_11494_Argument_0_0->content.encoded.typeId = UA_NODEID_NUMERIC(0, 298);\r\nUA_ByteString_allocBuffer(&variablenode_ns_0_i_11494_Argument_0_0->content.encoded.body, 65000);\r\nUA_Byte *posvariablenode_ns_0_i_11494_Argument_0_0 = variablenode_ns_0_i_11494_Argument_0_0->content.encoded.body.data;\r\nconst UA_Byte *endvariablenode_ns_0_i_11494_Argument_0_0 = &variablenode_ns_0_i_11494_Argument_0_0->content.encoded.body.data[65000];\r\n{\r\nretVal |= UA_encodeBinary(&variablenode_ns_0_i_11494_Argument_0_0_struct.Name, &UA_TYPES[UA_TYPES_STRING], &posvariablenode_ns_0_i_11494_Argument_0_0, &endvariablenode_ns_0_i_11494_Argument_0_0, NULL, NULL);\r\nretVal |= UA_encodeBinary(&variablenode_ns_0_i_11494_Argument_0_0_struct.DataType, &UA_TYPES[UA_TYPES_NODEID], &posvariablenode_ns_0_i_11494_Argument_0_0, &endvariablenode_ns_0_i_11494_Argument_0_0, NULL, NULL);\r\nretVal |= UA_encodeBinary(&variablenode_ns_0_i_11494_Argument_0_0_struct.ValueRank, &UA_TYPES[UA_TYPES_INT32], &posvariablenode_ns_0_i_11494_Argument_0_0, &endvariablenode_ns_0_i_11494_Argument_0_0, NULL, NULL);\r\nretVal |= UA_encodeBinary(&variablenode_ns_0_i_11494_Argument_0_0_struct.ArrayDimensions[0], &UA_TYPES[UA_TYPES_UINT32], &posvariablenode_ns_0_i_11494_Argument_0_0, &endvariablenode_ns_0_i_11494_Argument_0_0, NULL, NULL);\r\nretVal |= UA_encodeBinary(&variablenode_ns_0_i_11494_Argument_0_0_struct.Description, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], &posvariablenode_ns_0_i_11494_Argument_0_0, &endvariablenode_ns_0_i_11494_Argument_0_0, NULL, NULL);\r\n}\r\nsize_t variablenode_ns_0_i_11494_Argument_0_0_encOffset = (uintptr_t)(posvariablenode_ns_0_i_11494_Argument_0_0-variablenode_ns_0_i_11494_Argument_0_0->content.encoded.body.data);\r\nvariablenode_ns_0_i_11494_Argument_0_0->content.encoded.body.length = variablenode_ns_0_i_11494_Argument_0_0_encOffset;\r\nUA_Byte *variablenode_ns_0_i_11494_Argument_0_0_newBody = (UA_Byte *) UA_malloc(variablenode_ns_0_i_11494_Argument_0_0_encOffset);\r\nmemcpy(variablenode_ns_0_i_11494_Argument_0_0_newBody, variablenode_ns_0_i_11494_Argument_0_0->content.encoded.body.data, variablenode_ns_0_i_11494_Argument_0_0_encOffset);\r\nUA_Byte *variablenode_ns_0_i_11494_Argument_0_0_oldBody = variablenode_ns_0_i_11494_Argument_0_0->content.encoded.body.data;\r\nvariablenode_ns_0_i_11494_Argument_0_0->content.encoded.body.data = variablenode_ns_0_i_11494_Argument_0_0_newBody;\r\nUA_free(variablenode_ns_0_i_11494_Argument_0_0_oldBody);\r\n\r\n\r\nstruct {\r\n  UA_String Name;\r\n  UA_NodeId DataType;\r\n  UA_Int32 ValueRank;\r\n  UA_Int32 ArrayDimensionsSize;\r\n  UA_UInt32 *ArrayDimensions;\r\n  UA_LocalizedText Description;\r\n} variablenode_ns_0_i_11494_Argument_1_0_struct;\r\nvariablenode_ns_0_i_11494_Argument_1_0_struct.Name = UA_STRING(\"ClientHandles\");\r\nvariablenode_ns_0_i_11494_Argument_1_0_struct.DataType = UA_NODEID_NUMERIC(ns[0], 7);\r\nvariablenode_ns_0_i_11494_Argument_1_0_struct.ValueRank = (UA_Int32) 1;\r\nvariablenode_ns_0_i_11494_Argument_1_0_struct.ArrayDimensionsSize = 1;\r\nvariablenode_ns_0_i_11494_Argument_1_0_struct.ArrayDimensions = (UA_UInt32*) UA_malloc(sizeof(UA_UInt32));\r\nvariablenode_ns_0_i_11494_Argument_1_0_struct.ArrayDimensions[0]  = (UA_UInt32) 0;\r\nvariablenode_ns_0_i_11494_Argument_1_0_struct.Description = UA_LOCALIZEDTEXT(\"\", \"\");\r\nUA_ExtensionObject *variablenode_ns_0_i_11494_Argument_1_0 =  UA_ExtensionObject_new();\r\nvariablenode_ns_0_i_11494_Argument_1_0->encoding = UA_EXTENSIONOBJECT_ENCODED_BYTESTRING;\r\nvariablenode_ns_0_i_11494_Argument_1_0->content.encoded.typeId = UA_NODEID_NUMERIC(0, 298);\r\nUA_ByteString_allocBuffer(&variablenode_ns_0_i_11494_Argument_1_0->content.encoded.body, 65000);\r\nUA_Byte *posvariablenode_ns_0_i_11494_Argument_1_0 = variablenode_ns_0_i_11494_Argument_1_0->content.encoded.body.data;\r\nconst UA_Byte *endvariablenode_ns_0_i_11494_Argument_1_0 = &variablenode_ns_0_i_11494_Argument_1_0->content.encoded.body.data[65000];\r\n{\r\nretVal |= UA_encodeBinary(&variablenode_ns_0_i_11494_Argument_1_0_struct.Name, &UA_TYPES[UA_TYPES_STRING], &posvariablenode_ns_0_i_11494_Argument_1_0, &endvariablenode_ns_0_i_11494_Argument_1_0, NULL, NULL);\r\nretVal |= UA_encodeBinary(&variablenode_ns_0_i_11494_Argument_1_0_struct.DataType, &UA_TYPES[UA_TYPES_NODEID], &posvariablenode_ns_0_i_11494_Argument_1_0, &endvariablenode_ns_0_i_11494_Argument_1_0, NULL, NULL);\r\nretVal |= UA_encodeBinary(&variablenode_ns_0_i_11494_Argument_1_0_struct.ValueRank, &UA_TYPES[UA_TYPES_INT32], &posvariablenode_ns_0_i_11494_Argument_1_0, &endvariablenode_ns_0_i_11494_Argument_1_0, NULL, NULL);\r\nretVal |= UA_encodeBinary(&variablenode_ns_0_i_11494_Argument_1_0_struct.ArrayDimensions[0], &UA_TYPES[UA_TYPES_UINT32], &posvariablenode_ns_0_i_11494_Argument_1_0, &endvariablenode_ns_0_i_11494_Argument_1_0, NULL, NULL);\r\nretVal |= UA_encodeBinary(&variablenode_ns_0_i_11494_Argument_1_0_struct.Description, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], &posvariablenode_ns_0_i_11494_Argument_1_0, &endvariablenode_ns_0_i_11494_Argument_1_0, NULL, NULL);\r\n}\r\nsize_t variablenode_ns_0_i_11494_Argument_1_0_encOffset = (uintptr_t)(posvariablenode_ns_0_i_11494_Argument_1_0-variablenode_ns_0_i_11494_Argument_1_0->content.encoded.body.data);\r\nvariablenode_ns_0_i_11494_Argument_1_0->content.encoded.body.length = variablenode_ns_0_i_11494_Argument_1_0_encOffset;\r\nUA_Byte *variablenode_ns_0_i_11494_Argument_1_0_newBody = (UA_Byte *) UA_malloc(variablenode_ns_0_i_11494_Argument_1_0_encOffset);\r\nmemcpy(variablenode_ns_0_i_11494_Argument_1_0_newBody, variablenode_ns_0_i_11494_Argument_1_0->content.encoded.body.data, variablenode_ns_0_i_11494_Argument_1_0_encOffset);\r\nUA_Byte *variablenode_ns_0_i_11494_Argument_1_0_oldBody = variablenode_ns_0_i_11494_Argument_1_0->content.encoded.body.data;\r\nvariablenode_ns_0_i_11494_Argument_1_0->content.encoded.body.data = variablenode_ns_0_i_11494_Argument_1_0_newBody;\r\nUA_free(variablenode_ns_0_i_11494_Argument_1_0_oldBody);\r\n\r\nUA_ExtensionObject variablenode_ns_0_i_11494_variant_DataContents[2];\r\nvariablenode_ns_0_i_11494_variant_DataContents[0] = *variablenode_ns_0_i_11494_Argument_0_0;\r\nvariablenode_ns_0_i_11494_variant_DataContents[1] = *variablenode_ns_0_i_11494_Argument_1_0;\r\nUA_Variant_setArray(&attr.value, &variablenode_ns_0_i_11494_variant_DataContents, (UA_Int32) 2, &UA_TYPES[UA_TYPES_EXTENSIONOBJECT]);\r\nattr.displayName = UA_LOCALIZEDTEXT(\"\", \"OutputArguments\");\r\nattr.description = UA_LOCALIZEDTEXT(\"\", \"\");\r\nattr.writeMask = 0;\r\nattr.userWriteMask = 0;\r\nretVal |= UA_Server_addNode_begin(server, UA_NODECLASS_VARIABLE,\r\nUA_NODEID_NUMERIC(ns[0], 11494),\r\nUA_NODEID_NUMERIC(ns[0], 0),\r\nUA_NODEID_NUMERIC(ns[0], 0),\r\nUA_QUALIFIEDNAME(ns[0], \"OutputArguments\"),\r\nUA_NODEID_NUMERIC(ns[0], 68),\r\n(const UA_NodeAttributes*)&attr, &UA_TYPES[UA_TYPES_VARIABLEATTRIBUTES],NULL, NULL);\r\nUA_Array_delete(attr.arrayDimensions, 1, &UA_TYPES[UA_TYPES_UINT32]);\r\n\r\nUA_free(variablenode_ns_0_i_11494_Argument_0_0_struct.ArrayDimensions);\r\nUA_ExtensionObject_delete(variablenode_ns_0_i_11494_Argument_0_0);\r\n\r\nUA_free(variablenode_ns_0_i_11494_Argument_1_0_struct.ArrayDimensions);\r\nUA_ExtensionObject_delete(variablenode_ns_0_i_11494_Argument_1_0);\r\nretVal |= UA_Server_addReference(server, UA_NODEID_NUMERIC(ns[0], 11494), UA_NODEID_NUMERIC(ns[0], 46), UA_EXPANDEDNODEID_NUMERIC(ns[0], 11492), false);\r\nreturn retVal;\r\n}\r\n```\r\n\r\nBackground Information / Reproduction Steps\r\n===========================================\r\n\r\n\r\n\r\nChecklist\r\n=========\r\nPlease provide the following information:\r\n\r\n - [ ] open62541 Version (release number or git tag): d88df4281dde5744db06d6c738d0fcc6b73523e8\r\n - [ ] Other OPC UA SDKs used (client or server): \r\n - [ ] Operating system: Proprietary embedded OS\r\n - [ ] Logs (with `UA_LOGLEVEL` set as low as necessary) attached\r\n - [ ] Wireshark network dump attached\r\n - [ ] Self-contained code example attached\r\n - [ ] Critical issue\r\n"},"comment":{"url":"https://api.github.com/repos/open62541/open62541/issues/comments/403202641","html_url":"https://github.com/open62541/open62541/issues/1842#issuecomment-403202641","issue_url":"https://api.github.com/repos/open62541/open62541/issues/1842","id":403202641,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMzIwMjY0MQ==","user":{"login":"jpfr","id":1726411,"node_id":"MDQ6VXNlcjE3MjY0MTE=","avatar_url":"https://avatars1.githubusercontent.com/u/1726411?v=4","gravatar_id":"","url":"https://api.github.com/users/jpfr","html_url":"https://github.com/jpfr","followers_url":"https://api.github.com/users/jpfr/followers","following_url":"https://api.github.com/users/jpfr/following{/other_user}","gists_url":"https://api.github.com/users/jpfr/gists{/gist_id}","starred_url":"https://api.github.com/users/jpfr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpfr/subscriptions","organizations_url":"https://api.github.com/users/jpfr/orgs","repos_url":"https://api.github.com/users/jpfr/repos","events_url":"https://api.github.com/users/jpfr/events{/privacy}","received_events_url":"https://api.github.com/users/jpfr/received_events","type":"User","site_admin":false},"created_at":"2018-07-07T09:33:11Z","updated_at":"2018-07-07T09:33:11Z","author_association":"CONTRIBUTOR","body":"Did #1874 resolve this issue as well?"}}
{"actor":{"display_login":"jpfr"}}