Issue 1:
System information (version)

OpenCV => :4.1:

Operating System / Platform => :Ubuntu 19.04 64 Bit:

Compiler => :g++ 4.8.2

Detailed description

I try to initialiaze a variable in order to compute the BRISQUE descriptor and I received the error message:

terminate called after throwing an instance of 'std::logic_error'

what(): basic_string::_S_construct null not valid

Aborted (core dumped)

Steps to reproduce

General configuration for OpenCV 4.1.0 =====================================
Version control: 4.1.0

Extra modules:

Location (extra): /io/opencv_contrib/modules

Version control (extra): 4.1.0

Platform:

Timestamp: 2019-04-11T17:07:54Z

Host: Linux 4.4.0-101-generic x86_64

CMake: 3.9.0

CMake generator: Unix Makefiles

CMake build tool: /usr/bin/gmake

Configuration: Release

CPU/HW features:

Baseline: SSE SSE2 SSE3

requested: SSE3

Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2

requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX

SSE4_1 (13 files): + SSSE3 SSE4_1

SSE4_2 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2

FP16 (0 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX

AVX (4 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX

AVX2 (27 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2

C/C++:

Built as dynamic libs?: NO

C++ Compiler: /usr/lib/ccache/compilers/c++ (ver 4.8.2)

C++ flags (Release): -Wl,-strip-all -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wsign-promo -Wuninitialized -Winit-self -Wno-delete-non-virtual-dtor -Wno-comment -Wno-missing-field-initializers -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG

C++ flags (Debug): -Wl,-strip-all -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wsign-promo -Wuninitialized -Winit-self -Wno-delete-non-virtual-dtor -Wno-comment -Wno-missing-field-initializers -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG

C Compiler: /usr/lib/ccache/compilers/cc

C flags (Release): -Wl,-strip-all -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wuninitialized -Winit-self -Wno-comment -Wno-missing-field-initializers -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG

C flags (Debug): -Wl,-strip-all -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wuninitialized -Winit-self -Wno-comment -Wno-missing-field-initializers -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG

Linker flags (Release): -L/root/ffmpeg_build/lib -Wl,--gc-sections

Linker flags (Debug): -L/root/ffmpeg_build/lib -Wl,--gc-sections

ccache: YES

Precompiled headers: NO

Extra dependencies: ade /opt/Qt4.8.7/lib/libQtGui.so /opt/Qt4.8.7/lib/libQtTest.so /opt/Qt4.8.7/lib/libQtCore.so /lib64/libz.so /opt/libjpeg-turbo/lib64/libjpeg.a dl m pthread rt

3rdparty dependencies: ittnotify libprotobuf libwebp libpng libtiff libjasper IlmImf quirc

OpenCV modules:

To be built: aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dpm face features2d flann fuzzy gapi hfs highgui img_hash imgcodecs imgproc line_descriptor ml objdetect optflow phase_unwrapping photo plot python3 quality reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking video videoio videostab xfeatures2d ximgproc xobjdetect xphoto

Disabled: world

Disabled by dependency: -

Unavailable: cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv freetype hdf java js matlab ovis python2 sfm ts viz

Applications: -

Documentation: NO

Non-free algorithms: NO

GUI:

QT: YES (ver 4.8.7 EDITION = OpenSource)

QT OpenGL support: NO

GTK+: NO

VTK support: NO

Media I/O:

ZLib: /lib64/libz.so (ver 1.2.3)

JPEG: /opt/libjpeg-turbo/lib64/libjpeg.a (ver 62)

WEBP: build (ver encoder: 0x020e)

PNG: build (ver 1.6.36)

TIFF: build (ver 42 - 4.0.10)

JPEG 2000: build (ver 1.900.1)

OpenEXR: build (ver 1.7.1)

HDR: YES

SUNRASTER: YES

PXM: YES

PFM: YES

Video I/O:

DC1394: NO

FFMPEG: YES

avcodec: YES (58.47.106)

avformat: YES (58.26.101)

avutil: YES (56.26.100)

swscale: YES (5.4.100)

avresample: NO

GStreamer: NO

v4l/v4l2: YES (linux/videodev2.h)

Parallel framework: pthreads

Trace: YES (with Intel ITT)

Other third-party libraries:

Lapack: NO

Eigen: NO

Custom HAL: NO

Protobuf: build (3.5.1)

OpenCL: YES (no extra features)

Include path: /io/opencv/3rdparty/include/opencl/1.2

Link libraries: Dynamic load

Python 3:

Interpreter: /opt/python/cp36-cp36m/bin/python (ver 3.6.8)

Libraries: libpython3.6m.a (ver 3.6.8)

numpy: /opt/python/cp36-cp36m/lib/python3.6/site-packages/numpy/core/include (ver 1.11.3)

install path: python

Python (for build): /opt/python/cp36-cp36m/bin/python

Java:

ant: NO

JNI: NO

Java wrappers: NO

Java tests: NO

Issue 2:
Hello,

System information (version)

OpenCV => 4.0

Operating System / Platform => Windows 10 64 bit

Compiler => mingw-w64 GCC 8.1.0

Detailed description

The use of strcpy_s and strcat_s in window_w32.cpp makes OpenCV impossible to build with GCC (on Windows) which doesn't have the optional _s functions from C11. I'm not an expert in C/C++ so I would suggest to replace the use of the above with strncpy and strncat which should be present in all compilers (MSVC, GCC, Clang).

Steps to reproduce

Try to build OpenCV 4.0 beta with mingw-w64 GCC 8.1 on Windows.

Thanks.