1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-23 15:18:16 +00:00

Fix segfault on hc_mtlInvocationHelper() with valInt

This commit is contained in:
Gabriele Gristina 2022-02-13 21:16:21 +01:00
parent 7ea244bba7
commit 2f31391632

View File

@ -84,7 +84,13 @@ static int hc_mtlInvocationHelper (id target, SEL selector, void *returnValue)
if ([target respondsToSelector: selector])
{
NSMethodSignature *signature = [object_getClass (target) instanceMethodSignatureForSelector: selector];
if (signature == nil) return -1;
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature: signature];
if (invocation == nil) return -1;
[invocation setTarget: target];
[invocation setSelector: selector];
[invocation invoke];
@ -377,7 +383,7 @@ int hc_mtlDeviceGetAttribute (void *hashcat_ctx, int *pi, metalDeviceAttribute_t
uint64_t val64 = 0;
bool valBool = false;
int valInt = 0;
unsigned long valULong = 0;
switch (attrib)
{
@ -492,11 +498,11 @@ int hc_mtlDeviceGetAttribute (void *hashcat_ctx, int *pi, metalDeviceAttribute_t
*pi = 0;
SEL locationSelector = NSSelectorFromString(@"location");
valInt = 0;
valULong = 0;
hc_mtlInvocationHelper (metal_device, locationSelector, &valInt);
hc_mtlInvocationHelper (metal_device, locationSelector, &valULong);
*pi = valInt;
*pi = valULong;
break;
@ -505,10 +511,10 @@ int hc_mtlDeviceGetAttribute (void *hashcat_ctx, int *pi, metalDeviceAttribute_t
SEL locationNumberSelector = NSSelectorFromString(@"locationNumber");
valInt = 0;
hc_mtlInvocationHelper (metal_device, locationNumberSelector, &valInt);
valULong = 0;
hc_mtlInvocationHelper (metal_device, locationNumberSelector, &valULong);
*pi = valInt;
*pi = valULong;
break;