|
2023-03-23
| ||
| 07:27 | fix for [f3cb2a32d6] Add initialization to allocation of string rep buffer to resolve valgrind repor... check-in: ca0e3d0976 user: jan.nijtmans tags: core-8-branch | |
|
2023-03-22
| ||
| 21:24 | • Ticket [f3cb2a32d6] uninitialized value in format-2.18 status still Closed w... artifact: bbe976c45b user: jan.nijtmans | |
|
2023-03-20
| ||
| 18:46 | • Ticket [f3cb2a32d6]: 4 changes artifact: c4d8af5223 user: dgp | |
| 18:45 | Candidate fix for [f3cb2a32d6] Add initialization to allocation of string rep buffer to resolve valg... closed check-in: 24e82d736e user: dgp tags: bug-f3cb2a32d6 | |
|
2023-03-09
| ||
| 21:35 | Additional fix for [f3cb2a32d6]: uninitialized value in format-2.18 This commit causes a lot of b... check-in: 8d939a1c22 user: jan.nijtmans tags: mistake | |
|
2023-03-08
| ||
| 19:31 | • Ticket [f3cb2a32d6] uninitialized value in format-2.18 status still Closed w... artifact: a6440ba025 user: dgp | |
| 17:37 | • Ticket [f3cb2a32d6]: 5 changes artifact: b1e5a847c0 user: dgp | |
|
2023-03-07
| ||
| 07:07 | • Closed ticket [f3cb2a32d6]. artifact: d9022ca2aa user: jan.nijtmans | |
| 07:03 | Fix [f3cb2a32d6]: uninitialized value in format-2.18. Also remove repeated call to Tcl_DStringInit() check-in: b01a3c55ed user: jan.nijtmans tags: core-8-branch | |
|
2023-03-06
| ||
| 20:55 | • Pending ticket [f3cb2a32d6]: uninitialized value in format-2.18 plus 4 other... artifact: 125371f964 user: jan.nijtmans | |
| 19:58 | Proposed fix for [f3cb2a32d6]: uninitialized value in format-2.18 closed check-in: 05e83f801a user: jan.nijtmans tags: bug-f3cb2a32d6 | |
| 19:39 | • Ticket [f3cb2a32d6] uninitialized value in format-2.18 status still Open wit... artifact: 653375e3ea user: jan.nijtmans | |
| 17:24 | • New ticket [f3cb2a32d6]. artifact: a39ab5420b user: dgp | |
uninitialized value in format-2.18
Closed / Fixedf3cb2a32d60cf1386b08497b85434cf0177e7c6dCreated 4 years agoUpdated 4 years ago
Descriptionplain2023-03-06 17:24:24
A valgrind run exposes trouble in test format-2.18 ==19961== Conditional jump or move depends on uninitialised value(s) ==19961== at 0x5A7CF7: Tcl_UniCharToUtf (tclUtf.c:231) ==19961== by 0x59952D: ExtendStringRepWithUnicode (tclStringObj.c:4853) ==19961== by 0x5993C0: UpdateStringOfString (tclStringObj.c:4794) ==19961== by 0x57025B: Tcl_GetStringFromObj (tclObj.c:1705) ==19961== by 0x595DBD: Tcl_AppendFormatToObj (tclStringObj.c:2955) ==19961== by 0x59603F: Tcl_Format (tclStringObj.c:3029) ==19961== by 0x488590: TclCompileFormatCmd (tclCompCmds.c:3190) ==19961== by 0x50A4E3: TclAttemptCompileProc (tclEnsemble.c:3298) ==19961== by 0x4E6873: CompileCmdCompileProc (tclCompile.c:1993) ==19961== by 0x4E6EE2: CompileCommandTokens (tclCompile.c:2109) ==19961== by 0x4E745C: TclCompileScript (tclCompile.c:2269) ==19961== by 0x4E41FE: TclSetByteCodeFromAny (tclCompile.c:838) ==19961== by 0x5111D6: TclCompileObj (tclExecute.c:1776) ==19961== by 0x437DC0: TclNREvalObjEx (tclBasic.c:6732) ==19961== by 0x5868E5: TclNRUplevelObjCmd (tclProc.c:985) ==19961== by 0x434E1F: Dispatch (tclBasic.c:4997) ==19961== by 0x434EA7: TclNRRunCallbacks (tclBasic.c:5037) ==19961== by 0x434773: Tcl_EvalObjv (tclBasic.c:4756) ==19961== by 0x436DD5: TclEvalEx (tclBasic.c:5913) ==19961== by 0x559F7D: Tcl_FSEvalFileEx (tclIOUtil.c:1782) ==19961== by 0x5669A6: Tcl_MainEx (tclMain.c:405) ==19961== by 0x410188: main (tclAppInit.c:94)
Referenced by5
ca0e3d0976fix for [f3cb2a32d6] Add initialization to allocation of string rep buffer to resolve valgrind reports on use of uninitialized memory check-in2023-03-23 07:27:2824e82d736eCandidate fix for [f3cb2a32d6] Add initialization to allocation of string rep buffer to resolve valgrind reports on use of uninitialized memory check-in2023-03-20 18:45:288d939a1c22Additional fix for [f3cb2a32d6]: uninitialized value in format-2.18 This commit causes a lot of breackage .... check-in2023-03-09 21:35:07b01a3c55edFix [f3cb2a32d6]: uninitialized value in format-2.18. Also remove repeated call to Tcl_DStringInit() check-in2023-03-07 07:03:3605e83f801aProposed fix for [f3cb2a32d6]: uninitialized value in format-2.18 check-in2023-03-06 19:58:53
jan.nijtmans Ticket [f3cb2a32d6]: 3 changes
[History diff]2023-03-06 19:39:01
jan.nijtmanswiki2023-03-06 20:55:51
Proposed fix [here]
In Tcl 8.7, if Tcl_UniCharToUtf() is fed a lower surrogate, it checks if the previous Tcl_UniCharToUtf() call produced an upper surrogate. This previous result is stored in dst[0] and dst[1], but in this situation those two bytes are uninitialized. Initializing dst[0] just before the Tcl_UniCharToUtf() should help.
jan.nijtmansplain2023-03-07 07:07:52
Fixed [b01a3c55eda6af6d|] here (for 8.7 only, not needed in 9.0)
dgpplain2023-03-08 17:37:37
This change shifts the failure to a similar problem in the following test format-2.19: ---- format-2.19 start ==6436== Conditional jump or move depends on uninitialised value(s) ==6436== at 0x5A7E59: Tcl_UniCharToUtf (tclUtf.c:231) ==6436== by 0x59968F: ExtendStringRepWithUnicode (tclStringObj.c:4854) ==6436== by 0x59951B: UpdateStringOfString (tclStringObj.c:4794) ==6436== by 0x5703B6: Tcl_GetStringFromObj (tclObj.c:1705) ==6436== by 0x593752: Tcl_AppendObjToObj (tclStringObj.c:1862) ==6436== by 0x4E59AC: TclWordKnownAtCompileTime (tclCompile.c:1783) ==6436== by 0x488512: TclCompileFormatCmd (tclCompCmds.c:3170) ==6436== by 0x50A63E: TclAttemptCompileProc (tclEnsemble.c:3298) ==6436== by 0x4E69CE: CompileCmdCompileProc (tclCompile.c:1993) ==6436== by 0x4E703D: CompileCommandTokens (tclCompile.c:2109) ==6436== by 0x4E75B7: TclCompileScript (tclCompile.c:2269) ==6436== by 0x4E4359: TclSetByteCodeFromAny (tclCompile.c:838) ==6436== by 0x511331: TclCompileObj (tclExecute.c:1776) ==6436== by 0x437F1B: TclNREvalObjEx (tclBasic.c:6732) ==6436== by 0x586A40: TclNRUplevelObjCmd (tclProc.c:985) ==6436== by 0x434F7A: Dispatch (tclBasic.c:4997) ==6436== by 0x435002: TclNRRunCallbacks (tclBasic.c:5037) ==6436== by 0x4348CE: Tcl_EvalObjv (tclBasic.c:4756) ==6436== by 0x436F30: TclEvalEx (tclBasic.c:5913) ==6436== by 0x55A0D8: Tcl_FSEvalFileEx (tclIOUtil.c:1782) ==6436== by 0x566B01: Tcl_MainEx (tclMain.c:405) ==6436== by 0x410188: main (tclAppInit.c:94) ==6436== ++++ format-2.19 PASSED looking....
dgpplain2023-03-08 19:31:51
In test format-2.19 the access to uninitialized memory happens when generating the string rep of the argument "%s\uDE02". The first two characters are written as single-byte encoded UTF-8 into dst. Then the third character needs to be written starting at the 3rd byte of the string rep. Since the character U+DE02 is a low surrogate, it reads the 3rd and 4th byte to check for residue of a high surrogate, but those bytes are uninitialized. Moving the initialization to \0 inside the loop disrupts the surrogate history mechanism, so that's not an answer. Maybe a conditional initialization is possible, but getting really messy with callers of Tcl_UniCharToUtf() burdened with a lot of specialized knowledge to make the call in ways that reliably avoid this issue.
dgpplain2023-03-20 18:46:36
Candidate fix on a branch for review. Adds initialization to the allocation routine most often at work.
jan.nijtmanswiki2023-03-22 21:24:53
"Candidate fix" looks good to me. Thanks!
Log in (anonymous is fine) to add a comment.