[FFmpeg-devel] [PATCH] libavf: Auto-detect mjpeg 2000 in mpeg-ts

Ståle Kristoffersen staalebk at ifi.uio.no
Tue Oct 11 19:02:17 EEST 2016


On 2016-10-11 at 16:27, Michael Niedermayer wrote:
<snip>

> > +    for (i=0; i<p->buf_size-5; i++) {
> > +        soc = AV_RB16(p->buf + i);
> > +        if (soc == JPEG2000_SOC ) {
> > +            marker = AV_RB16(p->buf + i + 2);
> > +            marker_size = AV_RB16(p->buf + i + 4);
> > +            if (marker == JPEG2000_SIZ) {
> > +                i += marker_size + 2;
> > +                marker_marker = AV_RB8(p->buf + i + 2);
> 
> missing overflow and out of array checks

Ah, when I cleaned up the patch I removed the code, my bad.

> also the img2 demuxer for mjpeg2000 from img2dec.c does not work
> for this ?

It does work if I:
1) modify j2k_probe to not only check the first 4 bytes
2) hange the score return to be less than that of mpegts.
3) Add j2k_pipe to fmt_id_type[] in libavf/utils.c

I'm a bit worried about number 2. Increasing the score of mpegts might be a
better idea, but I am very afraid of touching any of that.

Is there a better way?
-- 
Ståle Kristoffersen


More information about the ffmpeg-devel mailing list