[Spice-devel] [PATCH xf86-video-qxl] When uploading a region, do not go outside the source image size.

Jeremy White jwhite at codeweavers.com
Fri Sep 19 09:43:02 PDT 2014

>> diff --git a/src/qxl_image.c b/src/qxl_image.c
>> index 8927fd4..53212de 100644
>> --- a/src/qxl_image.c
>> +++ b/src/qxl_image.c
>> @@ -62,6 +62,8 @@ hash_and_copy (const uint8_t *src, int src_stride,
>>   	const uint8_t *src_line = src + i * src_stride;
>>   	uint8_t *dest_line = dest + i * dest_stride;
>>   	int n_bytes = width * bytes_per_pixel;
>> +        if (n_bytes > src_stride)
>> +            n_bytes = src_stride;
> This file uses tabs. It seems there's a check to adjust the height in
> qxl_image_create() before calling into hash_and_copy? 'width' in
> qxl_image_create() is used a few times more in this function, I don't
> know if it's an issue that it's too big?

Huh.  Yeah, I'm pretty careful not to disrupt tabs on existing lines, 
but I've never really tried to preserve a 'this-file-prefers-tabs' sort 
of style.

I do find this code a bit muddy, but I still feel fairly confident that 
there is no other effect from the possible mismatch between source and 
'new' width.

Someday when I'm even more bored, I'll be sure to start a coding style 
flamewar, because this list has really been pretty friendly and cheerful 
for far too long <grin>.

Two tabs added and resent.



More information about the Spice-devel mailing list