Overview
| Artifact ID: | a021dcee10ec653d5abb3759851243fd942f33c0c4ea39bcf19ffe5b3c7f2bfd |
|---|---|
| Ticket: | 96551aca555c70e4e2157c534c8fdb11acf784e9
Avoid pointer arithmetic with NULL in FOREACH_STRUCT() |
| User & Date: | chrstphrchvz on 2023-04-22 07:23:48 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/x-fossil-wiki"
- comment changed to:
Not aware exactly what Tcl code triggers this, but it appears at the beginning of output from <tt>tcltest</tt> during <tt>make test</tt>: <blockquote><pre> <b>generic/tclOOMethod.c:1108:2: <span style="color:firebrick">runtime error:</span> applying zero offset to null pointer</b> </pre></blockquote> Something like the following is needed (<tt>var</tt> should also be parenthesized to avoid surprises): <blockquote><pre> --- generic/tclOOInt.h.orig +++ generic/tclOOInt.h @@ -594,7 +594,7 @@ MODULE_SCOPE void TclOOSetupVariableResolver(Tcl_Namespace *nsPtr); */ #define FOREACH_STRUCT(var,ary) \ <span style="color:firebrick">- for(i=0 ; var=&((ary).list[i]), i<(ary).num; i++)</span> <span style="color:green">+ for(i=0 ; (var)=((ary).list ? &((ary).list[i]) : NULL), i<(ary).num; i++)</span> /* * Convenience macros for iterating through hash tables. FOREACH_HASH_DECLS </pre></blockquote> <pre> </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: "35. TclOO Package"
- title changed to:
Avoid pointer arithmetic with NULL in FOREACH_STRUCT()
- type changed to: "Patch"