tomerfiliba-org/reedsolomon

Bug in bytearray from decoder

HaolingZHANG opened this issue · 1 comments

Hi,

I found a bug in the decoding part. It is good in Windows. In Linux and Mac OS, we found the decoder return a list [bytearray 1, bytearray 2, bytearray 3] not just a bytearray. The bytearray 1 is what we need in the decoding part. However, I am not sure why it is different in different operating systems.

In my package, we do the follow sentence to fix this problem (TypeError: 'bytearray' object cannot be interpreted as an integer):

self.tool = RSCodec(3)

decode_byte_list = list(self.tool.decode(byte_list))

if type(decode_byte_list[0]) is not int:
    decode_byte_list = list(decode_byte_list[0])

Best and FYI,

Zhang

It's not a bug, it's a feature. Reedsolo was changed around the time you opened your issue to return 3 bytearrays, to allow for a finer grained control:

decoded_msg, decoded_msgecc, errata_pos = rsc.decode(tampered_msg)

First is the decoded/repaired message, second is the decoded message and error correction code (because both get repaired in reality), third is the position of the errors and erasures.