[FFmpeg-devel] [libav-devel] [PATCH] vorbisdec: avoid calling get_bits to read 0 bits

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Sat Jan 2 23:46:35 CET 2016

On 02.01.2016 23:36, Luca Barbato wrote:
> On 02/01/16 23:26, Andreas Cadhalpun wrote:
>> On 02.01.2016 23:03, Luca Barbato wrote:
>>> On 02/01/16 20:01, Andreas Cadhalpun wrote:
>>>> It's documented to only support reading 1-25 bits.
>>>> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
>>>> ---
>>>>    libavcodec/vorbisdec.c | 4 ++--
>>>>    1 file changed, 2 insertions(+), 2 deletions(-)
>>> When do we get in this situation?
>> I'm not sure what you mean.
> Is it something exceptional (it is a corner case that might
> be rejected before we get to that place) or is just something overlooked?

I think it's just something overlooked.

>> The first one happens if bits is 0, e.g. because vc->audio_channels is 1.
>> The second one happens if rangebits is 0.
> Looks like we are getting at least some of places in which bits 0 is valid
> maybe a get_bits0 would simplify at least the looks of some of those cases ^^

Maybe, but on the other hand there are only about a dozen or so places in
the complete code base that would benefit from that.

Do you think that's enough to justify adding another helper function?

Best regards,

More information about the ffmpeg-devel mailing list