Closed Bug 425768 Opened 16 years ago Closed 16 years ago

Zipwriter corrupts zip files that previously contained extra fields

Categories

(Core :: General, defect)

defect
Not set
major

Tracking

()

RESOLVED FIXED
mozilla1.9

People

(Reporter: mossop, Assigned: mossop)

Details

(Keywords: dataloss)

Attachments

(1 file)

When editing a zip file created by a third party tool that wrote extra field data for any entry in the zip file, zipwriter will not correctly output the zip file leaving it unusable.

The fix for this is fairly simple, not going to be prone to cause any regression and can easily be unit tested.
Flags: blocking1.9?
Attached patch patch rev 1Splinter Review
This is some poor code that went effectively untested because the extra field is unused by zipwriter which writes pure zip files. The already in tree testcase of this didn't flag any errors because every unit test removes existing things from it. This new unit test just adds something and checks that the file isn't corrupt (it is without this patch) and that the length is correct.

The patch just properly uses the mFieldLength field to keep the length of the extrafield known.
Attachment #312356 - Flags: review?(benjamin)
Attachment #312356 - Flags: review?(benjamin) → review+
Attachment #312356 - Flags: approval1.9?
Comment on attachment 312356 [details] [diff] [review]
patch rev 1

a=beltzner
Attachment #312356 - Flags: approval1.9? → approval1.9+
Checking in modules/libjar/zipwriter/src/nsZipHeader.cpp;
/cvsroot/mozilla/modules/libjar/zipwriter/src/nsZipHeader.cpp,v  <--  nsZipHeader.cpp
new revision: 1.2; previous revision: 1.1
done
CS file: /cvsroot/mozilla/modules/libjar/zipwriter/test/unit/test_bug425768.js,v
done
Checking in modules/libjar/zipwriter/test/unit/test_bug425768.js;
/cvsroot/mozilla/modules/libjar/zipwriter/test/unit/test_bug425768.js,v  <--  test_bug425768.js
initial revision: 1.1
done
Status: NEW → RESOLVED
Closed: 16 years ago
Keywords: dataloss
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9
Flags: blocking1.9?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: