On 2020-09-01 17:21, Carl Eugen Hoyos wrote:
Am Mi., 2. Sept. 2020 um 01:17 Uhr schrieb <liush...@aosc.io>:

On 2020-09-01 17:07, Carl Eugen Hoyos wrote:
> Am Mi., 2. Sept. 2020 um 00:58 Uhr schrieb <liush...@aosc.io>:
>
>> +static int probe(const AVProbeData *p)
>> +{
>> +    if (AV_RL32(p->buf) == MKTAG('M', 'A', 'D', 'P') &&
>> +        (AV_RL16(p->buf + 4) > 0x00 || AV_RL16(p->buf + 4) <= 0xff))
>> +        return AVPROBE_SCORE_MAX / 3 * 2;
>> +    return 0;
>
> At least add the version check from read_header(),
> you could also add the "sanity checks" you do
> there to this function.

Thanks for the extremely quick response! I agree I can probably move the
version check to `probe()`.

You can copy it.

However the other checks require reading far into the header, I don't
know if it's appropriate to do that in `probe()`.

You can check the size.

Carl Eugen

Thanks for the advice! However, I discovered I made a mistake that led to this issue: the version field should be a `uint16_t` instead of `int16_t`. Also, I actually checked the version in `probe()` with `AV_RL16(p->buf + 4) <= 0xff`.

For the other checks, I have referenced other demuxers that decode similar formats (namely `fsb` and `brstm`), and I found that they didn't do these checks in `probe` but rather in `read_header`.

I am very sorry for the confusion. I have fixed these issues in my local repository and I will send a new version of the patch if no further issues are discovered.

Thanks,
Zixing
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to