Definition at line 250 of file infback.c.
256{
258 z_const
unsigned char FAR *
next;
259 unsigned char FAR *put;
264 unsigned char FAR *from;
267 unsigned len;
268 int ret;
269 static const unsigned short order[19] =
270 {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
271
272
276
277
288
289
290 for (;;)
291 switch (state->
mode) {
293
297 break;
298 }
303 case 0:
304 Tracev((stderr,
"inflate: stored block%s\n",
305 state->
last ?
" (last)" :
""));
307 break;
308 case 1:
310 Tracev((stderr,
"inflate: fixed codes block%s\n",
311 state->
last ?
" (last)" :
""));
313 break;
314 case 2:
315 Tracev((stderr,
"inflate: dynamic codes block%s\n",
316 state->
last ?
" (last)" :
""));
318 break;
319 case 3:
320 strm->msg = (
char *)
"invalid block type";
322 }
324 break;
325
327
330 if ((
hold & 0xffff) != ((
hold >> 16) ^ 0xffff)) {
331 strm->msg = (
char *)
"invalid stored block lengths";
333 break;
334 }
336 Tracev((stderr,
"inflate: stored length %u\n",
339
340
341 while (state->
length != 0) {
353 }
354 Tracev((stderr,
"inflate: stored end\n"));
356 break;
357
359
367#ifndef PKZIP_BUG_WORKAROUND
368 if (state->
nlen > 286 || state->
ndist > 30) {
369 strm->msg = (
char *)
"too many length or distance symbols";
371 break;
372 }
373#endif
374 Tracev((stderr,
"inflate: table sizes ok\n"));
375
376
380 state->
lens[order[state->
have++]] = (
unsigned short)
BITS(3);
382 }
383 while (state->
have < 19)
384 state->
lens[order[state->
have++]] = 0;
390 if (ret) {
391 strm->msg = (
char *)
"invalid code lengths set";
393 break;
394 }
395 Tracev((stderr,
"inflate: code lengths ok\n"));
396
397
400 for (;;) {
402 if ((
unsigned)(here.
bits) <=
bits)
break;
404 }
408 }
409 else {
410 if (here.
val == 16) {
413 if (state->
have == 0) {
414 strm->msg = (
char *)
"invalid bit length repeat";
416 break;
417 }
418 len = (unsigned)(state->
lens[state->
have - 1]);
421 }
422 else if (here.
val == 17) {
425 len = 0;
428 }
429 else {
432 len = 0;
435 }
437 strm->msg = (
char *)
"invalid bit length repeat";
439 break;
440 }
442 state->
lens[state->
have++] = (
unsigned short)len;
443 }
444 }
445
446
448
449
450 if (state->
lens[256] == 0) {
451 strm->msg = (
char *)
"invalid code -- missing end-of-block";
453 break;
454 }
455
456
457
458
464 if (ret) {
465 strm->msg = (
char *)
"invalid literal/lengths set";
467 break;
468 }
473 if (ret) {
474 strm->msg = (
char *)
"invalid distances set";
476 break;
477 }
478 Tracev((stderr,
"inflate: codes ok\n"));
480
482
483 if (
have >= 6 && left >= 258) {
489 break;
490 }
491
492
493 for (;;) {
495 if ((
unsigned)(here.
bits) <=
bits)
break;
497 }
498 if (here.
op && (here.
op & 0xf0) == 0) {
500 for (;;) {
505 }
507 }
510
511
514 "inflate: literal '%c'\n" :
515 "inflate: literal 0x%02x\n", here.
val));
517 *put++ = (
unsigned char)(state->
length);
518 left--;
520 break;
521 }
522
523
525 Tracevv((stderr,
"inflate: end of block\n"));
527 break;
528 }
529
530
532 strm->msg = (
char *)
"invalid literal/length code";
534 break;
535 }
536
537
538 state->
extra = (unsigned)(here.
op) & 15;
539 if (state->
extra != 0) {
543 }
545
546
547 for (;;) {
549 if ((
unsigned)(here.
bits) <=
bits)
break;
551 }
552 if ((here.
op & 0xf0) == 0) {
554 for (;;) {
559 }
561 }
564 strm->msg = (
char *)
"invalid distance code";
566 break;
567 }
569
570
571 state->
extra = (
unsigned)(here.
op) & 15;
572 if (state->
extra != 0) {
576 }
578 left : 0)) {
579 strm->msg = (
char *)
"invalid distance too far back";
581 break;
582 }
584
585
586 do {
592 }
593 else {
594 from = put - state->
offset;
596 }
600 do {
601 *put++ = *from++;
603 }
while (state->
length != 0);
604 break;
605
607
609 if (left < state->
wsize) {
610 if (out(out_desc, state->
window, state->
wsize - left))
612 }
613 goto inf_leave;
614
617 goto inf_leave;
618
619 default:
621 goto inf_leave;
622 }
623
624
625 inf_leave:
628 return ret;
629}
void fixedtables(struct inflate_state FAR *state)
void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start)
void copy(G4double dst[], const G4double src[], size_t size=G4FieldTrack::ncompSVEC)
code const FAR * distcode
unsigned char FAR * window
void ZLIB_INTERNAL zmemcpy(Bytef *dest, const Bytef *source, uInt len)
References BAD, inflate_state::bits, code::bits, BITS, BYTEBITS, inflate_state::codes, CODES, field_utils::copy(), inflate_state::distbits, inflate_state::distcode, DISTS, DONE, DROPBITS, inflate_state::extra, fixedtables(), inflate_state::have, inflate_state::hold, inflate_fast(), inflate_table(), INITBITS, inflate_state::last, LEN, inflate_state::lenbits, inflate_state::lencode, inflate_state::length, inflate_state::lens, LENS, LOAD, inflate_state::mode, inflate_state::ncode, inflate_state::ndist, NEEDBITS, inflate_state::next, inflate_state::nlen, inflate_state::offset, code::op, PULL, PULLBYTE, RESTORE, ROOM, STORED, inflate_state::strm, TABLE, Tracev, Tracevv, TYPE, code::val, inflate_state::whave, inflate_state::window, inflate_state::work, inflate_state::wsize, Z_BUF_ERROR, Z_DATA_ERROR, Z_NULL, Z_STREAM_END, Z_STREAM_ERROR, and zmemcpy().