| Summary: | [SOUP] Race condition when downloading a file due to the intermediate temporary file | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Carlos Garcia Campos <cgarcia> | ||||||||
| Component: | WebKit2 | Assignee: | Nobody <webkit-unassigned> | ||||||||
| Status: | RESOLVED FIXED | ||||||||||
| Severity: | Normal | CC: | commit-queue, mcatanzaro | ||||||||
| Priority: | P2 | ||||||||||
| Version: | 528+ (Nightly build) | ||||||||||
| Hardware: | Unspecified | ||||||||||
| OS: | Unspecified | ||||||||||
| Bug Depends on: | |||||||||||
| Bug Blocks: | 136372 | ||||||||||
| Attachments: |
|
||||||||||
|
Description
Carlos Garcia Campos
2014-09-01 02:09:53 PDT
Created attachment 237457 [details]
Patch
Created attachment 237459 [details]
Patch
Comment on attachment 237459 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=237459&action=review Looks good to me in general, I have just a few comments > Source/WebKit2/Shared/Downloads/soup/DownloadSoup.cpp:67 > + if (m_createdDestination) { > + ASSERT(m_destinationFile); > + g_file_delete(m_destinationFile.get(), nullptr, nullptr); > + } I think we can use m_destinationFile to know if the destination was successfully created. > Source/WebKit2/Shared/Downloads/soup/DownloadSoup.cpp:115 > + outputStream = adoptGRef(g_file_replace(m_destinationFile.get(), nullptr, false, G_FILE_CREATE_NONE, nullptr, &error.outPtr())); g_file_replace expects a gboolean, so better use FALSE, instead of false, even though it doesn't really matter. > Source/WebKit2/Shared/Downloads/soup/DownloadSoup.cpp:121 > + if (!outputStream) { > + downloadFailed(platformDownloadDestinationError(response, error->message)); > + return; > + } And here you could m_destinationFile.reset() and you don't need the m_createdDestination bool member Created attachment 237572 [details]
Patch
Comment on attachment 237572 [details]
Patch
Perfect, thanks!
Comment on attachment 237572 [details] Patch Clearing flags on attachment: 237572 Committed r173252: <http://trac.webkit.org/changeset/173252> All reviewed patches have been landed. Closing bug. |