Skip to content
Tcl Source Code View Ticket
Login

View Ticket

tcl::unsupported::icu::detect missing 32-bit error-check

Closed / Fixed02fe7f5c89c2b12c61474de3b6df8d165c24c698Created 2 years agoUpdated 2 years ago
Descriptionwiki2025-04-05 22:54:06
In line 352 of tclIcu.c:
    bytes = (char *) Tcl_GetBytesFromObj(interp, objPtr, &len);
a few lines after that (line 363):
    ucsdet_setText(csd, bytes, len, &status);

However the "len" parameter of ucsdet_setText() is int32_t, and no range-check is done (as in the other ICU functions. So if len > 2**31, this will lead to unexpected results.

Discovered when working on TIP #626.

Referenced by1
  • d05c268ca9Fix [02fe7f5c89]: tcl::unsupported::icu::detect missing 32-bit error-check check-in2025-04-06 16:12:26
jan.nijtmans Ticket [02fe7f5c89]: 3 changes [History diff]2025-04-05 22:54:23
jan.nijtmanswiki2025-04-05 22:57:37

The comment belonging to 'IcuDetectObjCmd' reads:

 * EncodingDetectObjCmd --
 *
 *	Implements the Tcl command EncodingDetect.
 *	  encdetect - returns names of all detectable encodings
 *	  encdetect BYTES ?-all? - return detected encoding(s)
So the C- and Tcl-functions names are not up-to-date any more

jan.nijtmanswiki2025-04-06 16:15:11

Fixed [here]

Log in (anonymous is fine) to add a comment.