libais
libais copied to clipboard
Ais8_200_40 is parsed incorrectly (Crash)
Here is a string that consistently reproduces this:
"!AIVDM,1,1,,B,86:hqAh0J010,0*6A"
Ais8_200_40::Ais8_200_40(const char *nmea_payload, const size_t pad)
: Ais8(nmea_payload, pad), form(0), dir(0), stream_dir(0), status_raw(0),
spare2(0) {
assert(dac == 200); <=== This is crashing because dac==1
Hmm... If a dac 1 message is getting to the 8_200_40 decoder, that is definitely a bug. I will look into it when I get a chance.
How did you parse the message that you ended up with a dac==1 message in Ais8_200_40?
I've copy pasted the code below.
static void testSchwehrVector(const vector<string>& lines) {
libais::VdmStream stream;
for (const string &line : lines) {
bool lineAdded = stream.AddLine(line);
if(!lineAdded) {
// Either line is not AIS line or
std::cerr<< "Could not handle" << line << std::endl;
}
}
while(!stream.empty()) {
std::unique_ptr<libais::AisMsg>aisMessage = stream.PopOldestMessage();
if((aisMessage != nullptr) && !aisMessage->had_error()) {
int message_id = aisMessage->message_id;
std::cerr << "Type:" <<message_id;
}
}
}
static void test7() {
const vector<string> lines = {
"!AIVDM,1,1,,B,86:hqAh0J010,0*6A"
};
testSchwehrVector(lines);
}