New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Corner-case bug in Reed Solomon code? #997
Comments
Here's a more direct version of your test:
I don't think this a bug though. You're using a field with 256 elements (I presume) and so the error locator can't express more than 256 distinct error locations. Your input has 257 elements though. Try using a different field like |
Hm, not quite; the failure occurs at 256 elements, not 257. I suspect my answer is still roughly correct, but the subtlety of why it works only at 255 elements is beyond me in looking at this for 15 minutes. It may still be a corner case bug, yeah, but maybe narrower than it seems. |
Hi,
First, thanks for this great library. I'm just using the Reed Solomon part of it and I stumbled on I think a corner-case bug.
When using data+error_codes of size 256, if I corrupt the first byte (after ReedSolomon encoding), neither the byte is "repaired" nor an exception is thrown when decoding. It doesn't seem to matter how many error_codes I use or the data content, but it only fails for data+error_codes of size 256.
I grep'd the ReedSolomon code for literals 255 and 256 but saw nothing fishy.
Hmm, code formatter on this wiki not working for me. JUnit test below. Depends on RSEncoderDecoder class, which looks fine by inspection (attached as '.txt')
RSEncoderDecoder.txt
import java.util.Arrays;
import org.junit.Test;
import com.casualcoding.reedsolomon.RSEncoderDecoder;
public class ReedSolomonByte0Bug
{
@test
public void testRSStreamAllZeros() throws Exception
{
/*
* numEcBytes doesn't seem to matter
*/
int numEcBytes = 8;
}
The text was updated successfully, but these errors were encountered: