Skip to content

Commit

Permalink
fixup3
Browse files Browse the repository at this point in the history
  • Loading branch information
Pro committed Aug 8, 2017
1 parent 11f04b1 commit 225cd99
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tests/fuzz/fuzz_binary_encoding.cc
Expand Up @@ -48,11 +48,19 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
UA_Byte *destBufOrig = destBuf;
const UA_Byte *destBufEnd = &destBuf[destBufferSize];

UA_StatusCode ret = UA_encodeBinary(decodedType, &UA_TYPES[typeIndex], &destBuf, &destBufEnd, NULL, NULL);
if (ret == UA_STATUSCODE_GOOD) {
// do nothing
UA_Byte *prevBuf = destBuf;
while (destBuf < destBufEnd) {
prevBuf = destBuf;
// destBuf will be moved by type size
UA_StatusCode ret = UA_encodeBinary(decodedType, &UA_TYPES[typeIndex], &destBuf, &destBufEnd, NULL, NULL);
if (ret == UA_STATUSCODE_GOOD) {
// do nothing
}
if (prevBuf == destBuf)
break;
}


UA_free(destBufOrig);

return 0;
Expand Down

0 comments on commit 225cd99

Please sign in to comment.