From 09608e5bce1452abb2255e1f859f076afea463b9 Mon Sep 17 00:00:00 2001 From: andreas_kupries Date: Thu, 17 Apr 2008 19:14:17 +0000 Subject: * generic/tclCompExpr.c (CompileMathFuncCall): Added * tests/compile.test (compile-16.0): Tcl_ResetResult before appending error message, to clear out possible sharing. Added test case demonstrating the crash (abort on shared object) without the fix. --- ChangeLog | 8 ++++++++ generic/tclCompExpr.c | 3 ++- tests/compile.test | 8 +++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 87ee56e..a55f42e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-04-17 Andreas Kupries + + * generic/tclCompExpr.c (CompileMathFuncCall): Added + * tests/compile.test (compile-16.0): Tcl_ResetResult before + appending error message, to clear out possible sharing. Added test + case demonstrating the crash (abort on shared object) without the + fix. + 2008-04-15 Andreas Kupries *** 8.4.19 TAGGED FOR RELEASE *** diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index 3ff749b..8c66f5c 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompExpr.c,v 1.13.2.3 2006/11/28 22:20:00 andreas_kupries Exp $ + * RCS: @(#) $Id: tclCompExpr.c,v 1.13.2.4 2008/04/17 19:14:20 andreas_kupries Exp $ */ #include "tclInt.h" @@ -852,6 +852,7 @@ CompileMathFuncCall(exprTokenPtr, funcName, infoPtr, envPtr, endPtrPtr) code = TCL_OK; hPtr = Tcl_FindHashEntry(&iPtr->mathFuncTable, funcName); if (hPtr == NULL) { + Tcl_ResetResult(interp); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "unknown math function \"", funcName, "\"", (char *) NULL); code = TCL_ERROR; diff --git a/tests/compile.test b/tests/compile.test index 69d3d77..f31e2b9 100644 --- a/tests/compile.test +++ b/tests/compile.test @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: compile.test,v 1.24.2.3 2004/10/26 20:14:36 dgp Exp $ +# RCS: @(#) $Id: compile.test,v 1.24.2.4 2008/04/17 19:14:20 andreas_kupries Exp $ package require tcltest 2 namespace import -force ::tcltest::* @@ -432,6 +432,12 @@ test compile-15.5 {proper TCL_RETURN code from [return]} { set result } "" +test compile-16.0 {error return from unbraced math func call of unknown function} { + set l {3 4 5} + catch { expr bogus([join $l ,]) } msg + set msg +} {unknown math function "bogus"} + # cleanup catch {rename p ""} -- cgit v0.12