Deleted Added
full compact
decompress.c (212901) decompress.c (215041)
1
2/*-------------------------------------------------------------*/
3/*--- Decompression machinery ---*/
4/*--- decompress.c ---*/
5/*-------------------------------------------------------------*/
6
7/* ------------------------------------------------------------------
8 This file is part of bzip2/libbzip2, a program and library for
9 lossless, block-sorting data compression.
10
1
2/*-------------------------------------------------------------*/
3/*--- Decompression machinery ---*/
4/*--- decompress.c ---*/
5/*-------------------------------------------------------------*/
6
7/* ------------------------------------------------------------------
8 This file is part of bzip2/libbzip2, a program and library for
9 lossless, block-sorting data compression.
10
11 bzip2/libbzip2 version 1.0.5 of 10 December 2007
12 Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
11 bzip2/libbzip2 version 1.0.6 of 6 September 2010
12 Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
13
14 Please read the WARNING, DISCLAIMER and PATENTS sections in the
15 README file.
16
17 This program is released under the terms of the license contained
18 in the file LICENSE.
19 ------------------------------------------------------------------ */
20

--- 466 unchanged lines hidden (view full) ---

487
488 /* Now we know what nblock is, we can do a better sanity
489 check on s->origPtr.
490 */
491 if (s->origPtr < 0 || s->origPtr >= nblock)
492 RETURN(BZ_DATA_ERROR);
493
494 /*-- Set up cftab to facilitate generation of T^(-1) --*/
13
14 Please read the WARNING, DISCLAIMER and PATENTS sections in the
15 README file.
16
17 This program is released under the terms of the license contained
18 in the file LICENSE.
19 ------------------------------------------------------------------ */
20

--- 466 unchanged lines hidden (view full) ---

487
488 /* Now we know what nblock is, we can do a better sanity
489 check on s->origPtr.
490 */
491 if (s->origPtr < 0 || s->origPtr >= nblock)
492 RETURN(BZ_DATA_ERROR);
493
494 /*-- Set up cftab to facilitate generation of T^(-1) --*/
495 /* Check: unzftab entries in range. */
496 for (i = 0; i <= 255; i++) {
497 if (s->unzftab[i] < 0 || s->unzftab[i] > nblock)
498 RETURN(BZ_DATA_ERROR);
499 }
500 /* Actually generate cftab. */
495 s->cftab[0] = 0;
496 for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1];
497 for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1];
501 s->cftab[0] = 0;
502 for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1];
503 for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1];
504 /* Check: cftab entries in range. */
498 for (i = 0; i <= 256; i++) {
499 if (s->cftab[i] < 0 || s->cftab[i] > nblock) {
500 /* s->cftab[i] can legitimately be == nblock */
501 RETURN(BZ_DATA_ERROR);
502 }
503 }
505 for (i = 0; i <= 256; i++) {
506 if (s->cftab[i] < 0 || s->cftab[i] > nblock) {
507 /* s->cftab[i] can legitimately be == nblock */
508 RETURN(BZ_DATA_ERROR);
509 }
510 }
511 /* Check: cftab entries non-descending. */
512 for (i = 1; i <= 256; i++) {
513 if (s->cftab[i-1] > s->cftab[i]) {
514 RETURN(BZ_DATA_ERROR);
515 }
516 }
504
505 s->state_out_len = 0;
506 s->state_out_ch = 0;
507 BZ_INITIALISE_CRC ( s->calculatedBlockCRC );
508 s->state = BZ_X_OUTPUT;
509 if (s->verbosity >= 2) VPrintf0 ( "rt+rld" );
510
511 if (s->smallDecompress) {

--- 122 unchanged lines hidden ---
517
518 s->state_out_len = 0;
519 s->state_out_ch = 0;
520 BZ_INITIALISE_CRC ( s->calculatedBlockCRC );
521 s->state = BZ_X_OUTPUT;
522 if (s->verbosity >= 2) VPrintf0 ( "rt+rld" );
523
524 if (s->smallDecompress) {

--- 122 unchanged lines hidden ---