Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
Fix Crashing NSURLSession Converter
Browse files Browse the repository at this point in the history
  • Loading branch information
Naville committed Aug 23, 2016
1 parent 38f3956 commit ca076de
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 32 deletions.
1 change: 1 addition & 0 deletions DOCS/HackingGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ When built with *JAILED* on, ThirdPartyToolsLoader will attempt to dlopen():

Make sure it's correctly signed

Everything in BuildConfig should be pretty self-explainary. Except *CreateExtraSegs* , which is a dict, used to inject file-on-disk into the tweak. Key is SegmentName and Value is path to the file


####Limitations
Expand Down
46 changes: 15 additions & 31 deletions Hooks/Utils/PlistObjectConverter.m
Original file line number Diff line number Diff line change
Expand Up @@ -641,37 +641,21 @@ + (NSDictionary *) convertNSURLSessionTask:(NSURLSessionTask*)task {
state_str = @"NSURLSessionTaskStateUnknown";
break;
}
NSDictionary *taskDict;
taskDict = [NSDictionary dictionaryWithObjects:
[NSArray arrayWithObjects:
[NSNumber numberWithUnsignedInteger:[task taskIdentifier]],
[PlistObjectConverter autoConvertNil:[PlistObjectConverter convertNSURLRequest:[task originalRequest]]],
[PlistObjectConverter autoConvertNil:[PlistObjectConverter convertNSURLRequest:[task currentRequest]]],
[PlistObjectConverter autoConvertNil:[PlistObjectConverter convertNSURLResponse:[task response]]],
[NSNumber numberWithInt:[task countOfBytesReceived]],
[NSNumber numberWithInt:[task countOfBytesSent]],
[NSNumber numberWithInt:[task countOfBytesExpectedToSend]],
[NSNumber numberWithInt:[task countOfBytesExpectedToReceive]],
[task taskDescription],
state_str,
[PlistObjectConverter autoConvertNil:[PlistObjectConverter convertNSError:[task error]]],
[NSNumber numberWithFloat:[task priority]],
nil]
forKeys:
[NSArray arrayWithObjects:
@"taskIdentifier",
@"originalRequest",
@"currentRequest",
@"response",
@"countOfBytesReceived",
@"countOfBytesSent",
@"countOfBytesExpectedToSend",
@"countOfBytesExpectedToReceive",
@"taskDescription",
@"state",
@"error",
@"priority",
nil]];
NSMutableDictionary *taskDict=[NSMutableDictionary dictionary];
[taskDict setObject:[NSNumber numberWithUnsignedInteger:[task taskIdentifier]] forKey:@"taskIdentifier"];
[taskDict setObject:[PlistObjectConverter convertNSURLRequest:[task originalRequest]] forKey:@"originalRequest"];
[taskDict setObject:[PlistObjectConverter convertNSURLRequest:[task currentRequest]] forKey:@"currentRequest"];
[taskDict setObject:[PlistObjectConverter convertNSURLResponse:[task response]] forKey:@"response"];
[taskDict setObject:[NSNumber numberWithInt:[task countOfBytesReceived]] forKey:@"countOfBytesReceived"];
[taskDict setObject:[NSNumber numberWithInt:[task countOfBytesSent]] forKey:@"countOfBytesSent"];
[taskDict setObject:[NSNumber numberWithInt:[task countOfBytesExpectedToSend]] forKey:@"countOfBytesExpectedToSend"];
[taskDict setObject:[NSNumber numberWithInt:[task countOfBytesExpectedToReceive]] forKey:@"countOfBytesExpectedToReceive"];
if([task taskDescription]!=nil){
[taskDict setObject:[task taskDescription] forKey:@"taskDescription"];
}
[taskDict setObject:state_str forKey:@"state"];
[taskDict setObject:[PlistObjectConverter convertNSError:[task error]] forKey:@"error"];
[taskDict setObject:[NSNumber numberWithFloat:[task priority]] forKey:@"priority"];
return taskDict;
}

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
462
465

0 comments on commit ca076de

Please sign in to comment.