Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Leo Izen <leo.izen@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH v9 1/5] avcodec/jpegxl: add Jpeg XL image codec and parser
Date: Mon, 28 Mar 2022 17:59:16 -0400
Message-ID: <3e72ca48-d310-be08-cb43-4e9677a356c2@gmail.com> (raw)
In-Reply-To: <AS1PR01MB9564470B805200967D887E508F189@AS1PR01MB9564.eurprd01.prod.exchangelabs.com>

On 3/23/22 10:45, Andreas Rheinhardt wrote:
> Leo Izen:
> + /* any other box is skipped at this point */
>> +        AV_WB32(tag_str, tag);
>> +        av_log(avctx, AV_LOG_VERBOSE, "skipping jxl container box: %s\n", tag_str);
> 1. tag_str is potentially not-zero terminated.
> 2. If tag_str contains a \0, it might get truncated; it would be better
> to just report it as hex with %X or so.
> 3. And actually I don't think that this should be reported at all.
If I change the report level to AV_LOG_DEBUG and report it as hex, does 
this work?
>> +static uint64_t jpegxl_get_bits(void *avctx, JpegXLParseContext *jxlr, int bits)
>> +{
>> +    if (jxlr->box_size) {
>> +        if (bits > jxlr->box_size) {
>> +            int remaining = jxlr->box_size;
>> +            uint64_t ret = jpegxl_get_bits(avctx, jxlr, remaining);
>> +            /* go to the next box */
>> +            int status = jpegxl_skip_boxes(avctx, jxlr);
>> +            if (status)
>> +                return 0;
>> +            ret |= jpegxl_get_bits(avctx, jxlr, bits - remaining) << remaining;
> What guarantees that there is not a sequence of boxes with a payload of
> 1 byte, so that a single read can span more than two boxes?
>
> And does the file format really allow to split the payload into
> different boxes at arbitrary positions?
>
Nothing guarantees it. If it does, the second call to jpegxl_get_bits 
will recurse. Since you can only request 64 bits at once and all jxlp 
boxes are at least one byte of payload, this has worst-case-scenario of 
8 calls for a 64 bits request. And unfortunately, it does allow the 
payload to be split at arbitrary positions.

>> +    *width = w, *height = h;
>> +    return 0;

 >Why does this pretend to be able to fail when it just can't?

I was going to move the size validity check to these, but I forgot. I 
will do that next revision of the patch.

>> +    *poutbuf = buf + i;
>> +    *poutbuf_size = buf_size - i;

 > Seems like the parser is discarding some data here (if i != 0).

That's the idea. It discards data that precedes the start of the frame. 
Is it not supposed to do this?


Leo Izen (thebombzen)


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

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

      reply	other threads:[~2022-03-28 21:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-23 11:03 Leo Izen
2022-03-23 11:03 ` [FFmpeg-devel] [PATCH v9 2/5] avcodec/libjxl: add Jpeg XL decoding via libjxl Leo Izen
2022-03-23 14:58   ` Andreas Rheinhardt
2022-03-23 11:03 ` [FFmpeg-devel] [PATCH v9 3/5] avcodec/libjxl: add Jpeg XL encoding " Leo Izen
2022-03-23 15:08   ` Andreas Rheinhardt
2022-03-28 21:16     ` Leo Izen
2022-03-30 11:12       ` Andreas Rheinhardt
2022-03-30 13:37         ` Leo Izen
2022-03-30 13:43           ` Andreas Rheinhardt
2022-03-23 11:03 ` [FFmpeg-devel] [PATCH v9 4/5] avformat/image2: add Jpeg XL as image2 format Leo Izen
2022-03-24 18:38   ` Michael Niedermayer
2022-03-28 20:51     ` Leo Izen
2022-03-30 11:16       ` Andreas Rheinhardt
2022-03-23 11:03 ` [FFmpeg-devel] [PATCH v9 5/5] fate/jpegxl: add Jpeg XL demux and parse FATE test Leo Izen
2022-03-23 14:45 ` [FFmpeg-devel] [PATCH v9 1/5] avcodec/jpegxl: add Jpeg XL image codec and parser Andreas Rheinhardt
2022-03-28 21:59   ` Leo Izen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3e72ca48-d310-be08-cb43-4e9677a356c2@gmail.com \
    --to=leo.izen@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git