Commit 89a4b84
committed
libarchive-c: fix seek() handling
seek() handling had two problems:
- seek callback had too short lifetime: it was garbage collected before
C code gets executed during archive iteration.
- seek callback had wrong prototype: context pointer was passed as 'int'
As a result test suite was occasionally crashing in NixOS:
============================= test session starts ==============================
platform linux -- Python 3.9.6, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
rootdir: /build/source
collected 33 items
tests/test_atime_mtime_ctime.py ........ [ 24%]
tests/test_convert.py . [ 27%]
tests/test_entry.py ....... [ 48%]
tests/test_errors.py .... [ 60%]
tests/test_rwx.py ...
Program received signal SIGSEGV, Segmentation fault.
0x00007fffe9314381 in classify_argument () from /nix/store/...-libffi-3.4.2/lib/libffi.so.8
0 0x00007fffe9314381 in classify_argument () from /nix/store/...-libffi-3.4.2/lib/libffi.so.8
1 0x00007fffe9315462 in ffi_closure_unix64_inner () from /nix/store/...-libffi-3.4.2/lib/libffi.so.8
2 0x00007fffe93159a0 in ffi_closure_unix64 () from /nix/store/...-libffi-3.4.2/lib/libffi.so.8
3 0x00007fffe9226287 in __archive_read_filter_seek () from /nix/store/...-libarchive-3.5.2-lib/lib/libarchive.so
4 0x00007fffe925ff8a in archive_read_format_zip_seekable_bid () from /nix/store/...-libarchive-3.5.2-lib/lib/libarchive.so
5 0x00007fffe92265e5 in archive_read_open1 () from /nix/store/...-libarchive-3.5.2-lib/lib/libarchive.so
6 0x00007fffe931580a in ffi_call_unix64 () from /nix/store/...-libffi-3.4.2/lib/libffi.so.8
7 0x00007fffe9314943 in ffi_call_int () from /nix/store/...-libffi-3.4.2/lib/libffi.so.8
8 0x00007fffe932e015 in _ctypes_callproc () from /nix/store/...-python3-3.9.6/lib/python3.9/lib-dynload/_ctypes.cpython-39-x86_64-linux-gnu.so
9 0x00007fffe932f992 in PyCFuncPtr_call () from /nix/store/...-python3-3.9.6/lib/python3.9/lib-dynload/_ctypes.cpython-39-x86_64-linux-gnu.so
10 0x00007ffff7ca0750 in _PyObject_MakeTpCall () from /nix/store/...-python3-3.9.6/lib/libpython3.9.so.1.0
11 0x00007ffff7c57f36 in _PyEval_EvalFrameDefault () from /nix/store/...-python3-3.9.6/lib/libpython3.9.so.1.0
...
The change fixes crashes for me.1 parent 222f41a commit 89a4b84
2 files changed
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| 146 | + | |
146 | 147 | | |
147 | 148 | | |
148 | | - | |
| 149 | + | |
149 | 150 | | |
150 | 151 | | |
151 | 152 | | |
| |||
0 commit comments