On Sat, Mar 20, 2021 at 10:00 PM Stephen R. van den Berg srb@cuci.nl wrote:
The code was/is not robust to begin with though. In io_add_space() the code was:
if( io->len == io->offset ) io->offset = io->len = 0; if( !force && io->malloced && !io->locked && io->len+bytes < io->allocated && (!bytes || io->len+bytes > io->len)) return io->buffer+io->len;
Checking for locked in the second if, and not in the first seems sloppy at best; defensive programming prescribes more robust checks here.
I don't mind that change, I just wanted to be sure there was no corruption observed that could not actually be explained with this code.