Skip to content

Crash in correct_reed_solomon_decode() #48

Open

Description

@burt2902

First of all, thank you for this great project.

I have been experiencing random crashes of the program that is decoding a reed-solomon protected data. I have managed to narrow down the issue to correct_reed_solomon_decode(). Below is a code snippet that eventually results in a crash.
The smaller the PARITY, the faster the crash happens. 2 is really fast, 4 takes quite some time, but eventually crashes.

#define PAYLOAD_SIZE      4
#define PARITY_SIZE       2

void rs_crash()
{
    correct_reed_solomon *rs = correct_reed_solomon_create(correct_rs_primitive_polynomial_ccsds, 1, 1, PARITY_SIZE);
    uint8_t encoded[PAYLOAD_SIZE + PARITY_SIZE];
    uint8_t decoded[PAYLOAD_SIZE];

    while(1)
    {
        for(int n = 0; n < PAYLOAD_SIZE + PARITY_SIZE; n++)
            encoded[n] = rand() % 256;
        correct_reed_solomon_decode(rs, encoded, PAYLOAD_SIZE + PARITY_SIZE, decoded); 
    }
}

Activity

  1. burt2902 commented on Mar 14, 2025

    @burt2902
    Author

    Below crashes with just 2 calls to correct_reed_solomon_decode()

    uint8_t encoded1[3] = {0x01, 0x02, 0x01};
    uint8_t encoded2[3] = {0x01, 0x02, 0x02};
    uint8_t decoded[2];
    
    correct_reed_solomon *rs_dec = correct_reed_solomon_create(correct_rs_primitive_polynomial_ccsds, 1, 1, 1);
    
    correct_reed_solomon_decode(rs_dec, encoded1, 3, decoded );
    correct_reed_solomon_decode(rs_dec, encoded2, 3, decoded );  // crash
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions