Possible bad memset in pixman_image_set_transform()

RESOLVED FIXED in mozilla12

Status

()

Core
Graphics
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: Dolske, Assigned: prip)

Tracking

(Blocks: 1 bug)

Trunk
mozilla12
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [pvs-studio][good first bug][lang=c++][mentor=jwein])

Attachments

(2 attachments, 1 obsolete attachment)

(Reporter)

Description

5 years ago
From http://www.viva64.com/en/a/0078/,
13th section in http://www.viva64.com/external-pictures/txt/mozilla-test.txt

V575 The 'memcmp' function processes '0' elements. Inspect the third argument.
pixman-image.c 520

pixman_bool_t
pixman_image_set_transform (...)
{
  memcmp (common->transform, transform, sizeof (pixman_transform_t) == 0))
}

I think there could be written like this.
memcmp (common->transform, transform, sizeof (pixman_transform_t)) == 0)
(Reporter)

Updated

5 years ago
Blocks: 710966
Whiteboard: [pvs-studio] → [pvs-studio][good first bug][lang=c++]
(Assignee)

Comment 1

5 years ago
Created attachment 582133 [details] [diff] [review]
Bug 710992 - Fix third argument in memcmp call in pixman-image.c
prip: When you are happy with the state of the patch, please request review from roc by setting the "review?" flag to "roc@ocallahan.org". Thanks for your contribution!
Assignee: nobody → thomas
Status: NEW → ASSIGNED
Whiteboard: [pvs-studio][good first bug][lang=c++] → [pvs-studio][good first bug][lang=c++][mentor=jwein]
(Assignee)

Updated

5 years ago
Attachment #582133 - Flags: review?(roc)
Comment on attachment 582133 [details] [diff] [review]
Bug 710992 - Fix third argument in memcmp call in pixman-image.c

Review of attachment 582133 [details] [diff] [review]:
-----------------------------------------------------------------

This is good. For landing, however, the patch needs to be prepped as a patch in gfx/cairo. See the README there for examples.

Also, this patch really needs to go upstream. Probably should post it to the cairo mailing list.
Attachment #582133 - Flags: review?(roc) → review+
(Assignee)

Comment 4

5 years ago
Created attachment 582616 [details] [diff] [review]
Bug 710992 - Fix third argument in memcmp call in pixman-image.c

Prepped as gfx/cairo-patch
Attachment #582133 - Attachment is obsolete: true
Attachment #582616 - Flags: review?(roc)
Comment on attachment 582616 [details] [diff] [review]
Bug 710992 - Fix third argument in memcmp call in pixman-image.c

+bad-memset.patch: Fix third argument in memcmp call in pixman-image.c

This belongs under "pixman patches"
(Assignee)

Comment 6

5 years ago
Created attachment 582686 [details] [diff] [review]
Bug 710992 - Fix third argument in memcmp call in pixman-image.c

Sorry - did not know that. Fixed now!
Attachment #582616 - Attachment is obsolete: true
Attachment #582616 - Flags: review?(roc)
Attachment #582686 - Flags: review?(roc)
Attachment #582686 - Flags: review?(roc) → review+
Attachment #582686 - Flags: checkin?

Comment 7

5 years ago
In addition to the patch, doesn't the change also need to be made to the actual file?
Comment on attachment 582133 [details] [diff] [review]
Bug 710992 - Fix third argument in memcmp call in pixman-image.c

You're right, Ed. We can just land both of these patches.
Attachment #582133 - Attachment is obsolete: false
Attachment #582133 - Flags: checkin?
I'll land it.
Thanks for the patch.

https://hg.mozilla.org/mozilla-central/rev/7d23dd6c50eb
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla12
Version: unspecified → Trunk

Comment 11

5 years ago
When you discover bugs in pixman, please report them upstream as well. 

Bug reports and patches can be sent to

       pixman@lists.freedesktop.org

or filed here:

       https://bugs.freedesktop.org/enter_bug.cgi?product=pixman

Updated

5 years ago
Attachment #582133 - Flags: checkin?

Updated

5 years ago
Attachment #582686 - Flags: checkin?
You need to log in before you can comment on or make changes to this bug.