virgl/video: Fix out-of-bounds access in fill_mpeg4_picture_desc()

An out-of-bounds access has occurred to array ref[2] and it needs
to be fixed.

Fixes: 6b5aecb195 ("virgl: add support for hardware video acceleration")
Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23160>
(cherry picked from commit 5c2f6d3f8e)
This commit is contained in:
Feng Jiang 2023-05-22 14:27:25 +08:00 committed by Eric Engestrom
parent 7286bc0d4b
commit 70e19345a5
2 changed files with 2 additions and 2 deletions

View file

@ -1867,7 +1867,7 @@
"description": "virgl/video: Fix out-of-bounds access in fill_mpeg4_picture_desc()",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "6b5aecb19558200fd39fda46db08456ba7acc180"
},

View file

@ -551,7 +551,7 @@ static int fill_mpeg4_picture_desc(const struct pipe_picture_desc *desc,
ITEM_SET(vmpeg4, mpeg4, top_field_first);
ITEM_CPY(vmpeg4, mpeg4, intra_matrix);
ITEM_CPY(vmpeg4, mpeg4, non_intra_matrix);
for (i = 0; i < 16; i++) {
for (i = 0; i < ARRAY_SIZE(mpeg4->ref); i++) {
vbuf = virgl_video_buffer(mpeg4->ref[i]);
vmpeg4->ref[i] = vbuf ? vbuf->handle : 0;
}