projects
/
platform
/
upstream
/
opencv.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4af3ca4
)
GetModuleFileName() doesn't reset last error on success
author
Ivan Pozdeev
<vano@mail.mipt.ru>
Thu, 7 Dec 2017 21:12:08 +0000
(
00:12
+0300)
committer
Ivan Pozdeev
<vano@mail.mipt.ru>
Fri, 8 Dec 2017 18:11:41 +0000
(21:11 +0300)
modules/videoio/src/cap_ffmpeg.cpp
patch
|
blob
|
history
diff --git
a/modules/videoio/src/cap_ffmpeg.cpp
b/modules/videoio/src/cap_ffmpeg.cpp
index
a70cbdf
..
5439f43
100644
(file)
--- a/
modules/videoio/src/cap_ffmpeg.cpp
+++ b/
modules/videoio/src/cap_ffmpeg.cpp
@@
-124,8
+124,10
@@
private:
if (m)
{
wchar_t path[MAX_PATH];
- size_t sz = GetModuleFileNameW(m, path, sizeof(path));
- if (sz > 0 && ERROR_SUCCESS == GetLastError())
+ const size_t path_size = sizeof(path)/sizeof(*path);
+ size_t sz = GetModuleFileNameW(m, path, path_size);
+ /* Don't handle paths longer than MAX_PATH until that becomes a real issue */
+ if (sz > 0 && sz < path_size)
{
wchar_t* s = wcsrchr(path, L'\\');
if (s)