[libav-devel] [PATCH] get_bits: introduce safe bitreading to prevent overreads.

Måns Rullgård mans at mansr.com
Fri Dec 16 23:59:47 CET 2011


Måns Rullgård <mans at mansr.com> writes:

> Martin Storsjö <martin at martin.st> writes:
>
>> On Fri, 16 Dec 2011, Mans Rullgard wrote:
>>
>>> diff --git a/configure b/configure
>>> index 974e75f..0349862 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -113,6 +113,7 @@ Configuration options:
>>>   --disable-dxva2          disable DXVA2 code
>>>   --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
>>>   --enable-hardcoded-tables use hardcoded tables instead of runtime generation
>>> +  --disable-safe-bitstream-reader disable buffer boundary checking in bitreaders (faster, but may crash)
>>>   --enable-memalign-hack   emulate memalign, interferes with memory debuggers
>>>   --disable-everything     disable all components listed below
>>>   --disable-encoder=NAME   disable encoder NAME
>>> @@ -976,6 +977,7 @@ CONFIG_LIST="
>>>     rdft
>>>     rtpdec
>>>     runtime_cpudetect
>>> +    safe_bitstream_reader
>>>     shared
>>>     sinewin
>>>     small
>>
>> Doesn't this still need to be enabled somewhere, or the help text
>> changed into --enable?
>
> Yes, I'm running some benchmarks now to determine whether to enable this
> by default.  We'll update the patch depending on the outcome.

The performance penalty on ARM (both Cortex-A8 and A9) is 0-2% for most
files, 4% in extreme cases.  In many cases, the change is within the
error margin of the measurement.

I will not object to turning this on by default.

-- 
Måns Rullgård
mans at mansr.com


More information about the libav-devel mailing list