|
2022-02-16
| ||
| 15:42 | • Closed ticket [c6fea6ba6f]: possible signed integer overflow in Tcl_GetLongFromO... artifact: 3969100760 user: jan.nijtmans | |
| 15:24 | Fix [c6fea6ba6]: possible signed integer overflow in Tcl_GetLongFromObj(), Tcl_GetWideIntFromObj() check-in: efbf66da7d user: jan.nijtmans tags: core-8-6-branch | |
| 02:16 | • Add attachment bignum-to-long-wide.diff to ticket [c6fea6ba6f6b2841|c6f... artifact: 28c551a57b user: chrstphrchvz | |
| 02:15 | • New ticket [c6fea6ba6f] possible signed integer overflow in Tcl_GetLongFromObj()... artifact: 6fec51f58c user: chrstphrchvz | |
possible signed integer overflow in Tcl_GetLongFromObj(), Tcl_GetWideIntFromObj()
Closed / Fixedc6fea6ba6f6b2841ad4d1a569ccc3cb6f6484abcCreated 5 years agoUpdated 5 years ago
Descriptionwiki2022-02-16 02:15:18
If Tcl_GetLongFromObj() or Tcl_GetWideIntFromObj() retrieve from a bignum whose value is LONG_MIN or WIDE_MIN respectively, then I believe there will be signed integer overflow (undefined behavior) on 2's complement systems.
The attached patch should avoid this by using the same approach suggested for [89de498973]: negate before casting, and by subtracting from 0 (binary minus) to avoid compiler warnings for unary minus with unsigned operand (e.g. MSVC /W2 warning C4146). However I have not identified a Tcl syntax example to trigger the overflow, as I have not found how to create a bignum with a value representable by long or Tcl_WideInt that can be saved and used by a command that then passes it to Tcl_GetLongFromObj() or Tcl_GetWideIntFromObj(); maybe I can come up with a C example.
jan.nijtmanswiki2022-02-16 15:42:55
Fixed[here]
Thanks for the report!
Log in (anonymous is fine) to add a comment.