diff options
-rw-r--r-- | jim.c | 4 | ||||
-rw-r--r-- | regtest.tcl | 6 |
2 files changed, 8 insertions, 2 deletions
@@ -4368,13 +4368,13 @@ Jim_Obj *Jim_NewReference(Jim_Interp *interp, Jim_Obj *objPtr, Jim_Obj *tagPtr, refObjPtr->internalRep.refValue.id = interp->referenceNextId; refObjPtr->internalRep.refValue.refPtr = refPtr; interp->referenceNextId++; - /* Set the tag. Trimmered at JIM_REFERENCE_TAGLEN. Everything + /* Set the tag. Trimmed at JIM_REFERENCE_TAGLEN. Everything * that does not pass the 'isrefchar' test is replaced with '_' */ tag = Jim_GetString(tagPtr, &tagLen); if (tagLen > JIM_REFERENCE_TAGLEN) tagLen = JIM_REFERENCE_TAGLEN; for (i = 0; i < JIM_REFERENCE_TAGLEN; i++) { - if (i < tagLen) + if (i < tagLen && isrefchar(tag[i])) refPtr->tag[i] = tag[i]; else refPtr->tag[i] = '_'; diff --git a/regtest.tcl b/regtest.tcl index 4bfcba6..09b193e 100644 --- a/regtest.tcl +++ b/regtest.tcl @@ -74,6 +74,12 @@ proc a {} {{x 1}} { rename a ""; incr x } a puts "TEST 11 PASSED" +# REGTEST 12 +# 13 Sep 2010 - reference with invalid tag +set a b[ref value "tag name"] +getref [string range $a 1 end] +puts "TEST 12 PASSED" + # TAKE THE FOLLOWING puts AS LAST LINE puts "--- ALL TESTS PASSED ---" |