SQLite Forum

Odd buffer overflow
Login
The [`_msize()`][1] interface is in the standard library (on some platforms).
It is suppose to work like [`malloc_usable_size()`][2]. If X is a pointer
obtained from malloc(), then `_msize(X)` is suppose to return the number
of usable bytes in the memory allocation.

[1]: https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/z2s077bc(v=vs.100)
[2]: https://man7.org/linux/man-pages/man3/malloc_usable_size.3.html

It appears that the `_msize()` implementation on the OP's system is
malfunctioning.  `_msize()` is not under the control of SQLite, so this
sounds like a system issue to me.

You can work-around the problem by compiling with `-DSQLITE_WITHOUT_MSIZE`.
In that case the `_msize()` routine will not be used.  (SQLite will
substitute its own implementation, which is less efficient, but it guaranteed
to work.)