From 037918a8fe31469fe69c607a9e4a68caaf9a4e6d Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h <vincent.penquerch@collabora.co.uk> Date: Tue, 22 Nov 2011 15:12:44 +0000 Subject: [PATCH] Guard against pathologically small buffer --- src/opus_encoder.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/opus_encoder.c b/src/opus_encoder.c index 5dda66523..c00bc2f8a 100644 --- a/src/opus_encoder.c +++ b/src/opus_encoder.c @@ -1212,6 +1212,11 @@ int opus_encode_float(OpusEncoder *st, const opus_val16 *pcm, int frame_size, the decoder to call the PLC */ if (ec_tell(&enc) > (max_data_bytes-1)*8) { + if (max_data_bytes < 2) + { + RESTORE_STACK; + return OPUS_BUFFER_TOO_SMALL; + } data[1] = 0; ret = 1; st->rangeFinal = 0; -- GitLab