Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FreeRDP/FreeRDP-old.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVic Lee <llyzs@163.com>2011-06-16 13:10:45 +0400
committerVic Lee <llyzs@163.com>2011-06-16 13:10:45 +0400
commitb7939646004aed75642cacab683cb0eeb9e724ff (patch)
tree33f3bb083ae5c1525e6c278572bbcd4755a1a025
parentcfd18eb9dc6f2ef5af3b345d90f33cb3321376de (diff)
cunit/librfx: fix memory corruption.
-rw-r--r--cunit/test_librfx.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/cunit/test_librfx.c b/cunit/test_librfx.c
index 7932390..3f81a7f 100644
--- a/cunit/test_librfx.c
+++ b/cunit/test_librfx.c
@@ -316,21 +316,21 @@ void
test_encode(void)
{
RFX_CONTEXT * context;
- uint8 ycbcr_buffer[16384];
+ uint8 ycbcr_buffer[1024000];
int y_size, cb_size, cr_size;
int i;
uint8 decode_buffer[4096 * 3];
- rgb_data = (uint8 *) malloc(100 * 80 * 3);
- for (i = 0; i < 80; i++)
- memcpy(rgb_data + i * 100 * 3, rgb_scanline_data, 80 * 3);
+ rgb_data = (uint8 *) malloc(64 * 64 * 3);
+ for (i = 0; i < 64; i++)
+ memcpy(rgb_data + i * 64 * 3, rgb_scanline_data, 64 * 3);
//hexdump(rgb_data, 64 * 64 * 3);
context = rfx_context_new();
context->mode = RLGR3;
rfx_context_set_pixel_format(context, RFX_PIXEL_FORMAT_RGB);
- rfx_encode_rgb(context, rgb_data, 64, 64, 100 * 3,
+ rfx_encode_rgb(context, rgb_data, 64, 64, 64 * 3,
test_quantization_values, test_quantization_values, test_quantization_values,
ycbcr_buffer, sizeof(ycbcr_buffer), &y_size, &cb_size, &cr_size);
//dump_buffer(context->cb_g_buffer, 4096);
@@ -357,10 +357,15 @@ void
test_message(void)
{
RFX_CONTEXT * context;
- uint8 buffer[16384];
+ uint8 buffer[1024000];
int size;
+ int i;
RFX_RECT rect = {0, 0, 64, 64};
+ rgb_data = (uint8 *) malloc(100 * 80 * 3);
+ for (i = 0; i < 80; i++)
+ memcpy(rgb_data + i * 100 * 3, rgb_scanline_data, 100 * 3);
+
context = rfx_context_new();
context->mode = RLGR3;
context->width = 800;
@@ -376,4 +381,5 @@ test_message(void)
/*hexdump(buffer, size);*/
rfx_context_free(context);
+ free(rgb_data);
}