I'm not sure if it's reproducible, but I ran into a similar case
where rail is trying to create a window with negative width
value.

> -----Original Message-----
> From: D Sundstrom [mailto:su...@peapod.net] 
> Sent: Friday, October 28, 2011 4:40 PM
> To: freerdp-devel@lists.sourceforge.net
> Subject: [Freerdp-devel] Polices for error handling
> 
> Just a general question before I start submitting patches.  
> What is the general policy for error handling in FreeRDP?
> 
> For example, the bug I'm chasing right now:
> 
> "xf_window.c" line 303:
> 
> xfWindow* xf_CreateWindow(xfInfo* xfi, rdpWindow* wnd, int x, 
> int y, int width, int height, uint32 id) {
>         xfWindow* window;
> 
>         window = (xfWindow*) xzalloc(sizeof(xfWindow));
> 
>         if ((width * height) < 1)
>                 return NULL;
> 
>         xf_FixWindowCoordinates(xfi, &x, &y, &width, &height);
> 
>         window->left = x;
>         window->top = y;
>         window->right = x + width - 1;
>         window->bottom = y + height - 1;
>         window->width = width;
>         window->height = height;
> 
>         if (window != NULL)
>         {
> 
> 
> Note there is a bug (window being checked for NULL after it 
> already been dereferenced), and also a memory leak (return 
> NULL after allocation without a free) and also that this 
> function can return NULL.
> 
> Back up at the caller:
> 
> xf_rail line 78:
> 
> 
> void xf_rail_CreateWindow(rdpRail* rail, rdpWindow* window) {
>         xfInfo* xfi;
>         xfWindow* xfw;
> 
>         xfi = (xfInfo*) rail->extra;
> 
>         xf_rail_FilterWindowInfo(rail, window);
> 
>         xfw = xf_CreateWindow((xfInfo*) rail->extra, window,
>                         window->windowOffsetX, window->windowOffsetY,
>                         window->windowWidth, window->windowHeight,
>                         window->windowId);
> 
>         xf_SetWindowStyle(xfi, xfw, window->style, 
> window->extendedStyle);
> 
> 
> The return code is never checked. The end result is a 
> segfault to the user when window is dereferenced.
> 
> (The actual bug is that width and height being passed to 
> xf_CreateWindow were zero for some reason, thus it returned a NULL)
> 
> 
> Just wondering if I should be doing something with return 
> code checking as I encounter these cases.
> 
> -David
> 
> --------------------------------------------------------------
> ----------------
> The demand for IT networking professionals continues to grow, 
> and the demand for specialized networking skills is growing 
> even more rapidly.
> Take a complimentary Learning@Cisco Self-Assessment and learn 
> about Cisco certifications, training, and career opportunities. 
> http://p.sf.net/sfu/cisco-dev2dev
> _______________________________________________
> Freerdp-devel mailing list
> Freerdp-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/freerdp-devel
> 

------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Freerdp-devel mailing list
Freerdp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freerdp-devel

Reply via email to