On 15.11.2013 18:17, Marko Mäkelä wrote:
Hi Klaus,

On Fri, Nov 15, 2013 at 04:47:10PM +0100, Klaus Schmidinger wrote:
#2  0x0810e3d2 in cPixmapMemory::DrawRectangle (this=0x6d3fe78, Rect=..., 
Color=2566914048) at osd.c:1333
1333      cRect r = Rect.Intersected(DrawPort().Size());

As far as I can tell, the entirely uninitialized cRect is being passed as the 
Rect parameter to cPixmapMemory::DrawRectangle(). Unfortunately, gdb cannot 
show me the stack above that. It would seem to me that 
cSkinLCARSDisplayMenu::Clear() is passing uninitialized bounds to 
cOsd::DrawRectangle(),
which will lead to funny values like this:

(gdb) p *this
$31 = {point = {x = 1418239204, y = 0}, size = {width = -1379480940, height = 201}, 
static Null = {point = {x = 0, y = 0}, size = {width = 0, height = 0}, static Null = 
<same as static member of an already seen type>}}

The constructor of cRect makes sure that all members are initialized to zero.
I'm afraid I can't think of a way there could be an uninitialized cRect.

Sorry, I used a bit sloppy language. cRect appears to be initialized, but with 
uninitialized values. You know, Valgrind does not complain when you copy 
uninitialized data around. It only complains when you are comparing 
uninitialized data or passing uninitialized data to a system call. The Valgrind
V-bits are tracking which bits are uninitialized.

The cRect constructor is not at fault. I tried this twice, but both times gdb 
would only show me the 3 topmost stack frames, claiming that the rest of the 
stack is corrupted. Valgrind did show more (quoting from my previous message):

==3601==    by 0x810AA0B: cOsd::DrawRectangle(int, int, int, int,
unsigned int) (osd.c:1922)
==3601==    by 0x8130482: cSkinLCARSDisplayMenu::Clear() (skinlcars.c:1463)

I could obviously not verify this (due to gdb claiming that the stack is 
corrupted), but I suspect that the parameters that are being passed are 
uninitialized:

void cSkinLCARSDisplayMenu::Clear(void)
{
   textScroller.Reset();
   osd->DrawRectangle(xi00, yi00, xi03 - 1, yi01 - 1, 
Theme.Color(clrBackground));
}

AFAICT, it is invoking this code in cOsd::DrawRectangle():
      pixmaps[0]->DrawRectangle(cRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1), Color);
This in turn should be invoking this constructor:
  cRect(int X, int Y, int Width, int Height): point(X, Y), size(Width, Height) 
{}

cSkinLCARSDisplayMenu::cSkinLCARSDisplayMenu() is not initializing any of the 
members xi00, yi00, xi03, yi01.

Is there a reproducible set of actions that causes this to happen?

Yes. Hit Play (to start playing the last played recording), Pause, Menu, 
Recordings while using the LCARS skin. The first 2 or 3 keypresses ought to be 
optional. I had to stop the video playback with the 2 first keypresses, because 
the softdevice framerate is measured in seconds per frame when
running under Valgrind :)

I have verified that cSkinLCARSDisplayMenu::Clear() actually gets called 
*before*
cSkinLCARSDisplayMenu::SetMenuCategory(), where the variables in question are 
initialized.
And in that call to Clear() the values are actually totally bogus.

Thanks for debugging this!
Please try whether this fixes it:

--- skinlcars.c
+++ skinlcars.c
@@ -900,6 +900,15 @@
   ys03 = ys04 - Gap;
   ys05 = yb15;

+  // The item area (just to have them initialized, actual setting will be done 
in SetMenuCategory():
+
+  xi00 = 0;
+  xi01 = 0;
+  xi02 = 0;
+  xi03 = 1;
+  yi00 = 0;
+  yi01 = 1;
+
   // The color buttons in submenus:
   xb00 = xa06;
   xb15 = xa07;


Klaus

_______________________________________________
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

Reply via email to