Discussion:
[Valgrind-developers] vex: r3392 - /trunk/priv/host_generic_reg_alloc2.c
s***@valgrind.org
2017-06-13 18:14:28 UTC
Permalink
Author: iraisr
Date: Tue Jun 13 19:14:28 2017
New Revision: 3392

Log:
Fix a possible array overrun in VEX register allocator.
Fixes BZ#381162.

Modified:
trunk/priv/host_generic_reg_alloc2.c

Modified: trunk/priv/host_generic_reg_alloc2.c
==============================================================================
--- trunk/priv/host_generic_reg_alloc2.c (original)
+++ trunk/priv/host_generic_reg_alloc2.c Tue Jun 13 19:14:28 2017
@@ -433,7 +433,7 @@

/* .. and the redundant backward map */
/* Each value is 0 .. n_rregs-1 or is INVALID_RREG_NO.
- This inplies n_rregs must be <= 32768. */
+ This implies n_rregs must be <= 32768. */
Short* vreg_state; /* [0 .. n_vregs-1] */

/* The vreg -> rreg map constructed and then applied to each
@@ -554,8 +554,7 @@

/* An array to hold the reg-usage info for the incoming
instructions. */
- reg_usage_arr
- = LibVEX_Alloc_inline(sizeof(HRegUsage) * instrs_in->arr_used-1);
+ reg_usage_arr = LibVEX_Alloc_inline(sizeof(HRegUsage) * instrs_in->arr_used);

/* ------ end of SET UP TO COMPUTE VREG LIVE RANGES ------ */

Loading...