[cpp-sp] branch master updated: SSPCPP-754 Enforce 64/32 bit coexistance
Rod Widdowson
rdw at steadingsoftware.com
Thu Sep 28 10:48:25 EDT 2017
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch master
in repository cpp-sp.
View the commit online:
http://git.shibboleth.net/view/?p=cpp-sp.git;a=commit;h=20e7abc89c1b5f5f3c9d9fbcb1a9b0a420ecdf48
The following commit(s) were added to refs/heads/master by this push:
new 20e7abc SSPCPP-754 Enforce 64/32 bit coexistance
20e7abc is described below
commit 20e7abc89c1b5f5f3c9d9fbcb1a9b0a420ecdf48
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Thu Sep 28 15:44:16 2017 +0100
SSPCPP-754 Enforce 64/32 bit coexistance
https://issues.shibboleth.net/jira/browse/SSPCPP-754
During serialization test that a "long" fits into 32 bits.
This means that a 64 bit server (shids or webserber) can safely
communicate with a 32 bit client (or just fail)
---
shibsp/remoting/impl/ddf.cpp | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/shibsp/remoting/impl/ddf.cpp b/shibsp/remoting/impl/ddf.cpp
index 3c63a12..7087aa6 100644
--- a/shibsp/remoting/impl/ddf.cpp
+++ b/shibsp/remoting/impl/ddf.cpp
@@ -826,6 +826,17 @@ void xml_encode(ostream& os, const char* start)
}
}
+static
+bool
+is32bitSafe(long what)
+{
+ if (sizeof(what) <= 4) return true;
+ unsigned long uWhat = (what < 0) ? -what : what;
+ unsigned long upperOfuWhat = uWhat >> 31;
+
+ return (0 == upperOfuWhat);
+}
+
void serialize(ddf_body_t* p, ostream& os, bool name_attr=true)
{
if (p) {
@@ -855,6 +866,7 @@ void serialize(ddf_body_t* p, ostream& os, bool name_attr=true)
break;
case ddf_body_t::DDF_INT:
+ if (is32bitSafe(p->value.integer)) throw IOException("Integer Overflow");
os << "<number";
if (name_attr && p->name) {
os << " name=\"";
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list