I'm having trouble getting a squash plugin working because it keeps segfaulting. My backtrace is similar enough to what I see from valgrind when running sharc that I think it's the same issue. valgrind:
nemequ@hoplite:~/local/src/sharc/src$ valgrind --tool=memcheck ./sharc -c1 iliad
==8985== Memcheck, a memory error detector
==8985== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==8985== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info
==8985== Command: ./sharc -c1 iliad
==8985==
==8985== Conditional jump or move depends on uninitialised value(s)
==8985== at 0x40258E: ssc_block_encode_finish (block_encode.c:226)
==8985== by 0x409732: ssc_encode_finish (main_encode.c:200)
==8985== by 0x409EDB: ssc_stream_compress_finish (stream.c:150)
==8985== by 0x412D22: main (client.c:197)
==8985==
==8985== Conditional jump or move depends on uninitialised value(s)
==8985== at 0x4A0752A: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==8985== by 0x409745: ssc_encode_finish (main_encode.c:201)
==8985== by 0x409EDB: ssc_stream_compress_finish (stream.c:150)
==8985== by 0x412D22: main (client.c:197)
==8985==
Compressed iliad (1,308,638 bytes) to iliad.sharc (776,904 bytes), Ratio out / in = 59.4%, Time = 0.417 s, Speed = 3 MB/s
==8985==
==8985== HEAP SUMMARY:
==8985== in use at exit: 504 bytes in 1 blocks
==8985== total heap usage: 5 allocs, 4 frees, 263,896 bytes allocated
==8985==
==8985== LEAK SUMMARY:
==8985== definitely lost: 504 bytes in 1 blocks
==8985== indirectly lost: 0 bytes in 0 blocks
==8985== possibly lost: 0 bytes in 0 blocks
==8985== still reachable: 0 bytes in 0 blocks
==8985== suppressed: 0 bytes in 0 blocks
==8985== Rerun with --leak-check=full to see details of leaked memory
==8985==
==8985== For counts of detected and suppressed errors, rerun with: -v
==8985== Use --track-origins=yes to see where uninitialised values come from
==8985== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 2 from 2)
FWIW, here is my backtrace from gdb:
Program received signal SIGSEGV, Segmentation fault.
__GI___libc_free (mem=0x637561206973696e) at malloc.c:2892
2892 if (chunk_is_mmapped(p)) /* release mmapped memory. */
(gdb) bt
#0 __GI___libc_free (mem=0x637561206973696e) at malloc.c:2892
#1 0x00007ffff6106665 in ssc_encode_finish (out=0x620770, state=0x6207d0) at /home/nemequ/local/src/squash/plugins/ssc/libssc/src/main_encode.c:201
#2 0x00007ffff6106aa1 in ssc_stream_compress_finish (stream=0x620750) at /home/nemequ/local/src/squash/plugins/ssc/libssc/src/stream.c:150
#3 0x00007ffff6102c17 in squash_ssc_process_stream_compress (operation=SQUASH_SSC_OPERATION_FINISH, stream=0x6204b0)
at /home/nemequ/local/src/squash/plugins/ssc/squash-ssc.c:325
#4 squash_ssc_process_stream_internal (operation=SQUASH_SSC_OPERATION_FINISH, stream=0x6204b0)
at /home/nemequ/local/src/squash/plugins/ssc/squash-ssc.c:491
#5 squash_ssc_finish_stream (stream=0x6204b0) at /home/nemequ/local/src/squash/plugins/ssc/squash-ssc.c:517
#6 0x00007ffff7df729b in squash_stream_finish (stream=0x6204b0) at /home/nemequ/local/src/squash/squash/stream.c:474
#7 0x00007ffff7df172b in squash_codec_compress_with_options (codec=0x619250, compressed=0x6224e0 "", compressed_length=0x7fffffffdba0,
uncompressed=0x4018c8 "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vulputate lectus nisl, vitae ultricies justo dictum nec. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia C"..., uncompressed_length=2725, options=0x0)
at /home/nemequ/local/src/squash/squash/codec.c:529
#8 0x0000000000401640 in check_codec (codec=0x619250) at /home/nemequ/local/src/squash/tests/buffer.c:11
#9 0x0000003bbf26d5a1 in test_case_run (tc=0x611cf0) at gtestutils.c:2067
#10 g_test_run_suite_internal (suite=suite@entry=0x610a80, path=path@entry=0x3bbf2e369e "") at gtestutils.c:2127
#11 0x0000003bbf26d766 in g_test_run_suite_internal (suite=suite@entry=0x610480, path=path@entry=0x3bbf2e369e "") at gtestutils.c:2138
#12 0x0000003bbf26d766 in g_test_run_suite_internal (suite=suite@entry=0x610460, path=path@entry=0x3bbf2e369e "") at gtestutils.c:2138
#13 0x0000003bbf26dadb in g_test_run_suite (suite=0x610460) at gtestutils.c:2189
#14 0x00000000004015d0 in main (argc=1, argv=0x7fffffffe038) at /home/nemequ/local/src/squash/tests/test-codecs.c:80
I can post the code if it would help, but it's a bit of a mess right now because of all the stuff I tried to fix this before realizing the issue can be reproduced by sharc, too (although it doesn't segfault, but that may just be luck).
I'm having trouble getting a squash plugin working because it keeps segfaulting. My backtrace is similar enough to what I see from valgrind when running sharc that I think it's the same issue. valgrind:
FWIW, here is my backtrace from gdb:
I can post the code if it would help, but it's a bit of a mess right now because of all the stuff I tried to fix this before realizing the issue can be reproduced by sharc, too (although it doesn't segfault, but that may just be luck).