Skip to content

Fixed issues with parsing METARS that could cause an ifinite loop crash and misinterpreted units#528

Merged
apps4av merged 3 commits into
apps4av:masterfrom
Silicon42:master
Apr 24, 2026
Merged

Fixed issues with parsing METARS that could cause an ifinite loop crash and misinterpreted units#528
apps4av merged 3 commits into
apps4av:masterfrom
Silicon42:master

Conversation

@Silicon42
Copy link
Copy Markdown
Contributor

Previously, parseData() prevented parsing past the last token by not incrementing the index if it was already on the last token, which could lead to getting stuck in an infinite loop if the last token was a runway visual range group, a weather group, or a sky condition, eventually leading to a crash. This was fixed by unconditionally incrementing the index and then conditionally returning from the function if there were no more tokens to parse. This also fixed an oversight where the parser previously assumed non-empty METARS would have at least 3 tokens which could lead to indexing past the last token and causing an exception on missing/delayed METARS which may have their LocID or Time fields set to "NIL=" according to the GDL90 specification.

A sample of a problematic METAR that this fixes is as follows
METAR KMER 242355Z 35013KT 10SM CLR=

Additionally, the trailing '=' that may be included as an optional message delimiter would remain on the last token, which could cause unit detection using String.endsWith() to select the wrong units. This was fixed by removing the trailing '=' from the data string before parsing.

@apps4av apps4av merged commit 188ca6d into apps4av:master Apr 24, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants