Artifacts Associated With Ticket 95e287b956e7b1dd
Ticket change [37beda3b8a] (rid 209769) by dgp on 2023-03-06 17:37:34:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-plain"
- comment initialized to:
valgrind run over test stringObj-4.2: ---- stringObj-4.2 start ==27231== Conditional jump or move depends on uninitialised value(s) ==27231== at 0x5A8425: Tcl_UtfToChar16 (tclUtf.c:534) ==27231== by 0x5A8999: Tcl_UtfToChar16DString (tclUtf.c:736) ==27231== by 0x591640: SetUTF16StringFromAny (tclStringObj.c:216) ==27231== by 0x56FB12: Tcl_ConvertToType (tclObj.c:977) ==27231== by 0x429729: TeststringobjCmd (tclTestObj.c:1373) ==27231== by 0x434E1F: Dispatch (tclBasic.c:4997) ==27231== by 0x434EA7: TclNRRunCallbacks (tclBasic.c:5037) ==27231== by 0x434773: Tcl_EvalObjv (tclBasic.c:4756) ==27231== by 0x436DD5: TclEvalEx (tclBasic.c:5913) ==27231== by 0x559F7D: Tcl_FSEvalFileEx (tclIOUtil.c:1782) ==27231== by 0x5669A6: Tcl_MainEx (tclMain.c:405) ==27231== by 0x410188: main (tclAppInit.c:94) ==27231== ==27231== Conditional jump or move depends on uninitialised value(s) ==27231== at 0x5A8439: Tcl_UtfToChar16 (tclUtf.c:548) ==27231== by 0x5A8999: Tcl_UtfToChar16DString (tclUtf.c:736) ==27231== by 0x591640: SetUTF16StringFromAny (tclStringObj.c:216) ==27231== by 0x56FB12: Tcl_ConvertToType (tclObj.c:977) ==27231== by 0x429729: TeststringobjCmd (tclTestObj.c:1373) ==27231== by 0x434E1F: Dispatch (tclBasic.c:4997) ==27231== by 0x434EA7: TclNRRunCallbacks (tclBasic.c:5037) ==27231== by 0x434773: Tcl_EvalObjv (tclBasic.c:4756) ==27231== by 0x436DD5: TclEvalEx (tclBasic.c:5913) ==27231== by 0x559F7D: Tcl_FSEvalFileEx (tclIOUtil.c:1782) ==27231== by 0x5669A6: Tcl_MainEx (tclMain.c:405) ==27231== by 0x410188: main (tclAppInit.c:94) ==27231== ==27231== Conditional jump or move depends on uninitialised value(s) ==27231== at 0x5A8513: Tcl_UtfToChar16 (tclUtf.c:555) ==27231== by 0x5A8999: Tcl_UtfToChar16DString (tclUtf.c:736) ==27231== by 0x591640: SetUTF16StringFromAny (tclStringObj.c:216) ==27231== by 0x56FB12: Tcl_ConvertToType (tclObj.c:977) ==27231== by 0x429729: TeststringobjCmd (tclTestObj.c:1373) ==27231== by 0x434E1F: Dispatch (tclBasic.c:4997) ==27231== by 0x434EA7: TclNRRunCallbacks (tclBasic.c:5037) ==27231== by 0x434773: Tcl_EvalObjv (tclBasic.c:4756) ==27231== by 0x436DD5: TclEvalEx (tclBasic.c:5913) ==27231== by 0x559F7D: Tcl_FSEvalFileEx (tclIOUtil.c:1782) ==27231== by 0x5669A6: Tcl_MainEx (tclMain.c:405) ==27231== by 0x410188: main (tclAppInit.c:94) ==27231== ==27231== Use of uninitialised value of size 8 ==27231== at 0x5A8A8D: Tcl_UtfCharComplete (tclUtf.c:779) ==27231== by 0x5A89DC: Tcl_UtfToChar16DString (tclUtf.c:740) ==27231== by 0x591640: SetUTF16StringFromAny (tclStringObj.c:216) ==27231== by 0x56FB12: Tcl_ConvertToType (tclObj.c:977) ==27231== by 0x429729: TeststringobjCmd (tclTestObj.c:1373) ==27231== by 0x434E1F: Dispatch (tclBasic.c:4997) ==27231== by 0x434EA7: TclNRRunCallbacks (tclBasic.c:5037) ==27231== by 0x434773: Tcl_EvalObjv (tclBasic.c:4756) ==27231== by 0x436DD5: TclEvalEx (tclBasic.c:5913) ==27231== by 0x559F7D: Tcl_FSEvalFileEx (tclIOUtil.c:1782) ==27231== by 0x5669A6: Tcl_MainEx (tclMain.c:405) ==27231== by 0x410188: main (tclAppInit.c:94) ==27231== ==27231== Conditional jump or move depends on uninitialised value(s) ==27231== at 0x5A8425: Tcl_UtfToChar16 (tclUtf.c:534) ==27231== by 0x5A89F3: Tcl_UtfToChar16DString (tclUtf.c:741) ==27231== by 0x591640: SetUTF16StringFromAny (tclStringObj.c:216) ==27231== by 0x56FB12: Tcl_ConvertToType (tclObj.c:977) ==27231== by 0x429729: TeststringobjCmd (tclTestObj.c:1373) ==27231== by 0x434E1F: Dispatch (tclBasic.c:4997) ==27231== by 0x434EA7: TclNRRunCallbacks (tclBasic.c:5037) ==27231== by 0x434773: Tcl_EvalObjv (tclBasic.c:4756) ==27231== by 0x436DD5: TclEvalEx (tclBasic.c:5913) ==27231== by 0x559F7D: Tcl_FSEvalFileEx (tclIOUtil.c:1782) ==27231== by 0x5669A6: Tcl_MainEx (tclMain.c:405) ==27231== by 0x410188: main (tclAppInit.c:94) ==27231== ==27231== Conditional jump or move depends on uninitialised value(s) ==27231== at 0x5A8439: Tcl_UtfToChar16 (tclUtf.c:548) ==27231== by 0x5A89F3: Tcl_UtfToChar16DString (tclUtf.c:741) ==27231== by 0x591640: SetUTF16StringFromAny (tclStringObj.c:216) ==27231== by 0x56FB12: Tcl_ConvertToType (tclObj.c:977) ==27231== by 0x429729: TeststringobjCmd (tclTestObj.c:1373) ==27231== by 0x434E1F: Dispatch (tclBasic.c:4997) ==27231== by 0x434EA7: TclNRRunCallbacks (tclBasic.c:5037) ==27231== by 0x434773: Tcl_EvalObjv (tclBasic.c:4756) ==27231== by 0x436DD5: TclEvalEx (tclBasic.c:5913) ==27231== by 0x559F7D: Tcl_FSEvalFileEx (tclIOUtil.c:1782) ==27231== by 0x5669A6: Tcl_MainEx (tclMain.c:405) ==27231== by 0x410188: main (tclAppInit.c:94) ==27231== ==27231== Conditional jump or move depends on uninitialised value(s) ==27231== at 0x5A8513: Tcl_UtfToChar16 (tclUtf.c:555) ==27231== by 0x5A89F3: Tcl_UtfToChar16DString (tclUtf.c:741) ==27231== by 0x591640: SetUTF16StringFromAny (tclStringObj.c:216) ==27231== by 0x56FB12: Tcl_ConvertToType (tclObj.c:977) ==27231== by 0x429729: TeststringobjCmd (tclTestObj.c:1373) ==27231== by 0x434E1F: Dispatch (tclBasic.c:4997) ==27231== by 0x434EA7: TclNRRunCallbacks (tclBasic.c:5037) ==27231== by 0x434773: Tcl_EvalObjv (tclBasic.c:4756) ==27231== by 0x436DD5: TclEvalEx (tclBasic.c:5913) ==27231== by 0x559F7D: Tcl_FSEvalFileEx (tclIOUtil.c:1782) ==27231== by 0x5669A6: Tcl_MainEx (tclMain.c:405) ==27231== by 0x410188: main (tclAppInit.c:94) ==27231== ++++ stringObj-4.2 PASSED
- foundin initialized to: "core-8-branch"
- is_private initialized to: "0"
- login: "dgp"
- priority initialized to: "5 Medium"
- private_contact initialized to: "8e2300e85be5dd1445b9666eb9429055951e33be"
- resolution initialized to: "None"
- severity initialized to: "Important"
- status initialized to: "Open"
- submitter initialized to: "dgp"
- subsystem initialized to: "10. Objects"
- title initialized to: "uninit value use in stringObj-4.2"
- type initialized to: "Bug"
Ticket change [205dc04993] (rid 209779) by jan.nijtmans on 2023-03-06 20:49:43:
- assignee changed to: "jan.nijtmans"
- icomment:
Question: Does core-8-6-branch have the same valgrind issue in the stringObj-4.2 testcase? I suspect it does. If so, it needs to be fixed there first. What happens is the following: <pre> teststringobj set 1 abcdef teststringobj setlength 1 10 </pre> So, a string with length 5 is enlarged to length 10. That means that the last 4(!) bytes of the string will be uninitialized. Then: <pre> teststringobj length2 1 </pre> So, the internal utf-16 representation of the string is generated, and the utf-16 length of the result is determined. That means that we are generating the utf-16 representation of a partly uninitialized string. Not strange that valgrind conplains! Proposed solution: Don't run "teststringobj length2" any more for this testcase, in core-8-6-branch, core-8-branch and in trunk. - login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
Ticket change [f70c68ced1] (rid 209784) by jan.nijtmans on 2023-03-06 21:19:13:
- icomment: "Proposed fix [9dd5f7f10d7c6409|here]"
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Pending"
Ticket change [935801d3e6] (rid 209810) by jan.nijtmans on 2023-03-07 07:46:06:
- closedate changed to: "2460010.82368278"
- closer changed to: "jan.nijtmans"
- foundin changed to: "8.6"
- icomment: "Fixed [04077c7b2e3962f5|here]"
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- status changed to: "Closed"
Ticket change [bd707ac29b] (rid 209898) by dgp on 2023-03-08 14:17:10:
- closedate changed to: "2460012.09526229"
- closer changed to: "dgp"
- icomment:
Your comments make sense to me. I haven't dug in to seek an explanation, but `make valgrind` on the core-8-6-branch did not report the problem. What do you think of an alternative solution where stringObj-4.2 is not modified, but is constrained so that test is skipped in a valgrind run? I have to imagine that comparing the two paths of computing string lengths was the point of the test, now lost. The existing test iortrans.tf-11.1 is an example of this approach.
- login: "dgp"
- mimetype: "text/plain"
Ticket change [d3aaa2ac9b] (rid 209899) by jan.nijtmans on 2023-03-08 14:33:17:
- closedate changed to: "2460012.10645255"
- closer changed to: "jan.nijtmans"
- icomment:
> What do you think of an alternative solution where stringObj-4.2 is not modified, but is constrained so that test is skipped in a valgrind run? Yes, I considered that. But ... uninitialized memory can contain anything. If the memory happens to contain a valid multy-byte UTF-8 sequence (e.g. 0xC0 0x80), then "teststringobj length2 1" will return a value < 10 and the test fails. This shows the test is bogus anyway. What could be done is change "teststringobj setlength" such that when the length is increased compared to the previous length, then the memory is filled with something (e.g. all 0-bytes). That would make stringObj-4.2 predictable, and it would also solve this valgrind issue.
- login: "jan.nijtmans"
- mimetype: "text/plain"