# Fwd: New Defects reported by Coverity Scan for GNURadio

**URL:** <https://www.ruby-forum.com/t/fwd-new-defects-reported-by-coverity-scan-for-gnuradio/233959>\
**Category:** GNU Radio\
**Created:** [January 26, 2015, 9:10am UTC](https://www.ruby-forum.com/t/fwd-new-defects-reported-by-coverity-scan-for-gnuradio/233959 "2015-01-26T09:10:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [January 26, 2015, 9:10am UTC](https://www.ruby-forum.com/t/fwd-new-defects-reported-by-coverity-scan-for-gnuradio/233959/1 "2015-01-26T09:10:14Z")

</div>

FYI.

-------- Forwarded Message --------  
Subject: New Defects reported by Coverity Scan for GNURadio  
Date: Sun, 25 Jan 2015 23:13:10 -0800  
From: removed\_email\_address@domain.invalid  
To: removed\_email\_address@domain.invalid

Hi,

Please find the latest report on new defect(s) introduced to GNURadio  
found with Coverity Scan.

7 new defect(s) introduced to GNURadio found with Coverity Scan.

New defect(s) Reported-by: Coverity Scan  
Showing 7 of 7 defect(s)

\*\* CID 1267227: Self assignment (NO\_EFFECT)  
/var/lib/jenkins/jobs/GNURadio-master/workspace/gnuradio/gr-dtv/lib/atsc/atsc\_interleaver\_impl.cc:  
61 in gr::dtv::atsc\_interleaver\_impl::atsc\_interleaver\_impl()()

\*\* CID 1267226: Dereference before null check (REVERSE\_INULL)  
/gr-digital/swig/digital\_swigPYTHON\_wrap.cxx: 235836 in  
\_wrap\_new\_constellation\_16qam\_sptr(\_object \*, \_object \*)()

\*\* CID 1267225: Dereference before null check (REVERSE\_INULL)  
/gr-digital/swig/digital\_swigPYTHON\_wrap.cxx: 234542 in  
\_wrap\_new\_constellation\_8psk\_natural\_sptr(\_object \*, \_object \*)()

\*\* CID 1267224: Uncaught exception (UNCAUGHT\_EXCEPT)  
/var/lib/jenkins/jobs/GNURadio-master/workspace/gnuradio/gnuradio-runtime/apps/gnuradio-config-info.cc:  
36 in main()

\*\* CID 1267223: Uncaught exception (UNCAUGHT\_EXCEPT)  
/var/lib/jenkins/jobs/GNURadio-master/workspace/gnuradio/gnuradio-runtime/apps/gnuradio-config-info.cc:  
36 in main()

\*\* CID 1267222: Uncaught exception (UNCAUGHT\_EXCEPT)  
/var/lib/jenkins/jobs/GNURadio-master/workspace/gnuradio/gnuradio-runtime/apps/gnuradio-config-info.cc:  
36 in main()

\*\* CID 1267221: Uninitialized scalar variable (UNINIT)  
/var/lib/jenkins/jobs/GNURadio-master/workspace/gnuradio/gr-dtv/lib/atsc/atsc\_field\_sync\_mux\_impl.cc:  
199 in gr::dtv::atsc\_field\_sync\_mux\_impl::general\_work(int,  
std::vector\<int, std::allocator\> &, std::vector\<const void \*,  
std::allocator\<const void \*\>\>&, std::vector\<void \*, std::allocator\<void  
\*\>\>&)()

* * *

\*\*\* CID 1267227: Self assignment (NO\_EFFECT)  
/var/lib/jenkins/jobs/GNURadio-master/workspace/gnuradio/gr-dtv/lib/atsc/atsc\_interleaver\_impl.cc:  
61 in gr::dtv::atsc\_interleaver\_impl::atsc\_interleaver\_impl()()  
55 }  
56  
57 memset(registers, 0, sizeof(unsigned char) \* I \* ((I - 1) \*  
J));  
58 memset(pointers, 0, sizeof(int) \* I);  
59  
60 this-\>I = I;

> > > ```
> > > CID 1267227: Self assignment (NO_EFFECT)
> > > Assignment operation "this->J = this->J" has no effect.
> > > 
> > > ```

