shithub: opus

Download patch

ref: 037918a8fe31469fe69c607a9e4a68caaf9a4e6d
parent: ab0b5f5ff388f70a81b4497beef6d7562ebc4068
author: Vincent Penquerc'h <[email protected]>
date: Tue Nov 22 10:12:44 EST 2011

Guard against pathologically small buffer

--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -1212,6 +1212,11 @@
        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;