Change comparison data type to fix int overflow
Since the value returned by CGDisplaySerialNumber is uint32_t, comparing it with a long data type can cause overflow when the value is greater than or equal to 2^31. And since this is a serial number, in some machine this value can be greater than 2^31. In those machines, QScreen::name will be empty due to the failed check here. Pick-to: 6.3 6.2 5.15 Change-Id: Ia037ba9e7a6d8025cc4b41c1b428eba38455330d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
9a7e55dcbe
commit
cb9ef46c77
@ -232,13 +232,13 @@ static QString displayName(CGDirectDisplayID displayID)
|
||||
NSDictionary *info = [(__bridge NSDictionary*)IODisplayCreateInfoDictionary(
|
||||
display, kIODisplayOnlyPreferredName) autorelease];
|
||||
|
||||
if ([[info objectForKey:@kDisplayVendorID] longValue] != CGDisplayVendorNumber(displayID))
|
||||
if ([[info objectForKey:@kDisplayVendorID] unsignedIntValue] != CGDisplayVendorNumber(displayID))
|
||||
continue;
|
||||
|
||||
if ([[info objectForKey:@kDisplayProductID] longValue] != CGDisplayModelNumber(displayID))
|
||||
if ([[info objectForKey:@kDisplayProductID] unsignedIntValue] != CGDisplayModelNumber(displayID))
|
||||
continue;
|
||||
|
||||
if ([[info objectForKey:@kDisplaySerialNumber] longValue] != CGDisplaySerialNumber(displayID))
|
||||
if ([[info objectForKey:@kDisplaySerialNumber] unsignedIntValue] != CGDisplaySerialNumber(displayID))
|
||||
continue;
|
||||
|
||||
NSDictionary *localizedNames = [info objectForKey:@kDisplayProductName];
|
||||
|
Loading…
Reference in New Issue
Block a user