multi: fix add_handle resizing

Due to someone being stupid, the resizing of the multi's transfer
table was actually shrinking it. Oh my.

Add test751 to reproduce, add code assertion.

Fixes #17473
Reported-by: Jeroen Ooms
Closes #17475
This commit is contained in:
Stefan Eissing 2025-05-28 14:04:31 +02:00 committed by Daniel Stenberg
parent 698491f444
commit d16ccbd55d
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
5 changed files with 132 additions and 2 deletions

View file

@ -347,7 +347,8 @@ static CURLMcode multi_xfers_add(struct Curl_multi *multi,
if(unused <= min_unused) {
/* make it a 64 multiple, since our bitsets frow by that and
* small (easy_multi) grows to at least 64 on first resize. */
unsigned int newsize = ((capacity + min_unused) + 63) / 64;
unsigned int newsize = (((capacity + min_unused) + 63) / 64) * 64;
DEBUGASSERT(newsize > capacity);
/* Grow the bitsets first. Should one fail, we do not need
* to downsize the already resized ones. The sets continue
* to work properly when larger than the table, but not