GNOME Bugzilla – Bug 735120
Segfault with truncated file
Last modified: 2014-08-23 07:29:40 UTC
Created attachment 283999 [details] Test archive The archive backend segfaults with the attached (truncated) file.
Created attachment 284000 [details] [review] archive: Retry operations that return ARCHIVE_RETRY Retry operations that return ARCHIVE_RETRY since it indicates that the operation has failed, the archive_entry is not valid, and the operation should be retried to see if it succeeds. This fixes a segfault on a truncated archive where archive_read_next_header would return ARCHIVE_RETRY and the backend would continue to try and use the invalid archive_entry that was returned.
Review of attachment 284000 [details] [review]: It would be good to clear the error before retrying... if (result < ARCHIVE_OK) { DEBUG ("archive_read_data_block: result = %d, error = '%s'\n", result, archive_error_string (archive->archive)); archive_set_error (archive->archive, ARCHIVE_OK, "No error"); archive_clear_error (archive->archive); } if (result == ARCHIVE_RETRY) continue;
Created attachment 284166 [details] [review] archive: Retry operations that return ARCHIVE_RETRY Retry operations that return ARCHIVE_RETRY since it indicates that the operation has failed, the archive_entry is not valid, and the operation should be retried to see if it succeeds. This fixes a segfault on a truncated archive where archive_read_next_header would return ARCHIVE_RETRY and the backend would continue to try and use the invalid archive_entry that was returned.
Review of attachment 284166 [details] [review]: Looks good, thanks!
Pushed to master and gnome-3-12. Thanks for the reviews!