microui
microui copied to clipboard
Unexpected Callback Invocation
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).