|
2023-03-06
| ||
| 21:23 | • Ticket [57bfcf43dd] Remove unreachable code in Tcl_SetWideIntObj() status st... artifact: 7eca1b7801 user: jan.nijtmans | |
| 21:22 | • Closed ticket [57bfcf43dd]. artifact: d62d8b5218 user: jan.nijtmans | |
|
2023-03-05
| ||
| 21:09 | Fix [57bfcf43dd]: Remove unreachable code in Tcl_SetWideIntObj() check-in: 71045bf69c user: jan.nijtmans tags: core-8-6-branch | |
| 18:55 | • New ticket [57bfcf43dd] Remove unreachable code in Tcl_SetWideIntObj(). artifact: 27b91fb5a2 user: chrstphrchvz | |
Remove unreachable code in Tcl_SetWideIntObj()
Closed / Fixed57bfcf43dd4bd6c2257c1063fc079d56ca169191Created 4 years agoUpdated 4 years ago
Descriptionwiki2023-03-05 18:55:22
In Tcl_SetWideIntObj() (generic/tclObj.c):
if ((wideValue >= (Tcl_WideInt) LONG_MIN)
&& (wideValue <= (Tcl_WideInt) LONG_MAX)) {
TclSetLongObj(objPtr, (long) wideValue);
} else {
#ifndef TCL_WIDE_INT_IS_LONG
TclSetWideIntObj(objPtr, wideValue);
#else
mp_int big;
TclBNInitBignumFromWideInt(&big, wideValue);
Tcl_SetBignumObj(objPtr, &big);
#endif
}
The section creating a bignum is only defined when Tcl_WideInt is long. But when Tcl_WideInt is long, the range check is always true: TclSetLongObj() is always called, and the bignum section is never used.
I am not aware of any other similar examples of this in core Tcl.
Referenced by1
71045bf69cFix [57bfcf43dd]: Remove unreachable code in Tcl_SetWideIntObj() check-in2023-03-05 21:09:46
jan.nijtmanswiki2023-03-06 21:22:08
Fixed [1045bf69c59070c|here]
jan.nijtmanswiki2023-03-06 21:23:40
Fixed [here]
Log in (anonymous is fine) to add a comment.