Actions
Bug #4388
closedbitvec: bitvec_read_field() can never return negative value on error
Start date:
02/05/2020
Due date:
% Done:
100%
Spec Reference:
Description
The doxygen documentation of bitvec_read_field() tells us that it can return a negative on error:
/*! read part of the vector
* \param[in] bv The boolean vector to work on
* \param[in,out] read_index Where reading supposed to start in the vector
* \param[in] len How many bits to read from vector
* \returns read bits or *negative value on error*
*/
uint64_t bitvec_read_field(struct bitvec *bv, unsigned int *read_index, unsigned int len) { ... }
However, as can be seen its return value is unsigned - uint64_t. So actually it returns a huge number on error.
This can be seen in the logs of OsmoPCU:
| Padding = 22|86|86|86|86|18446744073709551594|
where 18446744073709551594 is basically a negative number casted to uint64_t.
Actions