Actions

icon Post
text/html Subscribe
text/html Unsubscribe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • To: Stefan Seefeld <stefan@xxxxxxxxxxxxxxxx>
  • Subject: Re: [vsipl++] [patch] Fix for generic pwarp
  • From: Jules Bergmann <jules@xxxxxxxxxxxxxxxx>
  • Date: Thu, 10 Jan 2008 08:36:46 -0500

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@xxxxxxxxxxxxxxxx
(650) 331-3385 x705