Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CRASH] crash when opening .nsloggerrawdata in Desktop Viewer #304

Open
quzongyao opened this issue Mar 5, 2021 · 3 comments
Open

[CRASH] crash when opening .nsloggerrawdata in Desktop Viewer #304

quzongyao opened this issue Mar 5, 2021 · 3 comments

Comments

@quzongyao
Copy link

macOS: Big Sur 11.1
Desktop Viewer: 1.9.7

Client nslogger: installed by cocoapods and version is 1.9.7

How to reproduce:

  1. open an nsloggerrawdata file recorded in my iOS app
  2. open the file in Desktop Viewer
  3. 💣

Reproducing Rate:
100%

I also tried to build the Desktop Viewer myself from the master branch and crash is occurring.

And after the following change, no crash any more.

in LoggerDocument.m
- (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError **)outError {

LINE 312
-			NSData *subset = [NSData dataWithBytesNoCopy:(unsigned char *)p + 4 length:length];
+			NSData *subset = [NSData dataWithBytes:(unsigned char *)p + 4 length:length];

I checked the code, p is from the input param, and dataWithBytesNoCopy will hand the ownership from to subset.
This could cause the input param data to be deallocated twice.

Please check my analysis, thank you.

Sorry I don't have much time to make a PR.

@Deub27
Copy link

Deub27 commented May 8, 2021

Same issue here.
It works with 1.9.0 version, not with version >= 1.9.5

@nk-contorra
Copy link

should be:
NSData *subset = [NSData dataWithBytesNoCopy:(unsigned char *)p + 4 length:length freeWhenDone:NO];

@aolan
Copy link

aolan commented Jun 14, 2022

Did you compile the package yourself?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants