Closed Bug 679618 Opened 13 years ago Closed 13 years ago

uninitialized memory in gfx/2d/SourceSurfaceCG.cpp

Categories

(Core :: Graphics, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla9

People

(Reporter: david.volgyes, Assigned: atulagrwl)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20100101 Firefox/6.0
Build ID: 20110812233755

Steps to reproduce:

cppcheck found this uninitialized memory problem in the code.


Actual results:

in gfx/2d/SourceSurfaceCG.cpp in InitFromData(...) at line #113:

  void *data = malloc(aStride * aSize.height);
  memcpy(aData, data, aStride * aSize.height);

Well, the problem is that:
if you would like copy from data to aData, then data is uninitialized.
(Use calloc, or a memset befopre the copy, etc.)
If you would like copy from aData to data, then the order is wrong.


Expected results:

Fix this uninitialized data problem.
Blocks: cppcheck
Component: General → Graphics
Product: Firefox → Core
QA Contact: general → thebes
This is supposed to read memcpy(data, aData, aStride * aSize.height). Is this code actually used? I am amazed this hasn't been noticed before.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Whiteboard: [good first bug] [mentor=jdm]
This is my patch to mozilla. Please let me know if I am missing something.
Attachment #556387 - Flags: review?
Attachment #556387 - Flags: review? → review?(josh)
Attachment #556387 - Flags: review?(josh) → review?(jmuizelaar)
This code is not actually used at this point. As a matter of fact, it isn't even compiled, and it wouldn't compile if you tried to compile it :).
Attachment #556387 - Flags: review?(jmuizelaar) → review+
Assignee: nobody → atulagrwl
Status: NEW → ASSIGNED
Flags: in-testsuite-
Keywords: checkin-needed
OS: Linux → All
Hardware: x86_64 → All
In my queue :-)
Keywords: checkin-needed
http://hg.mozilla.org/mozilla-central/rev/5565603c0b7d

Thanks Atul :-)
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Clearing good first bug status to get this off the good first bug buglist!
Whiteboard: [good first bug] [mentor=jdm]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: