Hi all, I think this will be my last bug to check in for the day
In dcPackdata.cxx, there is (only) a routine set_used_length which basically dynamically grows a buffer that is used while packing/unpacking distributed function calls into datagrams.
The calculation to determine the “new” buffer size, if it is determined that it needs to grow, is:
_allocated_size = size * size + extra_size;
This is growing the buffer exponentially, which tends to actually work well enough in most cases since the amount of data being transmitted is small. However I tried to pass a 100KB+ string through it earlier, and found Panda crashing on the new[] operator. Apparently Windows didn’t think it was reasonable to allocate a 10GB buffer for it Actually it ‘only’ tried to allocate 3.something GB, presumably because the multiplication overflowed.
I suspect the line in question should look more like:
_allocated_size = size + size + extra_size;
However, I discovered even after fixing that I couldn’t pass a 100KB string… the packer uses a 16-bit int to track the length of the string. But that is my own design problem to solve … probably I should be using the blob32 type.
Anyways, thanks again!
- lem