steinbergmedia / vstgui

A user interface toolkit mainly for audio plug-ins
Other
880 stars 124 forks source link

COptionMenu().getMax() returns 18446744073709551616 #316

Closed sophiapoirier closed 10 months ago

sophiapoirier commented 10 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