Skip to content

Commit

Permalink
Handle crashing P25 RS decoder better.
Browse files Browse the repository at this point in the history
  • Loading branch information
g4klx committed Feb 16, 2017
1 parent 3672f09 commit 4b07afa
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions P25Data.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2016 by Jonathan Naylor G4KLX
* Copyright (C) 2016,2017 by Jonathan Naylor G4KLX
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -96,9 +96,14 @@ bool CP25Data::decodeLDU1(const unsigned char* data)
CP25Utils::decode(data, raw, 1356U, 1398U);
decodeLDUHamming(raw, rs + 15U);

bool ret = m_rs241213.decode(rs);
if (!ret)
try {
bool ret = m_rs241213.decode(rs);
if (!ret)
return false;
} catch (...) {
CUtils::dump(2U, "P25, RS carshed with input data", rs, 18U);
return false;
}

// Simple validation of the source id
unsigned int srcId = (rs[6U] << 16) + (rs[7U] << 8) + rs[8U];
Expand Down

0 comments on commit 4b07afa

Please sign in to comment.