]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix a possible array overrun in VEX register allocator.
authorIvo Raisr <ivosh@ivosh.net>
Tue, 13 Jun 2017 18:14:28 +0000 (18:14 +0000)
committerIvo Raisr <ivosh@ivosh.net>
Tue, 13 Jun 2017 18:14:28 +0000 (18:14 +0000)
Fixes BZ#381162.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3392

VEX/priv/host_generic_reg_alloc2.c

index ada2396865626ff3467d05d441e6732f8ec2cb1a..2294a9bcc9d78687f34c7ffa55b1f0c7037e1185 100644 (file)
@@ -433,7 +433,7 @@ HInstrArray* doRegisterAllocation (
 
    /* .. 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 @@ HInstrArray* doRegisterAllocation (
 
    /* 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 ------ */