mirror of
https://github.com/open62541/open62541.git
synced 2025-06-03 04:00:21 +00:00
fix(core): Allow out-of-memory during fuzzing (2nd try)
This commit is contained in:
parent
121c870c72
commit
50705b1a84
@ -3049,12 +3049,12 @@ UA_decodeJson(const UA_ByteString *src, void *dst, const UA_DataType *type,
|
||||
if(ret == UA_STATUSCODE_GOOD) {
|
||||
memset(dst, 0, type->memSize); /* Initialize the value */
|
||||
ret = decodeJsonJumpTable[type->typeKind](dst, type, &ctx, &parseCtx);
|
||||
}
|
||||
|
||||
/* Sanity check if all Tokens were processed */
|
||||
if(parseCtx.index != parseCtx.tokenCount &&
|
||||
parseCtx.index != parseCtx.tokenCount - 1)
|
||||
ret = UA_STATUSCODE_BADDECODINGERROR;
|
||||
/* Sanity check if all Tokens were processed */
|
||||
if(parseCtx.index != parseCtx.tokenCount &&
|
||||
parseCtx.index != parseCtx.tokenCount - 1)
|
||||
ret = UA_STATUSCODE_BADDECODINGERROR;
|
||||
}
|
||||
|
||||
/* Free token array on the heap */
|
||||
if(parseCtx.tokenArray != tokens)
|
||||
|
@ -42,6 +42,7 @@ LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
|
||||
if(retval == UA_STATUSCODE_BADOUTOFMEMORY) {
|
||||
UA_Variant_clear(&value);
|
||||
UA_ByteString_clear(&buf2);
|
||||
return 0;
|
||||
}
|
||||
UA_assert(retval == UA_STATUSCODE_GOOD);
|
||||
/* TODO: Enable this assertion when the binary-JSON-binary roundtrip is complete.
|
||||
|
Loading…
Reference in New Issue
Block a user