Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[xsrc/trunk]: xsrc/external/mit/pixman/dist/pixman pull across a fix from ups...



details:   https://anonhg.NetBSD.org/xsrc/rev/0b8692cecb06
branches:  trunk
changeset: 7385:0b8692cecb06
user:      mrg <mrg%NetBSD.org@localhost>
date:      Mon Jan 09 02:49:51 2023 +0000

description:
pull across a fix from upstream to fix clang builds.

https://gitlab.freedesktop.org/pixman/pixman/-/merge_requests/16/diffs?commit_id=d60b0af5e32fed034bd163d244148947d3ed91a8

Avoid undefined behavior (left-shifting negative value) in pixman_int_to_fixed

Reported in https://bugzilla.mozilla.org/show_bug.cgi?id=1580352. Casting
the argument to uint32_t should avoid invoking undefined behavior here.
We'll still have *implementation-defined* behavior when casting the result
back to pixman_fixed_t, but that's better than *undefined*.

diffstat:

 external/mit/pixman/dist/pixman/pixman.h |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 51ad6d3f2012 -r 0b8692cecb06 external/mit/pixman/dist/pixman/pixman.h
--- a/external/mit/pixman/dist/pixman/pixman.h  Sun Jan 08 22:03:02 2023 +0000
+++ b/external/mit/pixman/dist/pixman/pixman.h  Mon Jan 09 02:49:51 2023 +0000
@@ -127,7 +127,7 @@
 #define pixman_fixed_1_minus_e         (pixman_fixed_1 - pixman_fixed_e)
 #define pixman_fixed_minus_1           (pixman_int_to_fixed(-1))
 #define pixman_fixed_to_int(f)         ((int) ((f) >> 16))
-#define pixman_int_to_fixed(i)         ((pixman_fixed_t) ((i) << 16))
+#define pixman_int_to_fixed(i)         ((pixman_fixed_t) ((uint32_t) (i) << 16))
 #define pixman_fixed_to_double(f)      (double) ((f) / (double) pixman_fixed_1)
 #define pixman_double_to_fixed(d)      ((pixman_fixed_t) ((d) * 65536.0))
 #define pixman_fixed_frac(f)           ((f) & pixman_fixed_1_minus_e)



Home | Main Index | Thread Index | Old Index