diff --git a/src/fuzz.cc b/src/fuzz.cc index 03d1c25..bdfa371 100644 --- a/src/fuzz.cc +++ b/src/fuzz.cc @@ -34,11 +34,20 @@ int main(int argc, char **argv) // The binary difvif data is sent on stdin. char buf[1024]; vector databytes; - - for (;;) { - size_t len = read(0, buf, sizeof(buf)); - if (len <= 0) break; - databytes.insert(databytes.end(), buf, buf+len); + vector *ptr = reinterpret_cast*>(&databytes); + if (argc > 1 && argv[1][0] != 0) + { + // Read from file. + loadFile(string(argv[1]), ptr); + } + else + { + // Read from stdin + for (;;) { + size_t len = read(0, buf, sizeof(buf)); + if (len <= 0) break; + databytes.insert(databytes.end(), buf, buf+len); + } } map> values; diff --git a/src/util.cc b/src/util.cc index 1dd35e6..460f5a2 100644 --- a/src/util.cc +++ b/src/util.cc @@ -1051,8 +1051,9 @@ uint16_t crc16_EN13757(uchar *data, size_t len) uint16_t crc = 0x0000; assert(len == 0 || data != NULL); - assert(len < 1024); - for (size_t i=0; i