You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2016/02/02 23:23:00 UTC
[1/2] qpid-proton git commit: PROTON-1116: Potential infinite
recursion detected by VC++14 compiler
Repository: qpid-proton
Updated Branches:
refs/heads/0.12.x b1f461bf2 -> 5917bf8aa
PROTON-1116: Potential infinite recursion detected by VC++14 compiler
The problem is caused by the implicit conversion constructor in proton::value.
Made it explicit and fixed a few places that relied on it.
This is a simple fix for 0.12, a safer and more flexible encoding/decoding
system based on type-traits will be committed to master.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/5c380018
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/5c380018
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/5c380018
Branch: refs/heads/0.12.x
Commit: 5c380018978e1b55b4c39b1a3aa75bc7a0ab29a8
Parents: b1f461b
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Feb 2 15:08:12 2016 -0500
Committer: Andrew Stitcher <as...@apache.org>
Committed: Tue Feb 2 17:16:38 2016 -0500
----------------------------------------------------------------------
proton-c/bindings/cpp/include/proton/value.hpp | 7 +++++--
proton-c/bindings/cpp/src/condition.cpp | 2 +-
proton-c/bindings/cpp/src/test_bits.hpp | 5 +++++
proton-c/bindings/cpp/src/value_test.cpp | 8 ++++----
4 files changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c380018/proton-c/bindings/cpp/include/proton/value.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/include/proton/value.hpp b/proton-c/bindings/cpp/include/proton/value.hpp
index 4076e99..b2c1c0b 100644
--- a/proton-c/bindings/cpp/include/proton/value.hpp
+++ b/proton-c/bindings/cpp/include/proton/value.hpp
@@ -45,8 +45,11 @@ class value : public comparable<value> {
/// Copy a value.
PN_CPP_EXTERN value& operator=(const value&);
- /// Create a value from C++ type T.
- template <class T> value(const T& x) : data_(proton::data::create()) { encode() << x; }
+ /// Explicit conversion from from C++ type T.
+ template <class T> explicit value(const T& x) : data_(proton::data::create()) { encode() << x; }
+
+ /// Allow implicit conversion from a proton::scalar.
+ value(const scalar& x) { encode() << x; }
/// Create a value from C++ type T.
template <class T> value& operator=(const T& x) { encode() << x; return *this; }
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c380018/proton-c/bindings/cpp/src/condition.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/condition.cpp b/proton-c/bindings/cpp/src/condition.cpp
index 221afcd..4910358 100644
--- a/proton-c/bindings/cpp/src/condition.cpp
+++ b/proton-c/bindings/cpp/src/condition.cpp
@@ -40,7 +40,7 @@ std::string condition::description() const {
value condition::info() const {
pn_data_t* t = pn_condition_info(condition_);
- return t ? t : value();
+ return t ? value(t) : value();
}
std::string condition::str() const {
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c380018/proton-c/bindings/cpp/src/test_bits.hpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/test_bits.hpp b/proton-c/bindings/cpp/src/test_bits.hpp
index 39d4be5..f6297da 100644
--- a/proton-c/bindings/cpp/src/test_bits.hpp
+++ b/proton-c/bindings/cpp/src/test_bits.hpp
@@ -86,5 +86,10 @@ template <class T> std::ostream& operator<<(std::ostream& o, const std::vector<T
template <class T> std::ostream& operator<<(std::ostream& o, const std::deque<T>& s) {
return o << test::many<T>(s);
}
+
+template <class U, class V> std::ostream& operator<<(std::ostream& o, const std::pair<U, V>& p) {
+ return o << "( " << p.first << " , " << p.second << " )";
+}
}
+
#endif // TEST_BITS_HPP
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5c380018/proton-c/bindings/cpp/src/value_test.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/value_test.cpp b/proton-c/bindings/cpp/src/value_test.cpp
index b19ea76..cc94950 100644
--- a/proton-c/bindings/cpp/src/value_test.cpp
+++ b/proton-c/bindings/cpp/src/value_test.cpp
@@ -60,13 +60,13 @@ void map_test() {
m["a"] = 1;
m["b"] = 2;
m["c"] = 3;
- value v = m;
+ value v(m);
ASSERT_EQUAL("{\"a\"=1, \"b\"=2, \"c\"=3}", str(v));
std::map<value, value> mv;
v.get(mv);
- ASSERT_EQUAL(mv["a"], value(amqp_int(1)));
- mv["b"] = amqp_binary("xyz");
- mv.erase("c");
+ ASSERT_EQUAL(mv[value("a")], value(amqp_int(1)));
+ mv[value("b")] = amqp_binary("xyz");
+ mv.erase(value("c"));
v = value(mv);
ASSERT_EQUAL("{\"a\"=1, \"b\"=b\"xyz\"}", str(v));
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[2/2] qpid-proton git commit: PROTON-1121: Avoid null dereference
discovered by Coverity.
Posted by as...@apache.org.
PROTON-1121: Avoid null dereference discovered by Coverity.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/5917bf8a
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/5917bf8a
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/5917bf8a
Branch: refs/heads/0.12.x
Commit: 5917bf8aac443a2ab3da24dcf5bc923cd8b77375
Parents: 5c38001
Author: Andrew Stitcher <as...@apache.org>
Authored: Mon Feb 1 16:56:27 2016 -0500
Committer: Andrew Stitcher <as...@apache.org>
Committed: Tue Feb 2 17:17:05 2016 -0500
----------------------------------------------------------------------
proton-c/src/sasl/sasl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5917bf8a/proton-c/src/sasl/sasl.c
----------------------------------------------------------------------
diff --git a/proton-c/src/sasl/sasl.c b/proton-c/src/sasl/sasl.c
index 994082c..29d377e 100644
--- a/proton-c/src/sasl/sasl.c
+++ b/proton-c/src/sasl/sasl.c
@@ -600,7 +600,7 @@ void pn_sasl_allowed_mechs(pn_sasl_t *sasl0, const char *mechs)
pni_sasl_t *sasl = get_sasl_internal(sasl0);
free(sasl->included_mechanisms);
sasl->included_mechanisms = mechs ? pn_strdup(mechs) : NULL;
- if (strcmp(mechs, "ANONYMOUS")==0 ) {
+ if (mechs && strcmp(mechs, "ANONYMOUS")==0 ) {
pn_transport_t *transport = get_transport_internal(sasl0);
pni_sasl_force_anonymous(transport);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org