Overview
| Artifact ID: | 9429a65a904761c361968ef9c50793bc14326b534035bd5c94c088bb27adbf1d |
|---|---|
| Ticket: | 85fc8bca030ecf2656929cc0a222145a57cca8b2
Pointer arithmetic with NULL in buildInfoObjCmd() |
| User & Date: | chrstphrchvz on 2025-08-31 22:50:10 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/x-fossil-wiki"
- comment changed to:
Example UBSan error for the default case: <pre> % tcl::build-info boneless <b>tclBasic.c:755:36: <span style="color:firebrick">runtime error:</span> applying non-zero offset 1 to null pointer</b> 0 </pre> The error is due to <tt>p++</tt> being used as the for loop condition. I believe there is an instance of this in the <tt>ID_COMPILER</tt> case as well. One possible fix: <pre> --- generic/tclBasic.c +++ generic/tclBasic.c @@ -731,7 +731,8 @@ } return TCL_OK; case ID_COMPILER: <span style="color:firebrick">- for (p = strchr(buildData, '.'); p++; p = strchr(p, '.')) {</span> <span style="color:green">+ for (p = strchr(buildData, '.'); p != NULL; p = strchr(p, '.')) { + p++;</span> /* * Does the word begin with one of the standard prefixes? */ @@ -752,7 +753,8 @@ break; default: /* Boolean test for other identifiers' presence */ arg = TclGetStringFromObj(objv[1], &len); <span style="color:firebrick">- for (p = strchr(buildData, '.'); p++; p = strchr(p, '.')) {</span> <span style="color:green">+ for (p = strchr(buildData, '.'); p != NULL; p = strchr(p, '.')) { + p++;</span> if (!strncmp(p, arg, len) && ((p[len] == '.') || (p[len] == '-') || (p[len] == '\0'))) { if (p[len] == '-') { </pre> - foundin changed to: "core-8-branch"
- is_private changed to: "0"
- login: "chrstphrchvz"
- priority changed to: "5 Medium"
- private_contact changed to: "6133eb3026f9b10aa9b7b48da92ae2834fc225b0"
- resolution changed to: "None"
- severity changed to: "Minor"
- status changed to: "Open"
- submitter changed to: "chrstphrchvz"
- subsystem changed to: "54. Configuration Reporting"
- title changed to: "Pointer arithmetic with NULL in buildInfoObjCmd()"
- type changed to: "Bug"