Segfault when mounting certain ZIP files
Quake 3 uses PK3 files to hold assets. PK3 files are just renamed ZIP files, so they can be mounted in LOVR via `lovr.filesystem.mount`.
In a typical modern installation of Quake 3, you will have, at minimum, PK3 files named `pak0.pk3` through `pak8.pk3`. The first file, `pak0.pk3`, is the base game data. The files `pak1.pk3` through `pak8.pk3` came as part of free patches, which may be downloaded [here](<https://ioquake3.org/extras/patch-data/>).
I am able to mount `pak0.pk3` through `pak4.pk3`, as well as `pak8.pk3`. However, `pak5.pk3` through `pak7.pk3` cause a segfault.
They seem to be valid ZIP files. Calling `zip -T pak5.pk3` reports no issues. And, of course, Quake 3 loads them just fine.
There's only one thing that stands out to me about the "bad" files. If I ask for file listings from them via `unzip -l pak5.pk3` I notice directory listings appearing _after_ the files.
```
> unzip -l pak5.pk3
Archive: pak5.pk3
Length Date Time Name
--------- ---------- ----- ----
264510 2000-12-14 16:44 demos/demo127.dm_48
0 2000-12-14 17:04 demos/
0 2000-12-14 11:07 menu/medals/
16428 2000-10-30 20:29 menu/medals/medal_capture.tga
0 2000-12-14 16:31 menu/
23896 2000-12-14 16:32 scripts/gfx.shader
0 2000-12-14 17:13 scripts/
--------- -------
304834 7 files
```
Every "good" file seems to consistently list directories _before_ files.
```
> unzip -l pak8.pk3
Archive: pak8.pk3
Length Date Time Name
--------- ---------- ----- ----
0 2002-10-07 11:17 demos/
152158 2002-10-07 11:17 demos/four.dm_68
0 2002-10-07 11:16 menu/
0 2002-10-07 11:16 menu/art/
1100 2002-09-30 14:16 menu/art/pblogo.tga
0 2002-10-07 11:16 vm/
278308 2002-09-30 14:16 vm/ui.qvm
325220 2002-09-30 14:16 vm/cgame.qvm
469796 2002-09-30 14:16 vm/qagame.qvm
--------- -------
1226582 9 files
```
I've been poking around LOVR's code a bit, and nothing is immediately jumping out to me as likely to be at fault. The issue may be with the miniz library instead, but I don't know.
关闭于 2026-05-31 3 条评论