Previous commit added better detection of amb8465 dongles. This commit removes unnecessary assert for length inside crc calculation. This check caused unnecessary fuzz crashes.

pull/324/head
Fredrik Öhrström 2021-08-09 01:10:13 +02:00
rodzic 837b86da85
commit 5793d7f5b7
2 zmienionych plików z 17 dodań i 7 usunięć

Wyświetl plik

@ -34,11 +34,20 @@ int main(int argc, char **argv)
// The binary difvif data is sent on stdin.
char buf[1024];
vector<uchar> databytes;
for (;;) {
size_t len = read(0, buf, sizeof(buf));
if (len <= 0) break;
databytes.insert(databytes.end(), buf, buf+len);
vector<char> *ptr = reinterpret_cast<vector<char>*>(&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<string,pair<int,DVEntry>> values;

Wyświetl plik

@ -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<len; ++i) {
for (size_t i=0; i<len; ++i)
{
crc = crc16_EN13757_per_byte(crc, data[i]);
}