diff options
author | Jari Vetoniemi <mailroxas@gmail.com> | 2018-11-02 19:02:33 +0200 |
---|---|---|
committer | Jari Vetoniemi <mailroxas@gmail.com> | 2018-11-02 19:02:33 +0200 |
commit | 625fb922bfab3de3c199ad59b690dd50083f8585 (patch) | |
tree | c63cdaa0553cc9a3f3ee2d7b1117e31eecd524fb | |
parent | dbd276bd25ca9add50dea9b67ea57f0dd83e0a67 (diff) |
some hardening
-rw-r--r-- | src/pcm.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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 |