mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 00:03:03 +04:00
Merge pull request #21112 from vrabaud:3.4_luv_overflow
* Fix integer overflow in cv::Luv2RGBinteger::process. For LL=49, uu=205, vv=23, we end up with x=7373056 and y=458 which overflows y*x. * imgproc(test): adjust test parameters to cover SIMD code
This commit is contained in:
@@ -3567,7 +3567,7 @@ struct Luv2RGBinteger
|
||||
|
||||
long long int xv = ((int)up)*(long long)vp;
|
||||
int x = (int)(xv/BASE);
|
||||
x = y*x/BASE;
|
||||
x = ((long long int)y)*x/BASE;
|
||||
|
||||
long long int vpl = LUVLUT.LvToVpl_b[LL*256+vv];
|
||||
long long int zp = vpl - xv*(255/3);
|
||||
@@ -3689,6 +3689,7 @@ struct Luv2RGBinteger
|
||||
vzm[i] = zm;
|
||||
|
||||
vx[i] = (int32_t)(xv >> base_shift);
|
||||
vx[i] = (((int64_t)y_)*vx[i]) >> base_shift;
|
||||
}
|
||||
v_int32 zm[4];
|
||||
for(int k = 0; k < 4; k++)
|
||||
@@ -3697,11 +3698,6 @@ struct Luv2RGBinteger
|
||||
zm[k] = vx_load_aligned(vzm + k*vsize/4);
|
||||
}
|
||||
|
||||
for(int k = 0; k < 4; k++)
|
||||
{
|
||||
x[k] = (y[k]*x[k]) >> base_shift;
|
||||
}
|
||||
|
||||
// z = zm/256 + zm/65536;
|
||||
for (int k = 0; k < 4; k++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user