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
55574744
Commit
55574744
authored
6 years ago
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
imgcodecs(sunras): avoid buffer overrun
`src_pitch` may be large than data `step`
parent
5a27f7c8
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
grfmt_sunras.cpp
modules/imgcodecs/src/grfmt_sunras.cpp
+5
-5
No files found.
modules/imgcodecs/src/grfmt_sunras.cpp
View file @
55574744
...
...
@@ -175,8 +175,6 @@ bool SunRasterDecoder::readData( Mat& img )
AutoBuffer
<
uchar
>
_src
(
src_pitch
+
32
);
uchar
*
src
=
_src
;
AutoBuffer
<
uchar
>
_bgr
(
m_width
*
3
+
32
);
uchar
*
bgr
=
_bgr
;
if
(
!
color
&&
m_maptype
==
RMT_EQUAL_RGB
)
CvtPaletteToGray
(
m_palette
,
gray_palette
,
1
<<
m_bpp
);
...
...
@@ -340,16 +338,18 @@ bad_decoding_end:
case
24
:
for
(
y
=
0
;
y
<
m_height
;
y
++
,
data
+=
step
)
{
m_strm
.
getBytes
(
color
?
data
:
bgr
,
src_pitch
);
m_strm
.
getBytes
(
src
,
src_pitch
);
if
(
color
)
{
if
(
m_type
==
RAS_FORMAT_RGB
)
icvCvt_RGB2BGR_8u_C3R
(
data
,
0
,
data
,
0
,
cvSize
(
m_width
,
1
)
);
icvCvt_RGB2BGR_8u_C3R
(
src
,
0
,
data
,
0
,
cvSize
(
m_width
,
1
)
);
else
memcpy
(
data
,
src
,
std
::
min
(
step
,
(
size_t
)
src_pitch
));
}
else
{
icvCvt_BGR2Gray_8u_C3C1R
(
bgr
,
0
,
data
,
0
,
cvSize
(
m_width
,
1
),
icvCvt_BGR2Gray_8u_C3C1R
(
src
,
0
,
data
,
0
,
cvSize
(
m_width
,
1
),
m_type
==
RAS_FORMAT_RGB
?
2
:
0
);
}
}
...
...
This diff is collapsed.
Click to expand it.
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