Closed Bug 554142 Opened 14 years ago Closed 12 years ago

cairo-xlib-surface.c calls a macro with a side-effect in its argument

Categories

(Core :: Graphics, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 562746

People

(Reporter: mrbkap, Unassigned)

Details

Attachments

(1 file)

Attached patch Fix?Splinter Review
The code in question is:

do {
    *n++ = bswap_32 (*d++);
} while (--c);

bswap_32 is conditionally defined to use byteswap.h based on HAVE_BYTESWAP_H. If that macro is defined, then it appears that the macros defined in byetswap.h are side-effect safe (that is, they sample the parameter once and operate on the sample). If !HAVE_BYTESWAP_H, however, the macro evaluates its parameter multiple times, leading to mangled data and potential crashes.

I'll attach a patch, though I'm not sure what the procedure is for fixing cairo bugs, so I might not be the best person to drive this.
Attachment #434019 - Flags: review?(joe)
Comment on attachment 434019 [details] [diff] [review]
Fix?

We should just fix the version of bswap_32 in cairo_wideint_type_private.h.
Attachment #434019 - Flags: review?(joe) → review-
This was fixed upstream and imported in bug 562746

commit ce3ad6f41edf86ed6914f4d7f364111eba42ca65
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Mar 31 08:21:17 2010 +0100

    xlib: Avoid multiple evaluations inside bswap_*() macro.
    
    Fixes:
      Fonts are not readable if remote display to a machine with different
      endian.
      https://bugzilla.mozilla.org/show_bug.cgi?id=526977
    
    Reported-and-tested-by: Ginn Chen <Ginn.Chen@Sun.COM>
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.