https://bugs.kde.org/show_bug.cgi?id=514395
--- Comment #2 from Jonathan Verner <[email protected]> --- (In reply to Jonathan Verner from comment #1) > I've changed the `updateWindowSize` method as follows: > > ```cpp > if (scaled_gain >= static_cast<double>(std::numeric_limits<int>::max())) > { > max_window = 5000 + 1; > Out(SYS_UTP|LOG_DEBUG) << "RemoteWindow::updateWindowSize: > scaled_gain too big: " << scaled_gain << " " << max_window << endl; > } else if (scaled_gain <= > static_cast<double>(std::numeric_limits<int>::min())) { > max_window = MIN_PACKET_SIZE; > Out(SYS_UTP|LOG_DEBUG) << "RemoteWindow::updateWindowSize: > scaled_gain too small: " << scaled_gain << " " << max_window << endl; > } else { > int d = (int)qRound(scaled_gain); > if (max_window + d < MIN_PACKET_SIZE) > max_window = MIN_PACKET_SIZE; > else > max_window += d; > } > ``` > > And now it seems to run fine. However, the above change just avoids the > assert > (note that I've encountered a scaled_gain too large *and* too small). I > don't quite > understand the code, so I am not sure what to do if `scaled_gain` is outside > of the valid range. With the above changes, I am now hitting a different assert in `RemoteWindow::checkLostPackets` (on line 128): ``` 126 if (lost_packets) { 127 Out(SYS_UTP | LOG_DEBUG) << "UTP: lost packets on connection " << hdr->connection_id << endl; 128 max_window = (bt::Uint32)qRound(0.78 * max_window); 129 } ``` I suspect that this is due to `qRound` rounding to `int` and being passed (a double coming from) an `uint` which can be out of range (even when multiplied by 0.78). -- You are receiving this mail because: You are watching all bug changes.
