зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1519535 - Check that deviceNumber is valid in GetDeviceName; r=jib
Differential Revision: https://phabricator.services.mozilla.com/D21945 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
6a11c5c4c0
Коммит
0aa8a8ce34
|
@ -67,7 +67,10 @@ int32_t DeviceInfoIos::Init() {
|
|||
|
||||
char deviceNameUTF8[256];
|
||||
char deviceId[256];
|
||||
this->GetDeviceName(i, deviceNameUTF8, 256, deviceId, 256);
|
||||
int error = this->GetDeviceName(i, deviceNameUTF8, 256, deviceId, 256);
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
std::string deviceIdCopy(deviceId);
|
||||
std::pair<std::string, VideoCaptureCapabilities> mapPair =
|
||||
std::pair<std::string, VideoCaptureCapabilities>(deviceIdCopy, capabilityVector);
|
||||
|
@ -89,6 +92,11 @@ int32_t DeviceInfoIos::GetDeviceName(uint32_t deviceNumber,
|
|||
char* productUniqueIdUTF8,
|
||||
uint32_t productUniqueIdUTF8Length,
|
||||
pid_t* pid) {
|
||||
|
||||
if (deviceNumber >= NumberOfDevices()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
NSString* deviceName = [DeviceInfoIosObjC deviceNameForIndex:deviceNumber];
|
||||
|
||||
NSString* deviceUniqueId = [DeviceInfoIosObjC deviceUniqueIdForIndex:deviceNumber];
|
||||
|
|
Загрузка…
Ссылка в новой задаче