Bound the byte count in QCoapOption::uintValue()
uintValue() decoded the option value by OR-ing each byte shifted left by
8*i. For a value longer than 4 bytes the shift count reached 32 or more,
which is undefined behaviour. The top-byte shift also operated on a
promoted signed int, which can overflow.
Stop the loop at 4 bytes and cast each byte to the result type before
shifting. Document that only the low 4 bytes are used and point callers
at length().
Task-number: QTBUG-149345
Pick-to: 6.12 6.11 6.8
Change-Id: I3eaab43cedbcf37d15491f882c86645673c2e047
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>