TclPushVarName(): pointer overflow
Closed / Fixed77059c4f456952a4a7c23392b7a9a8d200bbcc39Created 4 years agoUpdated 1 year ago
Descriptionwiki2023-05-08 20:05:19
Doing set {} (e.g. from var-6.3) triggers an -fsanitize=pointer-overflow error:
generic/tclCompCmds.c:3454:6: runtime error: addition of unsigned offset to 0x603000023a75 overflowed to 0x603000023a74This might seem due to nameLen now being size_t, but I think it would be better if there was a check for nameLen < 1 or < 2.
Referenced by1
1a3e5bdaf5Fix [77059c4f45]: TclPushVarName(): pointer overflow check-in2025-09-18 09:35:47
chrstphrchvz Ticket [77059c4f45]: 3 changes
[History diff]2023-05-08 20:08:11
chrstphrchvzmarkdown2025-09-17 23:20:17
A better possible fix might be to declare nameLen as Tcl_Size.
chrstphrchvz Ticket [77059c4f45]: 3 changes
[History diff]2025-09-17 23:24:32
jan.nijtmanswiki2025-09-18 09:38:10
Like [this]?
chrstphrchvzmarkdown2025-09-18 18:08:09
I had thought of using Tcl_Size in case the current behavior was correct and that the overflow was harmless. But looking again, I see how the overflow suggests there is a problem, so I agree with Jan proposed's fix.
jan.nijtmanswiki2025-09-19 17:08:26
Fixed [here] (and in all other branches as well)
Thanks!
Log in (anonymous is fine) to add a comment.