mirror of
https://github.com/nu774/fdkaac.git
synced 2024-12-28 08:10:43 +01:00
wav/caf parser: add format checks
fixes https://github.com/nu774/fdkaac/issues/54
This commit is contained in:
parent
1a1ee2924f
commit
ecddb7d633
@ -75,8 +75,10 @@ int caf_desc(caf_reader_t *reader, int64_t chunk_size)
|
||||
ENSURE(mFormatID == M4AF_FOURCC('l','p','c','m'));
|
||||
ENSURE(mSampleRate && mBytesPerPacket &&
|
||||
mChannelsPerFrame >= 1 && mChannelsPerFrame <= 8 &&
|
||||
mBitsPerChannel && mFramesPerPacket == 1 &&
|
||||
mBitsPerChannel > 0 && mBitsPerChannel < 256 &&
|
||||
mFramesPerPacket == 1 &&
|
||||
mBytesPerPacket % mChannelsPerFrame == 0 &&
|
||||
mBytesPerPacket < 256 &&
|
||||
mBytesPerPacket >= mChannelsPerFrame * ((mBitsPerChannel + 7) / 8));
|
||||
|
||||
desc->sample_rate = mSampleRate;
|
||||
|
@ -113,8 +113,10 @@ int wav_fmt(wav_reader_t *reader, uint32_t size)
|
||||
wValidBitsPerSample = wBitsPerSample;
|
||||
|
||||
ENSURE(wFormatTag == 1 || wFormatTag == 3 || wFormatTag == 0xfffe);
|
||||
ENSURE(nChannels && nSamplesPerSec && nAvgBytesPerSec &&
|
||||
nBlockAlign && wBitsPerSample && !(wBitsPerSample & 7) &&
|
||||
ENSURE(nChannels > 0 && nChannels <= 8 &&
|
||||
nSamplesPerSec && nAvgBytesPerSec &&
|
||||
nBlockAlign && nBlockAlign < 256 &&
|
||||
wBitsPerSample && wBitsPerSample < 256 && !(wBitsPerSample & 7) &&
|
||||
nBlockAlign == nChannels * wBitsPerSample / 8);
|
||||
|
||||
if (wFormatTag == 3)
|
||||
|
Loading…
Reference in New Issue
Block a user