WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
74965
[Coverity] Fix uninitialized constructor defects in .../html
https://bugs.webkit.org/show_bug.cgi?id=74965
Summary
[Coverity] Fix uninitialized constructor defects in .../html
Greg Billock
Reported
2011-12-20 15:21:52 PST
[Coverity] Fix uninitialized constructor defects in .../html
Attachments
Patch
(9.25 KB, patch)
2011-12-20 15:22 PST
,
Greg Billock
no flags
Details
Formatted Diff
Diff
Patch
(10.04 KB, patch)
2011-12-20 16:25 PST
,
Greg Billock
no flags
Details
Formatted Diff
Diff
Patch
(10.04 KB, patch)
2011-12-21 10:24 PST
,
Greg Billock
no flags
Details
Formatted Diff
Diff
Patch
(10.10 KB, patch)
2012-01-03 13:14 PST
,
Greg Billock
no flags
Details
Formatted Diff
Diff
Patch
(9.37 KB, patch)
2012-01-04 15:00 PST
,
Greg Billock
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Greg Billock
Comment 1
2011-12-20 15:22:58 PST
Created
attachment 120097
[details]
Patch
Adam Barth
Comment 2
2011-12-20 15:59:20 PST
Comment on
attachment 120097
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=120097&action=review
> Source/WebCore/html/HTMLFormCollection.cpp:48 > : HTMLCollection(form.get(), OtherCollection, formCollectionInfo(form.get())) > + , currentPos(0)
Can you reformat this initializer list to the usual WebKit style (which is to start each line after the first with a ",") ?
> Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp:222 > + , m_lineDashOffset(other.m_lineDashOffset)
Is this change testable?
Greg Billock
Comment 3
2011-12-20 16:22:47 PST
Comment on
attachment 120097
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=120097&action=review
>> Source/WebCore/html/HTMLFormCollection.cpp:48 >> + , currentPos(0) > > Can you reformat this initializer list to the usual WebKit style (which is to start each line after the first with a ",") ?
Do you mean put the superclass constructor call on the previous line?
>> Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp:222 >> + , m_lineDashOffset(other.m_lineDashOffset) > > Is this change testable?
I think so. This code gets exercised in save(), which is called by clearRect(). I added a clearRect call to the layout test to ensure that the value is preserved.
Greg Billock
Comment 4
2011-12-20 16:25:27 PST
Created
attachment 120110
[details]
Patch
Alexey Proskuryakov
Comment 5
2011-12-20 16:48:10 PST
Comment on
attachment 120110
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=120110&action=review
It's great that Coverity found a real bug. We shouldn't take any complaint it makes as a requirement though. The changes in WebGLGetInfo look clearly against the intended design of this class.
> Source/WebCore/html/StepRange.cpp:42 > - if (element->hasAttribute(precisionAttr)) { > - step = 1.0; > + step = 1.0; > + if (element->hasAttribute(precisionAttr)) > hasStep = !equalIgnoringCase(element->getAttribute(precisionAttr), "float"); > - } else > + else > hasStep = element->getAllowedValueStep(&step);
Is this change testable? Although you're just moving this code, please note that WebKit coding style asks to not use .0 suffix on floating point literals. The same issue is present in some code you added below.
> Source/WebCore/html/canvas/CanvasStyle.h:91 > + CMYKAValues() : c(0.0), m(0.0), y(0.0), k(0.0), a(0.0) { }
No .0, again.
> Source/WebCore/html/track/WebVTTParser.cpp:113 > + , m_currentStartTime(0.0) > + , m_currentEndTime(0.0)
No .0.
Adam Barth
Comment 6
2011-12-20 16:54:23 PST
Comment on
attachment 120097
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=120097&action=review
>>> Source/WebCore/html/HTMLFormCollection.cpp:48 >>> + , currentPos(0) >> >> Can you reformat this initializer list to the usual WebKit style (which is to start each line after the first with a ",") ? > > Do you mean put the superclass constructor call on the previous line?
Oh, I misread the code that was already there. Please ignore my comment.
Greg Billock
Comment 7
2011-12-21 10:23:23 PST
Comment on
attachment 120110
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=120110&action=review
>> Source/WebCore/html/StepRange.cpp:42 >> hasStep = element->getAllowedValueStep(&step); > > Is this change testable? > > Although you're just moving this code, please note that WebKit coding style asks to not use .0 suffix on floating point literals. The same issue is present in some code you added below.
Done. I don't think this change is visible in tests. Coverity is worried that element->getAllowedValueStep may not initialize |step|, leaving the class in an undefined state. There's a check in clampValue accounting for that, so initializing is more of a cleanliness issue and insurance against regression.
>> Source/WebCore/html/canvas/CanvasStyle.h:91 >> + CMYKAValues() : c(0.0), m(0.0), y(0.0), k(0.0), a(0.0) { } > > No .0, again.
Done. (And elsewhere)
>> Source/WebCore/html/track/WebVTTParser.cpp:113 >> + , m_currentEndTime(0.0) > > No .0.
Done.
Greg Billock
Comment 8
2011-12-21 10:24:47 PST
Created
attachment 120190
[details]
Patch
Darin Adler
Comment 9
2011-12-21 11:10:36 PST
Comment on
attachment 120190
[details]
Patch Many of these changes look like they make the tool happy by initializing data that will never be read. Is there a distinction between changes that are actually needed and ones that just quiet the tool?
Alexey Proskuryakov
Comment 10
2011-12-21 14:04:21 PST
Comment on
attachment 120190
[details]
Patch Thank you! The change in StepRange constructor seems somewhat arbitrary and fragile, but the benefit of making future runs of Coverity cleaner outweighs the cost of code churn in my opinion. I'm still concerned by the changes to WebGLGetInfo. I think that these need to be discussed with an expert on this code (likely an author).
Alexey Proskuryakov
Comment 11
2011-12-21 14:06:34 PST
I think that all changes here are just to shut up the tool, except for the one that has a test. With the possible exception of WebGLGetInfo changes, these look harmless to me.
Greg Billock
Comment 12
2011-12-21 14:26:55 PST
Yes, the CanvasRenderingContext2D case is a real bug. I think the HTMLTreeBuilder and CSSPreloadScanner cases are oversights that's fair to call a hit as well. The rest are as you describe: nice to have the tool low-noise so real bugs like this stand out, and probably clearer on balance as well. I'm happy to get the WebGLInfo author to weigh in on those changes, since they are on the edge.
Alexey Proskuryakov
Comment 13
2011-12-21 14:56:59 PST
CC'ing folks who show up in svn blame for WebGLGetInfo.cpp
Kenneth Russell
Comment 14
2011-12-21 15:48:55 PST
Comment on
attachment 120190
[details]
Patch The changes to WebGLGetInfo look good.
Greg Billock
Comment 15
2011-12-22 12:39:02 PST
Good to go?
Greg Billock
Comment 16
2012-01-03 13:14:59 PST
Created
attachment 120985
[details]
Patch
WebKit Review Bot
Comment 17
2012-01-03 13:18:30 PST
Attachment 120985
[details]
did not pass style-queue: Failed to run "['Tools/Scripts/update-webkit']" exit_code: 9 Updating OpenSource Index mismatch: 3a7674dadd24ecd6a1b023eba203ecf2ed62fc59 != edb861612940a3244431d239dacdbc36317b627c rereading e1e2538cff7d320c2b7cc22c0b75c9369ce9cdb2 A LayoutTests/svg/custom/webkit-transform-crash.html A LayoutTests/svg/custom/webkit-transform-crash-expected.txt M LayoutTests/ChangeLog M Source/WebCore/ChangeLog M Source/WebCore/svg/SVGStyledTransformableElement.cpp 103950 = 8282a1d85ad097ce4064a5896912bdb211b115e6 already exists! Why are we refetching it? at /usr/lib/git-core/git-svn line 5210 Died at Tools/Scripts/update-webkit line 158. If any of these errors are false positives, please file a bug against check-webkit-style.
Adam Barth
Comment 18
2012-01-03 13:24:18 PST
> 103950 = 8282a1d85ad097ce4064a5896912bdb211b115e6 already exists! Why are we refetching it? > at /usr/lib/git-core/git-svn line 5210
Sorry. Will fix.
Gyuyoung Kim
Comment 19
2012-01-03 14:27:25 PST
Comment on
attachment 120985
[details]
Patch
Attachment 120985
[details]
did not pass efl-ews (efl): Output:
http://queues.webkit.org/results/11082160
WebKit Review Bot
Comment 20
2012-01-03 14:29:13 PST
Comment on
attachment 120985
[details]
Patch
Attachment 120985
[details]
did not pass chromium-ews (chromium-xvfb): Output:
http://queues.webkit.org/results/11083171
Collabora GTK+ EWS bot
Comment 21
2012-01-03 17:00:24 PST
Comment on
attachment 120985
[details]
Patch
Attachment 120985
[details]
did not pass gtk-ews (gtk): Output:
http://queues.webkit.org/results/11070201
Early Warning System Bot
Comment 22
2012-01-04 03:09:18 PST
Comment on
attachment 120985
[details]
Patch
Attachment 120985
[details]
did not pass qt-ews (qt): Output:
http://queues.webkit.org/results/10954873
Greg Billock
Comment 23
2012-01-04 12:44:00 PST
Were the bots misfiring on this patch? Or shall I resync and try again?
Adam Barth
Comment 24
2012-01-04 14:30:12 PST
Comment on
attachment 120985
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=120985&action=review
> Source/WebCore/html/parser/HTMLTreeBuilder.cpp:357 > + , m_isFakeInsertionMode(false)
This variable does not exist anymore, which is what's causing the build break.
Greg Billock
Comment 25
2012-01-04 14:59:48 PST
Comment on
attachment 120985
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=120985&action=review
>> Source/WebCore/html/parser/HTMLTreeBuilder.cpp:357 >> + , m_isFakeInsertionMode(false) > > This variable does not exist anymore, which is what's causing the build break.
drat, thanks. I saw the sync errors and thought it was a technicality.
Greg Billock
Comment 26
2012-01-04 15:00:45 PST
Created
attachment 121164
[details]
Patch
Greg Billock
Comment 27
2012-01-05 15:15:48 PST
Now fixed.
Greg Billock
Comment 28
2012-01-19 15:21:27 PST
Can you send this into the commit queue? Or do I need to merge to head at this point? Thanks!
Alexey Proskuryakov
Comment 29
2012-01-19 15:29:51 PST
Comment on
attachment 121164
[details]
Patch We'll see if it still applies.
WebKit Review Bot
Comment 30
2012-01-19 15:47:46 PST
Comment on
attachment 121164
[details]
Patch Clearing flags on attachment: 121164 Committed
r105457
: <
http://trac.webkit.org/changeset/105457
>
WebKit Review Bot
Comment 31
2012-01-19 15:47:53 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug