diff options
| author | Mark Adler <madler@alumni.caltech.edu> | 2023-08-11 10:59:03 -0700 |
|---|---|---|
| committer | Mark Adler <madler@alumni.caltech.edu> | 2023-08-11 10:59:03 -0700 |
| commit | 7dd6aa72455ef1f2aacdc28a00d1eaf632d59593 (patch) | |
| tree | 877076927ecf9c6b319f2c40332155db66759ac8 | |
| parent | c7ddcc2e0e8bb397ad720564228b538135ec11d8 (diff) | |
| download | zlib-7dd6aa72455ef1f2aacdc28a00d1eaf632d59593.tar.gz zlib-7dd6aa72455ef1f2aacdc28a00d1eaf632d59593.tar.bz2 zlib-7dd6aa72455ef1f2aacdc28a00d1eaf632d59593.zip | |
Fix bug when gzungetc() is used immediately after gzopen().
| -rw-r--r-- | gzread.c | 4 |
1 files changed, 4 insertions, 0 deletions
| @@ -443,6 +443,10 @@ int ZEXPORT gzungetc(int c, gzFile file) { | |||
| 443 | return -1; | 443 | return -1; |
| 444 | state = (gz_statep)file; | 444 | state = (gz_statep)file; |
| 445 | 445 | ||
| 446 | /* in case this was just opened, set up the input buffer */ | ||
| 447 | if (state->mode == GZ_READ && state->how == LOOK && state->x.have == 0) | ||
| 448 | (void)gz_look(state); | ||
| 449 | |||
| 446 | /* check that we're reading and that there's no (serious) error */ | 450 | /* check that we're reading and that there's no (serious) error */ |
| 447 | if (state->mode != GZ_READ || | 451 | if (state->mode != GZ_READ || |
| 448 | (state->err != Z_OK && state->err != Z_BUF_ERROR)) | 452 | (state->err != Z_OK && state->err != Z_BUF_ERROR)) |
