lofaldli / gr-ccsds

GNU Radio module for Reed Solomon coded CCSDS frames
40 stars 29 forks source link

Latest commit introduces segfault in ccsds_encoder block #14

Open chupalt opened 3 years ago

chupalt commented 3 years ago

In particular line 129 causes you to index into an out of bounds memory region of the in array

      // copy data from input to rs block
      if (d_interleave) {
          for (uint8_t j=0; j<RS_BLOCK_LEN; j++)
              rs_block[j] = in[i + (d_n_interleave*j)];
      } else {
          memcpy(rs_block, &in[i*RS_DATA_LEN], RS_DATA_LEN);
      }

in is typically 1115 bytes (223 5). RS_BLOCK_LEN = 255 (223+32), so in the case of an interleaving depth of 5 there are a number of values that will be larger than 1115 (max of 255 5 + 5= 1280). As long as nothing else is using this memory, you operate fine. If something else is using this memory or it is not accessible, you get a seg fault.