[Libreoffice-commits] core.git: idlc/source
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Wed Aug 14 07:44:09 UTC 2019
idlc/source/astexpression.cxx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
New commits:
commit 5e6d6c684ed31879b6393c12f2f7ade6355643a7
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Aug 14 08:37:12 2019 +0200
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Aug 14 09:43:19 2019 +0200
Avoid -fsanitize=float-cast-overflow when converting to AstExprValue::u::byval
...which is nominally of type sal_uInt8 but is also allowed to take on negative
sal_Int8 values. After a recent change to CustomTarget_idlc/parser_test it now
caused
> idlc/source/astexpression.cxx:907:59: runtime error: -128 is outside the range of representable values of type 'unsigned char'
> #0 in coerce_value(AstExprValue*, ExprType) at idlc/source/astexpression.cxx:907:59
[...]
> "conversion.tests 1" expected SUCCESS, got 1 (256): FAILED!
Change-Id: I343d39fa0b728133e58858ba62ec8a0f344e8fdf
Reviewed-on: https://gerrit.libreoffice.org/77440
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/idlc/source/astexpression.cxx b/idlc/source/astexpression.cxx
index 3da8db708d78..f9b0f08f0534 100644
--- a/idlc/source/astexpression.cxx
+++ b/idlc/source/astexpression.cxx
@@ -892,7 +892,7 @@ coerce_value(AstExprValue *ev, ExprType t)
{
return false;
}
- auto tmp = static_cast<unsigned char>(ev->u.fval);
+ auto tmp = static_cast<unsigned char>(static_cast<sal_Int32>(ev->u.fval));
ev->u.byval = tmp;
ev->et = ET_byte;
return true;
@@ -904,7 +904,7 @@ coerce_value(AstExprValue *ev, ExprType t)
{
return false;
}
- auto tmp = static_cast<unsigned char>(ev->u.dval);
+ auto tmp = static_cast<unsigned char>(static_cast<sal_Int32>(ev->u.dval));
ev->u.byval = tmp;
ev->et = ET_byte;
return true;
More information about the Libreoffice-commits
mailing list