8000 Add output_length_used check as requested · pypewpew/circuitpython@2fe0fa5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2fe0fa5

Browse files
Add output_length_used check as requested
1 parent 5432257 commit 2fe0fa5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ports/raspberrypi/audio_dma.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ STATIC size_t audio_dma_convert_samples(audio_dma_t *dma, uint8_t *input, uint32
6565
// reading bytes, writing 16-bit words, so output buffer will be bigger.
6666

6767
output_length_used *= 2;
68+
if (output_length_used > output_length) {
69+
mp_raise_RuntimeError(translate("Internal audio buffer too small"));
70+
}
6871

6972
// Correct "rail-to-rail" scaling of arbitrary-depth input to output
7073
// requires more operations than this, but at least the vital 8- to

0 commit comments

Comments
 (0)
0