Browse Source

Merge 1.0 branch into master (#3172)

Merge 1.0 branch into master
Stefan Profanter 5 years ago
parent
commit
c78b8830dc
3 changed files with 5 additions and 1 deletions
  1. 1 1
      deps/mdnsd
  2. 3 0
      src/ua_types_encoding_json.c
  3. 1 0
      tools/nodeset_compiler/backend_open62541_nodes.py

+ 1 - 1
deps/mdnsd

@@ -1 +1 @@
-Subproject commit 0f504efa29598c07dcab290ce6118d496c1f1ad1
+Subproject commit f7f0dd543f12fa7bbf2b667cceb287b9c8184b7d

+ 3 - 0
src/ua_types_encoding_json.c

@@ -2259,6 +2259,9 @@ searchObjectForKeyRec(const char *searchKey, CtxJson *ctx,
                 if(jsoneq((char*)ctx->pos, &parseCtx->tokenArray[parseCtx->index], searchKey) == 0) {
                     /*found*/
                     parseCtx->index++; /*We give back a pointer to the value of the searched key!*/
+                    if (parseCtx->index >= parseCtx->tokenCount)
+                        /* We got invalid json. See https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=14620 */
+                        return UA_STATUSCODE_BADOUTOFRANGE;
                     *resultIndex = parseCtx->index;
                     return UA_STATUSCODE_GOOD;
                 }

+ 1 - 0
tools/nodeset_compiler/backend_open62541_nodes.py

@@ -305,6 +305,7 @@ def generateExtensionObjectSubtypeCode(node, parent, nodeset, global_var_code, i
             for subArrayIdx,val in enumerate(subv):
                 code.append(generateNodeValueCode(instanceNameSafe + "_" + memberName + "[" + str(subArrayIdx) + "]" +" = ",
                                                   val, instanceName,instanceName + "_gehtNed_member", global_var_code, asIndirect=False))
+            code.append(instanceName + accessor + memberName + "Size = {0};".format(len(subv)))
             code.append(instanceName + accessor + memberName + " = " + instanceNameSafe+"_"+ memberName+";")
             continue