https://bugs.documentfoundation.org/show_bug.cgi?id=121074

--- Comment #18 from Mike Kaganski <[email protected]> ---
So yes, the problem is different size of long in used in generic Size (*not*
awt::Size): long is 4-byte on all architectures on Windows (or rather MSVC),
while it's 8 byte on 64-bit gcc/clang. Note that "long" in IDL is always
4-byte, so awt::Size is consistently uses sal_Int32 on all platforms.

On Windows, ScDocument::GetMMRect overflows aRect's 32-bit height when
multiplying 1824306210 by HMM_PER_TWIPS (~1.7), resulting in -2147483648
(SAL_MIN_INT32). Later, calculating resulting height, and subtracting 1 from
that, positive 2147483647 (SAL_MAX_INT32) appears, which successfully goes into
awt:Size.

On other platforms, ScDocument::GetMMRect produces correct 64-bit height, which
overflows only when copying to awt::Size, resulting in negative value there.

Converting the result of ScDocument::GetMMRect (already in MM100) from twips to
MM100 is incorrect; it could only succeed here because that would become more
than 0xFFFFFFFF, and owerflowing when writing to awt::Size would again give
positive fake result...

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to