TEBCResume(): pointer overflow for INST_LREPLACE4
Closed / Duplicate176de86b3bb11df158b0245f8706cf9e543ccc19Created 4 years agoUpdated 25 days ago
Descriptionwiki2023-05-08 16:16:12
As of [7a2fc29ce038], numNewElems is declared as size_t, which can lead to pointer overflow in OBJ_AT_DEPTH(numNewElems - 1). Example -fsanitize=pointer-overflow error during autoMkindex-3.4:
generic/tclExecute.c:5109:9: runtime error: subtraction of unsigned offset from 0x611000099078 overflowed to 0x611000099080
Declaring numToDelete as size_t seems fine, though.
Referenced by1
473a0e4b55Ticket [3d3124d01d] failures with -ftrapv compiler option status still Pending with 3 other changes ticket2023-09-15 13:24:24
chrstphrchvzwiki2023-09-15 13:28:28
As of [ba731752d345] I wonder if this issue also affects 8.7 (particularly on 32-bit); so far I have not observed that it does. However fix for this issue may still be applicable to both 8.7 and 9.0.
griffinplain2023-09-16 17:25:35
Fixed by broader updates to the uses of size_t everywhere.
chrstphrchvzwiki2023-09-16 22:10:27
Can you please elaborate how this was fixed? I still observe this on trunk, since TCL_HASH_TYPE is size_t.
griffinplain2023-09-17 16:22:19
I cannot reproduce the error. My first attempt produced no error. After review I realized I didn't run the build & test correctly. It this point I cannot get tcl to build correctly with sanitize at all, let alone run. Re-open the bug for someone else to pursue.
chrstphrchvzmarkdown2025-09-19 21:59:01
This error is still present (rephrased slightly):
generic/tclExecute.c:5203:21: runtime error: addition of unsigned offset to 0x6110000748c8 overflowed to 0x6110000748b8
and:
generic/tclExecute.c:5212:21: runtime error: addition of unsigned offset to 0x6110000ada88 overflowed to 0x6110000ada80
I no longer see this error during autoMkindex tests, but there are several other tests which do trigger it; one affected command is linsert {} 0 a b.
chrstphrchvzwiki2026-11-08 06:44:29
Closing as duplicate in favor of [94c6511e].
Log in (anonymous is fine) to add a comment.