Re: [PATCH] ui/cursor: incomplete check for integer overflow in cursor_alloc

2023-05-23 Thread Mauro Matteo Cascella
On Tue, May 23, 2023 at 4:07 PM Philippe Mathieu-Daudé wrote: > > On 23/5/23 14:57, Mauro Matteo Cascella wrote: > > On Tue, May 23, 2023 at 10:37 AM Philippe Mathieu-Daudé > > wrote: > >> > >> On 23/5/23 10:09, Daniel P. Berrangé wrote: > >>> On Mon, May 22, 2023 at 08:55:02PM +0200, Philippe Ma

Re: [PATCH] ui/cursor: incomplete check for integer overflow in cursor_alloc

2023-05-23 Thread Mauro Matteo Cascella
On Tue, May 23, 2023 at 3:03 PM Daniel P. Berrangé wrote: > > On Tue, May 23, 2023 at 02:50:09PM +0200, Mauro Matteo Cascella wrote: > > On Tue, May 23, 2023 at 10:16 AM Daniel P. Berrangé > > wrote: > > > > > > On Mon, May 08, 2023 at 04:18:13PM +0200, Mauro Matteo Cascella wrote: > > > > The c

Re: [PATCH] ui/cursor: incomplete check for integer overflow in cursor_alloc

2023-05-23 Thread Philippe Mathieu-Daudé
On 23/5/23 14:57, Mauro Matteo Cascella wrote: On Tue, May 23, 2023 at 10:37 AM Philippe Mathieu-Daudé wrote: On 23/5/23 10:09, Daniel P. Berrangé wrote: On Mon, May 22, 2023 at 08:55:02PM +0200, Philippe Mathieu-Daudé wrote: On 9/5/23 09:13, Marc-André Lureau wrote: Hi On Mon, May 8, 2023

Re: [PATCH] ui/cursor: incomplete check for integer overflow in cursor_alloc

2023-05-23 Thread Daniel P . Berrangé
On Tue, May 23, 2023 at 02:50:09PM +0200, Mauro Matteo Cascella wrote: > On Tue, May 23, 2023 at 10:16 AM Daniel P. Berrangé > wrote: > > > > On Mon, May 08, 2023 at 04:18:13PM +0200, Mauro Matteo Cascella wrote: > > > The cursor_alloc function still accepts a signed integer for both the > > > c

Re: [PATCH] ui/cursor: incomplete check for integer overflow in cursor_alloc

2023-05-23 Thread Mauro Matteo Cascella
On Tue, May 23, 2023 at 10:37 AM Philippe Mathieu-Daudé wrote: > > On 23/5/23 10:09, Daniel P. Berrangé wrote: > > On Mon, May 22, 2023 at 08:55:02PM +0200, Philippe Mathieu-Daudé wrote: > >> On 9/5/23 09:13, Marc-André Lureau wrote: > >>> Hi > >>> > >>> On Mon, May 8, 2023 at 6:21 PM Mauro Matteo

Re: [PATCH] ui/cursor: incomplete check for integer overflow in cursor_alloc

2023-05-23 Thread Mauro Matteo Cascella
On Tue, May 23, 2023 at 10:16 AM Daniel P. Berrangé wrote: > > On Mon, May 08, 2023 at 04:18:13PM +0200, Mauro Matteo Cascella wrote: > > The cursor_alloc function still accepts a signed integer for both the cursor > > width and height. A specially crafted negative width/height could make > > dat

Re: [PATCH] ui/cursor: incomplete check for integer overflow in cursor_alloc

2023-05-23 Thread Philippe Mathieu-Daudé
On 23/5/23 10:09, Daniel P. Berrangé wrote: On Mon, May 22, 2023 at 08:55:02PM +0200, Philippe Mathieu-Daudé wrote: On 9/5/23 09:13, Marc-André Lureau wrote: Hi On Mon, May 8, 2023 at 6:21 PM Mauro Matteo Cascella mailto:mcasc...@redhat.com>> wrote: The cursor_alloc function still accept

Re: [PATCH] ui/cursor: incomplete check for integer overflow in cursor_alloc

