Hi!

----

While testing ast-ksh.2013-02-22 on SuSE 12.2/AMD64/64bit we've hit a
valgrind hit in the "shweblinks.sh" (attached as "shweblinks.sh.gz")
application (which parses Google search results (using regex) and puts
the data into a stream of compound variables):
-- snip --
==25277== Conditional jump or move depends on uninitialised value(s)
==25277==    at 0x42CEC2: sh_setmatch (init.c:955)
==25277==    by 0x44CB7C: varsub (macro.c:1847)
==25277==    by 0x4485D2: copyto (macro.c:632)
==25277==    by 0x446D77: sh_macexpand (macro.c:243)
==25277==    by 0x4A557C: arg_expand (args.c:867)
==25277==    by 0x4A4FCF: sh_argbuild (args.c:724)
==25277==    by 0x4772EE: sh_exec (xec.c:975)
==25277==    by 0x47BAE9: sh_exec (xec.c:2204)
==25277==    by 0x47BBAA: sh_exec (xec.c:2221)
==25277==    by 0x47BAAE: sh_exec (xec.c:2200)
==25277==    by 0x4817C1: sh_funscope_20120720 (xec.c:4038)
==25277==    by 0x47F97F: sh_funct (xec.c:3348)
==25277==  Uninitialised value was created by a stack allocation
==25277==    at 0x449DC0: varsub (macro.c:1102)
-- snip --

I don't have a reduced testcase yet but already found a small and simple patch:
-- snip --
diff -r -u src/cmd/ksh93/sh/macro.c src/cmd/ksh93/sh/macro.c
--- src/cmd/ksh93/sh/macro.c   2013-03-12 00:25:39.298008003 +0100
+++ src/cmd/ksh93/sh/macro.c     2013-03-12 00:16:51.759384400 +0100
@@ -1789,7 +1789,7 @@
                register int d = (mode=='@'?' ':mp->ifs);
                int match[2*(MATCH_MAX+1)],index;
                int nmatch, nmatch_prev, vsize_last, tsize;
-               char *vlast,*oldv;
+               char *vlast=NULL,*oldv;
                while(1)
                {
                        if(!v)
-- snip --

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [email protected]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)

Attachment: shweblinks.sh.gz
Description: GNU Zip compressed data

_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to