mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
ui/cursor: make width/height unsigned 16-bit integer
Although not actually exploitable at the moment, a negative width/height could make datasize wrap around and potentially lead to buffer overflow. Since there is no reason a negative width/height is ever appropriate, modify QEMUCursor struct and cursor_alloc prototype to accept uint16_t. This protects us against accidentally introducing future bugs. Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com> Reported-by: Jacek Halon <jacek.halon@gmail.com> Reported-by: Yair Mizrahi <yairh33@gmail.com> Reported-by: Elsayed El-Refa'ei <e.elrefaei99@gmail.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20230523163023.608121-1-mcascell@redhat.com>
This commit is contained in:
parent
1dfea3f212
commit
4c93ce54e7
2 changed files with 4 additions and 3 deletions
|
@ -144,13 +144,13 @@ typedef struct QemuUIInfo {
|
|||
|
||||
/* cursor data format is 32bit RGBA */
|
||||
typedef struct QEMUCursor {
|
||||
int width, height;
|
||||
uint16_t width, height;
|
||||
int hot_x, hot_y;
|
||||
int refcount;
|
||||
uint32_t data[];
|
||||
} QEMUCursor;
|
||||
|
||||
QEMUCursor *cursor_alloc(int width, int height);
|
||||
QEMUCursor *cursor_alloc(uint16_t width, uint16_t height);
|
||||
QEMUCursor *cursor_ref(QEMUCursor *c);
|
||||
void cursor_unref(QEMUCursor *c);
|
||||
QEMUCursor *cursor_builtin_hidden(void);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue