Browse Source

Merge pull request #2856 from rgetz/rgetz-remove-warning-stringop-overflow

ft8: Fix CRC message length type causing memcpy overflow warning
chirpmodem-v8.0.0
Edouard Griffiths 4 months ago committed by GitHub
parent
commit
8064d990b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      ft8/libldpc.cpp
  2. 4
      ft8/libldpc.h

4
ft8/libldpc.cpp

@ -363,7 +363,7 @@ void LDPC::ldpc_decode_log(float codeword[], int iters, int plain[], int *ok) @@ -363,7 +363,7 @@ void LDPC::ldpc_decode_log(float codeword[], int iters, int plain[], int *ok)
// check the FT8 CRC-14
//
void LDPC::ft8_crc(int msg1[], int msglen, int out[14])
void LDPC::ft8_crc(int msg1[], uint32_t msglen, int out[14])
{
// the old FT8 polynomial for 12-bit CRC, 0xc06.
// int div[] = { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0 };
@ -375,7 +375,7 @@ void LDPC::ft8_crc(int msg1[], int msglen, int out[14]) @@ -375,7 +375,7 @@ void LDPC::ft8_crc(int msg1[], int msglen, int out[14])
std::vector<int> msg(msglen + 14);
std::memcpy(msg.data(), msg1, msglen * sizeof(int));
for (int i = 0; i < msglen; i++)
for (uint32_t i = 0; i < msglen; i++)
{
if (msg[i])
{

4
ft8/libldpc.h

@ -22,13 +22,15 @@ @@ -22,13 +22,15 @@
#ifndef libldpc_h
#define libldpc_h
#include <cstdint>
namespace FT8 {
class LDPC {
public:
static void ldpc_decode(const float llcodeword[], int iters, int plain[], int *ok);
static void ldpc_decode_log(float codeword[], int iters, int plain[], int *ok);
static void ft8_crc(int msg1[], int msglen, int out[14]);
static void ft8_crc(int msg1[], uint32_t msglen, int out[14]);
static void gauss_jordan(int rows, int cols, int m[174][2 * 91], int which[91], int *ok);
private:

Loading…
Cancel
Save