Merge "trusty: Adapt to Confirmationui Corpus Format"
This commit is contained in:
commit
1ee38ede4c
25 changed files with 30 additions and 9 deletions
|
@ -16,4 +16,8 @@ cc_fuzz {
|
|||
name: "trusty_confirmationui_fuzzer",
|
||||
defaults: ["trusty_fuzzer_defaults"],
|
||||
srcs: ["fuzz.cpp"],
|
||||
|
||||
// The initial corpus for this fuzzer was derived by dumping bytes from
|
||||
// ConfirmationUI VTS.
|
||||
corpus: ["corpus/*"],
|
||||
}
|
||||
|
|
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-2ekYc2
Normal file
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-2ekYc2
Normal file
Binary file not shown.
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-5yTG3f
Normal file
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-5yTG3f
Normal file
Binary file not shown.
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-6l8Soq
Normal file
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-6l8Soq
Normal file
Binary file not shown.
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-7kFpGO
Normal file
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-7kFpGO
Normal file
Binary file not shown.
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-92m2f3
Normal file
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-92m2f3
Normal file
Binary file not shown.
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-ALYIzO
Normal file
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-ALYIzO
Normal file
Binary file not shown.
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-AcIMhR
Normal file
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-AcIMhR
Normal file
Binary file not shown.
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-AieaIi
Normal file
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-AieaIi
Normal file
Binary file not shown.
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-BdqX5j
Normal file
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-BdqX5j
Normal file
Binary file not shown.
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-JBPIGs
Normal file
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-JBPIGs
Normal file
Binary file not shown.
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-MWHw4T
Normal file
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-MWHw4T
Normal file
Binary file not shown.
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-TZzVLO
Normal file
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-TZzVLO
Normal file
Binary file not shown.
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-WwdA3B
Normal file
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-WwdA3B
Normal file
Binary file not shown.
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-globJV
Normal file
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-globJV
Normal file
Binary file not shown.
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-hzUgjD
Normal file
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-hzUgjD
Normal file
Binary file not shown.
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-jXC78o
Normal file
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-jXC78o
Normal file
Binary file not shown.
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-kykxni
Normal file
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-kykxni
Normal file
Binary file not shown.
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-npHe8t
Normal file
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-npHe8t
Normal file
Binary file not shown.
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-rPgnyI
Normal file
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-rPgnyI
Normal file
Binary file not shown.
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-uCJ1Me
Normal file
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-uCJ1Me
Normal file
Binary file not shown.
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-wAQEjK
Normal file
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-wAQEjK
Normal file
Binary file not shown.
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-xjtOks
Normal file
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-xjtOks
Normal file
Binary file not shown.
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-zKFIjN
Normal file
BIN
trusty/confirmationui/fuzz/corpus/confirmationui-zKFIjN
Normal file
Binary file not shown.
|
@ -39,6 +39,15 @@ static struct uuid confirmationui_uuid = {
|
|||
{0xb0, 0x86, 0xdf, 0x0f, 0x6c, 0x23, 0x3c, 0x1b},
|
||||
};
|
||||
|
||||
/* The format of the packets is as following:
|
||||
* 16 bits (uint16_t, header) + payload bytes
|
||||
* The 16 bits header spicify the number of bytes of payload (header excluded).
|
||||
*/
|
||||
struct data_packet {
|
||||
uint16_t header;
|
||||
uint8_t payload[];
|
||||
};
|
||||
|
||||
static CoverageRecord record(TIPC_DEV, &confirmationui_uuid);
|
||||
|
||||
extern "C" int LLVMFuzzerInitialize(int* /* argc */, char*** /* argv */) {
|
||||
|
@ -47,8 +56,10 @@ extern "C" int LLVMFuzzerInitialize(int* /* argc */, char*** /* argv */) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Each corpus contains one or more data packets. */
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
static uint8_t buf[TIPC_MAX_MSG_SIZE];
|
||||
size_t data_idx = 0;
|
||||
|
||||
ExtraCounters counters(&record);
|
||||
counters.Reset();
|
||||
|
@ -59,16 +70,22 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
|||
android::trusty::fuzz::Abort();
|
||||
}
|
||||
|
||||
/* Write message to confirmationui server */
|
||||
ret = ta.Write(data, size);
|
||||
if (!ret.ok()) {
|
||||
return -1;
|
||||
}
|
||||
while (data_idx < size) {
|
||||
struct data_packet* data_packet_ptr = (struct data_packet*)&data[data_idx];
|
||||
size_t payload_size = data_packet_ptr->header;
|
||||
data_idx += data_packet_ptr->header + sizeof(data_packet_ptr->header);
|
||||
|
||||
/* Read message from confirmationui server */
|
||||
ret = ta.Read(&buf, sizeof(buf));
|
||||
if (!ret.ok()) {
|
||||
return -1;
|
||||
/* Write message to confirmationui server */
|
||||
ret = ta.Write(data_packet_ptr->payload, payload_size);
|
||||
if (!ret.ok()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Read message from confirmationui server */
|
||||
ret = ta.Read(&buf, sizeof(buf));
|
||||
if (!ret.ok()) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue