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

Bug found in connection:didReceiveResponse: #53

Open
ylisr opened this issue Apr 8, 2015 · 1 comment
Open

Bug found in connection:didReceiveResponse: #53

ylisr opened this issue Apr 8, 2015 · 1 comment

Comments

@ylisr
Copy link

ylisr commented Apr 8, 2015

Hi Thibault, thanks for the project, I've been using it for a while and it's wonderful.

Recently I've noticed some suspicious crashes happening and I'm able to narrow it down to the callback block of startDownloadWithURL:customPath:firstResponse:progress:error:complete:method. Turns out the totalLength parameter in progressBlock sometimes returns the maximum value of UInt64, so when I assign it to a 64-bit NSNumber, it causes a segmentation fault.

on Line 205 of TCBlobDownload.m I found:

self.expectedDataLength = self.receivedDataLength + [response expectedContentLength];

the expectedContentLength property of NSURLResponse returns -1 if there is no expectation that can be arrived, at the same time if I pause and resume a download, sometimes receivedDataLength could be 0 (not sure why), so here you could be assigning minus value to expectedDataLength which is a uint64_t. I suggest to check the value before the assignment.

Meanwhile,I'm using TCBlobDownload in my swift project at the moment. I should take your advice and switch to the newest swift version. Again thanks for your hard work :)

@thibaultcha
Copy link
Owner

Thanks for noticing this. I will maybe find some time to fix it.

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

2 participants