1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-11 02:46:12 -05:00

Merge pull request #2180 from srcejon/freq_scanner

AIS: Validate message length. Fixes #2125
This commit is contained in:
Edouard Griffiths 2024-06-21 01:44:44 +02:00 committed by GitHub
commit 4837d3aba3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 30 additions and 17 deletions

View File

@ -211,7 +211,8 @@ bool AISDemod::handleMessage(const Message& cmd)
// Decode the message // Decode the message
ais = AISMessage::decode(report.getMessage()); ais = AISMessage::decode(report.getMessage());
if (ais)
{
m_logStream << report.getDateTime().date().toString() << "," m_logStream << report.getDateTime().date().toString() << ","
<< report.getDateTime().time().toString() << "," << report.getDateTime().time().toString() << ","
<< report.getMessage().toHex() << "," << report.getMessage().toHex() << ","
@ -224,6 +225,7 @@ bool AISDemod::handleMessage(const Message& cmd)
delete ais; delete ais;
} }
}
return true; return true;
} }

View File

@ -422,6 +422,9 @@ void AISDemodGUI::messageReceived(const QByteArray& message, const QDateTime& da
// Decode the message // Decode the message
ais = AISMessage::decode(message); ais = AISMessage::decode(message);
if (!ais) {
return;
}
// Is scroll bar at bottom // Is scroll bar at bottom
QScrollBar *sb = ui->messages->verticalScrollBar(); QScrollBar *sb = ui->messages->verticalScrollBar();

View File

@ -6,7 +6,7 @@ This plugin can be used to demodulate AIS (Automatic Identification System) mess
AIS is broadcast globally on 25kHz channels at 161.975MHz and 162.025MHz, with other frequencies being used regionally or for special purposes. This demodulator is single channel, so if you wish to decode multiple channels simultaneously, you will need to add one AIS demodulator per frequency. As most AIS messages are on 161.975MHz and 162.025MHz, you can set the center frequency as 162MHz, with a sample rate of 100k+Sa/s, with one AIS demod with an input offset -25kHz and another at +25kHz. AIS is broadcast globally on 25kHz channels at 161.975MHz and 162.025MHz, with other frequencies being used regionally or for special purposes. This demodulator is single channel, so if you wish to decode multiple channels simultaneously, you will need to add one AIS demodulator per frequency. As most AIS messages are on 161.975MHz and 162.025MHz, you can set the center frequency as 162MHz, with a sample rate of 100k+Sa/s, with one AIS demod with an input offset -25kHz and another at +25kHz.
The AIS demodulators can send received messages to the [AIS feature](../../feature/ais/readme.md), which displays a table combining the latest data for vessels amalgamated from multiple demodulators and sends their positions to the [Map Feature](../../feature/map/readme.ais) for display in 2D or 3D. The AIS demodulators can send received messages to the [AIS feature](../../feature/ais/readme.md), which displays a table combining the latest data for vessels amalgamated from multiple demodulators and sends their positions to the [Map Feature](../../feature/map/readme.md) for display in 2D or 3D.
AIS uses GMSK/FM modulation at a baud rate of 9,600, with a modulation index of 0.5. The demodulator works at a sample rate of 57,600Sa/s. AIS uses GMSK/FM modulation at a baud rate of 9,600, with a modulation index of 0.5. The demodulator works at a sample rate of 57,600Sa/s.

View File

@ -152,8 +152,10 @@ bool AISGUI::handleMessage(const Message& message)
// Decode the message // Decode the message
AISMessage *ais = AISMessage::decode(report.getPacket()); AISMessage *ais = AISMessage::decode(report.getPacket());
// Update table // Update table
if (ais) {
updateVessels(ais, report.getDateTime()); updateVessels(ais, report.getDateTime());
} }
}
return false; return false;
} }

View File

@ -179,6 +179,10 @@ QString AISMessage::typeToString(quint8 type)
AISMessage* AISMessage::decode(const QByteArray ba) AISMessage* AISMessage::decode(const QByteArray ba)
{ {
if (ba.size() < 1) {
return nullptr;
}
int id = (ba[0] >> 2) & 0x3f; int id = (ba[0] >> 2) & 0x3f;
if ((id == 1) || (id == 2) || (id == 3)) { if ((id == 1) || (id == 2) || (id == 3)) {

View File

@ -60,6 +60,8 @@ void ConfigurationsDialog::populateTree()
return; return;
} }
sortConfigurations();
QList<Configuration*>::const_iterator it = m_configurations->begin(); QList<Configuration*>::const_iterator it = m_configurations->begin();
int middleIndex = m_configurations->size() / 2; int middleIndex = m_configurations->size() / 2;
QTreeWidgetItem *treeItem; QTreeWidgetItem *treeItem;
@ -445,14 +447,14 @@ void ConfigurationsDialog::on_configurationImport_clicked()
} }
} }
void ConfigurationsDialog::on_configurationTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous) void ConfigurationsDialog::on_configurationsTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous)
{ {
(void) current; (void) current;
(void) previous; (void) previous;
updateConfigurationControls(); updateConfigurationControls();
} }
void ConfigurationsDialog::on_configurationTree_itemActivated(QTreeWidgetItem *item, int column) void ConfigurationsDialog::on_configurationsTree_itemActivated(QTreeWidgetItem *item, int column)
{ {
(void) item; (void) item;
(void) column; (void) column;

View File

@ -69,8 +69,8 @@ private slots:
void on_configurationImport_clicked(); void on_configurationImport_clicked();
void on_configurationDelete_clicked(); void on_configurationDelete_clicked();
void on_configurationLoad_clicked(); void on_configurationLoad_clicked();
void on_configurationTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous); void on_configurationsTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
void on_configurationTree_itemActivated(QTreeWidgetItem *item, int column); void on_configurationsTree_itemActivated(QTreeWidgetItem *item, int column);
void accept() override; void accept() override;
signals: signals: