mirror of
https://github.com/zebrajr/opencv.git
synced 2025-12-06 12:19:50 +01:00
Avoid adding value to nullptr
This UB can be avoided by postponing calculation until needed.
This commit is contained in:
parent
342ced1e04
commit
b62ab874d1
|
|
@ -1048,9 +1048,9 @@ static void remapLanczos4( const Mat& _src, Mat& _dst, const Mat& _xy,
|
||||||
const int off_x = isRelative ? (_offset.x+dx) : 0;
|
const int off_x = isRelative ? (_offset.x+dx) : 0;
|
||||||
int sx = XY[dx*2]-3+off_x, sy = XY[dx*2+1]-3+off_y;
|
int sx = XY[dx*2]-3+off_x, sy = XY[dx*2+1]-3+off_y;
|
||||||
const AT* w = wtab + FXY[dx]*64;
|
const AT* w = wtab + FXY[dx]*64;
|
||||||
const T* S = S0 + sy*sstep + sx*cn;
|
|
||||||
if( (unsigned)sx < width1 && (unsigned)sy < height1 )
|
if( (unsigned)sx < width1 && (unsigned)sy < height1 )
|
||||||
{
|
{
|
||||||
|
const T* S = S0 + sy*sstep + sx*cn;
|
||||||
for(int k = 0; k < cn; k++ )
|
for(int k = 0; k < cn; k++ )
|
||||||
{
|
{
|
||||||
WT sum = 0;
|
WT sum = 0;
|
||||||
|
|
@ -1091,9 +1091,9 @@ static void remapLanczos4( const Mat& _src, Mat& _dst, const Mat& _xy,
|
||||||
for(int i = 0; i < 8; i++, w += 8 )
|
for(int i = 0; i < 8; i++, w += 8 )
|
||||||
{
|
{
|
||||||
int yi = y[i];
|
int yi = y[i];
|
||||||
const T* S1 = S0 + yi*sstep;
|
|
||||||
if( yi < 0 )
|
if( yi < 0 )
|
||||||
continue;
|
continue;
|
||||||
|
const T* S1 = S0 + yi*sstep;
|
||||||
if( x[0] >= 0 )
|
if( x[0] >= 0 )
|
||||||
sum += (S1[x[0]] - cv)*w[0];
|
sum += (S1[x[0]] - cv)*w[0];
|
||||||
if( x[1] >= 0 )
|
if( x[1] >= 0 )
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user