From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH v9 3/5] avcodec/libjxl: add Jpeg XL encoding via libjxl
Date: Wed, 30 Mar 2022 13:12:13 +0200
Message-ID: <AS1PR01MB9564B6349F054339442258478F1F9@AS1PR01MB9564.eurprd01.prod.exchangelabs.com> (raw)
In-Reply-To: <74e44665-37ed-bf5e-0ba4-7494706d2742@gmail.com>
Leo Izen:
> On 3/23/22 11:08, Andreas Rheinhardt wrote:
>>> + temp = av_realloc(ctx->buffer, ctx->buffer_size);
>>> + if (!temp) {
>>> + av_freep(&ctx->buffer);
>> If you free this, you will be in a scenario where ctx->buffer is NULL,
>> yet ctx->buffer_size is > 0. This is inconsistent and might lead to
>> crashs in JxlEncoderProcessOutput. So don't free this and only set
>> buffer_size after the reallocation succeeded.
> Does it matter what ctx->buffer_size is if ctx->buffer is NULL?
> On 3/23/22 11:08, Andreas Rheinhardt wrote:
>> Unnecessary: av_freep() resets ctx->buffer and resetting buffer_size is
>> unnecessary.
>
> Here, you claim that resetting buffer_size is unnecessary but above you
> insist it is necessary. I'm confused here.
>
buffer_size is not used after libjxl_encode_close() at all, as this is
the codec's close callback; libjxl_encode_frame() meanwhile may be
called again after freeing and if it reaches JxlEncoderProcessOutput(),
the latter would be called with next_out == NULL and available != 0.
JxlEncoderProcessOutput() might check for this (and error out) or it may
just crash.
- Andreas
_______________________________________________
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".
next prev parent reply other threads:[~2022-03-30 11:12 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-23 11:03 [FFmpeg-devel] [PATCH v9 1/5] avcodec/jpegxl: add Jpeg XL image codec and parser 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 [this message]
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
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=AS1PR01MB9564B6349F054339442258478F1F9@AS1PR01MB9564.eurprd01.prod.exchangelabs.com \
--to=andreas.rheinhardt@outlook.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