1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-01-11 08:10:59 +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]) if ([target respondsToSelector: selector])
{ {
NSMethodSignature *signature = [object_getClass (target) instanceMethodSignatureForSelector: selector]; NSMethodSignature *signature = [object_getClass (target) instanceMethodSignatureForSelector: selector];
if (signature == nil) return -1;
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature: signature]; NSInvocation *invocation = [NSInvocation invocationWithMethodSignature: signature];
if (invocation == nil) return -1;
[invocation setTarget: target]; [invocation setTarget: target];
[invocation setSelector: selector]; [invocation setSelector: selector];
[invocation invoke]; [invocation invoke];
@ -377,7 +383,7 @@ int hc_mtlDeviceGetAttribute (void *hashcat_ctx, int *pi, metalDeviceAttribute_t
uint64_t val64 = 0; uint64_t val64 = 0;
bool valBool = false; bool valBool = false;
int valInt = 0; unsigned long valULong = 0;
switch (attrib) switch (attrib)
{ {
@ -492,11 +498,11 @@ int hc_mtlDeviceGetAttribute (void *hashcat_ctx, int *pi, metalDeviceAttribute_t
*pi = 0; *pi = 0;
SEL locationSelector = NSSelectorFromString(@"location"); 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; break;
@ -505,10 +511,10 @@ int hc_mtlDeviceGetAttribute (void *hashcat_ctx, int *pi, metalDeviceAttribute_t
SEL locationNumberSelector = NSSelectorFromString(@"locationNumber"); SEL locationNumberSelector = NSSelectorFromString(@"locationNumber");
valInt = 0; valULong = 0;
hc_mtlInvocationHelper (metal_device, locationNumberSelector, &valInt); hc_mtlInvocationHelper (metal_device, locationNumberSelector, &valULong);
*pi = valInt; *pi = valULong;
break; break;