diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2024-07-23 14:10:26 +0100 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2024-07-29 16:55:59 +0100 |
| commit | 0892fffc2abaadfb5d8b79bb0250ae1794862560 (patch) | |
| tree | cbeae3bdff2a28a65f7a31eb37ccc3fd01a055ee /scripts/qapi/expr.py | |
| parent | 05b8d7249109c44a30352ac86d1f079ec0a8506e (diff) | |
| download | focaccia-qemu-0892fffc2abaadfb5d8b79bb0250ae1794862560.tar.gz focaccia-qemu-0892fffc2abaadfb5d8b79bb0250ae1794862560.zip | |
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 'scripts/qapi/expr.py')
0 files changed, 0 insertions, 0 deletions