nwaples / rardecode Goto Github PK
View Code? Open in Web Editor NEWA go package for reading RAR archives.
License: BSD 2-Clause "Simplified" License
A go package for reading RAR archives.
License: BSD 2-Clause "Simplified" License
This came up using trufflehog to scan a large number of repositories. I'm not sure of the file that caused this panic. I also haven't been able to reproduce the issue. If I can reproduce the issue in the future, I'll provide an example file.
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0xb424e4]
goroutine 1185589 [running]:
github.com/nwaples/rardecode/v2.(*rarBitReader).readBits(0xc0018af8b0, 0x10)
github.com/nwaples/rardecode/[email protected]/bit_reader.go:163 +0x44
github.com/nwaples/rardecode/v2.(*rarBitReader).readUint32(0x100c0018af828?)
github.com/nwaples/rardecode/[email protected]/bit_reader.go:209 +0xc5
github.com/nwaples/rardecode/v2.(*decoder29).parseVMFilter(0xc0082a33e0, {0xc04c695a08?, 0x20301f?, 0x20301f?})
github.com/nwaples/rardecode/[email protected]/decode29.go:118 +0x168
github.com/nwaples/rardecode/v2.(*decoder29).fill(0xc0082a33e0, 0xc000bead00)
github.com/nwaples/rardecode/[email protected]/decode29.go:246 +0xbd
github.com/nwaples/rardecode/v2.(*decodeReader).fill(0xc000bead00)
github.com/nwaples/rardecode/[email protected]/decode_reader.go:188 +0x8b
github.com/nwaples/rardecode/v2.(*decodeReader).bytes(0xc000bead00)
github.com/nwaples/rardecode/[email protected]/decode_reader.go:255 +0x32
github.com/nwaples/rardecode/v2.(*decodeReader).Read(0xc000bead00, {0xc049079000, 0x200, 0xb51025?})
github.com/nwaples/rardecode/[email protected]/decode_reader.go:301 +0x47
github.com/nwaples/rardecode/v2.(*limitedReader).Read(0xc07e72e420, {0xc049079000?, 0x7a543ee900000003?, 0xc07bd598c0?})
github.com/nwaples/rardecode/[email protected]/reader.go:260 +0x4a
github.com/nwaples/rardecode/v2.(*checksumReader).Read(0xc07e72e450, {0xc049079000, 0xc049079000?, 0x200})
github.com/nwaples/rardecode/[email protected]/reader.go:306 +0x37
github.com/nwaples/rardecode/v2.(*Reader).Read(0xc07b2fa480?, {0xc049079000?, 0x200?, 0x200?})
github.com/nwaples/rardecode/[email protected]/reader.go:346 +0x5e
github.com/trufflesecurity/trufflehog/v3/pkg/handlers.(*Archive).ReadToMax(0xc04c695950, {0x7fe559814a98, 0xc04c6b7c90})
github.com/trufflesecurity/trufflehog/[email protected]/pkg/handlers/archive.go:144 +0x11c
github.com/trufflesecurity/trufflehog/v3/pkg/handlers.(*Archive).extractorHandler.func1({0x232b6c8, 0xc07e72e300}, {{0x232fd88, 0xc07bd59940}, {0x1a45660, 0xc07bd59940}, {0xc0075c47b0, 0x24}, {0x0, 0x0}, ...})
github.com/trufflesecurity/trufflehog/[email protected]/pkg/handlers/archive.go:124 +0x13d
github.com/mholt/archiver/v4.Rar.Extract({0xc7?, {0x0?, 0x1bbf460?}}, {0x232b6c8, 0xc07e72e300}, {0x230fee0?, 0xc07dc09bf0?}, {0x0, 0x0, 0x0}, ...)
github.com/mholt/archiver/[email protected]/rar.go:108 +0x45d
github.com/trufflesecurity/trufflehog/v3/pkg/handlers.(*Archive).openArchive(0xc00a7d5710?, {0x232b658, 0xc000128000}, 0x0, {0x230fee0?, 0xc07dc09bf0?}, 0xc0048b9620?)
github.com/trufflesecurity/trufflehog/[email protected]/pkg/handlers/archive.go:76 +0x18c
github.com/trufflesecurity/trufflehog/v3/pkg/handlers.(*Archive).FromFile.func1()
github.com/trufflesecurity/trufflehog/[email protected]/pkg/handlers/archive.go:42 +0x6e
created by github.com/trufflesecurity/trufflehog/v3/pkg/handlers.(*Archive).FromFile
github.com/trufflesecurity/trufflehog/[email protected]/pkg/handlers/archive.go:40 +0xfb
I have problems with unpacking a large rar archive, the archive itself takes about 6GB and unpacked 25GB. The archive contains XML files with a database of Russian addresses.
You can download it from the official site http://fias.nalog.ru or from the direct link http://fias.nalog.ru/Public/Downloads/Actual/fias_xml.rar
The full error text
ERROR: 2017/10/12 00:37:10 unpack.go:12: Error unpack archive: data\AS_HOUSE_20171008_bed24a8e-4646-448d-acb8-8de765818389.XML: writing file: rardecode: decoder expected more data than is in packed file
I'm new to Go, you can tell me what the problem is.
Hey, thanks for making this! I'm trying out this library with a rar file I had lying around; it contains zip files, and on one of them when I try to write the contents to a file, this error is returned:
rardecode: bad file checksum
But other zip files contained in the archive previous to this one are read just fine. Does this mean the file is corrupted? I can send it to you privately if you'd like (just give me an email address to send the link to).
By the way, if this works out, I hope to add this to my archiver tool.
You ever seen an archive like this? Will this library handle these file names?
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r00
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r01
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r02
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r03
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r04
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r05
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r06
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r07
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r08
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r09
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r10
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r11
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r12
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r13
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r14
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r15
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r16
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r17
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r18
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r19
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r20
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r21
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r22
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r23
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r24
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r25
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r26
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r27
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r28
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r29
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r30
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r31
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r32
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r33
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r34
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r35
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r36
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r37
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r38
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r39
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r40
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r41
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r42
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r43
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r44
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r45
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r46
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r47
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r48
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r49
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r50
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r51
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r52
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r53
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r54
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r55
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r56
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r57
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r58
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r59
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r60
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r61
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r62
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r63
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r64
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r65
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r66
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r67
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r68
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r69
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r70
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r71
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r72
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r73
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r74
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r75
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r76
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r77
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r78
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r79
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r80
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r81
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r82
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r83
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r84
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r85
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r86
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r87
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r88
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r89
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r90
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r91
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r92
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r93
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r94
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r95
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r96
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r97
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r98
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.r99
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.rar
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s00
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s01
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s02
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s03
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s04
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s05
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s06
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s07
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s08
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s09
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s10
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s11
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s12
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s13
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s14
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s15
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s16
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s17
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s18
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s19
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s20
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s21
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s22
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s23
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s24
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s25
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s26
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s27
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s28
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s29
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s30
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s31
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s32
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s33
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s34
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s35
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s36
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s37
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s38
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s39
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s40
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s41
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s42
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s43
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s44
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s45
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s46
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s47
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s48
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s49
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s50
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s51
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s52
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s53
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s54
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s55
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s56
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s57
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s58
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s59
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s60
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s61
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s62
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s63
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s64
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s65
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s66
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s67
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s68
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s69
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s70
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s71
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s72
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s73
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s74
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s75
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s76
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s77
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s78
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s79
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s80
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s81
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s82
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s83
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s84
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s85
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s86
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s87
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s88
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s89
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s90
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s91
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s92
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s93
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s94
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s95
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s96
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s97
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s98
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.s99
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.sfv
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t00
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t01
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t02
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t03
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t04
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t05
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t06
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t07
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t08
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t09
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t10
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t11
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t12
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t13
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t14
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t15
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t16
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t17
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t18
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t19
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t20
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t21
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t22
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t23
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t24
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t25
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t26
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t27
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t28
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t29
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t30
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t31
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t32
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t33
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t34
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t35
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t36
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t37
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t38
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t39
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t40
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t41
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t42
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t43
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t44
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t45
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t46
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t47
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t48
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t49
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t50
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t51
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t52
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t53
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t54
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t55
./Steel_Division_2_Blood_Feud_in_Transylvania-FLT/flt-steel_division_2_blood_feud_in_transylvania.t56
The library throws a runtime panic when trying to read an encrypted RAR archive with providing an empty password. Sorry - but I can not provide a stacktrace.
To create a file that reproduces the error:
rar a -p test_enc.rar some_file.txt
I used rardecode.NewReader(r, "") as starting point. It seems to crash in the huffman decoder at rar.Next() (-> rardecode.readCodeLengthTable)
The problem is fairly easy...
If you loop over the same open archive with Next multiple times ( lets say the first time to find all the file names, the second to extract a specific one ), the second attempt will result in a EOF error. There is no build in way to reset the file pointer beyond closing the archive and reopening it.
Solution: Add a function that can reset the file position with File.Seek(0, 0)
Hello!
I want to try multiple passwords. Can I talk you into exporting these variables?
Then I can use errors.Is()
to check for rardecode.ErroBadPassword
.
Thank you!
This was discovered while using rardecode > mholt/archiver > trufflehog.
The problematic line is below, although the reason for the failure is unclear.
Line 453 in 434b4a3
panic: runtime error: index out of range [0] with length 0
goroutine 2147 [running]:
github.com/nwaples/rardecode/v2.(*subAllocator).contextSetNumStates(...)
/home/user/go/pkg/mod/github.com/nwaples/rardecode/[email protected]/ppm_model.go:453
github.com/nwaples/rardecode/v2.(*subAllocator).newContextSize(0xc0020b6050, 0x100)
/home/user/go/pkg/mod/github.com/nwaples/rardecode/[email protected]/ppm_model.go:444 +0xda
github.com/nwaples/rardecode/v2.(*model).restart(0xc0020b6008)
/home/user/go/pkg/mod/github.com/nwaples/rardecode/[email protected]/ppm_model.go:583 +0x125
github.com/nwaples/rardecode/v2.(*model).ReadByte(0xc0020b6008)
/home/user/go/pkg/mod/github.com/nwaples/rardecode/[email protected]/ppm_model.go:1030 +0x25
github.com/nwaples/rardecode/v2.(*ppm29Decoder).fill(0xc0020b6008, 0xc0020b4000)
/home/user/go/pkg/mod/github.com/nwaples/rardecode/[email protected]/decode29_ppm.go:93 +0x3f
github.com/nwaples/rardecode/v2.(*decoder29).fill(0xc0020a0360, 0xc0020b4000)
/home/user/go/pkg/mod/github.com/nwaples/rardecode/[email protected]/decode29.go:239 +0x85
github.com/nwaples/rardecode/v2.(*decodeReader).fill(0xc0020b4000)
/home/user/go/pkg/mod/github.com/nwaples/rardecode/[email protected]/decode_reader.go:188 +0x7e
github.com/nwaples/rardecode/v2.(*decodeReader).bytes(0xc0020b4000)
/home/user/go/pkg/mod/github.com/nwaples/rardecode/[email protected]/decode_reader.go:255 +0x2e
github.com/nwaples/rardecode/v2.(*limitedReader).bytes(0xc0020a27e0)
/home/user/go/pkg/mod/github.com/nwaples/rardecode/[email protected]/reader.go:269 +0x23
github.com/nwaples/rardecode/v2.(*checksumReader).bytes(0xc0020a2810)
/home/user/go/pkg/mod/github.com/nwaples/rardecode/[email protected]/reader.go:319 +0x27
github.com/nwaples/rardecode/v2.(*Reader).WriteTo(0xc001d38820, {0x470c660, 0xc00117ef80})
/home/user/go/pkg/mod/github.com/nwaples/rardecode/[email protected]/reader.go:358 +0x46
io.nopCloserWriterTo.WriteTo(...)
/home/user/sdk/go1.22.1/src/io/io.go:702
io.copyBuffer({0x470c660, 0xc00117ef80}, {0x7f527436c158, 0xc001120bc0}, {0x0, 0x0, 0x0})
/home/user/sdk/go1.22.1/src/io/io.go:411 +0x9d
io.Copy(...)
/home/user/sdk/go1.22.1/src/io/io.go:388
github.com/trufflesecurity/trufflehog/v3/pkg/writers/buffered_file_writer.NewFromReader({0x7f527436c158, 0xc001120bc0}, {0x0, 0x411d3f?, 0x0})
/tmp/trufflehog/pkg/writers/buffered_file_writer/bufferedfilewriter.go:125 +0xf1
github.com/trufflesecurity/trufflehog/v3/pkg/readers.NewBufferedFileReader({0x7f527436c158?, 0xc001120bc0?})
/tmp/trufflehog/pkg/readers/bufferedfilereader.go:27 +0x28
github.com/trufflesecurity/trufflehog/v3/pkg/handlers.newFileReader({0xc0014a40b0, 0x9}, {0x4715ff0?, 0xc001120bc0?})
/tmp/trufflehog/pkg/handlers/handlers.go:52 +0xfb
github.com/trufflesecurity/trufflehog/v3/pkg/handlers.(*archiveHandler).openArchive.(*archiveHandler).extractorHandler.func1({0x7f52647e15d0, 0xc001e94240}, {{0x473fc28, 0xc0001c4aa0}, {0x36585c0, 0xc0001c4aa0}, {0xc0014a40b0, 0x9}, {0x0, 0x0}, ...})
/tmp/trufflehog/pkg/handlers/archive.go:196 +0x645
github.com/mholt/archiver/v4.Rar.Extract({0xe0?, {0x0?, 0x3809980?}}, {0x7f52647e15d0, 0xc001e94240}, {0x4702b00?, 0xc0011b6030?}, {0x0, 0x0, 0x0}, ...)
/home/user/go/pkg/mod/github.com/mholt/archiver/[email protected]/rar.go:108 +0x49c
github.com/trufflesecurity/trufflehog/v3/pkg/handlers.(*archiveHandler).openArchive(0xc0014a6038, {0x473b5e0, 0xc001e941b0}, 0x0, {{0x4717b28, 0xc002a1e660}, {0x3cca2c5, 0x4}, 0xc0011b6030, 0x1}, ...)
/tmp/trufflehog/pkg/handlers/archive.go:98 +0x926
github.com/trufflesecurity/trufflehog/v3/pkg/handlers.(*archiveHandler).HandleFile.func1()
/tmp/trufflehog/pkg/handlers/archive.go:65 +0x1ac
created by github.com/trufflesecurity/trufflehog/v3/pkg/handlers.(*archiveHandler).HandleFile in goroutine 2146
/tmp/trufflehog/pkg/handlers/archive.go:51 +0xfb
Reproducers
This can be reproduced with the following files:
It would be nice to able able to get a list of all file(names) without having to reopen the archive.
Currently, we can check filenames one by one using Next(), but there is not Reset().
A slice of []File as in archive/zip would be best IMO.
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
Hello!
I just had a user open an issue for a crash I've never seen before. This is after ~2 years of use and tens of thousands of users.
You can see the stack trace here Unpackerr/unpackerr#142
The stack ends here: https://github.com/nwaples/rardecode/blob/master/archive15.go#L132
panic: time: missing Location in call to Date
I'm not real sure where to begin with this, and was hoping you could give me some guidance. Do you think this is specific to the archive? I'm assuming it must be. Or perhaps specific to the user's system? He mentioned it's happened several times, which is several times more than anyone else has seen this. Maybe it has something to do with a time zone? I can't say I've ever actually used time.Date()
anywhere..
Appreciate any thoughts you may have. Thanks!
If you have the following files:
myarchive.rar
myarchive.r00
myarchive.r01
what pattern should be used with your library to extract the single output file across these three parts of the archive?
I've tried a few different ways and have run into issues, but I think I'm just not using the library as intended. I see:
rardecode: archive continues in next volume
but that error is internal, so I don't think I'm supposed to handle it.
If I progress to the next file ( .r00 ) I get:
rardecode: invalid file block
Hello, a user of mine opened an issue about a rar archive not being properly extracted. We discussed this briefly on #25. I'm just making a new issue to keep these separate. This replaces and closes #25.
Original report with details of the"bug" can be found here: Unpackerr/unpackerr#140
Get this error with some of the files approximately a dozen or so out of 130+ rar files.
This is the go version i am using currently:
go version go1.6.2 darwin/amd64
and below is the code responsible for decoding the rar files using rardecode:
rarfile, err := os.Open(filepath.Join("downloads", f))
if err != nil {
return err
}
rdr, err := rardecode.NewReader(rarfile, "")
if err != nil {
return err
}
nf, err := rdr.Next()
if err != nil {
return err
}
ps := make([]byte, nf.UnPackedSize)
_, err = rdr.Read(ps)
if err != nil {
return err
}
newbok, err := os.Create(filepath.Join("bok", bokFile))
defer newbok.Close()
if err != nil {
return err
}
_, err = io.CopyBuffer(newbok, rdr, ps)
if err != nil {
return err
}
While this worked for the vast majority of the files, however it doesn't for dozen or so files. Vast majority getting the above mentioned error, and a couple get another but I'll leave that for another issue.
Am i doing it wrong, or is there a better way?
Thank you.
Line 805 in e2fa074
panic: runtime error: index out of range [256] with length 256
Create examples in Readme and source (for godoc reference).
On some really corrupt rar files I get an "integer divide by zero" error in decodeSymbol1() probably caused in the call to currentCount()
You maybe want to include a check to ensure scale and r.rnge are not null and throw an errCorruptPPM otherwise.
https://github.com/nwaples/rardecode/blob/master/ppm_model.go#L321
Another feature request: is it possible to add Previous, First, Last, JumpTo, NFiles functions?
In fact, API-wise, only JumpTo and NFiles should be enough (similar to what lib7zip provides), replacing Next as well.
The current API is quite restrictive, unless you're going to extract all the files in a sequential order (like the program unrar does by default). Random access to files is an important feature for many applications.
Less verbose than rardecode
, and unrar
has also been the name of the *nix utility for a long time.
If there are plans for an encoder, that I can suggest rar
It would be useful if the Reader struct implemented the ReadSeeker
interface. This would come in handy when trying to serve RAR files over HTTP with http.ServeContent. This is useful if the content that is archived is a video file; providing a ReadSeeker
would allow players such as VLC to seek in the video.
hello, I found an example of incorrect decompression.
cat rardecode_test.go
package rardecode
import (
"fmt"
"io"
"os"
"testing"
)
func TestDecode(t *testing.T) {
ar, err := OpenReader("A62PC版+手机版.rar", "51mh")
if err != nil {
t.Fatalf("failed to open reader: %s", err)
}
for i := 0; i < 15; i++ {
af, err := ar.Next()
if err != nil {
t.Fatalf("failed to advance the next file: %s", err)
}
filePath := fmt.Sprintf("tmp/%d", i)
fw, err := os.OpenFile(filePath, os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0644)
if err != nil {
t.Fatalf("failed to open file: %s", err)
}
io.CopyN(fw, ar, af.UnPackedSize)
fw.Close()
t.Logf("index: %d, name: %s, filesize: %d", i, af.Name, af.UnPackedSize)
}
}
go test -v
=== RUN TestDecode
rardecode_test.go:28: index: 0, name: A62/手机版 小白的露出受奸日记唯爱移植版.apk, filesize: 811753674
rardecode_test.go:28: index: 1, name: A62/PC版 Snower's New Clothes/credits.html, filesize: 2016436
rardecode_test.go:28: index: 2, name: A62/PC版 Snower's New Clothes/d3dcompiler_47.dll, filesize: 3661112
rardecode_test.go:28: index: 3, name: A62/PC版 Snower's New Clothes/ffmpeg.dll, filesize: 2058240
rardecode_test.go:28: index: 4, name: A62/PC版 Snower's New Clothes/Game.exe, filesize: 1604096
rardecode_test.go:28: index: 5, name: A62/PC版 Snower's New Clothes/icudtl.dat, filesize: 10171248
rardecode_test.go:28: index: 6, name: A62/PC版 Snower's New Clothes/libEGL.dll, filesize: 78848
rardecode_test.go:28: index: 7, name: A62/PC版 Snower's New Clothes/libGLESv2.dll, filesize: 3730944
rardecode_test.go:28: index: 8, name: A62/PC版 Snower's New Clothes/natives_blob.bin, filesize: 205638
rardecode_test.go:28: index: 9, name: A62/PC版 Snower's New Clothes/node.dll, filesize: 5749248
rardecode_test.go:28: index: 10, name: A62/PC版 Snower's New Clothes/nw.dll, filesize: 84381696
rardecode_test.go:28: index: 11, name: A62/PC版 Snower's New Clothes/nw_100_percent.pak, filesize: 827931
rardecode_test.go:28: index: 12, name: A62/PC版 Snower's New Clothes/nw_200_percent.pak, filesize: 1099441
rardecode_test.go:28: index: 13, name: A62/PC版 Snower's New Clothes/nw_elf.dll, filesize: 450048
rardecode_test.go:28: index: 14, name: A62/PC版 Snower's New Clothes/package.json, filesize: 243
--- PASS: TestDecode (33.16s)
PASS
ok github.com/nwaples/rardecode 33.161s
ls -ltr ./tmp
-rw-r--r-- 1 811753674 15:33 0
-rw-r--r-- 1 2016436 15:33 1
-rw-r--r-- 1 3661112 15:33 2
-rw-r--r-- 1 2058240 15:33 3
-rw-r--r-- 1 1604096 15:33 4
-rw-r--r-- 1 10171248 15:33 5
-rw-r--r-- 1 78848 15:33 6
-rw-r--r-- 1 3730944 15:33 7
-rw-r--r-- 1 205638 15:33 8
-rw-r--r-- 1 5749248 15:33 9
-rw-r--r-- 1 46071812 15:33 10
-rw-r--r-- 1 827931 15:33 11
-rw-r--r-- 1 1099441 15:33 12
-rw-r--r-- 1 450048 15:33 13
-rw-r--r-- 1 243 15:33 14
the rar file: A62PC版+手机版.rar download link:
https://drive.google.com/file/d/1yEd3cUGKDw-nyDo64kmv9GDe8ljsmLLI/view?usp=sharing
the filesize of 10th file is expected to be 84381696 but actual size is 46071812,what‘s the problem?
Please, add README with short description
I have a use case where I want to know the names of all of the files in a multipart volume, and ideally know that they are all there and valid.
I am wondering about the best way to expose this so that I don't have to re-implement it elsewhere, since all of the interesting logic is in here already.
In my case, I want to know the filenames after extracting the whole archive, so somehow keeping a list of files processed during decoding and then exposing that would work for me. Do you think that would be acceptable as an approach?
Alternatively, a specific API for asking the filenames, even if that means reading (parts of) the files again would work for me too. Do you think that would be better?
Or is there a better approach than these?
If there is an approach you think is acceptable for this, I'm happy to attempt to implement it.
(In case it's interesting, my use case is that I want to decode a (possibly multi-part) archive, and delete the compressed archive files afterwards)
I have a bunch of rar files that are (apparently) RAR4. Most of them fail to extract with rardecode
with a unsupported decoder version
. Adding some print statements shows that unpackver
is 20
.
Is there any particular reason that it is unsupported (other than lack of time, say)?
Is expanding the set of supported versions/formats something that is in the pipeline?
If there are no huge blockers, I may take a stab at adding support (although at this point i know nothing about the rar format(s) except the little i've gleaned from scanning through this codebase and the c++ unrar codebase)
Please pick an applicable license.
Is there a way to list the files contained inside an encrypted RAR archive without providing the password? Looking for methods or workarounds to view the file names without decrypting the entire archive.
When unpacking Cscan(.net_2x_3x).exe
from https://github.com/k8gege/K8tools/blob/master/K8Cscan5.4_20191101.rar, rardecode panics in decodeSymbol2, line 805:
for m.charMask[states[i].sym] == m.escCount {
Apparently i
equals len(states)
(both 22), causing the issue.
If there is any further information that you require, please let me know.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.