"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xrdp/xrdp_bitmap.c" between
xrdp-0.9.13.1.tar.gz and xrdp-0.9.14.tar.gz

About: xrdp is a remote desktop protocol (rdp) server (accepting connections from rdesktop and Microsoft’s own terminal server / remote desktop clients).

xrdp_bitmap.c  (xrdp-0.9.13.1):xrdp_bitmap.c  (xrdp-0.9.14)
skipping to change at line 28 skipping to change at line 28
* bitmap, drawable * bitmap, drawable
* this is a object that can be drawn on with a painter * this is a object that can be drawn on with a painter
* all windows, bitmaps, even the screen are of this type * all windows, bitmaps, even the screen are of this type
* maybe it should be called xrdp_drawable * maybe it should be called xrdp_drawable
*/ */
#if defined(HAVE_CONFIG_H) #if defined(HAVE_CONFIG_H)
#include <config_ac.h> #include <config_ac.h>
#endif #endif
#include <limits.h>
#include "xrdp.h" #include "xrdp.h"
#include "log.h" #include "log.h"
#define LLOG_LEVEL 1 #define LLOG_LEVEL 1
#define LLOGLN(_level, _args) \ #define LLOGLN(_level, _args) \
do \ do \
{ \ { \
if (_level < LLOG_LEVEL) \ if (_level < LLOG_LEVEL) \
{ \ { \
g_write("xrdp:xrdp_bitmap [%10.10u]: ", g_time3()); \ g_write("xrdp:xrdp_bitmap [%10.10u]: ", g_time3()); \
skipping to change at line 96 skipping to change at line 98
0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
}; };
#define CRC_START(in_crc) (in_crc) = 0xFFFFFFFF #define CRC_START(in_crc) (in_crc) = 0xFFFFFFFF
#define CRC_PASS(in_pixel, in_crc) \ #define CRC_PASS(in_pixel, in_crc) \
(in_crc) = g_crc_table[((in_crc) ^ (in_pixel)) & 0xff] ^ ((in_crc) >> 8) (in_crc) = g_crc_table[((in_crc) ^ (in_pixel)) & 0xff] ^ ((in_crc) >> 8)
#define CRC_END(in_crc) (in_crc) = ((in_crc) ^ 0xFFFFFFFF) #define CRC_END(in_crc) (in_crc) = ((in_crc) ^ 0xFFFFFFFF)
/*****************************************************************************/ /*****************************************************************************/
/* Allocate bitmap for specified dimensions, checking for int overflow */
static char *
alloc_bitmap_data(int width, int height, int Bpp)
{
char *result = NULL;
if (width > 0 && height > 0 && Bpp > 0)
{
int len = width;
/* g_malloc() currently takes an 'int' size */
if (len < INT_MAX / height)
{
len *= height;
if (len < INT_MAX / Bpp)
{
len *= Bpp;
result = (char *)malloc(len);
}
}
}
return result;
}
/*****************************************************************************/
struct xrdp_bitmap * struct xrdp_bitmap *
xrdp_bitmap_create(int width, int height, int bpp, xrdp_bitmap_create(int width, int height, int bpp,
int type, struct xrdp_wm *wm) int type, struct xrdp_wm *wm)
{ {
struct xrdp_bitmap *self = (struct xrdp_bitmap *)NULL; struct xrdp_bitmap *self = (struct xrdp_bitmap *)NULL;
int Bpp = 0; int Bpp = 0;
self = (struct xrdp_bitmap *)g_malloc(sizeof(struct xrdp_bitmap), 1); self = (struct xrdp_bitmap *)g_malloc(sizeof(struct xrdp_bitmap), 1);
self->type = type; self->type = type;
self->width = width; self->width = width;
skipping to change at line 125 skipping to change at line 151
case 15: case 15:
Bpp = 2; Bpp = 2;
break; break;
case 16: case 16:
Bpp = 2; Bpp = 2;
break; break;
} }
if (self->type == WND_TYPE_BITMAP || self->type == WND_TYPE_IMAGE) if (self->type == WND_TYPE_BITMAP || self->type == WND_TYPE_IMAGE)
{ {
self->data = (char *)g_malloc(width * height * Bpp, 0); self->data = alloc_bitmap_data(width, height, Bpp);
if (self->data == NULL)
{
LLOGLN(0, ("xrdp_bitmap_create: size overflow %dx%dx%d",
width, height, Bpp));
g_free(self);
return NULL;
}
} }
#if defined(XRDP_PAINTER) #if defined(XRDP_PAINTER)
if (self->type == WND_TYPE_SCREEN) /* noorders */ if (self->type == WND_TYPE_SCREEN) /* noorders */
{ {
LLOGLN(0, ("xrdp_bitmap_create: noorders")); LLOGLN(0, ("xrdp_bitmap_create: noorders"));
self->data = (char *) g_malloc(width * height * Bpp, 0); self->data = alloc_bitmap_data(width, height, Bpp);
if (self->data == NULL)
{
LLOGLN(0, ("xrdp_bitmap_create: size overflow %dx%dx%d",
width, height, Bpp));
g_free(self);
return NULL;
}
} }
#endif #endif
if (self->type != WND_TYPE_BITMAP) if (self->type != WND_TYPE_BITMAP)
{ {
self->child_list = list_create(); self->child_list = list_create();
} }
self->line_size = width * Bpp; self->line_size = width * Bpp;
 End of changes. 4 change blocks. 
2 lines changed or deleted 42 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)