summaryrefslogtreecommitdiff
path: root/backport-Fix-bug-when-gzungetc-is-used-immediately-after-gzopen.patch
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2026-11-07 06:22:11 +0000
committerCoprDistGit <infra@openeuler.org>2026-11-07 06:22:11 +0000
commitd259e194df12569c8fe286eacd285be28118ecd7 (patch)
tree838258e9a13837f135e94257e7d17db9c9218608 /backport-Fix-bug-when-gzungetc-is-used-immediately-after-gzopen.patch
parentb1143670a63c1a72a4bd0e0e4337fc5fa3be85b4 (diff)
automatic import of zlibopeneuler24.03_LTS_SP3
Diffstat (limited to 'backport-Fix-bug-when-gzungetc-is-used-immediately-after-gzopen.patch')
-rw-r--r--backport-Fix-bug-when-gzungetc-is-used-immediately-after-gzopen.patch26
1 files changed, 26 insertions, 0 deletions
diff --git a/backport-Fix-bug-when-gzungetc-is-used-immediately-after-gzopen.patch b/backport-Fix-bug-when-gzungetc-is-used-immediately-after-gzopen.patch
new file mode 100644
index 0000000..a6b892e
--- /dev/null
+++ b/backport-Fix-bug-when-gzungetc-is-used-immediately-after-gzopen.patch
@@ -0,0 +1,26 @@
+From 7dd6aa72455ef1f2aacdc28a00d1eaf632d59593 Mon Sep 17 00:00:00 2001
+From: Mark Adler <madler@alumni.caltech.edu>
+Date: Fri, 11 Aug 2023 10:59:03 -0700
+Subject: [PATCH] Fix bug when gzungetc() is used immediately after gzopen().
+
+Reference:https://github.com/madler/zlib/commit/7dd6aa72455ef1f2aacdc28a00d1eaf632d59593
+Conflict:NA
+---
+ gzread.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/gzread.c b/gzread.c
+index 6034a2823..4168cbc88 100644
+--- a/gzread.c
++++ b/gzread.c
+@@ -443,6 +443,10 @@ int ZEXPORT gzungetc(int c, gzFile file) {
+ return -1;
+ state = (gz_statep)file;
+
++ /* in case this was just opened, set up the input buffer */
++ if (state->mode == GZ_READ && state->how == LOOK && state->x.have == 0)
++ (void)gz_look(state);
++
+ /* check that we're reading and that there's no (serious) error */
+ if (state->mode != GZ_READ ||
+ (state->err != Z_OK && state->err != Z_BUF_ERROR))