From af254b8ff95ce1dca449ecbec088d0f643df4d86 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 19 Aug 2020 00:17:45 +0200 Subject: [PATCH] Fix Lua AudioRom read (buffer overflow) --- libs/ardour/audiorom.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/ardour/audiorom.cc b/libs/ardour/audiorom.cc index a5904cd353..a4f54ea195 100644 --- a/libs/ardour/audiorom.cc +++ b/libs/ardour/audiorom.cc @@ -20,6 +20,7 @@ #include "pbd/failed_constructor.h" #include "ardour/audiorom.h" +#include "ardour/runtime_functions.h" using namespace ARDOUR; @@ -51,6 +52,6 @@ AudioRom::read (Sample* dst, samplepos_t pos, samplecnt_t cnt, int channel) cons return 0; } samplecnt_t to_copy = std::min (cnt, _size - pos); - memcpy (dst, &_rom[pos], sizeof (Sample) * _size); + copy_vector (dst, &_rom[pos], to_copy); return to_copy; }