Message ID | CAB0OVGqiJX-CqPz=AA5EK0TwtTzuHYXDQpy3OvQJgV_wpbrXGg@mail.gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | [FFmpeg-devel] lavf/mxfdec: Limit score for strangely cut files | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
mån 2020-08-24 klockan 21:42 +0200 skrev Carl Eugen Hoyos: > Hi! > > Attached patch fixes ticket #8846, the sample there is both a mov and > an mxf file. > It is not entirely clear to me if the sample was only made to annoy us > but the content looks real. > > An alternative may be to check the extension if the score is equal but > I don't really like that either. The file is a polyglot, yes. The run-in feature in MXF exists to be able to add extra metadata and other MXF features while maintaining backward compatibility. And to be annoying. > Subject: [PATCH] lavf/mxfdec: Limit score for strangely cut files. I'd reword this to "lavf/mxfdec: Limit score for files with run-in" > @@ -3615,7 +3615,7 @@ static int mxf_probe(const AVProbeData *p) { > AV_RN32(bufp+ 4) == AV_RN32(mxf_header_partition_pack_key+ 4) && > AV_RN32(bufp+ 8) == AV_RN32(mxf_header_partition_pack_key+ 8) && > AV_RN16(bufp+12) == AV_RN16(mxf_header_partition_pack_key+12)) > - return AVPROBE_SCORE_MAX; > + return bufp - p->buf ? AVPROBE_SCORE_MAX - 1 : AVPROBE_SCORE_MAX; bufp != p->buf would be more readable. Else this does the same thing as a patch I was just working on, so the logic is OK. /Tomas
Am Di., 25. Aug. 2020 um 00:48 Uhr schrieb Tomas Härdin <tjoppen@acc.umu.se>: > > mån 2020-08-24 klockan 21:42 +0200 skrev Carl Eugen Hoyos: > > Hi! > > > > Attached patch fixes ticket #8846, the sample there is both a mov and > > an mxf file. > > It is not entirely clear to me if the sample was only made to annoy us > > but the content looks real. > > > > An alternative may be to check the extension if the score is equal but > > I don't really like that either. > > The file is a polyglot, yes. The run-in feature in MXF exists to be > able to add extra metadata and other MXF features while maintaining > backward compatibility. And to be annoying. The file does not play here with -f mxf... > > Subject: [PATCH] lavf/mxfdec: Limit score for strangely cut files. > > I'd reword this to "lavf/mxfdec: Limit score for files with run-in" > > > @@ -3615,7 +3615,7 @@ static int mxf_probe(const AVProbeData *p) { > > AV_RN32(bufp+ 4) == AV_RN32(mxf_header_partition_pack_key+ 4) && > > AV_RN32(bufp+ 8) == AV_RN32(mxf_header_partition_pack_key+ 8) && > > AV_RN16(bufp+12) == AV_RN16(mxf_header_partition_pack_key+12)) > > - return AVPROBE_SCORE_MAX; > > + return bufp - p->buf ? AVPROBE_SCORE_MAX - 1 : AVPROBE_SCORE_MAX; > > bufp != p->buf would be more readable. Else this does the same thing as > a patch I was just working on, so the logic is OK. Patch applied. Thank you, Carl Eugen
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 4b56984b77..14b430a8d4 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -3615,7 +3615,7 @@ static int mxf_probe(const AVProbeData *p) { AV_RN32(bufp+ 4) == AV_RN32(mxf_header_partition_pack_key+ 4) && AV_RN32(bufp+ 8) == AV_RN32(mxf_header_partition_pack_key+ 8) && AV_RN16(bufp+12) == AV_RN16(mxf_header_partition_pack_key+12)) - return AVPROBE_SCORE_MAX; + return bufp - p->buf ? AVPROBE_SCORE_MAX - 1 : AVPROBE_SCORE_MAX; bufp ++; } else bufp += 10;