From 2038a91cde2933d5fdbb7c747b7922a023e92f0c Mon Sep 17 00:00:00 2001 From: falkTX Date: Wed, 5 Sep 2018 20:22:33 +0200 Subject: [PATCH] Print warning if LV2 UI tries to send bad data --- source/backend/plugin/CarlaPluginLV2.cpp | 6 +++++- source/bridges-ui/CarlaBridgeFormatLV2.cpp | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/source/backend/plugin/CarlaPluginLV2.cpp b/source/backend/plugin/CarlaPluginLV2.cpp index dde8ac5b5..eb7eadc06 100644 --- a/source/backend/plugin/CarlaPluginLV2.cpp +++ b/source/backend/plugin/CarlaPluginLV2.cpp @@ -4772,7 +4772,11 @@ public: const LV2_Atom* const atom((const LV2_Atom*)buffer); // plugins sometimes fail on this, not good... - CARLA_SAFE_ASSERT_INT2(bufferSize == lv2_atom_total_size(atom), bufferSize, atom->size); + const uint32_t totalSize = lv2_atom_total_size(atom); + const uint32_t paddedSize = lv2_atom_pad_size(totalSize); + + if (bufferSize != totalSize && bufferSize != paddedSize) + carla_stderr2("Warning: LV2 UI sending atom with invalid size! size: %u, padded-size: %u", totalSize, paddedSize); for (uint32_t i=0; i < fEventsIn.count; ++i) { diff --git a/source/bridges-ui/CarlaBridgeFormatLV2.cpp b/source/bridges-ui/CarlaBridgeFormatLV2.cpp index 855245e34..81807c8a4 100644 --- a/source/bridges-ui/CarlaBridgeFormatLV2.cpp +++ b/source/bridges-ui/CarlaBridgeFormatLV2.cpp @@ -713,7 +713,11 @@ public: const LV2_Atom* const atom((const LV2_Atom*)buffer); // plugins sometimes fail on this, not good... - CARLA_SAFE_ASSERT_INT2(bufferSize == lv2_atom_total_size(atom), bufferSize, atom->size); + const uint32_t totalSize = lv2_atom_total_size(atom); + const uint32_t paddedSize = lv2_atom_pad_size(totalSize); + + if (bufferSize != totalSize && bufferSize != paddedSize) + carla_stderr2("Warning: LV2 UI sending atom with invalid size! size: %u, padded-size: %u", totalSize, paddedSize); writeLv2AtomMessage(rindex, atom); }