mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2026-04-04 21:30:39 +02:00
util: pattern: Fix chroma offset for insert_value_yuv_planar
The chroma offset calculation resulted in the running beyond
the end of the buffer.
eg For ysub=2, y=0 and y=1 should result in writing the same U & V
line, but chroma_offset = (y + 1) / ysub; resulted in them going
to different lines, potentially running off the end of the buffer
and causing a seg fault.
Update the calculation so lines 0 to (ysub-1) all write the same
output line.
Fixes: 40aeab6fd5 ("modetest: util: pattern: add new patterns")
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
This commit is contained in:
parent
116076ef39
commit
d06ea82901
1 changed files with 1 additions and 1 deletions
|
|
@ -1951,7 +1951,7 @@ static void insert_value_yuv_planar(const struct util_format_info *info,
|
|||
unsigned int cs = yuv->chroma_stride;
|
||||
unsigned int xsub = yuv->xsub;
|
||||
unsigned int ysub = yuv->ysub;
|
||||
unsigned int chroma_offset = (y + 1) / ysub;
|
||||
unsigned int chroma_offset = y / ysub;
|
||||
unsigned char *y_mem = planes[0] + (y * stride);
|
||||
unsigned char *u_mem = planes[1];
|
||||
unsigned char *v_mem = planes[2];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue