summaryrefslogtreecommitdiff
path: root/pp_pack.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2014-09-21 16:17:06 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2014-09-21 16:20:25 -0400
commit42262fd376c1e577f7a3a11ba0a606c6a3de1567 (patch)
tree6b2b49373ce2b4b4fb71880183011d334729cba9 /pp_pack.c
parent7e234f81b6d7325dd91edae7737f9bd69a91fc73 (diff)
downloadperl-42262fd376c1e577f7a3a11ba0a606c6a3de1567.tar.gz
Comments on unpack 'D' and long doubles formats.
Diffstat (limited to 'pp_pack.c')
-rw-r--r--pp_pack.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/pp_pack.c b/pp_pack.c
index d35a5af1ce..dbbf2e9f8b 100644
--- a/pp_pack.c
+++ b/pp_pack.c
@@ -1698,6 +1698,18 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c
ld_bytes aldouble;
SHIFT_BYTES(utf8, s, strend, aldouble.bytes,
sizeof(aldouble.bytes), datumtype, needs_swap);
+ /* The most common long double format, the x86 80-bit
+ * extended precision, has either 2 or 6 unused bytes,
+ * which may contain garbage, which may contain
+ * unintentional data. While we do zero the bytes of
+ * the long double data in pack(), here in unpack() we
+ * don't, because it's really hard to envision that
+ * reading the long double off aldouble would be
+ * affected the unused bytes.
+ *
+ * Note that trying to unpack 'long doubles' of 'long
+ * doubles' packed in another system is in the general
+ * case doomed without having more detail. */
if (!checksum)
mPUSHn(aldouble.ld);
else