We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9056d60 commit f76f8f4Copy full SHA for f76f8f4
src/inflate.c
@@ -1200,13 +1200,14 @@ int check_crc;
1200
uint8_t *pEnd = put+copy;
1201
int overlap = (int)(intptr_t)(put-from);
1202
if (overlap >= 4) { // overlap of source/dest won't impede normal copy
1203
- while (put < pEnd) {
+ while (put < pEnd-3) { // overwriting the output buffer here would be bad, so respect the true length
1204
*(uint32_t *)put = *(uint32_t *)from;
1205
put += 4;
1206
from += 4;
1207
}
1208
- // correct for possible overshoot of destination ptr
1209
- put = pEnd;
+ while (put < pEnd) { // tail end
+ *put++ = *from++;
1210
+ }
1211
} else if (overlap == 1) { // copy 1-byte pattern
1212
uint32_t pattern = *from;
1213
pattern = pattern | (pattern << 8);
0 commit comments