summaryrefslogtreecommitdiffstats
path: root/audio_utils
diff options
context:
space:
mode:
Diffstat (limited to 'audio_utils')
-rw-r--r--audio_utils/spdif/SPDIFEncoder.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/audio_utils/spdif/SPDIFEncoder.cpp b/audio_utils/spdif/SPDIFEncoder.cpp
index 4a8a02a..60b8425 100644
--- a/audio_utils/spdif/SPDIFEncoder.cpp
+++ b/audio_utils/spdif/SPDIFEncoder.cpp
@@ -140,6 +140,12 @@ void SPDIFEncoder::writeBurstBufferBytes(const uint8_t *buffer, size_t numBytes)
clearBurstBuffer();
return;
}
+
+ // Avoid reading first word past end of mBurstBuffer.
+ if (numBytes == 0) {
+ return;
+ }
+ // Pack bytes into short buffer.
uint16_t pad = mBurstBuffer[mByteCursor >> 1];
for (size_t i = 0; i < numBytes; i++) {
if (mByteCursor & 1 ) {