Browse Source

feat(CI): Disallow implicit casting of QByteArray to char* or void*

QByteArray usually holds arbitrary binary data, which can have null
characters or invalid characters when converted to ASCII or UTF8.
Disallow implicit casting for safety, forcing an explicit decision if
the conversion is wanted.
reviewable/pr6616/r1
Anthony Bilinski 3 years ago
parent
commit
f1b401166a
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
  1. 2
      CMakeLists.txt
  2. 2
      src/platform/camera/avfoundation.mm

2
CMakeLists.txt

@ -102,6 +102,8 @@ if (UNIX AND NOT APPLE) @@ -102,6 +102,8 @@ if (UNIX AND NOT APPLE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro")
endif()
add_definitions(-DQT_NO_CAST_FROM_BYTEARRAY)
include(CheckAtomic)
# Use ccache when available to speed up builds.

2
src/platform/camera/avfoundation.mm

@ -57,7 +57,7 @@ QVector<VideoMode> avfoundation::getDeviceModes(QString devName) @@ -57,7 +57,7 @@ QVector<VideoMode> avfoundation::getDeviceModes(QString devName)
return result;
}
else {
NSString* deviceName = [NSString stringWithCString:devName.toUtf8() encoding:NSUTF8StringEncoding];
NSString* deviceName = [NSString stringWithCString:devName.toUtf8().constData() encoding:NSUTF8StringEncoding];
AVCaptureDevice* device = [AVCaptureDevice deviceWithUniqueID:deviceName];
if (device == nil) {

Loading…
Cancel
Save