[vlc-commits] [Git][videolan/vlc][master] 2 commits: codec: avcodec: fix inverted loop/copy sizes
Steve Lhomme (@robUx4)
gitlab at videolan.org
Tue Aug 8 13:13:11 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
c57cd6c6 by Francois Cartegnie at 2023-08-08T11:10:10+00:00
codec: avcodec: fix inverted loop/copy sizes
- - - - -
a213c587 by Francois Cartegnie at 2023-08-08T11:10:10+00:00
filters: swscale: fix inverted loop/copy sizes
- - - - -
2 changed files:
- modules/codec/avcodec/video.c
- modules/video_chroma/swscale.c
Changes:
=====================================
modules/codec/avcodec/video.c
=====================================
@@ -1285,10 +1285,10 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
uint8_t *pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE);
if (pal) {
const video_palette_t *p_palette = p_dec->fmt_in->video.p_palette;
- for (size_t i=0; i<sizeof(p_palette->palette[0]); i++)
+ for (size_t i=0; i<ARRAY_SIZE(p_palette->palette); i++)
{
- memcpy(pal, p_palette->palette[i], ARRAY_SIZE(p_palette->palette));
- pal += ARRAY_SIZE(p_palette->palette);
+ memcpy(pal, p_palette->palette[i], sizeof(p_palette->palette[0]));
+ pal += sizeof(p_palette->palette[0]);
}
p_sys->palette_sent = true;
}
@@ -1430,10 +1430,10 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
"Palette size mismatch between vlc and libavutil" );
assert( frame->data[1] != NULL );
const uint8_t *src = frame->data[1];
- for (size_t i=0; i<sizeof(p_palette->palette[0]); i++)
+ for (size_t i=0; i<ARRAY_SIZE(p_palette->palette); i++)
{
- memcpy(p_palette->palette[i], src, ARRAY_SIZE(p_palette->palette));
- src += ARRAY_SIZE(p_palette->palette);
+ memcpy(p_palette->palette[i], src, sizeof(p_palette->palette[0]));
+ src += sizeof(p_palette->palette[0]);
}
p_palette->i_entries = AVPALETTE_COUNT;
p_dec->fmt_out.video.i_chroma = VLC_CODEC_RGBP;
=====================================
modules/video_chroma/swscale.c
=====================================
@@ -630,10 +630,10 @@ static void Convert( filter_t *p_filter, struct SwsContext *ctx,
static_assert(sizeof(p_palette->palette) == AVPALETTE_SIZE,
"Palette size mismatch between vlc and libavutil");
uint8_t *cursor = palette;
- for (size_t i=0; i<sizeof(p_palette->palette[0]); i++)
+ for (size_t i=0; i<ARRAY_SIZE(p_palette->palette); i++)
{
- memcpy(cursor, p_palette->palette[i], ARRAY_SIZE(p_palette->palette));
- cursor += ARRAY_SIZE(p_palette->palette);
+ memcpy(cursor, p_palette->palette[i], sizeof(p_palette->palette[0]));
+ cursor += sizeof(p_palette->palette[0]);
}
}
else
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2206ae973f71baad3f885b75e2b1fba5694c7264...a213c587b0392739edfac739d4f9e4b3f96a8b51
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2206ae973f71baad3f885b75e2b1fba5694c7264...a213c587b0392739edfac739d4f9e4b3f96a8b51
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list