[commit: ghc] master: rts: don't crash on 'hs_init(NULL, NULL)' in debug rts (97b7593)

git at git.haskell.org git at git.haskell.org
Fri Oct 10 20:57:35 UTC 2014


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/97b75935ca2cc9d5c9c8dcdb65439dd32af1907b/ghc

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

commit 97b75935ca2cc9d5c9c8dcdb65439dd32af1907b
Author: Sergei Trofimovich <slyfox at gentoo.org>
Date:   Fri Oct 10 21:43:30 2014 +0100

    rts: don't crash on 'hs_init(NULL, NULL)' in debug rts
    
    Caught by T6006 as a NULL dereference:
    
      Command: ./T6006
    
      Invalid read of size 8
         at 0x660ED9: hs_init_ghc (RtsStartup.c:168)
         by 0x660D90: hs_init (RtsStartup.c:112)
         by 0x40504D: main (in /home/slyfox/dev/git/ghc-validate/testsuite/tests/rts/T6006)
       Address 0x0 is not stack'd, malloc'd or (recently) free'd
    
    The regression was introduced by commit
    cb0a503a44bf016de3d9042906c6ac0c0821ffea
    
    Signed-off-by: Sergei Trofimovich <slyfox at gentoo.org>


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

97b75935ca2cc9d5c9c8dcdb65439dd32af1907b
 rts/RtsStartup.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c
index 5e6f9fa..32bed5a 100644
--- a/rts/RtsStartup.c
+++ b/rts/RtsStartup.c
@@ -161,12 +161,12 @@ hs_init_ghc(int *argc, char **argv[], RtsConfig rts_config)
         setFullProgArgv(*argc,*argv);
         setupRtsFlags(argc, *argv,
                       rts_config.rts_opts_enabled, rts_config.rts_opts, rts_config.rts_hs_main);
-    }
 
 #ifdef DEBUG
-    /* load debugging symbols for current binary */
-    DEBUG_LoadSymbols((*argv)[0]);
+        /* load debugging symbols for current binary */
+        DEBUG_LoadSymbols((*argv)[0]);
 #endif /* DEBUG */
+    }
 
     /* Initialise the stats department, phase 1 */
     initStats1();



More information about the ghc-commits mailing list