瀏覽代碼

edge case in decoding of diagnosticinfo uncoverved by oss-fuzz

Julius Pfrommer 7 年之前
父節點
當前提交
7e7eba2b5c
共有 1 個文件被更改,包括 2 次插入3 次删除
  1. 2 3
      src/ua_types_encoding_binary.c

+ 2 - 3
src/ua_types_encoding_binary.c

@@ -1324,15 +1324,14 @@ DECODE_BINARY(DiagnosticInfo) {
             UA_calloc(1, sizeof(UA_DiagnosticInfo));
         if(!dst->innerDiagnosticInfo)
             return UA_STATUSCODE_BADOUTOFMEMORY;
+        dst->hasInnerDiagnosticInfo = true;
 
         /* Check the recursion limit */
         if(ctx->depth > UA_ENCODING_MAX_RECURSION)
             return UA_STATUSCODE_BADENCODINGERROR;
-        ctx->depth++;
 
-        dst->hasInnerDiagnosticInfo = true;
+        ctx->depth++;
         ret |= DECODE_DIRECT(dst->innerDiagnosticInfo, DiagnosticInfo);
-
         ctx->depth--;
     }
     return ret;