From: Pavel Charvat Date: Wed, 13 Sep 2006 07:06:56 +0000 (+0200) Subject: fixed forbidden access to rows gaps X-Git-Tag: holmes-import~554 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=df64680a80f4f9059be46688038b413b58fa8d86;p=libucw.git fixed forbidden access to rows gaps --- diff --git a/images/image.c b/images/image.c index 914d0f17..deb8f9f8 100644 --- a/images/image.c +++ b/images/image.c @@ -145,7 +145,7 @@ image_clone(struct image_thread *it, struct image *src, uns flags, struct mempoo # define IMAGE_WALK_DO_STEP do{ walk_pos[0] = walk_sec_pos[0]; walk_pos[1] = walk_sec_pos[1]; walk_pos[2] = walk_sec_pos[2]; }while(0) # include "images/image-walk.h" } - else if (src->row_size != img->row_size) + else if (src->row_size != img->row_size || ((img->flags | src->flags) & IMAGE_GAPS_PROTECTED)) { byte *s = src->pixels; byte *d = img->pixels; @@ -176,7 +176,15 @@ image_clear(struct image_thread *it UNUSED, struct image *img) { DBG("image_clear(img=%p)", img); if (img->image_size) - bzero(img->pixels, img->image_size); + if (img->flags & IMAGE_GAPS_PROTECTED) + { + byte *p = img->pixels; + uns bytes = img->cols * img->pixel_size; + for (uns row = img->rows; row--; p += img->row_size) + bzero(p, bytes); + } + else + bzero(img->pixels, img->image_size); } struct image *