1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- #include <ua_types.h>
- #include "ua_server_internal.h"
- #include "ua_config_standard.h"
- #include "ua_log_stdout.h"
- #include "ua_types_encoding_binary.h"
- extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
- if (size == 0)
- return 0;
- const uint8_t *ptr = data;
- size_t ptrSize = size;
-
- uint8_t typeIndex = ptr[0];
- ptr++;
- ptrSize--;
- if (typeIndex >= UA_TYPES_COUNT)
- return 0;
- size_t offset = 0;
- if (ptrSize >= sizeof(size_t)) {
- offset = (*ptr);
- ptr += sizeof(size_t);
- ptrSize -= sizeof(size_t);
- }
- void *dst = UA_new(&UA_TYPES[typeIndex]);
- const UA_ByteString binary = {
- ptrSize,
- (UA_Byte *)(void *)ptr
- };
- UA_StatusCode ret = UA_decodeBinary(&binary, &offset, dst, &UA_TYPES[typeIndex], 0, nullptr);
- if (ret == UA_STATUSCODE_GOOD) {
-
- }
- UA_delete(dst, &UA_TYPES[typeIndex]);
- return 0;
- }
|