Fix issue when importing m4a
PBD::RingBuffer<>::rw_vector can return a NULL pointer for the 2nd buffer, which can lead to undefined behavior: `memcpy (NULL, src, 0);`
This commit is contained in:
parent
f8a5d45b7a
commit
bd6fb8f172
@ -236,6 +236,9 @@ FFMPEGFileImportableSource::did_read_data (std::string data, size_t size)
|
|||||||
samplecnt_t written = 0;
|
samplecnt_t written = 0;
|
||||||
for (int i = 0; i < 2; ++i) {
|
for (int i = 0; i < 2; ++i) {
|
||||||
samplecnt_t cnt = std::min<samplecnt_t> (n_samples, wv.len[i]);
|
samplecnt_t cnt = std::min<samplecnt_t> (n_samples, wv.len[i]);
|
||||||
|
if (!cnt || !wv.buf[i]) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
memcpy (wv.buf[i], cur, cnt * sizeof (float));
|
memcpy (wv.buf[i], cur, cnt * sizeof (float));
|
||||||
written += cnt;
|
written += cnt;
|
||||||
n_samples -= cnt;
|
n_samples -= cnt;
|
||||||
|
Loading…
Reference in New Issue
Block a user