[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problems with miss-behaving uBlox Module
From: |
Gary E. Miller |
Subject: |
Re: Problems with miss-behaving uBlox Module |
Date: |
Mon, 29 Mar 2021 22:49:58 -0700 |
Yo Andreas!
On Tue, 30 Mar 2021 04:58:45 +0000
Neustifter Andreas <Andreas.Neustifter@kapsch.net> wrote:
> > I added a check in packet.c for a u-blox packet with a length field
> > containing zero. Now in git head. It could not go into an
> > infinite loop, but it possibly could have looped a long time.
>
> Yes, this is what I have done in the interim as well but wanted to
> verify it first. Good to know that you came to the same conclusion.
Nothing verified until I have a data sample that used to fail.
> Philosophical topic: since lexer->length is a (unsigned) size_t I
> think the else branch will never be executed. In this case: do you
> prefer leaving the else in there, just in case or remove it (and
> maybe add a comment?).
I think you are talking about this code:
if (0 == lexer->length) {
// no payload
lexer->state = UBX_CHECKSUM_A;
} else if (MAX_PACKET_LENGTH >= lexer->length) {
// normal size payload
lexer->state = UBX_LENGTH_2;
} else {
// bad length
return character_pushback(lexer, GROUND_STATE);
}
In that case the else can happen if the length is too long. Coverity
is pretty fussy about having tests like that.
> The information contained in this e-mail message is privileged and
> confidential and is for the exclusive use of the addressee.
Fat chance.
RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
gem@rellim.com Tel:+1 541 382 8588
Veritas liberabit vos. -- Quid est veritas?
"If you can't measure it, you can't improve it." - Lord Kelvin
pgpASpuUbagwJ.pgp
Description: OpenPGP digital signature