Found with american fuzzy lop and affects the current code from github.
This is the stack trace from address sanitizer:
==15954==ERROR: AddressSanitizer: SEGV on unknown address 0x7f6b33f70000 (pc 0x7f6b33c4b51b bp 0x000000002000 sp 0x7ffd66f70510 T0)
==15954==The signal is caused by a READ memory access.
#0 0x7f6b33c4b51a in fwrite /var/tmp/portage/sys-libs/glibc-2.23-r2/work/glibc-2.23/libio/iofwrite.c:35
#1 0x4f69fd in fwrite_crc /f/lha/lha/src/crcio.c:87:17
#2 0x53d63f in decode /f/lha/lha/src/slide.c:451:17
#3 0x4faf2f in decode_lzhuf /f/lha/lha/src/extract.c:97:15
#4 0x52d929 in extract_one /f/lha/lha/src/lhext.c:386:19
#5 0x52d929 in cmd_extract /f/lha/lha/src/lhext.c:574
#6 0x524456 in main /f/lha/lha/src/lharc.c:680:9
#7 0x7f6b33c0578f in __libc_start_main /var/tmp/portage/sys-libs/glibc-2.23-r2/work/glibc-2.23/csu/../csu/libc-start.c:289
#8 0x419888 in _start (/mnt/ram/lha/lha+0x419888)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /var/tmp/portage/sys-libs/glibc-2.23-r2/work/glibc-2.23/libio/iofwrite.c:35 in fwrite
==15954==ABORTING
This input file https://crashes.fuzzing-project.org/lha-segfault-fwrite_crc.lha causes a segfault in lha with the p parameter.
Test: lha p lha-segfault-fwrite_crc.lha
Found with american fuzzy lop and affects the current code from github.
This is the stack trace from address sanitizer: