From: Leo Izen <leo.izen@gmail.com> To: ffmpeg-devel@ffmpeg.org Cc: Cole Dilorenzo <coolkingcole@gmail.com>, Leo Izen <leo.izen@gmail.com> Subject: [FFmpeg-devel] [PATCH] avcodec/jpegxl_parser: fix OOB read regression Date: Thu, 12 Oct 2023 21:49:59 -0400 Message-ID: <20231013014959.536776-1-leo.izen@gmail.com> (raw) In f7ac3512f5b5cb8eb149f37300b43461d8e93af3 the size of the dynamically allocated buffer was shrunk, but it was made too small for very small alphabet sizes. This patch sets a minimum size to prevent an OOB read. Reported-by: Cole Dilorenzo <coolkingcole@gmail.com> Signed-off-by: Leo Izen <leo.izen@gmail.com> --- libavcodec/jpegxl_parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/jpegxl_parser.c b/libavcodec/jpegxl_parser.c index dde36b0d6e..e00e01e82b 100644 --- a/libavcodec/jpegxl_parser.c +++ b/libavcodec/jpegxl_parser.c @@ -726,8 +726,8 @@ static int read_vlc_prefix(GetBitContext *gb, JXLEntropyDecoder *dec, JXLSymbolD if (ret < 0) goto end; - buf = av_mallocz(dist->alphabet_size * (2 * sizeof(int8_t) + sizeof(int16_t) + sizeof(uint32_t)) - + sizeof(uint32_t)); + buf = av_mallocz(dist->alphabet_size * (2 * sizeof(int8_t) + sizeof(int16_t)) + + FFMAX(15, dist->alphabet_size + 1) * sizeof(uint32_t)); if (!buf) { ret = AVERROR(ENOMEM); goto end; -- 2.42.0 _______________________________________________ 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 reply other threads:[~2023-10-13 1:50 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-10-13 1:49 Leo Izen [this message] 2023-10-15 0:49 ` [FFmpeg-devel] [PATCH v2] " Leo Izen 2023-10-16 10:44 ` 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=20231013014959.536776-1-leo.izen@gmail.com \ --to=leo.izen@gmail.com \ --cc=coolkingcole@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