[
https://issues.apache.org/jira/browse/STDCXX-841?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12588619#action_12588619
]
Eric Lemings commented on STDCXX-841:
-------------------------------------
I haven't tested this yet but I think the patch is pretty simple:
{noformat}
Index: utilities/20.temp.buffer.cpp
===================================================================
--- utilities/20.temp.buffer.cpp (revision 647022)
+++ utilities/20.temp.buffer.cpp (working copy)
@@ -268,6 +268,11 @@
// exercise arithmetic overflow (not to be confused
// with the out-of-memory tests below)
+ // prevent overflow when sizeof(T) is almost as large
+ // as _RWSTD_SIZE_MAX
+ if ((_RWSTD_SIZE_MAX >> 1) <= i)
+ break;
+
// attempts to allocate space for an array of elements
// with a total size that exceeds SIZE_MAX must fail
nelems = _RWSTD_PTRDIFF_MAX / i + 1;
{noformat}
> [Sun C++] SIGFPE in 20.temp.buffer in LP64
> ------------------------------------------
>
> Key: STDCXX-841
> URL: https://issues.apache.org/jira/browse/STDCXX-841
> Project: C++ Standard Library
> Issue Type: Bug
> Components: Tests
> Affects Versions: 4.2.0
> Environment: Sun C++
> Reporter: Martin Sebor
> Assignee: Eric Lemings
> Priority: Minor
> Fix For: 4.2.1
>
> Original Estimate: 2h
> Time Spent: 0.5h
> Remaining Estimate: 1.5h
>
> When compiled with Sun C++ (any version) in LP64 mode, the test
> [20.temp.buffer.cpp|http://svn.apache.org/viewvc/stdcxx/trunk/tests/utilities/20.temp.buffer.cpp?view=markup]
> abends with SIGFPE.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.