Read WAV frames in chunks instead of trusting the header count


The PCM frame count declared by a WAV header is untrusted. Both
QDrWavAudioDecoder and QSampleCache sized their output buffer up
front from that count, so a crafted file with a huge or wrapping
frame count could trigger an enormous allocation or an integer
overflow. Add a QtMultimediaPrivate::readFramesInChunks() helper
that grows the buffer chunk by chunk as frames are actually
produced, and fails unless exactly the declared frame count is
read.

Fixes: QTBUG-151155
Pick-to: 6.12
Change-Id: I32c9e77cfd29857b8f08f085fe7c77553cb3e3fd
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
Reviewed-by: Nils Petter Skålerud <nils.petter.skalerud@qt.io>
commitab5d16cdca6d1560bb36b5629352c3e8bc78a408
parent94e0c042ed6c1a9a0288ec1aa5194108d6db8a29
authorTim Blechmann <tim.blechmann@qt.io>
committerArtem Dyomin <artem.dyomin@qt.io>
commit timeTue, 6 Oct 2026 00:26:52 +0000