[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r9843: Fix bug #24363.
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r9843: Fix bug #24363. |
Date: |
Thu, 25 Sep 2008 16:51:42 +0200 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 9843
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Thu 2008-09-25 16:51:42 +0200
message:
Fix bug #24363.
modified:
libcore/character.cpp
testsuite/actionscript.all/Transform.as
------------------------------------------------------------
revno: 9842.1.1
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Thu 2008-09-25 16:23:50 +0200
message:
Fix undefined behaviour overflow bugginess.
modified:
libcore/character.cpp
------------------------------------------------------------
revno: 9842.1.2
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Thu 2008-09-25 16:26:24 +0200
message:
Test passes also on 64-bit machines now.
modified:
testsuite/actionscript.all/Transform.as
=== modified file 'libcore/character.cpp'
--- a/libcore/character.cpp 2008-09-18 06:49:30 +0000
+++ b/libcore/character.cpp 2008-09-25 14:23:50 +0000
@@ -404,22 +404,37 @@
else // setter
{
const as_value& inval = fn.arg(0);
- const double input = inval.to_number();
- if ( inval.is_undefined() || inval.is_null() || !
utility::isFinite(input) )
+
+ // The new internal alpha value is input / 100.0 * 256.
+ // We test for finiteness later, but the multiplication
+ // won't make any difference.
+ const double newAlpha = inval.to_number() * 2.56;
+
+ if ( inval.is_undefined() || inval.is_null() ||
+ !utility::isFinite(newAlpha) )
{
IF_VERBOSE_ASCODING_ERRORS(
- log_aserror(_("Ignored attempt to set %s.%s=%s"),
- ptr->getTarget(),
- _("_alpha"), // trying to reuse translations
- fn.arg(0));
+ log_aserror(_("Ignored attempt to set %s._alpha=%s"),
+ ptr->getTarget(), fn.arg(0));
);
return rv;
}
- // set alpha = input / 100.0 * 256 = input * 2.56;
- cxform cx = ptr->get_cxform();
- cx.aa = (boost::int16_t)(input * 2.56);
+
+ cxform cx = ptr->get_cxform();
+
+ // Overflows are *not* truncated, but set to -32768.
+ if (newAlpha > std::numeric_limits<boost::int16_t>::max() ||
+ newAlpha < std::numeric_limits<boost::int16_t>::min())
+ {
+ cx.aa = std::numeric_limits<boost::int16_t>::min();
+ }
+ else
+ {
+ cx.aa = static_cast<boost::int16_t>(newAlpha);
+ }
+
ptr->set_cxform(cx);
- ptr->transformedByScript(); // m_accept_anim_moves = false;
+ ptr->transformedByScript();
}
return rv;
=== modified file 'testsuite/actionscript.all/Transform.as'
--- a/testsuite/actionscript.all/Transform.as 2008-09-25 12:58:38 +0000
+++ b/testsuite/actionscript.all/Transform.as 2008-09-25 14:26:24 +0000
@@ -90,7 +90,7 @@
check_equals(mcx.transform.colorTransform.toString(), "(redMultiplier=1,
greenMultiplier=1, blueMultiplier=1, alphaMultiplier=-0.98828125, redOffset=0,
greenOffset=0, blueOffset=0, alphaOffset=0)");
mcx._alpha = 13000;
-xcheck_equals(mcx.transform.colorTransform.toString(), "(redMultiplier=1,
greenMultiplier=1, blueMultiplier=1, alphaMultiplier=-128, redOffset=0,
greenOffset=0, blueOffset=0, alphaOffset=0)");
+check_equals(mcx.transform.colorTransform.toString(), "(redMultiplier=1,
greenMultiplier=1, blueMultiplier=1, alphaMultiplier=-128, redOffset=0,
greenOffset=0, blueOffset=0, alphaOffset=0)");
r = new ColorTransform(2, 3, 4, 5, 5, -5, 5, -5);
mcx.transform.colorTransform = r;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r9843: Fix bug #24363.,
Benjamin Wolsey <=