# 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/239536>\
**Category:** GNU Radio\
**Created:** [March 3, 2014, 10:59pm UTC](https://www.ruby-forum.com/t/fwd-new-defects-reported-by-coverity-scan-for-gnuradio/239536 "2014-03-03T22:59:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [March 3, 2014, 10:59pm UTC](https://www.ruby-forum.com/t/fwd-new-defects-reported-by-coverity-scan-for-gnuradio/239536/1 "2014-03-03T22:59:36Z")

</div>

The latest Coverity scan showed these new items. We should probably  
double check them. The Null dereference is likely related to the order  
in which some class methods get called.

The compare against zero of an unsigned number should be checked to make  
sure that is what was really meant.

Philip

\*\* CID 1189412: Explicit null dereferenced (FORWARD\_NULL)  
/var/lib/jenkins/jobs/GNURadio-master/workspace/gnuradio/gr-filter/lib/fft\_filter.cc:  
355 in gr::filter::kernel::fft\_filter\_ccf::fft\_filter\_ccf(int, const  
std::vector\<float, std::allocator\> &, int)()

\*\* CID 1189413: Unsigned compared against 0 (NO\_EFFECT)  
/var/lib/jenkins/jobs/GNURadio-master/workspace/gnuradio/gr-filter/lib/pfb\_synthesizer\_ccf\_impl.cc:  
225 in gr::filter::pfb\_synthesizer\_ccf\_impl::set\_channel\_map(const  
std::vector\<int, std::allocator\> &)()

* * *

\*\*\* CID 1189412: Explicit null dereferenced (FORWARD\_NULL)  
/var/lib/jenkins/jobs/GNURadio-master/workspace/gnuradio/gr-filter/lib/fft\_filter.cc:  
355 in gr::filter::kernel::fft\_filter\_ccf::fft\_filter\_ccf(int, const  
std::vector\<float, std::allocator\> &, int)()  
349  
/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/  
350  
351  
352 fft\_filter\_ccf::fft\_filter\_ccf(int decimation,  
353 const std::vector &taps,  
354 int nthreads)

> > > ```
> > > CID 1189412: Explicit null dereferenced (FORWARD_NULL)
> > > Assigning: "this->d_fwdfft" = "NULL".
> > > 
> > > ```

355 : d\_fftsize(-1), d\_decimation(decimation), d\_fwdfft(0),  
356 d\_invfft(0), d\_nthreads(nthreads), d\_xformed\_taps(NULL)  
357 {  
358 set\_taps(taps);  
359 }  
360

* * *

\*\*\* CID 1189413: Unsigned compared against 0 (NO\_EFFECT)  
/var/lib/jenkins/jobs/GNURadio-master/workspace/gnuradio/gr-filter/lib/pfb\_synthesizer\_ccf\_impl.cc:  
225 in gr::filter::pfb\_synthesizer\_ccf\_impl::set\_channel\_map(const  
std::vector\<int, std::allocator\> &)()  
219 {  
220 gr:🧵:scoped\_lock guard(d\_mutex);  
221  
222 if(map.size() \> 0) {  
223 unsigned int max = (unsigned  
int)\*std::max\_element(map.begin(), map.end());  
224 unsigned int min = (unsigned  
int)\*std::min\_element(map.begin(), map.end());

> > > ```
> > > CID 1189413: Unsigned compared against 0 (NO_EFFECT)
> > > This less-than-zero comparison of an unsigned value is never true. "min < 
> > > 
> > > ```

0U".  
225 if((max \>= d\_twox\*d\_numchans) || (min \< 0)) {  
226 throw  
std::invalid\_argument(“pfb\_synthesizer\_ccf\_impl::set\_channel\_map: map  
range out of bounds.\n”);  
227 }  
228 d\_channel\_map = map;  
229  
230 // Zero out fft buffer so that unused channels are  
always 0

---

<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:** [March 3, 2014, 11:01pm UTC](https://www.ruby-forum.com/t/fwd-new-defects-reported-by-coverity-scan-for-gnuradio/239536/2 "2014-03-03T23:01:58Z")

</div>

On Mon, Mar 3, 2014 at 4:58 PM, Philip B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> The latest Coverity scan showed these new items. We should probably  
> double check them. The Null dereference is likely related to the order  
> in which some class methods get called.
> 
> The compare against zero of an unsigned number should be checked to make  
> sure that is what was really meant.
> 
> Philip

Too late. I already pushed fixes for these and updated Coverity.

I noticed the defect emails and it’s related to code I just pushed  
this weekend, so it was easy enough for me to get them while they were  
fresh in my mind.

Thanks for keeping on top of this, though.

Tom

---

<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:** [March 4, 2014, 1:20pm UTC](https://www.ruby-forum.com/t/fwd-new-defects-reported-by-coverity-scan-for-gnuradio/239536/3 "2014-03-04T13:20:44Z")

</div>

On 03/03/2014 05:00 PM, Tom R. wrote:

> Too late. I already pushed fixes for these and updated Coverity.
> 
> I noticed the defect emails and it’s related to code I just pushed  
> this weekend, so it was easy enough for me to get them while they were  
> fresh in my mind.
> 
> Thanks for keeping on top of this, though.

Thanks. I figured some visibility would encourage more people to pay  
attention to Coverity.

You can sign up for Soverity at [https://scan.coverity.com/](https://scan.coverity.com/) and then  
request access to the GNU Radio reports. It’s a great way to learn about  
some interesting coding errors.

While things like comparing unsigned ints with 0 may seem trivial, they  
can be pointers to actual bugs.

Philip
