bugRAPP - Raster Processing Primitives - Bugs: bug #39396, Failure evaluating overlap between...

 
 

bug #39396: Failure evaluating overlap between two pixel buffer if one of them is for a binary image

Submitted by:  Fabrizio Dini <fabrizio>
Submitted on:  Tue 02 Jul 2013 09:57:55 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Hans-Peter Nilsson <hpataxis>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 29 Sep 2014 06:52:46 PM UTC, comment #1:

Fix committed, update your git tree or wait for the next release.

Hans-Peter Nilsson <hpataxis>
Project AdministratorIn charge of this item.
Tue 02 Jul 2013 09:57:55 AM UTC, original submission:

It seems to me that RAPP library ver. 0.7 (but I think the issue was introduced in RAPP 0.6) fails at evaluating the overlap between two pixel buffers if one of them refers to a binary image. Attached you can find a sample code the shows the wrong behavior.

The example I made in the attached source code is the following.
Two images of 108x34 pixels are allocated (this size comes from a real application but you can try with different values). The first image is 1bpp (1 bit per pixel) so it is a binary image. The second is 8bpp (256 gray levels image). I tested this code on my laptop, where the rapp_alignment is 4 byte (the same can be found on artpec3-based Axis cameras). Given this rapp_alignment, the stride for the two images is 108 for the 8bpp image (equal to the image width) and 16 for the 1bpp. Image size is thus 3672 bytes for the 8bpp image and 544 bytes for the 1bpp image.
First, 544 bytes are allocated (with rapp_malloc) for the 1bpp image. Second, 3672 bytes are allocate (with rapp_malloc) for the 8bpp image. Then, a rapp function involving the two pixel buffers is called. I used rapp_thresh_gt_u8 but I think you can use other functions, provided that the source and destination image are 8bpp and 1bpp. These function will check for pixel buffers overlap and return the error code -9 if there is an overlap.

In the attached example, the two buffers are considered by rapp to be overlapped, even though there are more that 544 bytes of distance between the beginning of the first pixel buffer (1bpp) and the second pixel buffer (8bpp).

Please note that the order of memory allocation operation is important. I think the error occurs because RAPP computes a wrong size for the buffer of the binary image. If the gray level image is allocated before the binary image, the error is likely to remain silent.

I think the bug is in rapp_util.h where the macros RAPP_VALIDATE_RESTRICT, RAPP_VALIDATE_RESTRICT_PLUS and RAPP_VALIDATE_RESTRICT_OFFSET are defined. Probably the last one needs to be revised.

regards,
Fabrizio

Fabrizio Dini <fabrizio>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #28476:  RappBugTest.c added by fabrizio (3KiB - text/x-csrc)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by hpataxis (Posted a comment)
  • -unavailable- added by fabrizio (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 29 Sep 2014 06:52:46 PM UTChpataxisStatusNone=>Fixed
      Assigned toNone=>hpataxis
      Open/ClosedOpen=>Closed
    Tue 02 Jul 2013 09:57:55 AM UTCfabrizioAttached File-=>Added RappBugTest.c, #28476

    Back to the top


    Powered by Savane 3.1-cleanup1