]> wimlib.net Git - wimlib/commitdiff
lzms-common.c: Don't process first byte in x86 filter
authorEric Biggers <ebiggers3@gmail.com>
Sat, 26 Jul 2014 05:58:40 +0000 (00:58 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Sat, 26 Jul 2014 06:19:20 +0000 (01:19 -0500)
Microsoft's LZMS compressor and decompressor seemingly skip this byte.

This resulted in different behavior on the following uncompressed data:

0000000 e8 6b e8 fb ff 5e 1f 03 e8 63 e8 fb ff 5e c0 02
0000016 e8 5b e8 fb ff 5e 51 01 e8 53 e8 fb ff 5e c4 00

wimlib would do a translation following the e8 byte at offset 16, since
it would enable x86 translations following the identification of matching
absolute addresses following the potential opcodes at offsets 0 and 8.
But as far as I can tell, the Microsoft implementation just skips byte 0
entirely and doesn't consider it as beginning a potential instruction.

src/lzms-common.c

index db9bd905ca80467388fa662de4615d2575e0dacb..e274c6ba6bc2bc54e1f20fceddeabdc8bbdc89de 100644 (file)
@@ -317,7 +317,7 @@ lzms_x86_filter(u8 data[restrict], s32 size,
        for (s32 i = 0; i < 65536; i++)
                last_target_usages[i] = -LZMS_X86_MAX_GOOD_TARGET_OFFSET - 1;
 
-       for (s32 i = 0; i < size - 16; ) {
+       for (s32 i = 1; i < size - 16; ) {
                s32 max_trans_offset;
                s32 n;