Skip to content

Commit

Permalink
BUGFIX: Solve the use after free problem caused by early release of r…
Browse files Browse the repository at this point in the history
…eturn value
  • Loading branch information
SilverFruity committed Aug 15, 2024
1 parent 93bc2d0 commit a355b01
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions OCRunner/ORCoreImp/ORCoreImp.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void methodIMP(ffi_cif *cfi,void *ret,void **args, void*userdata){
ctx.isDeallocScope = sel == NSSelectorFromString(@"dealloc");
scope.entryCtx = ctx;

MFValue *returnValue = nil;
__autoreleasing MFValue *returnValue = nil;
[ORArgsStack push:argValues];
returnValue = [methodImp execute:scope];
if (returnValue.type != TypeVoid && returnValue.pointer != NULL){
Expand Down Expand Up @@ -97,7 +97,7 @@ void blockInter(ffi_cif *cfi,void *ret,void **args, void*userdata){
MFValue *argValue = [[MFValue alloc] initTypeEncode:[sig getArgumentTypeAtIndex:i] pointer:args[i]];
[argValues addObject:argValue];
}
MFValue *value = nil;
__autoreleasing MFValue *value = nil;
[ORArgsStack push:argValues];
value = [mangoBlock.func execute:mangoBlock.outScope];
if (value.type != TypeVoid && value.pointer != NULL){
Expand Down
2 changes: 1 addition & 1 deletion OCRunner/RunnerClasses+Execute.m
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ typedef NS_OPTIONS(NSUInteger, UIControlState) {\n\
if (key && value){
dict[key] = value;
}else{
NSLog(@"OCRunner Error: the key %@ or value %@ of NSDictionary can't be nil", key?:@"", value?:@"");
NSLog(@"OCRunner Error: the key '%@' or value '%@' of NSDictionary can't be nil", key?:@"null", value?:@"null");
}
}
return [MFValue valueWithObject:[dict copy]];
Expand Down

0 comments on commit a355b01

Please sign in to comment.