nwaples/rardecode

Crash bug

Closed this issue · 4 comments

dosgo commented

password ==0010011password
checkPwd("test.rar","0010011password");

/check password/
func checkPwd(archivePath string,password string)(bool,error){
log.Printf("password:%s len:%d\r\n",password,len(password));
r,err:= rardecode.OpenReader(archivePath,password)
defer r.Close();
if(err!=nil){
return false,err;
}
_,err=r.Next();
if(err!=nil){
return false,nil;
}
_, err = ioutil.ReadAll(r)
if(err!=nil){
return false,nil;
}
return true,nil;

}

goroutine 1 [running]:
github.com/nwaples/rardecode.(*huffmanDecoder).readSym(0xc00007fb20, 0x785180, 0xc0000fc060, 0x14, 0x0, 0x0)
D:/go/src/github.com/nwaples/rardecode/huffman.go:137 +0x3a9
github.com/nwaples/rardecode.readCodeLengthTable(0x785180, 0xc0000fc060, 0xc0001e6050, 0x194, 0x194, 0x6cfb01, 0x1, 0xc0000fe050)
D:/go/src/github.com/nwaples/rardecode/huffman.go:167 +0x1fb
github.com/nwaples/rardecode.(*lz29Decoder).init(0xc0001e6050, 0xc0000fc060, 0x0, 0x0)
D:/go/src/github.com/nwaples/rardecode/decode29_lz.go:71 +0xc1
github.com/nwaples/rardecode.(*decoder29).readBlockHeader(0xc0001e6000, 0xc0000fc060, 0xc000083d48)
D:/go/src/github.com/nwaples/rardecode/decode29.go:212 +0x1a9
github.com/nwaples/rardecode.(*decoder29).init(0xc0001e6000, 0xbd8170, 0xc000104070, 0x6cbb01, 0x784800, 0xbd8170)
D:/go/src/github.com/nwaples/rardecode/decode29.go:57 +0x104
github.com/nwaples/rardecode.(*decodeReader).init(0xc000112030, 0xbd8170, 0xc000104070, 0x784fc0, 0xc0001e6000, 0x11, 0x1, 0x10, 0xc000104070)
D:/go/src/github.com/nwaples/rardecode/decode_reader.go:148 +0x101
github.com/nwaples/rardecode.(*Reader).Next(0xc000112008, 0x8, 0x722b76, 0xf)
D:/go/src/github.com/nwaples/rardecode/reader.go:305 +0x497

Sorry for the delay.
Is this only one particular file that is the problem? Having a copy of it would help to debug.
Is the version of go 32 or 64 bit?

dosgo commented

test.rar.zip
password is 123456

go version go1.13.1 windows/amd64

Thank you

dosgo commented

Only when the password is "0010011password" to unzip will it crash.

Sorry for the delay, it should be fixed now.