* trace-cmd library: suspicious SWIG instructions for the python wrappers
@ 2024-06-20 8:49 Jerome Marchand
0 siblings, 0 replies; only message in thread
From: Jerome Marchand @ 2024-06-20 8:49 UTC (permalink / raw)
To: Steven Rostedt, Johannes Berg, Linux Trace Devel
Hi,
Static analysis also showed the following error:
Error: UNINIT (CWE-457):
trace-cmd-v3.2/python/ctracecmd_wrap.c:18170: var_decl: Declaring
variable "temp3" without initializer.
trace-cmd-v3.2/python/ctracecmd_wrap.c:18175: assign: Assigning: "arg3"
= "&temp3", which points to uninitialized data.
trace-cmd-v3.2/python/ctracecmd_wrap.c:18188: uninit_use_in_call: Using
uninitialized value "*arg3" when calling "tep_plugin_kvm_get_func".
#18186| }
#18187| arg2 = (struct tep_record *)(argp2);
#18188|-> result = (char *)tep_plugin_kvm_get_func(arg1,arg2,arg3);
#18189| resultobj = SWIG_FromCharPtr((const char *)result);
#18190| if (SWIG_IsTmpObj(res3)) {
AFAICT, this is because of the following line in ctracecmd.i:
%apply unsigned long long *OUTPUT {unsigned long long *}
IIUC, it tells SWIG that all unsigned long long* are to be treated as
output parameter so the wrapping code generated by SWIG doesn't bother
to copy it's value which would definitely explain the uninitialized
use warning above. Also I checked that removing that line produce code
that don't use arg3 uninitialized.
The next line in ctracecmd.i is just as suspicious:
%apply int *OUTPUT {int *}
I have no previous experience with SWIG and I don't understand what
the original intent was when those lines were added, so I don't know
how to fix it.
Regards,
Jerome
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-06-20 8:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-20 8:49 trace-cmd library: suspicious SWIG instructions for the python wrappers Jerome Marchand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).