summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXANTRONIX Development2022-02-03 18:02:40 -0500
committerXANTRONIX Development2022-02-03 18:02:40 -0500
commit34c18d0de34430c1c53b69f06d54440cf3a25d93 (patch)
tree64ec20907d8f12c0b5f2a7d52388ccc8f122e246
parent46ee5553721505ae172faa357daed79c54df1387 (diff)
downloadxas-34c18d0de34430c1c53b69f06d54440cf3a25d93.tar.gz
xas-34c18d0de34430c1c53b69f06d54440cf3a25d93.tar.bz2
xas-34c18d0de34430c1c53b69f06d54440cf3a25d93.zip
Ensure stream reads can't oversohot buffer size
-rw-r--r--src/audio.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/audio.c b/src/audio.c
index f5dc5ee..001d449 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -178,6 +178,10 @@ ssize_t xas_audio_stream_read(xas_audio_stream *stream,
size_t count) {
*samples = stream + 1;
+ if (count > stream->buffer_size) {
+ count = stream->buffer_size;
+ }
+
return stream->fill(stream->ctx,
*samples,
count,