Explorar el Código

Check for empty extension object array for add node service

See https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5585

Credit to oss-fuzz
Stefan Profanter hace 7 años
padre
commit
0578af91fd
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  1. 6 0
      src/server/ua_nodes.c

+ 6 - 0
src/server/ua_nodes.c

@@ -297,6 +297,12 @@ copyCommonVariableAttributes(UA_VariableNode *node,
      * we need to decode it and set the decoded value instead of the encoded object */
      * we need to decode it and set the decoded value instead of the encoded object */
     UA_Boolean valueSet = false;
     UA_Boolean valueSet = false;
     if(attr->value.type != NULL && UA_NodeId_equal(&attr->value.type->typeId, &extensionObject)) {
     if(attr->value.type != NULL && UA_NodeId_equal(&attr->value.type->typeId, &extensionObject)) {
+
+        if (attr->value.data == UA_EMPTY_ARRAY_SENTINEL) {
+            /* do nothing since we got an empty array of extension objects */
+            return UA_STATUSCODE_GOOD;
+        }
+
         const UA_ExtensionObject *obj = (const UA_ExtensionObject *)attr->value.data;
         const UA_ExtensionObject *obj = (const UA_ExtensionObject *)attr->value.data;
         if(obj && obj->encoding == UA_EXTENSIONOBJECT_ENCODED_BYTESTRING) {
         if(obj && obj->encoding == UA_EXTENSIONOBJECT_ENCODED_BYTESTRING) {