13
0

Use byte-offset when reading size at ringbuffer boundary

This likely fixes https://github.com/sfztools/sfizz/issues/221
This commit is contained in:
Robin Gareus 2020-05-12 19:30:15 +02:00
parent ab6e274613
commit 9908419f89
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -108,7 +108,7 @@ Worker::verify_message_completeness(PBD::RingBuffer<uint8_t>* rb)
memcpy (&size, vec.buf[0], sizeof (size)); memcpy (&size, vec.buf[0], sizeof (size));
} else { } else {
memcpy (&size, vec.buf[0], vec.len[0]); memcpy (&size, vec.buf[0], vec.len[0]);
memcpy (&size + vec.len[0], vec.buf[1], sizeof(size) - vec.len[0]); memcpy (& reinterpret_cast<uint8_t*>(&size)[vec.len[0]], vec.buf[1], sizeof(size) - vec.len[0]);
} }
if (read_space < size+sizeof(size)) { if (read_space < size+sizeof(size)) {
/* message from writer is yet incomplete. respond next cycle */ /* message from writer is yet incomplete. respond next cycle */