Bug 16414

Summary: Valgrind: Conditional jump or move depends on uninitialised value(s)
Product: WebKit Reporter: David Carson <dacarson>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Severity: Normal CC: mitz
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.4   

Description David Carson 2007-12-12 12:55:57 PST
Valgrind reports:

==3471== Conditional jump or move depends on uninitialised value(s)
==3471==    at 0x1074003D: WebCore::RenderBlock::calcInlinePrefWidths()
==3471==    by 0x107404C7: WebCore::RenderBlock::calcPrefWidths()
==3471==    by 0x10752D58: WebCore::RenderBox::minPrefWidth() const
==3471==    by 0x107577ED:
WebCore::RenderBox::calcWidthUsing(WebCore::WidthType, int)

The Codes:

               // Determine if we have a breakable character.  Pass in
               // whether or not we should ignore any spaces at the front
               // of the string.  If those are going to be stripped out,
               // then they shouldn't be considered in the breakable char
               // check.
               bool hasBreakableChar, hasBreak;
               int beginMin, endMin;
               bool beginWS, endWS;
               int beginMax, endMax;
               t->trimmedPrefWidths(inlineMax, beginMin, beginWS, endMin, endWS,
                                    hasBreakableChar, hasBreak, beginMax, endMax,
                                    childMin, childMax, stripFrontSpaces);

               // This text object will not be rendered, but it may still provide a breaking opportunity.
               if (!hasBreak && childMax == 0) {
3755:                if (autoWrap && (beginWS || endWS)) {
                       m_minPrefWidth = max(inlineMin, m_minPrefWidth);
                       inlineMin = 0;

and trimmedPrefWidths.cpp, which is passed references to these bools:

   int len = textLength();
   if (!len || (stripFrontSpaces && m_text->containsOnlyWhitespace())) {
       maxW = 0;
       hasBreak = false;

   minW = m_minWidth;
   maxW = m_maxWidth;
   beginWS = !stripFrontSpaces && m_hasBeginWS;
   endWS = m_hasEndWS;

My guess is that trimmedPrefWidths is returning without setting the
beginWS and endWS bools.  These are then used on line 3755.  They should
probably be set to something before the call to trimmedPrefWidths.
Setting both to false seems to solve the problem.
Comment 1 mitz 2007-12-12 23:50:59 PST

*** This bug has been marked as a duplicate of 13864 ***