You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Steve Huston (JIRA)" <qp...@incubator.apache.org> on 2009/06/27 00:33:47 UTC
[jira] Resolved: (QPID-1960) C++ test for InlineVector tries to
take address of invalid byte
[ https://issues.apache.org/jira/browse/QPID-1960?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Steve Huston resolved QPID-1960.
--------------------------------
Resolution: Fixed
Fixed; r788893
> C++ test for InlineVector tries to take address of invalid byte
> ---------------------------------------------------------------
>
> Key: QPID-1960
> URL: https://issues.apache.org/jira/browse/QPID-1960
> Project: Qpid
> Issue Type: Bug
> Affects Versions: 0.5
> Reporter: Steve Huston
> Fix For: 0.6
>
>
> The qpid/src/tests/InlineVector.cpp test isInline() tester works by taking address of element 0 and comparing it to various things. However, if the InlineVector has no storage allocated yet, taking the address of element 0 is invalid. In this case, Windows Visual Studio throws an out-of-range exception.
> This fixes it:
> Index: src/tests/InlineVector.cpp
> ===================================================================
> --- src/tests/InlineVector.cpp (revision 788779)
> +++ src/tests/InlineVector.cpp (working copy)
> @@ -30,6 +30,10 @@
> typedef InlineVector<int, 3> Vec;
> bool isInline(const Vec& v) {
> + // If nothing, give it the benefit of the doubt;
> + // can't take address of nothing.
> + if (v.size() <= 0)
> + return true;
> return (const char*)&v <= (const char*)(&v[0]) &&
> (const char*)(&v[0]) < (const char*)&v+sizeof(v);
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org