Commit cbbd8447 authored by Davis King's avatar Davis King

Added more validation code to the BSP tools. Now they will do a little more

to detect invalid serialization.
parent 23d1c1fa
...@@ -453,6 +453,10 @@ namespace dlib ...@@ -453,6 +453,10 @@ namespace dlib
{ {
std::istringstream sin(*temp); std::istringstream sin(*temp);
deserialize(item, sin); deserialize(item, sin);
if (sin.peek() != EOF)
throw serialization_error("deserialize() did not consume all bytes produced by serialize(). "
"This probably means you are calling a receive method with a different type "
"of object than the one which was sent.");
return true; return true;
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment