catid/leopard

No description how to restore missed original data after decoding

Closed this issue · 1 comments

awson commented

I've looked into benchmark.cpp and the only place decode_work_data is used is at

if (!CheckPacket(decode_work_data[i], params.buffer_bytes))
.

Thus i conjecture decode_work_data[i] has CRC32 in first 4 bytes, then the length of data in next 4 bytes, and then the data (which correspond to missed original_data[i]) itself in remaining (length) data(?).

But if this hypothesis is correct then we should have extra 8 bytes room in each decode_work_data[i], but the code uses buffer_bytes only (exactly as for any other buffer).

If the hypothesis is wrong then where should we extract missed original_data[i] from?

catid commented

I think you're right. Usually there is some way in an app to check the validity of the data.

One way to do it would be to set app_data_bytes = buffer_bytes - 8, and then original_data would contain [CRC] [LEN] [APP DATA] and the decode_work_data can be checked for validity as you suggested