diff options
| author | Mark Adler <madler@alumni.caltech.edu> | 2025-02-01 17:09:32 -0800 |
|---|---|---|
| committer | Mark Adler <madler@alumni.caltech.edu> | 2025-02-01 17:16:39 -0800 |
| commit | ab0266a36271746cea957f9edefc2ccf78aa2074 (patch) | |
| tree | 4644a6986963f41cfac368b4e5435275f242a567 | |
| parent | ec346f1c39aa5569ec899d65ee5bba67a09ae2fc (diff) | |
| download | zlib-ab0266a36271746cea957f9edefc2ccf78aa2074.tar.gz zlib-ab0266a36271746cea957f9edefc2ccf78aa2074.tar.bz2 zlib-ab0266a36271746cea957f9edefc2ccf78aa2074.zip | |
Avoid use of memcpy() in inflate when areas can overlap.
| -rw-r--r-- | inflate.c | 6 |
1 files changed, 3 insertions, 3 deletions
| @@ -884,12 +884,12 @@ int ZEXPORT inflate(z_streamp strm, int flush) { | |||
| 884 | if (copy > have) copy = have; | 884 | if (copy > have) copy = have; |
| 885 | if (copy > left) copy = left; | 885 | if (copy > left) copy = left; |
| 886 | if (copy == 0) goto inf_leave; | 886 | if (copy == 0) goto inf_leave; |
| 887 | zmemcpy(put, next, copy); | ||
| 888 | have -= copy; | 887 | have -= copy; |
| 889 | next += copy; | ||
| 890 | left -= copy; | 888 | left -= copy; |
| 891 | put += copy; | ||
| 892 | state->length -= copy; | 889 | state->length -= copy; |
| 890 | do { | ||
| 891 | *put++ = *next++; | ||
| 892 | } while (--copy); | ||
| 893 | break; | 893 | break; |
| 894 | } | 894 | } |
| 895 | Tracev((stderr, "inflate: stored end\n")); | 895 | Tracev((stderr, "inflate: stored end\n")); |
