On Tue Jul 30 18:07:42 2024 +0000, Alfred Agrell wrote:
I'm nor aware of this kind of stuff causing any trouble in practice, but I agree with fixing it anyways. Creating a two-or-more-past-the-end pointer is UB. I also agree with refactoring the bounds check into a function instead of having five different copies. (The last two are TOOLBAR_GetButton and TOOLBAR_SetCmdId, which are correct, but still duplicate.) Finally, I strongly suspect TOOLBAR_GetCheckedGroupButtonIndex contains a similar bug. I suspect the > should be >=.
@zhiyi, how do you like offer from @Alcaro?