microui icon indicating copy to clipboard operation
microui copied to clipboard

Unexpected Callback Invocation

Open ghost opened this issue 6 months ago • 0 comments

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).

ghost avatar Jun 28 '25 04:06 ghost