Skip to content

Commit

Permalink
Check block type before deferring to flag for 32-bit block size
Browse files Browse the repository at this point in the history
Should fix Bug 3536613 “Empty file when LONG_BLOCK is not set”
https://sourceforge.net/support/tracker.php?aid=3536613
  • Loading branch information
Martin Panter committed Jul 12, 2012
1 parent b8d565e commit 06a776c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/rarblock.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ RARBlock::RARBlock(std::istream &in)
headsize = in.get();
headsize += in.get() * 256;

if ( ( flags & 0x8000 ) != 0 )
/* Read 32-bit size field if the block type is known to include the
field, or if the flag is set for unknown block types. */
if ( FILE == blocktype || SUB_2_00 == blocktype ||
RECOVERY_2_00 == blocktype || SUB_3_00 == blocktype ||
(blocktype >= UNKNOWN || blocktype < FIRST) && flags & 0x8000 )
{
size = in.get();
size += in.get() * 256;
Expand Down

0 comments on commit 06a776c

Please sign in to comment.