summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2018-11-02 19:02:33 +0200
committerJari Vetoniemi <mailroxas@gmail.com>2018-11-02 19:02:33 +0200
commit625fb922bfab3de3c199ad59b690dd50083f8585 (patch)
treec63cdaa0553cc9a3f3ee2d7b1117e31eecd524fb
parentdbd276bd25ca9add50dea9b67ea57f0dd83e0a67 (diff)
some hardening
-rw-r--r--src/pcm.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/pcm.c b/src/pcm.c
index d1e3734..3a28b37 100644
--- a/src/pcm.c
+++ b/src/pcm.c
@@ -369,7 +369,8 @@ io_do(snd_pcm_t *pcm, const void *buffer, const size_t frames, size_t (*io)(stru
const size_t enc_frames = sizeof(encoded) / (params[1].bps * chans);
const size_t max_frames = MIN(dec_frames, enc_frames);
for (const unsigned char *p = buffer; total_frames > 0;) {
- const int todo_frames = (total_frames > max_frames ? max_frames : total_frames);
+ const int todo_frames = MIN(max_frames, total_frames);
+ assert(todo_frames <= total_frames);
total_frames -= todo_frames;
// sadly can't function pointer here as some formats may need different parameters for decoder