61 this-\>J = J;  
62 commutator = 0;  
63 }  
64  
65 atsc\_interleaver\_impl::~atsc\_interleaver\_impl()  
66 {

* * *

\*\*\* CID 1267226: Dereference before null check (REVERSE\_INULL)  
/gr-digital/swig/digital\_swigPYTHON\_wrap.cxx: 235836 in  
\_wrap\_new\_constellation\_16qam\_sptr(\_object \*, \_object \*)()  
235830 SWIGINTERN PyObject  
\*\_wrap\_new\_constellation\_16qam\_sptr(PyObject \*self, PyObject \*args) {  
235831 int argc;  
235832 PyObject \*argv[2];  
235833 int ii;  
235834  
235835 if (!PyTuple\_Check(args)) SWIG\_fail;

> > > ```
> > > CID 1267226: Dereference before null check (REVERSE_INULL)
> > > Null-checking "args" suggests that it may be null, but it has already been 
> > > 
> > > ```

dereferenced on all paths leading to the check.  
235836 argc = args ? (int)PyObject\_Length(args) : 0;  
235837 for (ii = 0; (ii \< 1) && (ii \< argc); ii++) {  
235838 argv[ii] = PyTuple\_GET\_ITEM(args,ii);  
235839 }  
235840 if (argc == 0) {  
235841 return \_wrap\_new\_constellation\_16qam\_sptr\_\_SWIG\_0(self,  
args);

* * *

\*\*\* CID 1267225: Dereference before null check (REVERSE\_INULL)  
/gr-digital/swig/digital\_swigPYTHON\_wrap.cxx: 234542 in  
\_wrap\_new\_constellation\_8psk\_natural\_sptr(\_object \*, \_object \*)()  
234536 SWIGINTERN PyObject  
\*\_wrap\_new\_constellation\_8psk\_natural\_sptr(PyObject \*self, PyObject  
\*args) {  
234537 int argc;  
234538 PyObject \*argv[2];  
234539 int ii;  
234540  
234541 if (!PyTuple\_Check(args)) SWIG\_fail;

> > > ```
> > > CID 1267225: Dereference before null check (REVERSE_INULL)
> > > Null-checking "args" suggests that it may be null, but it has already been 
> > > 
> > > ```

dereferenced on all paths leading to the check.  
234542 argc = args ? (int)PyObject\_Length(args) : 0;  
234543 for (ii = 0; (ii \< 1) && (ii \< argc); ii++) {  
234544 argv[ii] = PyTuple\_GET\_ITEM(args,ii);  
234545 }  
234546 if (argc == 0) {  
234547 return  
\_wrap\_new\_constellation\_8psk\_natural\_sptr\_\_SWIG\_0(self, args);

* * *

\*\*\* CID 1267224: Uncaught exception (UNCAUGHT\_EXCEPT)  
/var/lib/jenkins/jobs/GNURadio-master/workspace/gnuradio/gnuradio-runtime/apps/gnuradio-config-info.cc:  
36 in main()  
30 #include   
31  
32 namespace po = boost::program\_options;  
33 using boost::format;  
34  
35 int

> > > ```
> > > CID 1267224: Uncaught exception (UNCAUGHT_EXCEPT)
> > > In function "main" an exception of type 
> > > 
> > > ```

"boost::exception\_detail::clone\_impl\<boost::exception\_detail::error\_info\_injectorboost::io::bad\_format\_string

> " is thrown and never caught.  
> 36 main(int argc, char \*\*argv)  
> 37 {  
> 38 po::options\_description desc((format(“Program options: %1%  
> [options]”) % argv[0]).str());  
> 39 po::variables\_map vm;  
> 40  
> 41 desc.add\_options()

* * *

\*\*\* CID 1267223: Uncaught exception (UNCAUGHT\_EXCEPT)  
/var/lib/jenkins/jobs/GNURadio-master/workspace/gnuradio/gnuradio-runtime/apps/gnuradio-config-info.cc:  
36 in main()  
30 #include   
31  
32 namespace po = boost::program\_options;  
33 using boost::format;  
34  
35 int

> > > ```
> > > CID 1267223: Uncaught exception (UNCAUGHT_EXCEPT)
> > > In function "main" an exception of type 
> > > 
> > > ```

"boost::exception\_detail::clone\_impl\<boost::exception\_detail::error\_info\_injectorboost::io::too\_few\_args

> " is thrown and never caught.  
> 36 main(int argc, char \*\*argv)  
> 37 {  
> 38 po::options\_description desc((format(“Program options: %1%  
> [options]”) % argv[0]).str());  
> 39 po::variables\_map vm;  
> 40  
> 41 desc.add\_options()

* * *

\*\*\* CID 1267222: Uncaught exception (UNCAUGHT\_EXCEPT)  
/var/lib/jenkins/jobs/GNURadio-master/workspace/gnuradio/gnuradio-runtime/apps/gnuradio-config-info.cc:  
36 in main()  
30 #include   
31  
32 namespace po = boost::program\_options;  
33 using boost::format;  
34  
35 int

> > > ```
> > > CID 1267222: Uncaught exception (UNCAUGHT_EXCEPT)
> > > In function "main" an exception of type 
> > > 
> > > ```

"boost::exception\_detail::clone\_impl\<boost::exception\_detail::error\_info\_injectorboost::io::too\_many\_args

> " is thrown and never caught.  
> 36 main(int argc, char \*\*argv)  
> 37 {  
> 38 po::options\_description desc((format(“Program options: %1%  
> [options]”) % argv[0]).str());  
> 39 po::variables\_map vm;  
> 40  
> 41 desc.add\_options()

* * *

\*\*\* CID 1267221: Uninitialized scalar variable (UNINIT)  
/var/lib/jenkins/jobs/GNURadio-master/workspace/gnuradio/gr-dtv/lib/atsc/atsc\_field\_sync\_mux\_impl.cc:  
199 in gr::dtv::atsc\_field\_sync\_mux\_impl::general\_work(int,  
std::vector\<int, std::allocator\> &, std::vector\<const void \*,  
std::allocator\<const void \*\>\>&, std::vector\<void \*, std::allocator\<void  
\*\>\>&)()  
193 }  
194 else {  
195 init\_field\_sync\_2(&field\_sync, d\_saved\_symbols);  
196 }  
197  
198 // note that index doesn’t advance in this branch

> > > ```
> > > CID 1267221: Uninitialized scalar variable (UNINIT)
> > > Using uninitialized value "field_sync". Field "field_sync._pad_" is 
> > > 
> > > ```

uninitialized.  
199 out[outdex] = field\_sync;  
200 d\_already\_output\_field\_sync = true;  
201 }  
202 else {  
203 // already output field sync, now output first  
regular segment  
204 out[outdex] = in[index];

* * *

To view the defects in Coverity Scan visit,  
[https://scan.coverity.com/projects/588?tab=overview](https://scan.coverity.com/projects/588?tab=overview)

To manage Coverity Scan email notifications for “removed\_email\_address@domain.invalid”,  
click  
[https://scan.coverity.com/subscriptions/edit?email=philip%40balister.org&token=e8f98366c9e8587eaa57ec261c04b7ad](https://scan.coverity.com/subscriptions/edit?email=philip%40balister.org&token=e8f98366c9e8587eaa57ec261c04b7ad)  
.

---

<div class="post-metadata">

**Author:** ![stedwick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/90ced4/32.png) [@stedwick](https://www.ruby-forum.com/u/stedwick)\
**Post date:** [January 26, 2015, 9:50am UTC](https://www.ruby-forum.com/t/fwd-new-defects-reported-by-coverity-scan-for-gnuradio/233959/2 "2015-01-26T09:50:14Z")

</div>

I can address the two issues in gr-dtv.

CID 1267227 seems spurious. Coverity doesn’t complain about the previous  
line,  
even though it’s doing exactly the same operation. Also, the code  
executes  
properly, so there’s no doubt that this-\>J is being set.

Of course, the this-\> business is a bit of a C++ trick, and can be  
easily coded  
in a more conventional way.

CID 1267221 is complaining about the _pad_ field not being initialized.  
The  
_pad_ field is just padding to a power of 2 and is not used. So again,  
not a  
bug, but can be easily changed to eliminate the complaint.

Ron

---

<div class="post-metadata">

**Author:** ![stedwick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/90ced4/32.png) [@stedwick](https://www.ruby-forum.com/u/stedwick)\
**Post date:** [January 26, 2015, 10:05am UTC](https://www.ruby-forum.com/t/fwd-new-defects-reported-by-coverity-scan-for-gnuradio/233959/3 "2015-01-26T10:05:29Z")

</div>

After looking at the code a little more, Coverity is correct about  
CID 1267227. Not sure why it doesn’t complain about the previous  
line. The original code had I and J passed in as parameters, and  
setting the private variables was necessary. In the ATSC version,  
I and J are fixed, so I removed the parameters but neglected  
to remove the superfluous setting of the private variables.

Ron

---

<div class="post-metadata">

**Author:** ![stedwick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/90ced4/32.png) [@stedwick](https://www.ruby-forum.com/u/stedwick)\
**Post date:** [January 26, 2015, 6:01pm UTC](https://www.ruby-forum.com/t/fwd-new-defects-reported-by-coverity-scan-for-gnuradio/233959/4 "2015-01-26T18:01:43Z")

</div>

Ron et everyone else,

Coverity lets you ‘own’ bugs so it’s clear who’s working on what. Also,  
we can flag issues als false positives.

Cheers,  
M
