OSDN Git Service

macfb: fix overflow of color_palette array
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Thu, 7 Oct 2021 22:12:44 +0000 (23:12 +0100)
committerLaurent Vivier <laurent@vivier.eu>
Fri, 8 Oct 2021 11:31:03 +0000 (13:31 +0200)
commit14d0ddfce781374b7ce40062c0afc2ed00419267
tree91b68eba45d25307148ef11093e50129f6c9b58b
parent906c2323f1edf41b1851e7e36231023ee930aa3c
macfb: fix overflow of color_palette array

The palette_current index counter has a maximum size of 256 * 3 to cover a full
color palette of 256 RGB entries. Linux assumes that the palette_current index
wraps back around to zero after writing 256 RGB entries so ensure that
palette_current is reset at this point to prevent data corruption within
MacfbState.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20211007221253.29024-5-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
hw/display/macfb.c