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
1260060d
Commit
1260060d
authored
Nov 05, 2015
by
jiakai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check boundary in ExifReader
parent
b3ac2746
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
5 deletions
+22
-5
jpeg_exif.cpp
modules/imgcodecs/src/jpeg_exif.cpp
+22
-5
No files found.
modules/imgcodecs/src/jpeg_exif.cpp
View file @
1260060d
...
@@ -42,6 +42,13 @@
...
@@ -42,6 +42,13 @@
#include "jpeg_exif.hpp"
#include "jpeg_exif.hpp"
namespace
{
class
ExifParsingError
{
};
}
namespace
cv
namespace
cv
{
{
...
@@ -66,12 +73,16 @@ ExifReader::~ExifReader()
...
@@ -66,12 +73,16 @@ ExifReader::~ExifReader()
*/
*/
bool
ExifReader
::
parse
()
bool
ExifReader
::
parse
()
{
{
m_exif
=
getExif
();
try
{
if
(
!
m_exif
.
empty
()
)
m_exif
=
getExif
();
{
if
(
!
m_exif
.
empty
()
)
return
true
;
{
return
true
;
}
return
false
;
}
catch
(
ExifParsingError
&
)
{
return
false
;
}
}
return
false
;
}
}
...
@@ -401,6 +412,9 @@ std::string ExifReader::getString(const size_t offset) const
...
@@ -401,6 +412,9 @@ std::string ExifReader::getString(const size_t offset) const
*/
*/
uint16_t
ExifReader
::
getU16
(
const
size_t
offset
)
const
uint16_t
ExifReader
::
getU16
(
const
size_t
offset
)
const
{
{
if
(
offset
+
1
>=
m_data
.
size
())
throw
ExifParsingError
();
if
(
m_format
==
INTEL
)
if
(
m_format
==
INTEL
)
{
{
return
m_data
[
offset
]
+
(
m_data
[
offset
+
1
]
<<
8
);
return
m_data
[
offset
]
+
(
m_data
[
offset
+
1
]
<<
8
);
...
@@ -416,6 +430,9 @@ uint16_t ExifReader::getU16(const size_t offset) const
...
@@ -416,6 +430,9 @@ uint16_t ExifReader::getU16(const size_t offset) const
*/
*/
uint32_t
ExifReader
::
getU32
(
const
size_t
offset
)
const
uint32_t
ExifReader
::
getU32
(
const
size_t
offset
)
const
{
{
if
(
offset
+
3
>=
m_data
.
size
())
throw
ExifParsingError
();
if
(
m_format
==
INTEL
)
if
(
m_format
==
INTEL
)
{
{
return
m_data
[
offset
]
+
return
m_data
[
offset
]
+
...
...
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