diff options
author | Robin Gareus <robin@gareus.org> | 2018-12-05 16:04:29 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2018-12-05 16:04:29 +0100 |
commit | 863a6ade9ee42ca6623980b122aed9c8378066df (patch) | |
tree | cd42dc7c7ee5a634871cb1dcd850d73f380c291b /libs/ardour/ardour/silentfilesource.h | |
parent | 5f3672eef0f2642009459b1b9f921b796f5adcf7 (diff) |
Prevent endless read of silent files
This fixes issues with analysis and archiving that rely on a readable
to return 0.
Note however that createSilent() uses max_samplecnt (INT64_MAX) by
default. This relies on a region setting the length of its missing
source.
Diffstat (limited to 'libs/ardour/ardour/silentfilesource.h')
-rw-r--r-- | libs/ardour/ardour/silentfilesource.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libs/ardour/ardour/silentfilesource.h b/libs/ardour/ardour/silentfilesource.h index a0bd51cc38..79dc8b0a50 100644 --- a/libs/ardour/ardour/silentfilesource.h +++ b/libs/ardour/ardour/silentfilesource.h @@ -51,7 +51,8 @@ protected: _length = len; } - samplecnt_t read_unlocked (Sample *dst, samplepos_t /*start*/, samplecnt_t cnt) const { + samplecnt_t read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const { + cnt = std::min (cnt, _length - start); memset (dst, 0, sizeof (Sample) * cnt); return cnt; } |