valgrind report for Tcl_UniCharToUtf
Closed / Fixed5f236bc67afef5e01f786d1ad93e9a0759b575f4Created 7 years agoUpdated 7 years ago
Descriptionplain2019-12-09 07:42:21
Sorry for being a PITA, here is another test case:
1. build a core-8-branch tclsh (x86_64, linux, static, symbols, purify, standard TCL_UTF_MAX=3)
2. run it interactively in
valgrind --track-origins=yes --leak-check=full -v ...
3. type at tclsh's prompt
puts "\udcdc\ud8d8\ueeee"
4. observe immediately
==22743== Conditional jump or move depends on uninitialised value(s)
==22743== at 0x296323: Tcl_UniCharToUtf (tclUtf.c:159)
==22743== by 0x1FCCF5: UtfToUtfProc (tclEncoding.c:2425)
==22743== by 0x1FC9BA: UtfIntToUtfExtProc (tclEncoding.c:2247)
==22743== by 0x1FB2AE: Tcl_UtfToExternal (tclEncoding.c:1477)
==22743== by 0x23898B: Write (tclIO.c:4336)
==22743== by 0x2386AA: Tcl_WriteObj (tclIO.c:4208)
==22743== by 0x242674: Tcl_PutsObjCmd (tclIOCmd.c:183)
==22743== by 0x135EE6: Dispatch (tclBasic.c:4811)
==22743== by 0x135F6C: TclNRRunCallbacks (tclBasic.c:4851)
==22743== by 0x138912: TclEvalObjEx (tclBasic.c:6420)
==22743== by 0x1388A6: Tcl_EvalObjEx (tclBasic.c:6401)
==22743== by 0x2FDC56: Tcl_RecordAndEvalObj (tclHistory.c:189)
==22743== Uninitialised value was created by a heap allocation
...
5. repeat step 3, no more valgrind complaints seen
Referenced by2
9792eb9013Fix [5f236bc67a]: valgrind report for Tcl_UniCharToUtf. Also add test-cases for more corner-cases. check-in2019-12-10 13:16:483e0a616f7eAttempt to fix [5f236bc67a]: valgrind report for Tcl_UniCharToUtf check-in2019-12-09 19:36:21
jan.nijtmanswiki2019-12-09 19:38:30
No problem. My original intention was to make core-8-6-branch work fine with TCL_UTF_MAX=3, and core-8-branch with TCL_UTF_MAX=4|6. But ... while backporting things to core-8-6-branch I might as well make it work for all TCL_UTF_MAX values gradually.
I think I got everything covered now in [3e0a616f7e9bf5a2]. I'll see if I can test it with Valgrind.
Thanks!
jan.nijtmanswiki2019-12-11 09:00:22
Looks like valgrind is satisfied now.
Thanks for persuing this!
Log in (anonymous is fine) to add a comment.