aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/libbz2/decompress.c
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:45:01 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:01 +0300
commit2d37894b1b037cf24231090eda8589bbb44fb6fc (patch)
treebe835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/libs/libbz2/decompress.c
parent718c552901d703c502ccbefdfc3c9028d608b947 (diff)
downloadydb-2d37894b1b037cf24231090eda8589bbb44fb6fc.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/libbz2/decompress.c')
-rw-r--r--contrib/libs/libbz2/decompress.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/contrib/libs/libbz2/decompress.c b/contrib/libs/libbz2/decompress.c
index 881cd03add..a1a0bac892 100644
--- a/contrib/libs/libbz2/decompress.c
+++ b/contrib/libs/libbz2/decompress.c
@@ -387,13 +387,13 @@ Int32 BZ2_decompress ( DState* s )
es = -1;
N = 1;
do {
- /* Check that N doesn't get too big, so that es doesn't
- go negative. The maximum value that can be
- RUNA/RUNB encoded is equal to the block size (post
- the initial RLE), viz, 900k, so bounding N at 2
- million should guard against overflow without
- rejecting any legitimate inputs. */
- if (N >= 2*1024*1024) RETURN(BZ_DATA_ERROR);
+ /* Check that N doesn't get too big, so that es doesn't
+ go negative. The maximum value that can be
+ RUNA/RUNB encoded is equal to the block size (post
+ the initial RLE), viz, 900k, so bounding N at 2
+ million should guard against overflow without
+ rejecting any legitimate inputs. */
+ if (N >= 2*1024*1024) RETURN(BZ_DATA_ERROR);
if (nextSym == BZ_RUNA) es = es + (0+1) * N; else
if (nextSym == BZ_RUNB) es = es + (1+1) * N;
N = N * 2;
@@ -498,28 +498,28 @@ Int32 BZ2_decompress ( DState* s )
RETURN(BZ_DATA_ERROR);
/*-- Set up cftab to facilitate generation of T^(-1) --*/
- /* Check: unzftab entries in range. */
- for (i = 0; i <= 255; i++) {
- if (s->unzftab[i] < 0 || s->unzftab[i] > nblock)
- RETURN(BZ_DATA_ERROR);
- }
- /* Actually generate cftab. */
+ /* Check: unzftab entries in range. */
+ for (i = 0; i <= 255; i++) {
+ if (s->unzftab[i] < 0 || s->unzftab[i] > nblock)
+ RETURN(BZ_DATA_ERROR);
+ }
+ /* Actually generate cftab. */
s->cftab[0] = 0;
for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1];
for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1];
- /* Check: cftab entries in range. */
+ /* Check: cftab entries in range. */
for (i = 0; i <= 256; i++) {
if (s->cftab[i] < 0 || s->cftab[i] > nblock) {
/* s->cftab[i] can legitimately be == nblock */
RETURN(BZ_DATA_ERROR);
}
}
- /* Check: cftab entries non-descending. */
- for (i = 1; i <= 256; i++) {
- if (s->cftab[i-1] > s->cftab[i]) {
- RETURN(BZ_DATA_ERROR);
- }
- }
+ /* Check: cftab entries non-descending. */
+ for (i = 1; i <= 256; i++) {
+ if (s->cftab[i-1] > s->cftab[i]) {
+ RETURN(BZ_DATA_ERROR);
+ }
+ }
s->state_out_len = 0;
s->state_out_ch = 0;