Tim says it's safe

This commit is contained in:
Jean-Marc Valin 2011-10-13 16:24:11 -04:00
parent ab96457554
commit e9b53212f2
2 changed files with 2 additions and 2 deletions

View file

@ -321,7 +321,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
} }
start_band = 0; start_band = 0;
if (!decode_fec && mode != MODE_CELT_ONLY && data != NULL && ec_tell(&dec)+17+20*(st->mode == MODE_HYBRID) < 8*len) if (!decode_fec && mode != MODE_CELT_ONLY && data != NULL && ec_tell(&dec)+17+20*(st->mode == MODE_HYBRID) <= 8*len)
{ {
/* Check if we have a redundant 0-8 kHz band */ /* Check if we have a redundant 0-8 kHz band */
if (mode == MODE_HYBRID) if (mode == MODE_HYBRID)

View file

@ -918,7 +918,7 @@ int opus_encode_float(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
} }
} }
if ( st->mode != MODE_CELT_ONLY && ec_tell(&enc)+17+20*(st->mode == MODE_HYBRID) < 8*(max_data_bytes-1)) if ( st->mode != MODE_CELT_ONLY && ec_tell(&enc)+17+20*(st->mode == MODE_HYBRID) <= 8*(max_data_bytes-1))
{ {
/* For SILK mode, the redundancy is inferred from the length */ /* For SILK mode, the redundancy is inferred from the length */
if (st->mode == MODE_HYBRID && (redundancy || ec_tell(&enc)+37 < 8*nb_compr_bytes)) if (st->mode == MODE_HYBRID && (redundancy || ec_tell(&enc)+37 < 8*nb_compr_bytes))