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

Submitter:  Fabrizio Dini <fabrizio>
Submitted:  Tue 02 Jul 2013 09:57:55 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  hpataxis
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group administrator
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 Files:
   
   
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
  • -email is unavailable- added by hpataxis (Posted a comment)
  • -email is unavailable- added by fabrizio (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-09-29 hpataxis StatusNone Fixed
        Assigned toNone hpataxis
        Open/ClosedOpen Closed
    2013-07-02 fabrizio Attached File- Added RappBugTest.c, #28476

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code