Skip to content

Commit 25eb00c

Browse files
committed
1 parent b62c902 commit 25eb00c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: libaudiofile/modules/IMA.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ int IMA::decodeBlockWAVE(const uint8_t *encoded, int16_t *decoded)
169169
if (encoded[1] & 0x80)
170170
m_adpcmState[c].previousValue -= 0x10000;
171171

172-
m_adpcmState[c].index = encoded[2];
172+
m_adpcmState[c].index = clamp(encoded[2], 0, 88);
173173

174174
*decoded++ = m_adpcmState[c].previousValue;
175175

@@ -210,7 +210,7 @@ int IMA::decodeBlockQT(const uint8_t *encoded, int16_t *decoded)
210210
predictor -= 0x10000;
211211

212212
state.previousValue = clamp(predictor, MIN_INT16, MAX_INT16);
213-
state.index = encoded[1] & 0x7f;
213+
state.index = clamp(encoded[1] & 0x7f, 0, 88);
214214
encoded += 2;
215215

216216
for (int n=0; n<m_framesPerPacket; n+=2)

0 commit comments

Comments
 (0)