#6 Segmentation Fault - program doesn't work


I compiled rarcrack on my ArchLinux 64 bits.
Warning while compiling : "Comparison between an integer and a pointer"
Error while executing : "Segmentation fault"


  • JAZ

    Same issue in UBUNTU:
    Solution: delete/comment line 326 in rarcrack.c:
    326: printf("INFO: detected file type: %s\n", TYPE[archive_type]);


  • Anonymous

    It is not necessary. It happens because archive_type after not founding archive type equals -1, so it is bad index for table. If you make conditional f.e (if archive_type == -1) archive_type = 3 it works fully.


  • Anonymous

    Yeah. The developer really messed up here. As said before, the problem is line 326. I'm no expert in C, but I'm guessing that printf was not used correctly. Wrong type of argument maybe?

    Here is the backtrace in case it helps the developer or any possible contributors.

    #0 0x00007ffff708d5bf in vfprintf () from /lib64/libc.so.6
    #1 0x00007ffff7133c39 in __printf_chk () from /lib64/libc.so.6
    #2 0x0000000000402347 in printf (__fmt=0x4027e8 "INFO: detected file type: %s\n") at /usr/include/bits/stdio2.h:105
    #3 init (argc=2, argv=0x7fffffffdec8) at rarcrack.c:326
    #4 0x000000000040261f in main (argc=2, argv=0x7fffffffdec8) at rarcrack.c:348


  • Anonymous

    Alright. I know the mistake the developer made. If it can't tell the file type (which seems like always), printf get's passed an invalid variable type, thus causing the error. I'm not an expert, but it seems to me this can be fixed by a simple if test.

    In other words, the dev needs to lrn2flowcontrol.


  • Anonymous

    I fixed this once and for all.

    Pay attention software author!

    This is how you fix it.

    Download my patch.
    wget http://pastebin.com/raw.php?i=dqtxd1Pu rarcrack.c.fix

    Rename the original source code.
    mv rarcrack.c rarcrack.c.old

    Apply the patch.
    patch rarcrack.c.old -i rarcrack.c.fix.diff -o rarcrack.c

    Now make and make install. It should work just fine now. :)

    Hopefully, the developer will have this remedied by the next release. [/hint]

  • I wanted to assess rarcrack on an RAR I made with a known password. I got by the segmentation fault by using the "--type rar" switch. Of course, the password returned as good wasn't correct, but that got me by the segmentation fault.

    What a joke.