Skip to content

Bug found in connection:didReceiveResponse: #53

@ylisr

Description

@ylisr

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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions