aboutsummaryrefslogtreecommitdiff
path: root/module-common.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2024-07-23 14:10:26 +0100
committerPeter Maydell <peter.maydell@linaro.org>2024-07-29 16:55:59 +0100
commit0892fffc2abaadfb5d8b79bb0250ae1794862560 (patch)
treecbeae3bdff2a28a65f7a31eb37ccc3fd01a055ee /module-common.c
parent05b8d7249109c44a30352ac86d1f079ec0a8506e (diff)
downloadqemu-0892fffc2abaadfb5d8b79bb0250ae1794862560.zip
qemu-0892fffc2abaadfb5d8b79bb0250ae1794862560.tar.gz
qemu-0892fffc2abaadfb5d8b79bb0250ae1794862560.tar.bz2
hw/misc/bcm2835_property: Fix handling of FRAMEBUFFER_SET_PALETTE
The documentation of the "Set palette" mailbox property at https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface#set-palette says it has the form: Length: 24..1032 Value: u32: offset: first palette index to set (0-255) u32: length: number of palette entries to set (1-256) u32...: RGBA palette values (offset to offset+length-1) We get this wrong in a couple of ways: * we aren't checking the offset and length are in range, so the guest can make us spin for a long time by providing a large length * the bounds check on our loop is wrong: we should iterate through 'length' palette entries, not 'length - offset' entries Fix the loop to implement the bounds checks and get the loop condition right. In the process, make the variables local to this switch case, rather than function-global, so it's clearer what type they are when reading the code. Cc: qemu-stable@nongnu.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-id: 20240723131029.1159908-2-peter.maydell@linaro.org
Diffstat (limited to 'module-common.c')
0 files changed, 0 insertions, 0 deletions