Fuse crashes when writing CSW tapes under some circumstances.
Steps:
1. Start Fuse without traps: fuse --no-traps
2. Type a Basic program: 10 PRINT "Hello world"
3. Start recording: Media->Tape->Record Start
4. Save program: SAVE "test"
5. Stop tape: Media->Tape->Record Stop
6. Write tape to file (test.csw): Media->Tape->Record write...
Fuse crashes with this message:
./fuse: error: libspectrum: invalid block type 0x100 given to libspectrum_tape_block_bit_length
Floating point exception (core dumped)
The trace is:
Thread 1 "fuse" received signal SIGFPE, Arithmetic exception.
0x00007ffff7b95eeb in csw_write_body (buffer=0x7fffd80130d0,
tape=0x5555568a65e0, sample_rate=0,
body_uncompressed_length=0x7fffffffcbb0) at csw.c:237
237 long scale = 3500000/sample_rate;
(gdb) bt
#0 0x00007ffff7b95eeb in csw_write_body (buffer=0x7fffd80130d0, tape=0x5555568a65e0, sample_rate=0, body_uncompressed_length=0x7fffffffcbb0) at csw.c:237
#1 0x00007ffff7b9617a in libspectrum_csw_write (new_buffer=0x555556c19400, tape=0x5555568a65e0) at csw.c:304
#2 0x00007ffff7bae5b9 in libspectrum_tape_write (buffer=0x7fffffffcc58, length=0x7fffffffcc60, tape=0x5555568a65e0, type=LIBSPECTRUM_ID_TAPE_CSW)
at tape.c:300
#3 0x00005555555a2abe in tape_write (filename=0x55555648d780 "/home/user/test.csw") at tape.c:359
#4 0x00005555555a47f5 in ui_tape_write () at ui.c:745
#5 0x0000555555582c59 in menu_media_tape_write (gtk_action=0x555556509300, data=0x0) at menu.c:402
#6 0x00007ffff65af10d in g_closure_invoke ()
at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#7 0x00007ffff65c205e in () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#8 0x00007ffff65ca715 in g_signal_emit_valist ()
at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#9 0x00007ffff65cb12f in g_signal_emit ()
at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#10 0x00007ffff7322ae0 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#11 0x00007ffff65af346 in () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#12 0x00007ffff65ca9ff in g_signal_emit_valist ()
at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0