Coverity CID 1518991: Integer handling issues
Report:
*** CID 1518991: Integer handling issues (SIGN_EXTENSION)
/src/core/or/congestion_control_vegas.c: 341 in cwnd_became_full()
335 * full. This can happen if several SENDMEs arrive before we
336 * return to the eventloop to fill the inbuf on edge connections.
337 */
338 static inline bool
339 cwnd_became_full(const congestion_control_t *cc)
340 {
>>> CID 1518991: Integer handling issues (SIGN_EXTENSION)
>>> Suspicious implicit sign extension: "cc->sendme_inc" with type
"uint8_t" (8 bits, unsigned) is promoted in "cc_vegas_cwnd_full_gap *
cc->sendme_inc" to type "int" (32 bits, signed), then sign-extended to type
"unsigned long" (64 bits, unsigned). If "cc_vegas_cwnd_full_gap *
cc->sendme_inc" is greater than 0x7FFFFFFF, the upper bits of the result
will all be 1.
341 if (cc->inflight + cc_vegas_cwnd_full_gap*cc->sendme_inc >=
cc->cwnd) {
342 return true;
343 } else {
344 return false;
345 }
346 }