Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
791ebd05
Commit
791ebd05
authored
May 27, 2019
by
Rostislav Vasilikhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
out of bounds read fixed in rgb2luv_b
parent
898cf702
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
7 deletions
+20
-7
color_lab.cpp
modules/imgproc/src/color_lab.cpp
+20
-7
No files found.
modules/imgproc/src/color_lab.cpp
View file @
791ebd05
...
@@ -3266,7 +3266,7 @@ struct RGB2Luv_b
...
@@ -3266,7 +3266,7 @@ struct RGB2Luv_b
return
;
return
;
}
}
int
i
,
j
,
scn
=
srccn
;
int
scn
=
srccn
;
#if CV_SIMD
#if CV_SIMD
float
CV_DECL_ALIGNED
(
CV_SIMD_WIDTH
)
buf
[
bufChannels
*
BLOCK_SIZE
];
float
CV_DECL_ALIGNED
(
CV_SIMD_WIDTH
)
buf
[
bufChannels
*
BLOCK_SIZE
];
#else
#else
...
@@ -3295,16 +3295,16 @@ struct RGB2Luv_b
...
@@ -3295,16 +3295,16 @@ struct RGB2Luv_b
}
}
#endif
#endif
for
(
i
=
0
;
i
<
n
;
i
+=
BLOCK_SIZE
,
dst
+=
BLOCK_SIZE
*
bufChannels
)
for
(
int
i
=
0
;
i
<
n
;
i
+=
BLOCK_SIZE
,
dst
+=
BLOCK_SIZE
*
bufChannels
)
{
{
int
dn
=
std
::
min
(
n
-
i
,
(
int
)
BLOCK_SIZE
);
int
dn
=
std
::
min
(
n
-
i
,
(
int
)
BLOCK_SIZE
);
j
=
0
;
static
const
softfloat
f255inv
=
softfloat
::
one
()
/
f255
;
static
const
softfloat
f255inv
=
softfloat
::
one
()
/
f255
;
#if CV_SIMD
#if CV_SIMD
v_float32
v255inv
=
vx_setall_f32
((
float
)
f255inv
);
v_float32
v255inv
=
vx_setall_f32
((
float
)
f255inv
);
if
(
scn
==
4
)
if
(
scn
==
4
)
{
{
int
j
=
0
;
static
const
int
nBlock
=
fsize
*
4
;
static
const
int
nBlock
=
fsize
*
4
;
for
(
;
j
<=
dn
*
bufChannels
-
nBlock
*
3
;
for
(
;
j
<=
dn
*
bufChannels
-
nBlock
*
3
;
j
+=
nBlock
*
3
,
src
+=
nBlock
*
4
)
j
+=
nBlock
*
3
,
src
+=
nBlock
*
4
)
...
@@ -3334,9 +3334,16 @@ struct RGB2Luv_b
...
@@ -3334,9 +3334,16 @@ struct RGB2Luv_b
v_store_interleave
(
buf
+
j
+
k
*
3
*
fsize
,
f
[
0
*
4
+
k
],
f
[
1
*
4
+
k
],
f
[
2
*
4
+
k
]);
v_store_interleave
(
buf
+
j
+
k
*
3
*
fsize
,
f
[
0
*
4
+
k
],
f
[
1
*
4
+
k
],
f
[
2
*
4
+
k
]);
}
}
}
}
for
(
;
j
<
dn
*
bufChannels
;
j
+=
bufChannels
,
src
+=
4
)
{
buf
[
j
]
=
(
float
)(
src
[
0
]
*
((
float
)
f255inv
));
buf
[
j
+
1
]
=
(
float
)(
src
[
1
]
*
((
float
)
f255inv
));
buf
[
j
+
2
]
=
(
float
)(
src
[
2
]
*
((
float
)
f255inv
));
}
}
}
else
// scn == 3
else
// scn == 3
{
{
int
j
=
0
;
static
const
int
nBlock
=
fsize
*
2
;
static
const
int
nBlock
=
fsize
*
2
;
for
(
;
j
<=
dn
*
bufChannels
-
nBlock
;
for
(
;
j
<=
dn
*
bufChannels
-
nBlock
;
j
+=
nBlock
,
src
+=
nBlock
)
j
+=
nBlock
,
src
+=
nBlock
)
...
@@ -3348,17 +3355,23 @@ struct RGB2Luv_b
...
@@ -3348,17 +3355,23 @@ struct RGB2Luv_b
v_store_aligned
(
buf
+
j
+
0
*
fsize
,
v_cvt_f32
(
q0
)
*
v255inv
);
v_store_aligned
(
buf
+
j
+
0
*
fsize
,
v_cvt_f32
(
q0
)
*
v255inv
);
v_store_aligned
(
buf
+
j
+
1
*
fsize
,
v_cvt_f32
(
q1
)
*
v255inv
);
v_store_aligned
(
buf
+
j
+
1
*
fsize
,
v_cvt_f32
(
q1
)
*
v255inv
);
}
}
for
(
;
j
<
dn
*
bufChannels
;
j
++
,
src
++
)
{
buf
[
j
]
=
(
float
)(
src
[
0
]
*
((
float
)
f255inv
));
}
}
}
#e
ndif
#e
lse
for
(
;
j
<
dn
*
bufChannels
;
j
+=
bufChannels
,
src
+=
scn
)
for
(
int
j
=
0
;
j
<
dn
*
bufChannels
;
j
+=
bufChannels
,
src
+=
scn
)
{
{
buf
[
j
]
=
(
float
)(
src
[
0
]
*
((
float
)
f255inv
));
buf
[
j
]
=
(
float
)(
src
[
0
]
*
((
float
)
f255inv
));
buf
[
j
+
1
]
=
(
float
)(
src
[
1
]
*
((
float
)
f255inv
));
buf
[
j
+
1
]
=
(
float
)(
src
[
1
]
*
((
float
)
f255inv
));
buf
[
j
+
2
]
=
(
float
)(
src
[
2
]
*
((
float
)
f255inv
));
buf
[
j
+
2
]
=
(
float
)(
src
[
2
]
*
((
float
)
f255inv
));
}
}
#endif
fcvt
(
buf
,
buf
,
dn
);
fcvt
(
buf
,
buf
,
dn
);
j
=
0
;
int
j
=
0
;
#if CV_SIMD
#if CV_SIMD
for
(
;
j
<=
dn
*
3
-
fsize
*
3
*
4
;
j
+=
fsize
*
3
*
4
)
for
(
;
j
<=
dn
*
3
-
fsize
*
3
*
4
;
j
+=
fsize
*
3
*
4
)
...
@@ -3389,7 +3402,7 @@ struct RGB2Luv_b
...
@@ -3389,7 +3402,7 @@ struct RGB2Luv_b
#endif
#endif
for
(
;
j
<
dn
*
3
;
j
+=
3
)
for
(
;
j
<
dn
*
3
;
j
+=
3
)
{
{
dst
[
j
]
=
saturate_cast
<
uchar
>
(
buf
[
j
]
*
(
float
)
fL
);
dst
[
j
+
0
]
=
saturate_cast
<
uchar
>
(
buf
[
j
+
0
]
*
(
float
)
fL
);
dst
[
j
+
1
]
=
saturate_cast
<
uchar
>
(
buf
[
j
+
1
]
*
(
float
)
fu
+
(
float
)
su
);
dst
[
j
+
1
]
=
saturate_cast
<
uchar
>
(
buf
[
j
+
1
]
*
(
float
)
fu
+
(
float
)
su
);
dst
[
j
+
2
]
=
saturate_cast
<
uchar
>
(
buf
[
j
+
2
]
*
(
float
)
fv
+
(
float
)
sv
);
dst
[
j
+
2
]
=
saturate_cast
<
uchar
>
(
buf
[
j
+
2
]
*
(
float
)
fv
+
(
float
)
sv
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment