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
45a21555
Commit
45a21555
authored
Aug 16, 2016
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7117 from patsp:fix_tiff_imdecode_remove_temporary_file
parents
d1d8c7d8
84e17126
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
4 deletions
+29
-4
loadsave.cpp
modules/imgcodecs/src/loadsave.cpp
+16
-4
test_grfmt.cpp
modules/imgcodecs/test/test_grfmt.cpp
+13
-0
No files found.
modules/imgcodecs/src/loadsave.cpp
View file @
45a21555
...
...
@@ -514,8 +514,14 @@ imdecode_( const Mat& buf, int flags, int hdrtype, Mat* mat=0 )
if
(
!
decoder
->
readHeader
()
)
{
if
(
!
filename
.
empty
()
)
remove
(
filename
.
c_str
());
decoder
.
release
();
if
(
!
filename
.
empty
()
)
{
if
(
remove
(
filename
.
c_str
())
!=
0
)
{
CV_Error
(
CV_StsError
,
"unable to remove temporary file"
);
}
}
return
0
;
}
...
...
@@ -556,8 +562,14 @@ imdecode_( const Mat& buf, int flags, int hdrtype, Mat* mat=0 )
}
bool
code
=
decoder
->
readData
(
*
data
);
if
(
!
filename
.
empty
()
)
remove
(
filename
.
c_str
());
decoder
.
release
();
if
(
!
filename
.
empty
()
)
{
if
(
remove
(
filename
.
c_str
())
!=
0
)
{
CV_Error
(
CV_StsError
,
"unable to remove temporary file"
);
}
}
if
(
!
code
)
{
...
...
modules/imgcodecs/test/test_grfmt.cpp
View file @
45a21555
...
...
@@ -890,6 +890,19 @@ TEST(Imgcodecs_Tiff, decode_multipage)
CV_GrfmtReadTifMultiPage
test
;
test
.
safe_run
();
}
TEST
(
Imgcodecs_Tiff
,
imdecode_no_exception_temporary_file_removed
)
{
cvtest
::
TS
&
ts
=
*
cvtest
::
TS
::
ptr
();
string
input
=
string
(
ts
.
get_data_path
())
+
"../cv/shared/lena.png"
;
cv
::
Mat
img
=
cv
::
imread
(
input
);
ASSERT_FALSE
(
img
.
empty
());
std
::
vector
<
uchar
>
buf
;
EXPECT_NO_THROW
(
cv
::
imencode
(
".tiff"
,
img
,
buf
));
EXPECT_NO_THROW
(
cv
::
imdecode
(
buf
,
IMREAD_UNCHANGED
));
}
#endif
#ifdef HAVE_WEBP
...
...
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