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
20bf7b6a
Commit
20bf7b6a
authored
Sep 02, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
imgcodecs(webp): use safe cast to size_t on Win32
parent
f9c8bb40
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
grfmt_webp.cpp
modules/imgcodecs/src/grfmt_webp.cpp
+1
-1
utils.hpp
modules/imgcodecs/src/utils.hpp
+9
-0
No files found.
modules/imgcodecs/src/grfmt_webp.cpp
View file @
20bf7b6a
...
...
@@ -107,7 +107,7 @@ bool WebPDecoder::readHeader()
{
fs
.
open
(
m_filename
.
c_str
(),
std
::
ios
::
binary
);
fs
.
seekg
(
0
,
std
::
ios
::
end
);
fs_size
=
fs
.
tellg
(
);
fs_size
=
safeCastToSizeT
(
fs
.
tellg
(),
"File is too large"
);
fs
.
seekg
(
0
,
std
::
ios
::
beg
);
CV_Assert
(
fs
&&
"File stream error"
);
CV_CheckGE
(
fs_size
,
WEBP_HEADER_SIZE
,
"File is too small"
);
...
...
modules/imgcodecs/src/utils.hpp
View file @
20bf7b6a
...
...
@@ -44,6 +44,15 @@
int
validateToInt
(
size_t
step
);
template
<
typename
_Tp
>
static
inline
size_t
safeCastToSizeT
(
const
_Tp
v_origin
,
const
char
*
msg
)
{
const
size_t
value_cast
=
(
size_t
)
v_origin
;
if
((
_Tp
)
value_cast
!=
v_origin
)
CV_Error
(
cv
::
Error
::
StsError
,
msg
?
msg
:
"Can't cast value into size_t"
);
return
value_cast
;
}
struct
PaletteEntry
{
unsigned
char
b
,
g
,
r
,
a
;
...
...
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