diff options
author | Julian Seward <jseward@acm.org> | 2005-02-15 22:13:13 +0100 |
---|---|---|
committer | Julian Seward <jseward@acm.org> | 2005-02-15 22:13:13 +0100 |
commit | 4d540bfc95a4b0eefc1d1f388ec33534aaeb3a2f (patch) | |
tree | 3b7e9c650b4c61d114e1716c4698e40d5c8d7ef7 /decompress.c | |
parent | 099d844292f60f9d58914da29e5773204dc55e7a (diff) | |
download | bzip2-1.0.3.tar.gz bzip2-1.0.3.tar.bz2 bzip2-1.0.3.zip |
bzip2-1.0.3bzip2-1.0.3
Diffstat (limited to 'decompress.c')
-rw-r--r-- | decompress.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/decompress.c b/decompress.c index e921347..81c3d2c 100644 --- a/decompress.c +++ b/decompress.c | |||
@@ -8,7 +8,7 @@ | |||
8 | This file is a part of bzip2 and/or libbzip2, a program and | 8 | This file is a part of bzip2 and/or libbzip2, a program and |
9 | library for lossless, block-sorting data compression. | 9 | library for lossless, block-sorting data compression. |
10 | 10 | ||
11 | Copyright (C) 1996-2002 Julian R Seward. All rights reserved. | 11 | Copyright (C) 1996-2005 Julian R Seward. All rights reserved. |
12 | 12 | ||
13 | Redistribution and use in source and binary forms, with or without | 13 | Redistribution and use in source and binary forms, with or without |
14 | modification, are permitted provided that the following conditions | 14 | modification, are permitted provided that the following conditions |
@@ -42,7 +42,7 @@ | |||
42 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 42 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
43 | 43 | ||
44 | Julian Seward, Cambridge, UK. | 44 | Julian Seward, Cambridge, UK. |
45 | jseward@acm.org | 45 | jseward@bzip.org |
46 | bzip2/libbzip2 version 1.0 of 21 March 2000 | 46 | bzip2/libbzip2 version 1.0 of 21 March 2000 |
47 | 47 | ||
48 | This program is based on (at least) the work of: | 48 | This program is based on (at least) the work of: |
@@ -524,17 +524,23 @@ Int32 BZ2_decompress ( DState* s ) | |||
524 | if (s->origPtr < 0 || s->origPtr >= nblock) | 524 | if (s->origPtr < 0 || s->origPtr >= nblock) |
525 | RETURN(BZ_DATA_ERROR); | 525 | RETURN(BZ_DATA_ERROR); |
526 | 526 | ||
527 | /*-- Set up cftab to facilitate generation of T^(-1) --*/ | ||
528 | s->cftab[0] = 0; | ||
529 | for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1]; | ||
530 | for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1]; | ||
531 | for (i = 0; i <= 256; i++) { | ||
532 | if (s->cftab[i] < 0 || s->cftab[i] > nblock) { | ||
533 | /* s->cftab[i] can legitimately be == nblock */ | ||
534 | RETURN(BZ_DATA_ERROR); | ||
535 | } | ||
536 | } | ||
537 | |||
527 | s->state_out_len = 0; | 538 | s->state_out_len = 0; |
528 | s->state_out_ch = 0; | 539 | s->state_out_ch = 0; |
529 | BZ_INITIALISE_CRC ( s->calculatedBlockCRC ); | 540 | BZ_INITIALISE_CRC ( s->calculatedBlockCRC ); |
530 | s->state = BZ_X_OUTPUT; | 541 | s->state = BZ_X_OUTPUT; |
531 | if (s->verbosity >= 2) VPrintf0 ( "rt+rld" ); | 542 | if (s->verbosity >= 2) VPrintf0 ( "rt+rld" ); |
532 | 543 | ||
533 | /*-- Set up cftab to facilitate generation of T^(-1) --*/ | ||
534 | s->cftab[0] = 0; | ||
535 | for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1]; | ||
536 | for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1]; | ||
537 | |||
538 | if (s->smallDecompress) { | 544 | if (s->smallDecompress) { |
539 | 545 | ||
540 | /*-- Make a copy of cftab, used in generation of T --*/ | 546 | /*-- Make a copy of cftab, used in generation of T --*/ |