Bug 71686

Summary: rar and unrar Segmentation fault on password-prot. archive with -p-
Product: Ports & Packages Reporter: Mark.Martinec
Component: Individual Port(s)Assignee: Andrey A. Chernov <ache>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Mark.Martinec 2004-09-12 22:20:20 UTC
Both the rar and unrar with any command (x, t, v, l) segfaults on certain (not all) password-protected (or broken?) archives when password is not given or is incorrect.

Here is an example RAR that triggers the problem:
  http://www.ijs.si/people/mark/frt45q.rar
(caution with that file, might contain a virus)

While this may be a minor annoyance for interactive use, it can be
a showstopper in anti-virus software (clamav, amavisd-new, ...)
which calls unrar or rar to unpack RAR archives.

Here is a backtrace after 'unrar t -p-' fault:

Program received signal SIGSEGV, Segmentation fault.
0x28211e80 in _ftello () from /lib/libc.so.5
(gdb) bt
#0  0x28211e80 in _ftello () from /lib/libc.so.5
#1  0x28211e05 in ftello () from /lib/libc.so.5
#2  0x0804d06e in File::Tell() (this=0xbfbea890) at file.cpp:449
#3  0x0804c2b5 in SaveFilePos (this=0xbfbea420, SaveFile=@0xbfbea890) at savepos.cpp:6
#4  0x0804d26a in File::FileLength() (this=0xbfbea890) at file.cpp:582
#5  0x0805e8ab in CmdExtract::ExtractArchiveInit(CommandData*, Archive&) (this=0xbfbf5760,
    Cmd=0xbfbf8d64, Arc=@0xbfbea890) at extract.cpp:56
#6  0x0805eb3c in CmdExtract::ExtractArchive(CommandData*) (this=0xbfbf5760, Cmd=0xbfbf8d64)
    at extract.cpp:107
#7  0x0805e774 in CmdExtract::DoExtract(CommandData*) (this=0xbfbf5760, Cmd=0xbfbf8d64)
    at extract.cpp:30
#8  0x0806d8fe in CommandData::ProcessCommand() (this=0xbfbf8d64) at cmddata.cpp:977
#9  0x08049b57 in main (argc=9, argv=0xbfbfe894) at rar.cpp:101
#10 0x08049826 in _start ()

Program versions from ports distinfo (most recent):
  (unrarsrc-3.3.5.tar.gz)
  (rarbsd-3.3.0.tar.gz)

How-To-Repeat:  $ rar t -inul -p- frt45q.rar
  Segmentation fault

$ unrar t -inul -p- frt45q.rar
  Segmentation fault

$ rar t frt45q.rar
  RAR 3.30    Copyright (c) 1993-2004 Eugene Roshal    22 Jan 2004
  Shareware version         Type RAR -? for help
  Enter password (will not be echoed) for frt45q.rar:
  Encrypted file:  CRC failed in frt45q.rar
    (password  incorrect ?)Segmentation fault
Comment 1 Mark.Martinec 2004-09-13 14:52:12 UTC
I got the following reply from the RARLAB:

From: Eugene Roshal <roshal@rarlab.com>
Subject: Re: bug rar
> You may try rar 3.4.* or unrar 3.4.*, which are available
> on www.rarlab.com. They handle such situation correctly in my tests.
> Eugene

Indeed the new rar and unrar 3.4 beta solves the problem,
so a ports update (or a backport of the fix) may be in order.

  Mark
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2004-09-13 20:39:49 UTC
Responsible Changed
From-To: freebsd-ports-bugs->ache

Over to maintainer.
Comment 3 Mark.Martinec 2004-10-19 00:17:39 UTC
The new versions of rar and unrar in ports fixes the problem, thanks!
This problem report may be closed as far as I am concerned.

Regards
  Mark
Comment 4 Andrey A. Chernov freebsd_committer freebsd_triage 2004-10-20 20:15:18 UTC
State Changed
From-To: open->closed

fixed in updated versions