Bug in libmirsdrapi-rsp.so.1.97

Add useful snippets of code or links to entire SDR projects.
Post Reply
User avatar
Posts: 10
Joined: Mon Oct 17, 2016 8:11 am

Bug in libmirsdrapi-rsp.so.1.97

Post by neok » Sun Nov 20, 2016 8:23 am


I have been testing "sdrx", an SDR app I am writing for the RSP1 (and RTLSDR) dongles, on the
"valgrind" memory checker tool. I fixed bugs reported in my code but there is still one being
reported, apparently in libmirsdrapi-rsp.so.1.97:

Code: Select all

==17452== Conditional jump or move depends on uninitialised value(s)
==17452==    at 0x40FA51: SDRPlay_GC (sdrplay.c:118)
==17452==    by 0x651BAB2: Agc (mir_sdr.c:5032)
==17452==    by 0x651BAD8: mir_sdr_Agc (mir_sdr.c:4280)
==17452==    by 0x651D65B: StreamReadThread (mir_sdr.c:3100)
==17452==    by 0x84B0403: start_thread (pthread_create.c:333)
==17452==    by 0x8DBF50E: clone (clone.S:105)
==17452==  Uninitialised value was created by a stack allocation
==17452==    at 0x6512400: ??? (in /usr/local/lib/libmirsdrapi-rsp.so.1.97)
I verified this by printing lnaGRdB as returned by the mir_sdr_GainChangeCallback function and
the first value returned appears to be "garbage", a very large value that even prints as negative
value. It seems to happen only once after mir_sdr_StreamInit is called.

This is the mir_sdr_GainChangeCallback function in my code:

Code: Select all

SDRPlay_GC( unsigned int gRdB, unsigned int lnaGRdB, void *cbContext )
  gchar gain[5];
  gdouble smeter;

  gRdB += lnaGRdB;
  if( gRdB > SDRPLAY_MAX_GRDB ) gRdB = 0;
  snprintf( gain, sizeof(gain), "%4.1f\n",
	  SDRPLAY_MAX_GRDB - (double)gRdB );
  gtk_label_set_text( GTK_LABEL(gain_label), gain );
  smeter = (double)gRdB / SDRPLAY_MAX_GRDB;
	  GTK_PROGRESS_BAR(smeter_progbar), smeter );
I thought I should report this.

Reason: No reason

Post Reply