Opened 2 years ago

Last modified 7 months ago

#5165 new defect

Zip files with comments trip assertion on game startup

Reported by: Teiresias Owned by:
Priority: Nice to Have Milestone: Alpha 24
Component: Core engine Keywords:
Cc: Patch: Phab:D1511

Description

Placing a .zip file with a "zip file comment" below the $0AD-HOME/binaries/data/mods/public folder (so the pyrogenesis engine will scan it) causes a startup assertion to fire on all of my machines. On Windows, it said "(error while formatting error message)" while on Linux and FreeBSD it reports an assertion in archive_zip@500 has tripped.

The attached test.zip file trips the problem on my machines when placed e.g. in $0AD-HOME/binaries/data/mods/public/simulation/ai, and was built using the buildzipwithcomment.sh file inside that archive.

Note: The actual zip command was created using the zipnote utility. The tool crashed on both Linux and FreeBSD for me, so I fetched the source from ftp://ftp.info-zip.org/pub/infozip/src/zip30.tgz and debugged into it. It seems that the fclose(x); instruction in zipnote.c:666 is trying to close a file already closed in zipnote.c:552, and my stdlibs seem unforgiving to it. So I patched the zipnote.c and used that to create the comment. That's why the buildzipwithcomment.sh explicitly calls ./zipnote

(I actually encountered this problem during AI breeding as the jasmine archive is a commented zip file, and destilled it down to the test.zip)

Attachments (1)

test.zip (13.1 KB ) - added by Teiresias 2 years ago.
Test archive with a comment, trips assertion archive_zip.cpp@500 and contains patched zipnote.c

Download all attachments as: .zip

Change History (7)

by Teiresias, 2 years ago

Attachment: test.zip added

Test archive with a comment, trips assertion archive_zip.cpp@500 and contains patched zipnote.c

comment:1 by Teiresias, 2 years ago

Fix is ready on my disk, will try to commit it into Phabricator.

comment:2 by Teiresias, 2 years ago

Milestone: Alpha 24Backlog

comment:3 by Teiresias, 2 years ago

Milestone: BacklogAlpha 24
Owner: set to (none)
Patch: Phab:D1511

comment:4 by Teiresias, 2 years ago

Fix has been put into Phabricator including description of problem cause and solution.

comment:5 by Teiresias, 2 years ago

Updated Phabricator item. The test.zip in Phab:D1511 now has been stripped from the zipnote.c sources to reduce the file size to a minimum.

On the trac ticket, I keep the original test.zip in place since the zipnote problem is independent of 0AD and the patch inside the .zip might be of help to somebody.

(Doubled fclose(x) is undefined behavior and may have worked in the past, but modern runtimes are likely to be less forgiving).

comment:6 by Angen, 7 months ago

Owner: (none) removed
Note: See TracTickets for help on using tickets.