2023-05-23 Thread Daniel P . Berrangé
On Mon, May 08, 2023 at 04:18:13PM +0200, Mauro Matteo Cascella wrote: > The cursor_alloc function still accepts a signed integer for both the cursor > width and height. A specially crafted negative width/height could make > datasize > wrap around and cause the next allocation to be 0, potentially

Re: [PATCH] ui/cursor: incomplete check for integer overflow in cursor_alloc

2023-05-23 Thread Daniel P . Berrangé
On Mon, May 22, 2023 at 08:55:02PM +0200, Philippe Mathieu-Daudé wrote: > On 9/5/23 09:13, Marc-André Lureau wrote: > > Hi > > > > On Mon, May 8, 2023 at 6:21 PM Mauro Matteo Cascella > > mailto:mcasc...@redhat.com>> wrote: > > > > The cursor_alloc function still accepts a signed integer for

Re: [PATCH] ui/cursor: incomplete check for integer overflow in cursor_alloc

2023-05-22 Thread Gerd Hoffmann
> > -QEMUCursor *cursor_alloc(int width, int height) > > +QEMUCursor *cursor_alloc(uint32_t width, uint32_t height) > >  { > >      QEMUCursor *c; > > Can't we check width/height > 0 && <= SOME_LIMIT_THAT_MAKES_SENSE? > > Maybe a 16K * 16K cursor is future proof and safe enough.

Re: [PATCH] ui/cursor: incomplete check for integer overflow in cursor_alloc

2023-05-22 Thread Mauro Matteo Cascella
On Mon, May 22, 2023 at 8:55 PM Philippe Mathieu-Daudé wrote: > > On 9/5/23 09:13, Marc-André Lureau wrote: > > Hi > > > > On Mon, May 8, 2023 at 6:21 PM Mauro Matteo Cascella > > mailto:mcasc...@redhat.com>> wrote: > > > > The cursor_alloc function still accepts a signed integer for both > >

Re: [PATCH] ui/cursor: incomplete check for integer overflow in cursor_alloc

2023-05-22 Thread Philippe Mathieu-Daudé
On 9/5/23 09:13, Marc-André Lureau wrote: Hi On Mon, May 8, 2023 at 6:21 PM Mauro Matteo Cascella mailto:mcasc...@redhat.com>> wrote: The cursor_alloc function still accepts a signed integer for both the cursor width and height. A specially crafted negative width/height could

Re: [PATCH] ui/cursor: incomplete check for integer overflow in cursor_alloc

2023-05-22 Thread Mauro Matteo Cascella
On Mon, May 8, 2023 at 4:20 PM Mauro Matteo Cascella wrote: > > The cursor_alloc function still accepts a signed integer for both the cursor > width and height. A specially crafted negative width/height could make > datasize > wrap around and cause the next allocation to be 0, potentially leading

Re: [PATCH] ui/cursor: incomplete check for integer overflow in cursor_alloc

2023-05-10 Thread Michael Tokarev
08.05.2023 17:18, Mauro Matteo Cascella wrote: The cursor_alloc function still accepts a signed integer for both the cursor width and height. A specially crafted negative width/height could make datasize wrap around and cause the next allocation to be 0, potentially leading to a heap buffer overf

Re: [PATCH] ui/cursor: incomplete check for integer overflow in cursor_alloc

2023-05-09 Thread Marc-André Lureau
Hi On Mon, May 8, 2023 at 6:21 PM Mauro Matteo Cascella wrote: > The cursor_alloc function still accepts a signed integer for both the > cursor > width and height. A specially crafted negative width/height could make > datasize > wrap around and cause the next allocation to be 0, potentially lea

[PATCH] ui/cursor: incomplete check for integer overflow in cursor_alloc

2023-05-08 Thread Mauro Matteo Cascella
The cursor_alloc function still accepts a signed integer for both the cursor width and height. A specially crafted negative width/height could make datasize wrap around and cause the next allocation to be 0, potentially leading to a heap buffer overflow. Modify QEMUCursor struct and cursor_alloc pr