Kirill K. Smirnov : winhelp: Fix LZ77 decompressor.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Aug 11 13:37:26 CDT 2006
Module: wine
Branch: master
Commit: 27681bdfaf6878dbbf4b25f3b468e682dd2c253a
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=27681bdfaf6878dbbf4b25f3b468e682dd2c253a
Author: Kirill K. Smirnov <lich at math.spbu.ru>
Date: Fri Aug 11 19:28:49 2006 +0400
winhelp: Fix LZ77 decompressor.
---
programs/winhelp/hlpfile.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/programs/winhelp/hlpfile.c b/programs/winhelp/hlpfile.c
index 92cc565..53f1a10 100644
--- a/programs/winhelp/hlpfile.c
+++ b/programs/winhelp/hlpfile.c
@@ -1498,8 +1498,16 @@ static BYTE *HLPFILE_UncompressLZ77(BYTE
int code = GET_USHORT(ptr, 0);
int len = 3 + (code >> 12);
int offset = code & 0xfff;
- memcpy(newptr, newptr - offset - 1, len);
- newptr += len;
+ /*
+ * We must copy byte-by-byte here. We cannot use memcpy nor
+ * memmove here. Just example:
+ * a[]={1,2,3,4,5,6,7,8,9,10}
+ * newptr=a+2;
+ * offset=1;
+ * We expect:
+ * {1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 11, 12}
+ */
+ for (; len>0; len--, newptr++) *newptr = *(newptr-offset-1);
ptr += 2;
}
else *newptr++ = *ptr++;
More information about the wine-cvs
mailing list