#74·microui

Unexpected Callback Invocation

Author: ghostCreated Jun 28, 2025Updated Jun 28, 2025

Documentation does not specify any details in regards of `ctx->text_width` and `ctx->text_height` callback functions. In particular, `ctx->text_width` is called with parameter `len` equal to `-1` two times. In many cases, this may lead to either overflow (when number is interpreted as a huge unsigned integer), or underflow (often allocators for strings increase the length by one to store the terminating null character; this leads to the `len` being interpreted as zero). Documentation must clarify that `ctx->text_width` may be called with `len` parameter of `-1`, in which case user must explicitly calculate the size of the string (presumably using `strlen` on the assumption that the string is null terminated).