Subject: | Wrong secret or corrupted data causes perl error in JSON. |
When a wrong secret, or the data is corrupted deserialize will call the
actual deserializer with an undef argument. This causes perl to exit
with an error.
This issue might be specific to JSON, I have only done limited testing
with other serializers, and so far JSON is the only one to show this
problem, so I am not sure if the patch should be applied to the
serializer stub or farther back.
This patch fixes this problem with JSON:
--- JSON.pm.old Thu Apr 16 07:39:39 2009
+++ JSON.pm Tue Nov 23 00:24:07 2010
@@ -13,7 +13,7 @@
}
sub deserialize {
- return JSON->VERSION < 2 ? JSON->new->jsonToObj($_[1]) :
JSON->new->decode($_[1]);
+ $_[1] and return JSON->VERSION < 2 ? JSON->new->jsonToObj($_[1])
: JSON->new->decode($_[1]);
}
1;
-Neil-