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
7f896643
Commit
7f896643
authored
Jul 06, 2016
by
Jan Starzynski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix for buffer-overflow in IPPCalcHistInvoker::operator()
parent
b4112a58
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
histogram.cpp
modules/imgproc/src/histogram.cpp
+6
-5
No files found.
modules/imgproc/src/histogram.cpp
View file @
7f896643
...
@@ -1188,6 +1188,7 @@ public:
...
@@ -1188,6 +1188,7 @@ public:
virtual
void
operator
()
(
const
Range
&
range
)
const
virtual
void
operator
()
(
const
Range
&
range
)
const
{
{
Ipp32s
levelNum
=
histSize
+
1
;
Mat
phist
(
hist
->
size
(),
hist
->
type
(),
Scalar
::
all
(
0
));
Mat
phist
(
hist
->
size
(),
hist
->
type
(),
Scalar
::
all
(
0
));
#if IPP_VERSION_X100 >= 900
#if IPP_VERSION_X100 >= 900
IppiSize
roi
=
{
src
->
cols
,
range
.
end
-
range
.
start
};
IppiSize
roi
=
{
src
->
cols
,
range
.
end
-
range
.
start
};
...
@@ -1196,7 +1197,7 @@ public:
...
@@ -1196,7 +1197,7 @@ public:
IppiHistogramSpec
*
pSpec
=
NULL
;
IppiHistogramSpec
*
pSpec
=
NULL
;
Ipp8u
*
pBuffer
=
NULL
;
Ipp8u
*
pBuffer
=
NULL
;
if
(
ippiHistogramGetBufferSize
(
ipp8u
,
roi
,
&
histSize
,
1
,
1
,
&
specSize
,
&
bufferSize
)
<
0
)
if
(
ippiHistogramGetBufferSize
(
ipp8u
,
roi
,
&
levelNum
,
1
,
1
,
&
specSize
,
&
bufferSize
)
<
0
)
{
{
*
ok
=
false
;
*
ok
=
false
;
return
;
return
;
...
@@ -1217,7 +1218,7 @@ public:
...
@@ -1217,7 +1218,7 @@ public:
return
;
return
;
}
}
if
(
ippiHistogramUniformInit
(
ipp8u
,
(
Ipp32f
*
)
&
low
,
(
Ipp32f
*
)
&
high
,
(
Ipp32s
*
)
&
histSize
,
1
,
pSpec
)
<
0
)
if
(
ippiHistogramUniformInit
(
ipp8u
,
(
Ipp32f
*
)
&
low
,
(
Ipp32f
*
)
&
high
,
(
Ipp32s
*
)
&
levelNum
,
1
,
pSpec
)
<
0
)
{
{
if
(
pSpec
)
ippFree
(
pSpec
);
if
(
pSpec
)
ippFree
(
pSpec
);
if
(
pBuffer
)
ippFree
(
pBuffer
);
if
(
pBuffer
)
ippFree
(
pBuffer
);
...
@@ -1233,7 +1234,7 @@ public:
...
@@ -1233,7 +1234,7 @@ public:
#else
#else
CV_SUPPRESS_DEPRECATED_START
CV_SUPPRESS_DEPRECATED_START
IppStatus
status
=
ippiHistogramEven_8u_C1R
(
src
->
ptr
(
range
.
start
),
(
int
)
src
->
step
,
ippiSize
(
src
->
cols
,
range
.
end
-
range
.
start
),
IppStatus
status
=
ippiHistogramEven_8u_C1R
(
src
->
ptr
(
range
.
start
),
(
int
)
src
->
step
,
ippiSize
(
src
->
cols
,
range
.
end
-
range
.
start
),
phist
.
ptr
<
Ipp32s
>
(),
(
Ipp32s
*
)(
Ipp32f
*
)
*
levels
,
histSize
,
(
Ipp32s
)
low
,
(
Ipp32s
)
high
);
phist
.
ptr
<
Ipp32s
>
(),
(
Ipp32s
*
)(
Ipp32f
*
)
*
levels
,
levelNum
,
(
Ipp32s
)
low
,
(
Ipp32s
)
high
);
CV_SUPPRESS_DEPRECATED_END
CV_SUPPRESS_DEPRECATED_END
#endif
#endif
if
(
status
<
0
)
if
(
status
<
0
)
...
@@ -1282,7 +1283,7 @@ static bool ipp_calchist(const Mat* images, int nimages, const int* channels,
...
@@ -1282,7 +1283,7 @@ static bool ipp_calchist(const Mat* images, int nimages, const int* channels,
!
accumulate
&&
uniform
)
!
accumulate
&&
uniform
)
{
{
ihist
.
setTo
(
Scalar
::
all
(
0
));
ihist
.
setTo
(
Scalar
::
all
(
0
));
AutoBuffer
<
Ipp32f
>
levels
(
histSize
[
0
]
+
1
);
AutoBuffer
<
Ipp32f
>
levels
(
histSize
[
0
]);
bool
ok
=
true
;
bool
ok
=
true
;
const
Mat
&
src
=
images
[
0
];
const
Mat
&
src
=
images
[
0
];
...
@@ -1290,7 +1291,7 @@ static bool ipp_calchist(const Mat* images, int nimages, const int* channels,
...
@@ -1290,7 +1291,7 @@ static bool ipp_calchist(const Mat* images, int nimages, const int* channels,
#ifdef HAVE_CONCURRENCY
#ifdef HAVE_CONCURRENCY
nstripes
=
1
;
nstripes
=
1
;
#endif
#endif
IPPCalcHistInvoker
invoker
(
src
,
ihist
,
levels
,
histSize
[
0
]
+
1
,
ranges
[
0
][
0
],
ranges
[
0
][
1
],
&
ok
);
IPPCalcHistInvoker
invoker
(
src
,
ihist
,
levels
,
histSize
[
0
],
ranges
[
0
][
0
],
ranges
[
0
][
1
],
&
ok
);
Range
range
(
0
,
src
.
rows
);
Range
range
(
0
,
src
.
rows
);
parallel_for_
(
range
,
invoker
,
nstripes
);
parallel_for_
(
range
,
invoker
,
nstripes
);
...
...
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