Closed
Bug 678982
Opened 13 years ago
Closed 13 years ago
potential null pointer dereference in gfx/layers/d3d10/ImageLayerD3D10.cpp
Categories
(Core :: Graphics, defect)
Tracking
()
RESOLVED
FIXED
mozilla12
People
(Reporter: david.volgyes, Assigned: aceman)
References
Details
Attachments
(1 file, 2 obsolete files)
(deleted),
patch
|
aceman
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0
Build ID: 20110622232440
Steps to reproduce:
cppcheck 1.49 (http://cppcheck.sourceforge.net/) found a plenty of potential null pointer dereference. This is one of them.
Actual results:
in the line #53 there is a check for 'aSurface' is null or not,
but at line #65 there is an unchecked aSurface->
which is a potential null pointer dereference.
Expected results:
Well, it depends. I do not know the code well enough, but you definitely should check the pointer before dereference. A possible fix is attached, but this fix seems ugly for me. (But I have no better idea.)
Updated•13 years ago
|
Component: General → Graphics
Product: Firefox → Core
QA Contact: general → thebes
Comment 1•13 years ago
|
||
Realistically, aSurface should never be NULL there, and if it is, we've got bigger problems! The right solution is probably to remove the NULL check at the top, and add a 'if (!aSurface) { return NULL; }' to the top of that function. I doubt that wouldn't break further down the flow though.
Updated•13 years ago
|
Assignee: nobody → david.volgyes
Comment 2•13 years ago
|
||
Unassigning from David per his request (bug 679610 comment 4).
For anyone looking at this bug, feel free to take it, David has very kindly provided a patch, but will not have time to follow it through.
Assignee: david.volgyes → nobody
Whiteboard: [has patch, needs new assignee]
Assignee: nobody → acelists
Attachment #553172 -
Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #589659 -
Flags: review?(bas.schouten)
OS: Linux → Windows 7
Hardware: x86_64 → x86
Whiteboard: [has patch, needs new assignee]
Comment 4•13 years ago
|
||
Comment on attachment 589659 [details] [diff] [review]
fix per comment 1
Review of attachment 589659 [details] [diff] [review]:
-----------------------------------------------------------------
::: gfx/layers/d3d10/ImageLayerD3D10.cpp
@@ +49,5 @@
> SurfaceToTexture(ID3D10Device *aDevice,
> gfxASurface *aSurface,
> const gfxIntSize &aSize)
> {
> + if (!aSurface) { return NULL; }
nit: as per coding style
if (!aSurface) {
return NULL;
}
Attachment #589659 -
Flags: review?(bas.schouten) → review+
Carrying over review=bas.schouten .
Attachment #589659 -
Attachment is obsolete: true
Attachment #589667 -
Flags: review+
Keywords: checkin-needed
Comment 6•13 years ago
|
||
Keywords: checkin-needed
Target Milestone: --- → mozilla12
Comment 7•13 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•