[commit: ghc] ghc-7.8: Fix potential out-of-bound memory access (07fb613)

git at git.haskell.org git at git.haskell.org
Sun Apr 27 14:44:23 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-7.8
Link       : http://ghc.haskell.org/trac/ghc/changeset/07fb613bf599aa9237b1ef73861706b447173d38/ghc

>---------------------------------------------------------------

commit 07fb613bf599aa9237b1ef73861706b447173d38
Author: Nicolas Trangez <ikke at nicolast.be>
Date:   Wed Apr 23 20:27:04 2014 +0200

    Fix potential out-of-bound memory access
    
    Issue discovered by Coverity scan, CID 43165.
    
    Signed-off-by: Austin Seipp <austin at well-typed.com>
    (cherry picked from commit fa0cbd297ba12e02273efcaa5f52fe76e10b7126)


>---------------------------------------------------------------

07fb613bf599aa9237b1ef73861706b447173d38
 utils/hp2ps/HpFile.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/utils/hp2ps/HpFile.c b/utils/hp2ps/HpFile.c
index 86cbfb2..bdbf201 100644
--- a/utils/hp2ps/HpFile.c
+++ b/utils/hp2ps/HpFile.c
@@ -332,7 +332,7 @@ GetHpTok(FILE *infp)
  *	"thefloatish").
  */
 
-static char numberstring[ NUMBER_LENGTH - 1 ];
+static char numberstring[ NUMBER_LENGTH + 1 ];
 
 token
 GetNumber(FILE *infp)
@@ -350,7 +350,7 @@ GetNumber(FILE *infp)
         ch = getc(infp);
     }   
  
-    ASSERT(i < NUMBER_LENGTH); /* did not overflow */
+    ASSERT(i <= NUMBER_LENGTH); /* did not overflow */
 
     numberstring[ i ] = '\0';
  



More information about the ghc-commits mailing list