Redundantly limit number of drag-and-drop formats

As reported in #149, the DrumCore 3 plugin would segfault when trying to
drag files from it. This happened because the plugin presumably
underflows somewhere and then reports that it supports 4294967282
different drag-and-drop formats, even though yabridge asked for a
maximum of 16.
This commit is contained in:
Robbert van der Helm
2021-12-16 01:52:37 +01:00
parent 7ddcd5c315
commit d48dbe71da
2 changed files with 9 additions and 0 deletions
+5
View File
@@ -790,6 +790,11 @@ void CALLBACK dnd_winevent_callback(HWINEVENTHOOK /*hWinEventHook*/,
&num_formats);
enumerator->Release();
// NOTE: This DrumCore 3 plugin reports 4294967282 for `num_formats` which
// is uh a lot more than 16. So to prevent causing a segfault here we
// need to manually cap `num_formats` to 16.
num_formats = std::min(num_formats, static_cast<unsigned int>(16));
// NOTE: MeldaProduction plugins don't return any supported formats for some
// reason, so we'll hardcode a HDROP
if (num_formats == 0) {