steinbergmedia / vstgui

A user interface toolkit mainly for audio plug-ins
Other
850 stars 121 forks source link

COptionMenu().getMax() returns 18446744073709551616 #316

Closed sophiapoirier closed 6 months ago

sophiapoirier commented 6 months ago

If you create a VSTGUI::COptionMenu (any way other than copy constructing an existing one) and call getMax() or getRange() before adding any entries, these return 18446744073709551616. This is because getMax() bases its result on calling size() on an empty std::vector minus one, which wraps to 64-bit unsigned integer max i.e. 18446744073709551615 and then casts that to 32-bit float which cannot represent that value and instead rounds to 18446744073709551616. proposed fix attached coptionmenu.h.patch