From 52448473be701a3b992d9cbc803eb31794966b69 Mon Sep 17 00:00:00 2001 From: Paulo Andrade Date: Wed, 24 Sep 2014 14:56:20 -0300 Subject: [PATCH] x86: Update instruction size information for Windows x64 * lib/jit_x86-sz.c: Generate information about instruction lengths for more precise calculation of buffer size on Windows x64. This change is specially important because the maximum instruction length is larger than other systems, what could cause an out of bounds write on special conditions without this update. --- ChangeLog | 9 ++ lib/jit_x86-sz.c | 351 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 360 insertions(+) diff --git a/ChangeLog b/ChangeLog index 059f0aca5..fa8b3ebdf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2014-09-24 Paulo Andrade + + * lib/jit_x86-sz.c: Generate information about instruction + lengths for more precise calculation of buffer size on + Windows x64. This change is specially important because + the maximum instruction length is larger than other + systems, what could cause an out of bounds write on + special conditions without this update. + 2014-09-24 Paulo Andrade * check/lightning.c: Add workaround to conflicting global diff --git a/lib/jit_x86-sz.c b/lib/jit_x86-sz.c index 2e76e0cf2..b8c9af374 100644 --- a/lib/jit_x86-sz.c +++ b/lib/jit_x86-sz.c @@ -350,6 +350,356 @@ #endif /* __WORDSIZE */ #if __WORDSIZE == 64 +#if __CYGWIN__ +#define JIT_INSTR_MAX 71 + 0, + 0, + 0, + 0, + 0, + 0, + 7, + 71, + 0, + 4, + 13, + 6, + 13, + 6, + 7, + 6, + 13, + 9, + 13, + 9, + 7, + 7, + 14, + 20, + 30, + 20, + 30, + 22, + 29, + 23, + 30, + 25, + 32, + 26, + 33, + 22, + 29, + 23, + 30, + 6, + 13, + 6, + 13, + 6, + 13, + 9, + 8, + 9, + 7, + 9, + 7, + 6, + 6, + 13, + 14, + 13, + 14, + 13, + 14, + 13, + 14, + 13, + 14, + 13, + 14, + 13, + 14, + 13, + 14, + 13, + 14, + 13, + 14, + 3, + 10, + 7, + 7, + 4, + 4, + 3, + 3, + 6, + 4, + 15, + 4, + 15, + 4, + 15, + 4, + 15, + 3, + 14, + 3, + 14, + 3, + 14, + 5, + 8, + 5, + 8, + 5, + 8, + 5, + 8, + 4, + 7, + 4, + 6, + 4, + 7, + 6, + 17, + 4, + 15, + 3, + 14, + 3, + 14, + 7, + 7, + 5, + 5, + 4, + 6, + 4, + 8, + 9, + 10, + 9, + 10, + 9, + 13, + 9, + 10, + 9, + 19, + 9, + 10, + 9, + 10, + 9, + 10, + 9, + 10, + 9, + 19, + 9, + 13, + 9, + 13, + 9, + 10, + 9, + 10, + 9, + 10, + 9, + 10, + 9, + 10, + 9, + 10, + 9, + 10, + 9, + 10, + 3, + 5, + 3, + 13, + 68, + 0, + 10, + 21, + 15, + 21, + 10, + 21, + 15, + 21, + 15, + 15, + 5, + 16, + 31, + 16, + 31, + 18, + 33, + 16, + 31, + 16, + 31, + 20, + 35, + 16, + 31, + 16, + 31, + 16, + 31, + 16, + 31, + 16, + 31, + 16, + 31, + 16, + 31, + 16, + 31, + 5, + 5, + 5, + 5, + 5, + 15, + 5, + 16, + 6, + 8, + 5, + 16, + 6, + 9, + 10, + 21, + 10, + 24, + 12, + 27, + 10, + 25, + 10, + 25, + 13, + 28, + 10, + 25, + 10, + 25, + 10, + 25, + 10, + 25, + 10, + 25, + 10, + 25, + 10, + 25, + 10, + 25, + 0, + 10, + 25, + 15, + 25, + 10, + 25, + 15, + 25, + 22, + 16, + 5, + 17, + 32, + 17, + 32, + 19, + 34, + 17, + 32, + 17, + 32, + 21, + 36, + 17, + 32, + 17, + 32, + 17, + 32, + 17, + 32, + 17, + 32, + 17, + 32, + 17, + 32, + 17, + 32, + 5, + 5, + 5, + 5, + 5, + 15, + 5, + 16, + 6, + 8, + 5, + 16, + 6, + 9, + 11, + 26, + 11, + 26, + 13, + 28, + 11, + 26, + 11, + 26, + 14, + 29, + 11, + 26, + 11, + 26, + 11, + 26, + 11, + 26, + 11, + 26, + 11, + 26, + 11, + 26, + 11, + 26, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +#else + #define JIT_INSTR_MAX 43 0, 0, @@ -697,4 +1047,5 @@ 0, 0, 0, +#endif /* __CYGWIN__ */ #endif /* __WORDSIZE */