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
8a76fada
Commit
8a76fada
authored
Jan 09, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
imgcodecs: add overflow checks
parent
be524792
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
bitstrm.cpp
modules/imgcodecs/src/bitstrm.cpp
+7
-1
grfmt_bmp.cpp
modules/imgcodecs/src/grfmt_bmp.cpp
+1
-0
No files found.
modules/imgcodecs/src/bitstrm.cpp
View file @
8a76fada
...
...
@@ -42,6 +42,7 @@
#include "precomp.hpp"
#include "bitstrm.hpp"
#include "utils.hpp"
namespace
cv
{
...
...
@@ -183,13 +184,18 @@ void RBaseStream::setPos( int pos )
int
RBaseStream
::
getPos
()
{
CV_Assert
(
isOpened
());
return
m_block_pos
+
(
int
)(
m_current
-
m_start
);
int
pos
=
validateToInt
((
m_current
-
m_start
)
+
m_block_pos
);
CV_Assert
(
pos
>=
m_block_pos
);
// overflow check
CV_Assert
(
pos
>=
0
);
// overflow check
return
pos
;
}
void
RBaseStream
::
skip
(
int
bytes
)
{
CV_Assert
(
bytes
>=
0
);
uchar
*
old
=
m_current
;
m_current
+=
bytes
;
CV_Assert
(
m_current
>=
old
);
// overflow check
}
///////////////////////// RLByteStream ////////////////////////////
...
...
modules/imgcodecs/src/grfmt_bmp.cpp
View file @
8a76fada
...
...
@@ -95,6 +95,7 @@ bool BmpDecoder::readHeader()
m_offset
=
m_strm
.
getDWord
();
int
size
=
m_strm
.
getDWord
();
CV_Assert
(
size
>
0
);
// overflow, 2Gb limit
if
(
size
>=
36
)
{
...
...
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