Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH] avcodec/rpzaenc: don't use buffer data beyond the end of a row
Date: Tue, 13 Aug 2024 14:26:09 -0300
Message-ID: <669c3471-68d8-4423-9001-134c892c8e93@gmail.com> (raw)
In-Reply-To: <20240813140529.2204-1-jamrial@gmail.com>

On 8/13/2024 11:05 AM, James Almer wrote:
> Fixes use of uninitized data (masked by the default zeroing of image buffers).
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>   libavcodec/rpzaenc.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/rpzaenc.c b/libavcodec/rpzaenc.c
> index d84555d6c6..3a1924d385 100644
> --- a/libavcodec/rpzaenc.c
> +++ b/libavcodec/rpzaenc.c
> @@ -749,20 +749,24 @@ post_skip :
>   
>               if (err > s->sixteen_color_thresh) { // DO SIXTEEN COLOR BLOCK
>                   const uint16_t *row_ptr;
> -                int y_size, rgb555;
> +                int y_size, x_size, rgb555;
>   
>                   block_offset  = get_block_info(&bi, block_counter, 0);
>                   pblock_offset = get_block_info(&bi, block_counter, 1);
>   
>                   row_ptr = &src_pixels[block_offset];
>                   y_size = FFMIN(4, bi.image_height - bi.row * 4);
> +                x_size = FFMIN(4, bi.image_width  - bi.col * 4);
>   
>                   for (int y = 0; y < y_size; y++) {
> -                    for (int x = 0; x < 4; x++) {
> +                    for (int x = 0; x < x_size; x++) {
>                           rgb555 = row_ptr[x] & ~0x8000;
>   
>                           put_bits(&s->pb, 16, rgb555);
>                       }
> +                    for (int x = x_size; x < 4; x++)
> +                        put_bits(&s->pb, 16, 0);
> +
>                       row_ptr += bi.rowstride;
>                   }

Will apply soon to remove all the yellow from fate.

_______________________________________________
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:[~2024-08-13 17:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-13 14:05 James Almer
2024-08-13 17:26 ` James Almer [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=669c3471-68d8-4423-9001-134c892c8e93@gmail.com \
    --to=jamrial@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