[FFmpeg-devel] [PATCH]lavf/swfdec: Reduce score when auto-detecting swf files

Carl Eugen Hoyos ceffmpeg at gmail.com
Sat Jan 20 16:42:41 EET 2018


2018-01-20 3:14 GMT+01:00 Michael Niedermayer <michael at niedermayer.cc>:
> On Sat, Jan 20, 2018 at 02:36:08AM +0100, Carl Eugen Hoyos wrote:
>> 2018-01-19 23:42 GMT+01:00 Michael Niedermayer <michael at niedermayer.cc>:
>> > On Fri, Jan 19, 2018 at 07:25:43PM +0100, Carl Eugen Hoyos wrote:
>> >> 2018-01-19 18:51 GMT+01:00 Michael Niedermayer <michael at niedermayer.cc>:
>> >> > On Thu, Jan 18, 2018 at 09:28:40PM +0100, Carl Eugen Hoyos wrote:
>> >> >> Hi!
>> >> >>
>> >> >> The probe score for swf files (with uncompressed headers) is currently
>> >> >> very high after testing a little more than 24bit, attached patch
>> >> >> reduces the score.
>> >> >
>> >> > hmm
>> >> > the first 24 bits are tested and all but 2 values are rejected
>> >> >
>> >> > thats 23 bits that must match
>> >>
>> >> Ok.
>> >>
>> >> > then 4 values are tested which can be from 1 to 31 bits each
>> >> > the tests are each either == 0 or != 0 so they are a bit weak
>> >> > but its at least adding 4 bits that must match and also len
>> >>
>> >> I was sure this is not equivalent to four bits on a specific
>> >> position (but for the patch I assumed a "best case scenario"
>> >> where this actually were the case).
>> >>
>> >> > itself has to be smallish so we could argue that this gets us to
>> >> > about 28 bits
>> >>
>> >> > and then buf[3] is checked to be < 20
>> >> > at this point we need about 32bits to be matching, still not huge but
>> >> > id think this is stronger than what file extensions prove which are
>> >> > MAX/2
>> >>
>> >> We return MAX/2 for many "initial 32 bits" tests and I believe
>> >> we made good experience (and for MAX/2 the extension is
>> >> ignored or do I misremember?)
>> >>
>> >
>> >> > The test is weakened by using 0 / not 0 / ascii as values though
>> >> >
>> >> > Have you seen an actual probe failure ?
>> >>
>> >> No, I was looking at another issue.
>> >
>> > we have many files with wrong extensions, its not uncommon
>>
>> Yes, I misremembered how extensions are rated, I actually
>> wanted to set the return value to "AVPROBE_SCORE_EXTENSION + 1".
>> Would that be ok?
>
> yes

Pushed with this new value.

Thank you, Carl Eugen


More information about the ffmpeg-devel mailing list