Skip to content

Commit

Permalink
SOUND: Force alignment of IMA ADPCM stream size to block size
Browse files Browse the repository at this point in the history
This decoder can't cope with unaligned input.
  • Loading branch information
DrMcCoy committed Aug 2, 2018
1 parent 94b1e83 commit 57de459
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/sound/decoders/adpcm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ size_t Apple_ADPCMStream::readBuffer(int16 *buffer, const size_t numSamples) {
class MSIma_ADPCMStream : public Ima_ADPCMStream {
public:
MSIma_ADPCMStream(Common::SeekableReadStream *stream, bool disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign)
: Ima_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) {
: Ima_ADPCMStream(stream, disposeAfterUse, size - (size % ((blockAlign == 0) ? 1 : blockAlign)),
rate, channels, blockAlign) {

if (blockAlign == 0)
error("MSIma_ADPCMStream(): blockAlign isn't specified");
Expand Down

0 comments on commit 57de459

Please sign in to comment.