[vsipl++] [patch] Fix for generic pwarp

Jules Bergmann jules at codesourcery.com
Thu Jan 10 13:36:46 UTC 2008


Stefan Seefeld wrote:
> Jules Bergmann wrote:
>> Stefan,
>>
>> This patch attempts to fix the generic pwarp impl so that it doesn't
>> access memory past the end of the input image.
>>
>> Can you give a spin on windows to see if it fixes the segfault?
> 
> Unfortunately it still fails.
> Luckily, though, I have been able to reproduce the failure under Linux,
> using ElectricFence, and it seems to be the exact same place as on
> Windows, at least if I trust the debugger(s):

Can you try running the patch through electric fence?

In particular, it replaces

> z11 = *(p + in_stride_0 + 1)

with

> +	T z11 = *(p + off_11); // in.get(v0+1, u0+1);

where

> +	stride_type off_11 = std::min<stride_type>(in_stride_0 + 1, limit);

i.e. the patch attempts to clip off_11 if it results in an address 
beyond the image.  Perhaps I am setting limit incorrectly.


The problem with adjusting the clipping

-      if (u >= 0 && u <= u_clip && v >= 0 && v <= v_clip)
+      if (u >= 0 && u < u_clip && v >= 0 && v < v_clip)

is that u == u_clip is actually valid, since it falls exactly on a pixel 
and does not require interpolation with u_clip+1.  (This is the case 
mentioned yesterday, where values outside the image may be read, but are 
not used in computing the result (since they are weighted with 0)).

				-- Jules

-- 
Jules Bergmann
CodeSourcery
jules at codesourcery.com
(650) 331-3385 x705



More information about the vsipl++ mailing list