[cclm] Fix heap corruption for non 64 divisible frames

This commit is contained in:
Joose Sainio 2022-12-15 13:12:42 +02:00
parent 62fabc60dd
commit 7038430646
2 changed files with 2 additions and 2 deletions

View file

@ -449,7 +449,7 @@ static void downsample_cclm_rec(encoder_state_t *state, int x, int y, int width,
if((y + height * 2) % 64 == 0) {
int line = y / 64 * stride2 / 2;
y_rec -= LCU_WIDTH;
for (int i = 0; i < width; ++i) {
for (int i = 0; i < width && i + x < stride2 / 2; ++i) {
int s = 2;
s += y_rec[i * 2] * 2;
s += y_rec[i * 2 + 1];

View file

@ -61,7 +61,7 @@ videoframe_t * uvg_videoframe_alloc(int32_t width,
frame->sao_chroma = MALLOC(sao_info_t, frame->width_in_lcu * frame->height_in_lcu);
if (cclm) {
assert(chroma_format == UVG_CSP_420);
frame->cclm_luma_rec = MALLOC(uvg_pixel, (((width + 7) & ~7) + FRAME_PADDING_LUMA) * (((height + 7) & ~7) + FRAME_PADDING_LUMA) / 4);
frame->cclm_luma_rec = MALLOC(uvg_pixel, (((width + 7) & ~7) + FRAME_PADDING_LUMA) * (((height + 15) & ~7) + FRAME_PADDING_LUMA) / 4);
frame->cclm_luma_rec_top_line = MALLOC(uvg_pixel, (((width + 7) & ~7) + FRAME_PADDING_LUMA) / 2 * CEILDIV(height, 64));
}
}